|
From: <de...@us...> - 2003-08-22 19:58:05
|
Update of /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data
In directory sc8-pr-cvs1:/tmp/cvs-serv7810/tr/data
Added Files:
TrCalqueMaillage.java
Removed Files:
TrMaillage.java
Log Message:
tr: ajout de l'export pour le maillage
gestion affichage maillage
commun modif mineure
--- NEW FILE: TrCalqueMaillage.java ---
/*
* @file TrMaillage.java
* @creation 30 juin 2003
* @modification $Date: 2003/08/22 16:02:24 $
* @license GNU General Public License 2
* @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
* @mail de...@fu...
*/
package org.fudaa.fudaa.tr.data;
import gnu.trove.TIntObjectHashMap;
import org.fudaa.dodico.h2d.H2dElement;
import org.fudaa.dodico.h2d.H2dMaillage;
import org.fudaa.dodico.h2d.H2dPoint;
import org.fudaa.ebli.calque.BCalque;
import org.fudaa.ebli.calque.ZCalqueAffichageDonnees;
import org.fudaa.ebli.calque.ZCalqueLongPolygone;
import org.fudaa.ebli.calque.ZCalquePoint;
import org.fudaa.ebli.calque.ZCalquePolygone;
import org.fudaa.ebli.calque.ZModeleDonnees;
import org.fudaa.ebli.calque.ZModeleLongPolygone;
import org.fudaa.ebli.calque.ZModeleMaillage;
import org.fudaa.ebli.calque.ZModeleMaillageElement;
import org.fudaa.ebli.calque.ZModelePoint;
import org.fudaa.ebli.calque.ZModelePolygone;
import org.fudaa.ebli.commun.EbliListeSelection;
import org.fudaa.ebli.geometrie.GrBoite;
import org.fudaa.ebli.geometrie.GrPoint;
import org.fudaa.ebli.geometrie.GrPolygone;
import org.fudaa.ebli.geometrie.VecteurGrPoint;
import org.fudaa.ebli.trace.PTrait;
/**
* @author deniger
* @version $Id: TrCalqueMaillage.java,v 1.1 2003/08/22 16:02:24 deniger Exp $
*/
public class TrCalqueMaillage extends ZCalqueAffichageDonnees
{
H2dMaillage mail_;
ZCalquePoint cqPt_;
/**
* @param _pts
* @param _elts
*/
public TrCalqueMaillage(H2dMaillage _maill)
{
setName("Maillage");
mail_=_maill;
cqPt_=new ZCalquePoint(new ModelePoint());
cqPt_.setName("Points");
add(cqPt_);
BCalque p=new ZCalquePolygone(new ModelePolygone());
p.setName("polygone");
add(p);
p=new ZCalqueLongPolygone(new ModeleBord());
p.setName("bord");
add(p);
}
/**
*
*/
public GrBoite getDomaine()
{
GrBoite b = new GrBoite();
H2dPoint pt=mail_.getMinPoint();
b.o = new GrPoint(pt.getX(), pt.getY(), pt.getZ());
pt=mail_.getMaxPoint();
b.e = new GrPoint(pt.getX(), pt.getY(), pt.getZ());
return b;
}
public ZModelePoint getModelePoint()
{
return new ModelePoint();
}
public ZModelePolygone getModelePolygone()
{
return new ModelePolygone();
}
public ZModeleLongPolygone getModeleBord()
{
return new ModeleBord();
}
private class ModelePoint implements ZModelePoint
{
/**
*
*/
public boolean point(GrPoint _p, int _i)
{
return TrCalqueMaillage.this.point(_p, _i);
}
/**
*
*/
public GrBoite getDomaine()
{
return TrCalqueMaillage.this.getDomaine();
}
/**
*
*/
public int getNombre()
{
return TrCalqueMaillage.this.mail_.getPtsNb();
}
/**
*
*/
public Object getObject(int _ind)
{
throw new UnsupportedOperationException("methode non implantée");
}
}
protected class ModelePolygone implements ZModelePolygone
{
/**
*
*/
public boolean polygone(GrPolygone _p, int _i)
{
return TrCalqueMaillage.this.polygone(_p, _i);
}
/**
*
*/
public GrBoite getDomaine()
{
return TrCalqueMaillage.this.getDomaine();
}
/**
*
*/
public int getNombre()
{
return TrCalqueMaillage.this.mail_.getEltNb();
}
/**
*
*/
public Object getObject(int _ind)
{
throw new UnsupportedOperationException("methode non implantée");
}
/**
*
*/
public int nbPoints(int i)
{
return TrCalqueMaillage.this.getNbPointsForElt(i);
}
}
public int getNbPointsForElt(int _indexElt)
{
return mail_.getElement(_indexElt).getPtNb();
}
public static void initGrPoint(H2dPoint _pt, GrPoint _ptToinit)
{
_ptToinit.x = _pt.getX();
_ptToinit.y = _pt.getY();
_ptToinit.z = _pt.getZ();
}
public static void initGrPolygone(
H2dMaillage _ma,
H2dElement _pt,
GrPolygone _ptToinit)
{
int n = _pt.getPtNb();
if (_ptToinit.nombre() != n)
{
_ptToinit.sommets.setSize(n);
}
GrPoint grpt;
H2dPoint hpt;
for (int i = 0; i < n; i++)
{
hpt = _ma.getPt(_pt.getPtIndex()[i]);
grpt = _ptToinit.sommets.renvoie(i);
if (grpt != null)
initGrPoint(hpt, grpt);
else
{
grpt = new GrPoint(hpt.getX(), hpt.getY(), hpt.getZ());
_ptToinit.sommets.remplace(grpt, i);
}
}
}
private class ModeleBord implements ZModeleLongPolygone
{
private TIntObjectHashMap indexMinMax_;
public ModeleBord()
{
int n=mail_.getPtsFrontiere().getBordInternNb();
if(n>0)
{
indexMinMax_=new TIntObjectHashMap(n);
for(int i=0;i<n;i++)
{
indexMinMax_.put(i,mail_.getMinMaxPointFrontiere(i));
}
}
}
/**
*
*/
public GrBoite getDomaineForPolygoneIdx(int _idx)
{
if(_idx==0) return TrCalqueMaillage.this.getDomaine();
if(indexMinMax_==null)
{
System.err.println("Prob !!!");
return null;
}
else
{
H2dPoint[] minMax=(H2dPoint[])indexMinMax_.get(_idx-1);
GrBoite r=new GrBoite();
r.o=new GrPoint();
r.e=new GrPoint();
initGrPoint(minMax[0], r.o);
initGrPoint(minMax[1], r.e);
return r;
}
}
/**
*
*/
public int getNbPointForPolygoneIdx(int _idx)
{
return TrCalqueMaillage.this.mail_.getPtsFrontiere().getPtNbForBord(_idx);
}
/**
*
*/
public int getPolygoneNb()
{
return TrCalqueMaillage.this.mail_.getPtsFrontiere().getBordNb();
}
/**
*
*/
public boolean point(GrPoint _p, int _polygoneIdx, int _pointIdx)
{
H2dPoint pt=mail_.getPt(TrCalqueMaillage.this.mail_.getPtsFrontiere().getPtIdxForBord(_polygoneIdx,_pointIdx));
initGrPoint(pt, _p);
return true;
}
/**
*
*/
public GrBoite getDomaine()
{
return TrCalqueMaillage.this.getDomaine();
}
/**
*
*/
public int getNombre()
{
return TrCalqueMaillage.this.mail_.getPtsFrontiere().getBordNb();
}
/**
*
*/
public Object getObject(int _ind)
{
return null;
}
}
/**
*
*/
public boolean point(GrPoint _p, int _i)
{
initGrPoint(mail_.getPt(_i), _p);
return true;
}
/**
*
*/
public boolean polygone(GrPolygone _poly, int _i)
{
initGrPolygone(this.mail_, mail_.getElement(_i), _poly);
return true;
}
/**
*
*/
public ZModeleDonnees modeleDonnees() {
return cqPt_.modeleDonnees();
}
/**
*
*/
public EbliListeSelection selection(
GrPoint _pt,
int _tolerance,
boolean _partiel) {
return cqPt_.selection(_pt, _tolerance, _partiel);
}
/**
*
*/
public EbliListeSelection selection(GrPolygone _poly, boolean _partiel) {
return cqPt_.selection(_poly,_partiel);
}
}
--- TrMaillage.java DELETED ---
|