|
From: Frederic D. <de...@us...> - 2004-06-11 16:40:00
|
Update of /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6565/src/org/fudaa/fudaa/meshviewer/layer Modified Files: MvNodeNumberLayer.java MvLegendLayer.java MvLayerGroup.java MvLayer.java MvNodeModelDefault.java MvNodeLayer.java MvInfoDelegateAbstract.java MvElementNumberLayer.java MvElementLayer.java MvGridLayerGroup.java Log Message: Index: MvGridLayerGroup.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvGridLayerGroup.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MvGridLayerGroup.java 1 Jun 2004 11:27:43 -0000 1.3 --- MvGridLayerGroup.java 11 Jun 2004 16:39:44 -0000 1.4 *************** *** 1,4 **** ! /* ! * @file TrMaillage.java * @creation 30 juin 2003 * @modification $Date$ --- 1,3 ---- ! /** * @creation 30 juin 2003 * @modification $Date$ *************** *** 8,11 **** --- 7,11 ---- */ package org.fudaa.fudaa.meshviewer.layer; + import java.awt.Graphics; *************** *** 20,23 **** --- 20,24 ---- import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.geometrie.GrPolygone; + import org.fudaa.fudaa.meshviewer.MvResource; import org.fudaa.fudaa.meshviewer.layer.MvPanelInfo.InfoData; import org.fudaa.fudaa.ressource.FudaaResource; *************** *** 27,132 **** */ public class MvGridLayerGroup extends MvLayerGroup { ! EfGrid mail_; ! MvNodeLayer cqPt_; ! MvElementLayer cqPoly_; public MvGridLayerGroup(EfGrid _maill) { this(_maill, null); } - - public final EfGrid getGrid(){ - return mail_; - } public MvGridLayerGroup(EfGrid _maill, MvInfoDelegate _d) { ! this( ! _maill, ! new MvNodeModelDefault(_maill, _d), ! new MvElementModelDefault(_maill, _d)); } ! public MvGridLayerGroup( ! EfGrid _maill, ! MvNodeModel _ptModel, ! MvElementModel _eltModel) { ! setTitle(FudaaResource.getS("Maillage")); setName("cqMaillage"); setDestructible(false); ! mail_= _maill; ! cqPt_= new MvNodeLayer(_ptModel); cqPt_.setName("cqPts"); ! cqPt_.setTitle(FudaaResource.getS("Noeuds")); cqPt_.setDestructible(false); add(cqPt_); ! cqPoly_= new MvElementLayer(_eltModel); cqPoly_.setDestructible(false); cqPoly_.setName("cqPolygon"); ! cqPoly_.setTitle(FudaaResource.getS("Eléments")); add(cqPoly_); } ! public MvElementLayer getPolygonLayer() { ! return cqPoly_; ! } ! public MvNodeLayer getPointLayer() { ! return cqPt_; } ! public void setGrid(EfGrid _g) { ! if (_g != mail_) { ! mail_= _g; ! ((MvElementModel)cqPoly_.modele()).setGrid(_g); ! ((MvNodeModel)cqPt_.modele()).setGrid(_g); } - } /** * */ public GrBoite getDomaine() { ! GrBoite b= new GrBoite(); ! EfNode 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 int getNbPointsForElt(int _indexElt) { return mail_.getElement(_indexElt).getPtNb(); } ! public static void initGrPoint(EfNode _pt, GrPoint _ptToinit) { ! _ptToinit.x= _pt.getX(); ! _ptToinit.y= _pt.getY(); ! _ptToinit.z= _pt.getZ(); } ! public static void initGrPolygone( ! EfGrid _ma, ! EfElement _pt, ! GrPolygone _ptToinit) { ! int n= _pt.getPtNb(); ! if (_ptToinit.nombre() != n) { ! _ptToinit.sommets.setSize(n); ! } ! GrPoint grpt; ! EfNode 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); ! } ! } } ! public void paintComponent(Graphics _g) { ! if ((!cqPoly_.isVisible()) ! || (!cqPt_.isSelectionEmpty()) ! || (cqPt_.getPaletteCouleur() != null)) ! super.paintComponent(_g); else { ! cqPoly_.paintComponent(_g); } } /** * --- 28,160 ---- */ public class MvGridLayerGroup extends MvLayerGroup { ! ! public static void initGrPoint(EfNode _pt, GrPoint _ptToinit) { ! _ptToinit.x = _pt.getX(); ! _ptToinit.y = _pt.getY(); ! _ptToinit.z = _pt.getZ(); ! } ! ! public static void initGrPolygone(EfGrid _ma, EfElement _pt, GrPolygone _ptToinit) { ! int n = _pt.getPtNb(); ! if (_ptToinit.nombre() != n) { ! _ptToinit.sommets.setSize(n); ! } ! GrPoint grpt; ! EfNode 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); ! } ! } ! } ! ! protected MvElementLayer cqPoly_; ! protected MvNodeLayer cqPt_; ! protected EfGrid mail_; ! private boolean polyOldValue = true; public MvGridLayerGroup(EfGrid _maill) { this(_maill, null); } public MvGridLayerGroup(EfGrid _maill, MvInfoDelegate _d) { ! this(_maill, new MvNodeModelDefault(_maill, _d), new MvElementModelDefault(_maill, _d)); } ! ! public MvGridLayerGroup(EfGrid _maill, MvNodeModel _ptModel, MvElementModel _eltModel) { ! setTitle(MvResource.getS("Maillage")); setName("cqMaillage"); setDestructible(false); ! mail_ = _maill; ! cqPt_ = new MvNodeLayer(_ptModel); cqPt_.setName("cqPts"); ! cqPt_.setTitle(MvResource.getS("Noeuds")); cqPt_.setDestructible(false); add(cqPt_); ! cqPoly_ = new MvElementLayer(_eltModel); cqPoly_.setDestructible(false); cqPoly_.setName("cqPolygon"); ! cqPoly_.setTitle(MvResource.getS("Eléments")); add(cqPoly_); } ! public final void clearSelection() { ! cqPoly_.clearSelection(); ! cqPt_.clearSelection(); } ! /** ! * ! */ ! public void fillWithInfo(InfoData _m) { ! _m.setTitle(FudaaResource.getS("Maillage")); ! _m.put(FudaaResource.getS("Nombre de noeuds"), CtuluLib.getString(mail_.getPtsNb())); ! _m.put(FudaaResource.getS("Nombre d'éléments"), CtuluLib.getString(mail_.getEltNb())); ! EfFrontier fr = mail_.getFrontiers(); ! if (fr != null) { ! _m.put(FudaaResource.getS("Nombre de frontières"), CtuluLib.getString(fr.getNbFrontier())); ! _m.put(FudaaResource.getS("Nombre total de noeuds sur les frontières"), CtuluLib.getString(fr ! .getNbTotalPt())); } } + /** * */ public GrBoite getDomaine() { ! GrBoite b = new GrBoite(); ! EfNode 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 final EfGrid getGrid() { + return mail_; + } + public int getNbPointsForElt(int _indexElt) { return mail_.getElement(_indexElt).getPtNb(); } ! ! public MvNodeLayer getPointLayer() { ! return cqPt_; } ! ! public MvElementLayer getPolygonLayer() { ! return cqPoly_; } ! ! /** ! * ! */ ! public ZModeleDonnees modeleDonnees() { ! return cqPt_.modeleDonnees(); ! } ! ! protected void determinePaintState() { ! if ((!cqPoly_.isVisible()) || (cqPoly_.getPaletteCouleur() != null) ! || ((cqPt_.getIcone() != null) && (cqPt_.getIcone().getIconWidth() > 1) && (cqPt_.getIcone().getIconHeight() > 1)) || (cqPt_.getPaletteCouleur() != null) ! || (cqPoly_.getForeground() != cqPt_.getForeground())) { ! cqPt_.setPainted(true); ! } else { ! cqPt_.setPainted(false); } } + + /** + * @see java.awt.Component#paint(java.awt.Graphics) + */ + public final void paint(Graphics _g) { + determinePaintState(); + super.paint(_g); + } + /** * *************** *** 136,139 **** --- 164,168 ---- return true; } + /** * *************** *** 143,152 **** return true; } ! /** ! * ! */ ! public ZModeleDonnees modeleDonnees() { ! return cqPt_.modeleDonnees(); ! } /** * --- 172,176 ---- return true; } ! /** * *************** *** 155,158 **** --- 179,183 ---- return cqPt_.selection(_pt, _tolerance); } + /** * *************** *** 161,169 **** return cqPt_.selection(_poly); } ! public final void clearSelection() { ! cqPoly_.clearSelection(); ! cqPt_.clearSelection(); } ! private boolean polyOldValue= true; /** * --- 186,199 ---- return cqPt_.selection(_poly); } ! ! public void setGrid(EfGrid _g) { ! if (_g != mail_) { ! mail_ = _g; ! ((MvElementModel) cqPoly_.modele()).setGrid(_g); ! ((MvNodeModel) cqPt_.modele()).setGrid(_g); ! } ! } ! /** * *************** *** 171,207 **** public void setRapide(boolean _v) { if (rapide_ != _v) { ! boolean vp= rapide_; ! rapide_= _v; cqPt_.setRapide(_v); // cqBord_.setRapide(_v); if (_v) { ! polyOldValue= cqPoly_.isVisible(); cqPoly_.setVisible(false); ! } else ! cqPoly_.setVisible(polyOldValue); firePropertyChange("ajustement", vp, rapide_); } } - /** - * - */ - public void fillWithInfo(InfoData _m) { - _m.setTitle(FudaaResource.getS("Maillage")); - _m.put( - FudaaResource.getS("Nombre de noeuds"), - CtuluLib.getString(mail_.getPtsNb())); - _m.put( - FudaaResource.getS("Nombre d'éléments"), - CtuluLib.getString(mail_.getEltNb())); - EfFrontier fr= mail_.getFrontiers(); - if (fr != null) { - _m.put( - FudaaResource.getS("Nombre de frontières"), - CtuluLib.getString(fr.getNbFrontier())); - _m.put( - FudaaResource.getS("Nombre total de noeuds sur les frontières"), - CtuluLib.getString(fr.getNbTotalPt())); - } - } ! } --- 201,216 ---- public void setRapide(boolean _v) { if (rapide_ != _v) { ! boolean vp = rapide_; ! rapide_ = _v; cqPt_.setRapide(_v); // cqBord_.setRapide(_v); if (_v) { ! polyOldValue = cqPoly_.isVisible(); cqPoly_.setVisible(false); ! } ! else cqPoly_.setVisible(polyOldValue); firePropertyChange("ajustement", vp, rapide_); } } ! } \ No newline at end of file Index: MvInfoDelegateAbstract.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvInfoDelegateAbstract.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MvInfoDelegateAbstract.java 31 Mar 2004 08:17:48 -0000 1.3 --- MvInfoDelegateAbstract.java 11 Jun 2004 16:39:44 -0000 1.4 *************** *** 25,31 **** public abstract EfGrid getGrid(); - /** - * * - */ public final void fillWithPointInfo( InfoData _m, --- 25,28 ---- *************** *** 46,52 **** * @param _idx */ ! public final void fillWithPointInfo(InfoData _m, int _idx) { int[] idx = new int[2]; ! int idxOnFr = getGrid().getFrontiers().getIdxOnFrontier(_idx, idx); fillWithPointInfo(_m, _idx, idxOnFr, idx[0], idx[1]); } --- 43,51 ---- * @param _idx */ ! public void fillWithPointInfo(InfoData _m, int _idx) { int[] idx = new int[2]; ! int idxOnFr=-1; ! if(getGrid().getFrontiers()!=null) ! idxOnFr = getGrid().getFrontiers().getIdxOnFrontier(_idx, idx); fillWithPointInfo(_m, _idx, idxOnFr, idx[0], idx[1]); } *************** *** 57,61 **** --- 56,63 ---- */ public final void fillWithXYZPointInfo(InfoData _m, int _idx) { + if(getGrid().getFrontiers()!=null) fillWithXYZPointInfo(_m, _idx, getGrid().getFrontiers().getIdxOnFrontier(_idx)); + else + fillWithXYZPointInfo(_m, _idx, -1); } *************** *** 117,121 **** EfNode p = getGrid().getPt(indice); String idx = CtuluLib.getString(i + 1); ! int idxOnFr = getGrid().getFrontiers().getIdxOnFrontier(indice); _m.put( FudaaResource.getS("Point n° {0}", idx), --- 119,125 ---- EfNode p = getGrid().getPt(indice); String idx = CtuluLib.getString(i + 1); ! int idxOnFr=-1; ! if(getGrid().getFrontiers()!=null) ! idxOnFr = getGrid().getFrontiers().getIdxOnFrontier(indice); _m.put( FudaaResource.getS("Point n° {0}", idx), Index: MvLayer.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvLayer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MvLayer.java 31 Mar 2004 08:17:48 -0000 1.2 --- MvLayer.java 11 Jun 2004 16:39:44 -0000 1.3 *************** *** 24,28 **** * @return les indices des points selectionnes */ ! public int[] getPtIdx(); /** --- 24,28 ---- * @return les indices des points selectionnes */ ! public int[] getSelectedPtIdx(); /** *************** *** 30,34 **** */ public boolean isSelectionElementEmpty(); ! public int[] getElementIdx(); public GrBoite getZoomOnSelected(); public void addSelectionListener(ZSelectionListener _l); --- 30,34 ---- */ public boolean isSelectionElementEmpty(); ! public int[] getSelectedElementIdx(); public GrBoite getZoomOnSelected(); public void addSelectionListener(ZSelectionListener _l); Index: MvLayerGroup.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvLayerGroup.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MvLayerGroup.java 12 Feb 2004 16:27:40 -0000 1.1 --- MvLayerGroup.java 11 Jun 2004 16:39:44 -0000 1.2 *************** *** 27,31 **** * */ ! public int[] getPtIdx() { return null; } --- 27,31 ---- * */ ! public int[] getSelectedPtIdx() { return null; } *************** *** 41,45 **** * */ ! public int[] getElementIdx() { return null; } --- 41,45 ---- * */ ! public int[] getSelectedElementIdx() { return null; } Index: MvNodeLayer.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvNodeLayer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MvNodeLayer.java 31 Mar 2004 08:17:48 -0000 1.3 --- MvNodeLayer.java 11 Jun 2004 16:39:44 -0000 1.4 *************** *** 25,29 **** * @return les indices des points sélectionnés */ ! public int[] getPtIdx() { if (!isSelectionEmpty()) { return selection_.getSelectedIndex(); --- 25,29 ---- * @return les indices des points sélectionnés */ ! public int[] getSelectedPtIdx() { if (!isSelectionEmpty()) { return selection_.getSelectedIndex(); *************** *** 33,39 **** /** ! * @see org.fudaa.fudaa.meshviewer.layer.MvLayer#getElementIdx() */ ! public int[] getElementIdx() { return null; } --- 33,39 ---- /** ! * @see org.fudaa.fudaa.meshviewer.layer.MvLayer#getSelectedElementIdx() */ ! public int[] getSelectedElementIdx() { return null; } *************** *** 70,79 **** } } ! double coef= 1.1; ! r.e.x= r.e.x * coef; ! r.e.y= r.e.y * coef; ! r.o.x= r.o.x / coef; ! r.o.y= r.o.y / coef; ! return r; } /** --- 70,88 ---- } } ! GrBoite bTout=modele_.getDomaine(); ! double wT=bTout.getLargeur(); ! double hT=bTout.getHauteur(); ! double coef= 0.1; ! if(r.getHauteur()<hT*coef){ ! double delta=(r.getHauteur()-hT*coef)/2; ! r.e.x+=delta; ! r.o.x-=delta; ! } ! if(r.getLargeur()<wT*coef){ ! double delta=(r.getLargeur()-wT*coef)/2; ! r.e.y+=delta; ! r.o.y-=delta; ! } ! return r.intersectionXY(bTout); } /** Index: MvLegendLayer.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvLegendLayer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MvLegendLayer.java 1 Jun 2004 11:27:43 -0000 1.1 --- MvLegendLayer.java 11 Jun 2004 16:39:44 -0000 1.2 *************** *** 26,30 **** * */ ! public int[] getPtIdx() { return null; } --- 26,30 ---- * */ ! public int[] getSelectedPtIdx() { return null; } *************** *** 40,44 **** * */ ! public int[] getElementIdx() { return null; } --- 40,44 ---- * */ ! public int[] getSelectedElementIdx() { return null; } Index: MvNodeModelDefault.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvNodeModelDefault.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MvNodeModelDefault.java 1 Jun 2004 11:27:43 -0000 1.4 --- MvNodeModelDefault.java 11 Jun 2004 16:39:44 -0000 1.5 *************** *** 50,53 **** --- 50,56 ---- } + /** + * @return le maillage en question + */ public final EfGrid getGrid(){ return grid_; Index: MvElementNumberLayer.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvElementNumberLayer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MvElementNumberLayer.java 12 Feb 2004 16:27:40 -0000 1.1 --- MvElementNumberLayer.java 11 Jun 2004 16:39:44 -0000 1.2 *************** *** 1,4 **** ! /* ! * @file TrElementNumberLayer.java * @creation 5 déc. 2003 * @modification $Date$ --- 1,3 ---- ! /** * @creation 5 déc. 2003 * @modification $Date$ *************** *** 8,11 **** --- 7,11 ---- */ package org.fudaa.fudaa.meshviewer.layer; + import gnu.trove.TIntHashSet; import gnu.trove.TIntIterator; *************** *** 18,22 **** import org.fudaa.ctulu.CtuluLib; - import org.fudaa.ebli.calque.ZCalqueAffichageDonnees; import org.fudaa.ebli.calque.ZModeleDonnees; --- 18,21 ---- *************** *** 26,54 **** import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.geometrie.GrPolygone; ! import org.fudaa.fudaa.meshviewer.layer.MvPanelInfo.InfoData; - import org.fudaa.fudaa.ressource.FudaaResource; /** * @author deniger * @version $Id$ */ ! public class MvElementNumberLayer ! extends ZCalqueAffichageDonnees ! implements MvLayer { private boolean all_; private TIntHashSet selectedElement_; private MvElementNumberModel model_; /** * */ public MvElementNumberLayer(MvElementNumberModel _m) { ! model_= _m; ! setTitle(FudaaResource.getS("Numéros des éléments")); } public boolean isPtToDisplayEmpty() { ! return ( ! (!all_) ! && ((selectedElement_ == null) || (selectedElement_.size() == 0))); } /** * --- 25,52 ---- import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.geometrie.GrPolygone; ! import org.fudaa.fudaa.meshviewer.MvResource; import org.fudaa.fudaa.meshviewer.layer.MvPanelInfo.InfoData; /** * @author deniger * @version $Id$ */ ! public class MvElementNumberLayer extends ZCalqueAffichageDonnees implements MvLayer { ! private boolean all_; private TIntHashSet selectedElement_; private MvElementNumberModel model_; + /** * */ public MvElementNumberLayer(MvElementNumberModel _m) { ! model_ = _m; ! setTitle(MvResource.getS("Numéros des éléments")); } + public boolean isPtToDisplayEmpty() { ! return ((!all_) && ((selectedElement_ == null) || (selectedElement_.size() == 0))); } + /** * *************** *** 57,80 **** return all_; } public void clearEltIdxShow() { ! all_= false; ! if (selectedElement_ != null) ! selectedElement_.clear(); quick_repaint(); } /** * */ public void setSelectedElement(int[] _idx) { ! if (_idx == null) ! return; if (!all_) { if (_idx.length == model_.getNbElement()) { ! all_= true; ! if (selectedElement_ != null) ! selectedElement_.clear(); ! } else if (selectedElement_ == null) { ! selectedElement_= new TIntHashSet(_idx); ! } else { selectedElement_.clear(); selectedElement_.ensureCapacity(_idx.length); --- 55,79 ---- return all_; } + public void clearEltIdxShow() { ! all_ = false; ! if (selectedElement_ != null) selectedElement_.clear(); quick_repaint(); } + /** * */ public void setSelectedElement(int[] _idx) { ! if (_idx == null) return; if (!all_) { if (_idx.length == model_.getNbElement()) { ! all_ = true; ! if (selectedElement_ != null) selectedElement_.clear(); ! } ! else if (selectedElement_ == null) { ! selectedElement_ = new TIntHashSet(_idx); ! } ! else { selectedElement_.clear(); selectedElement_.ensureCapacity(_idx.length); *************** *** 84,179 **** quick_repaint(); } public void addSelectedPoint(int[] _idx) { if (!all_) { if (selectedElement_ == null) { ! selectedElement_= new TIntHashSet(_idx); quick_repaint(); ! } else { ! boolean change= selectedElement_.addAll(_idx); if (selectedElement_.size() == model_.getNbElement()) { selectedElement_.clear(); ! all_= true; ! repaint(); ! } else if (change) repaint(); } } } /** * */ public void setAll(boolean _b) { ! if (_b == all_) ! return; ! all_= _b; ! if (selectedElement_ != null) ! selectedElement_.clear(); repaint(); } ! public void paintComponent(Graphics g) { ! if (isRapide()) ! return; ! if ((!all_) ! && ((selectedElement_ == null) || (selectedElement_.size() == 0))) { ! return; ! } ! GrBoite clip= getClipReel(g); ! GrBoite domaine= model_.getDomaine(); //Si le domaine des polys n'est pas dans le domaine d'affichage on arrete ! if (!domaine.intersectXY(clip)) { ! return; ! } ! GrPolygone p= new GrPolygone(); ! GrPoint pt= new GrPoint(); ! GrMorphisme versEcran= getVersEcran(); ! Font old= g.getFont(); ! Color oldC= g.getColor(); g.setFont(getFont()); ! if (isAttenue()) ! g.setColor(attenueCouleur(getForeground())); ! else ! g.setColor(getForeground()); double x, y; // Color foreground= g.getColor(); ! if ((!all_) ! && (selectedElement_ != null) ! && (selectedElement_.size() > 0)) { ! TIntIterator it= selectedElement_.iterator(); ! FontMetrics fm= g.getFontMetrics(); // Color backColor=getBackground(); ! for (int i= selectedElement_.size(); i-- > 0;) { ! int idx= it.next(); model_.polygone(p, idx); p.centre(pt); if (clip.contientXY(pt)) { pt.autoApplique(versEcran); ! String s= CtuluLib.getString(idx + 1); ! Rectangle2D rec= fm.getStringBounds(s, g); ! x= pt.x - rec.getWidth() / 2; ! y= pt.y + rec.getHeight() / 2; // rec.setFrame(x, y - fm.getAscent(), rec.getWidth(), rec.getHeight()); // g.setColor(backColor); // ((Graphics2D)g).fill(rec); // g.setColor(foreground); ! g.drawString(s, (int)x, (int)y); } } ! } else if (all_) { ! FontMetrics fm= g.getFontMetrics(); // Color backColor=getBackground(); ! for (int i= model_.getNbElement() - 1; i >= 0; i--) { model_.polygone(p, i); p.centre(pt); if (clip.contientXY(pt)) { ! String s= CtuluLib.getString(i + 1); pt.autoApplique(versEcran); ! Rectangle2D rec= fm.getStringBounds(s, g); ! x= pt.x - rec.getWidth() / 2; ! y= pt.y + rec.getHeight() / 2; // rec.setFrame(x, y - fm.getAscent(), rec.getWidth(), rec.getHeight()); // g.setColor(backColor); // ((Graphics2D)g).fill(rec); // g.setColor(foreground); ! g.drawString(s, (int)x, (int)y); } } --- 83,171 ---- quick_repaint(); } + public void addSelectedPoint(int[] _idx) { if (!all_) { if (selectedElement_ == null) { ! selectedElement_ = new TIntHashSet(_idx); quick_repaint(); ! } ! else { ! boolean change = selectedElement_.addAll(_idx); if (selectedElement_.size() == model_.getNbElement()) { selectedElement_.clear(); ! all_ = true; repaint(); + } + else if (change) repaint(); } } } + /** * */ public void setAll(boolean _b) { ! if (_b == all_) return; ! all_ = _b; ! if (selectedElement_ != null) selectedElement_.clear(); repaint(); } ! ! public void paintDonnees(Graphics g) { ! if (isRapide()) return; ! if ((!all_) && ((selectedElement_ == null) || (selectedElement_.size() == 0))) { return; } ! GrBoite clip = getClipReel(g); ! GrBoite domaine = model_.getDomaine(); //Si le domaine des polys n'est pas dans le domaine d'affichage on arrete ! if (!domaine.intersectXY(clip)) { return; } ! GrPolygone p = new GrPolygone(); ! GrPoint pt = new GrPoint(); ! GrMorphisme versEcran = getVersEcran(); ! Font old = g.getFont(); ! Color oldC = g.getColor(); g.setFont(getFont()); ! if (isAttenue()) g.setColor(attenueCouleur(getForeground())); ! else g.setColor(getForeground()); double x, y; // Color foreground= g.getColor(); ! if ((!all_) && (selectedElement_ != null) && (selectedElement_.size() > 0)) { ! TIntIterator it = selectedElement_.iterator(); ! FontMetrics fm = g.getFontMetrics(); // Color backColor=getBackground(); ! for (int i = selectedElement_.size(); i-- > 0;) { ! int idx = it.next(); model_.polygone(p, idx); p.centre(pt); if (clip.contientXY(pt)) { pt.autoApplique(versEcran); ! String s = CtuluLib.getString(idx + 1); ! Rectangle2D rec = fm.getStringBounds(s, g); ! x = pt.x - rec.getWidth() / 2; ! y = pt.y + rec.getHeight() / 2; // rec.setFrame(x, y - fm.getAscent(), rec.getWidth(), rec.getHeight()); // g.setColor(backColor); // ((Graphics2D)g).fill(rec); // g.setColor(foreground); ! g.drawString(s, (int) x, (int) y); } } ! } ! else if (all_) { ! FontMetrics fm = g.getFontMetrics(); // Color backColor=getBackground(); ! for (int i = model_.getNbElement() - 1; i >= 0; i--) { model_.polygone(p, i); p.centre(pt); if (clip.contientXY(pt)) { ! String s = CtuluLib.getString(i + 1); pt.autoApplique(versEcran); ! Rectangle2D rec = fm.getStringBounds(s, g); ! x = pt.x - rec.getWidth() / 2; ! y = pt.y + rec.getHeight() / 2; // rec.setFrame(x, y - fm.getAscent(), rec.getWidth(), rec.getHeight()); // g.setColor(backColor); // ((Graphics2D)g).fill(rec); // g.setColor(foreground); ! g.drawString(s, (int) x, (int) y); } } *************** *** 182,185 **** --- 174,178 ---- g.setColor(oldC); } + /** * *************** *** 188,191 **** --- 181,185 ---- return null; } + /** * *************** *** 194,197 **** --- 188,192 ---- return null; } + /** * *************** *** 200,215 **** return model_; } /** * */ ! public int[] getPtIdx() { return null; } /** * */ ! public int[] getElementIdx() { return null; } /** * --- 195,213 ---- return model_; } + /** * */ ! public int[] getSelectedPtIdx() { return null; } + /** * */ ! public int[] getSelectedElementIdx() { return null; } + /** * *************** *** 218,221 **** --- 216,220 ---- return true; } + /** * *************** *** 232,236 **** } - /** * --- 231,234 ---- *************** *** 238,240 **** public void fillWithInfo(InfoData _m) {} ! } --- 236,239 ---- public void fillWithInfo(InfoData _m) {} ! public void paintSelection(Graphics _g) {} ! } \ No newline at end of file Index: MvElementLayer.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvElementLayer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MvElementLayer.java 5 May 2004 12:42:38 -0000 1.2 --- MvElementLayer.java 11 Jun 2004 16:39:44 -0000 1.3 *************** *** 8,11 **** --- 8,12 ---- */ package org.fudaa.fudaa.meshviewer.layer; + import gnu.trove.TIntHashSet; *************** *** 18,21 **** --- 19,23 ---- */ public class MvElementLayer extends ZCalquePolygone implements MvLayer { + /** * *************** *** 24,27 **** --- 26,30 ---- super(); } + /** * @param _modele *************** *** 30,42 **** super(_modele); } /** * */ ! public int[] getPtIdx() { if (!isSelectionEmpty()) { ! TIntHashSet r= new TIntHashSet(); ! int max= selection_.getMaxIndex(); ! MvElementModel m= (MvElementModel)modele_; ! for (int i= selection_.getMinIndex(); i <= max; i++) { if (selection_.isSelected(i)) { m.fillWithPtIdx(i, r); --- 33,46 ---- super(_modele); } + /** * */ ! public int[] getSelectedPtIdx() { if (!isSelectionEmpty()) { ! TIntHashSet r = new TIntHashSet(); ! int max = selection_.getMaxIndex(); ! MvElementModel m = (MvElementModel) modele_; ! for (int i = selection_.getMinIndex(); i <= max; i++) { if (selection_.isSelected(i)) { m.fillWithPtIdx(i, r); *************** *** 47,56 **** return null; } /** * */ ! public int[] getElementIdx() { return selection_ == null ? null : selection_.getSelectedIndex(); } /** * --- 51,62 ---- return null; } + /** * */ ! public int[] getSelectedElementIdx() { return selection_ == null ? null : selection_.getSelectedIndex(); } + /** * *************** *** 59,62 **** --- 65,69 ---- return isSelectionEmpty(); } + /** * *************** *** 65,81 **** return isSelectionEmpty(); } /** ! * */ public GrBoite getZoomOnSelected() { ! if (isSelectionEmpty()) ! return null; ! int m= selection_.getMaxIndex(); ! if (m > modele_.getNombre()) ! m= modele_.getNombre() - 1; ! GrBoite r= new GrBoite(); ! GrBoite temp= new GrBoite(); ! GrPolygone poly= new GrPolygone(); ! for (int i= selection_.getMinIndex(); i <= m; i++) { if (selection_.isSelected(i)) { modele_.polygone(poly, i); --- 72,87 ---- return isSelectionEmpty(); } + /** ! * @see org.fudaa.fudaa.meshviewer.layer.MvLayer#getZoomOnSelected() */ public GrBoite getZoomOnSelected() { ! if (isSelectionEmpty()) return null; ! int m = selection_.getMaxIndex(); ! if (m > modele_.getNombre()) m = modele_.getNombre() - 1; ! GrBoite r = new GrBoite(); ! GrBoite temp = new GrBoite(); ! GrPolygone poly = new GrPolygone(); ! for (int i = selection_.getMinIndex(); i <= m; i++) { if (selection_.isSelected(i)) { modele_.polygone(poly, i); *************** *** 84,93 **** } } ! double coef= 1.1; ! r.e.x= r.e.x * coef; ! r.e.y= r.e.y * coef; ! r.o.x= r.o.x / coef; ! r.o.y= r.o.y / coef; ! return r; } --- 90,109 ---- } } ! GrBoite bTout = modele_.getDomaine(); ! double wT = bTout.getLargeur(); ! double hT = bTout.getHauteur(); ! //au moins 10% du domaine total ! double coef = 0.1; ! if (r.getHauteur() < hT * coef) { ! double delta = (r.getHauteur() - hT * coef) / 2; ! r.e.x += delta; ! r.o.x -= delta; ! } ! if (r.getLargeur() < wT * coef) { ! double delta = (r.getLargeur() - wT * coef) / 2; ! r.e.y += delta; ! r.o.y -= delta; ! } ! return r.intersectionXY(bTout); } *************** *** 97,103 **** public void fillWithInfo(MvPanelInfo.InfoData _m) { if (!isSelectionEmpty()) { ! ((MvElementModel)modele_).fillWithInfo(_m, selection_); } } ! } --- 113,119 ---- public void fillWithInfo(MvPanelInfo.InfoData _m) { if (!isSelectionEmpty()) { ! ((MvElementModel) modele_).fillWithInfo(_m, selection_); } } ! } \ No newline at end of file Index: MvNodeNumberLayer.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvNodeNumberLayer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MvNodeNumberLayer.java 12 Feb 2004 16:27:40 -0000 1.1 --- MvNodeNumberLayer.java 11 Jun 2004 16:39:44 -0000 1.2 *************** *** 1,4 **** ! /* ! * @file TrPointNumberLayer.java * @creation 4 déc. 2003 * @modification $Date$ --- 1,3 ---- ! /** * @creation 4 déc. 2003 * @modification $Date$ *************** *** 19,23 **** import org.fudaa.ctulu.CtuluLib; - import org.fudaa.ebli.calque.ZCalqueAffichageDonnees; import org.fudaa.ebli.calque.ZModeleDonnees; --- 18,21 ---- *************** *** 27,32 **** import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.geometrie.GrPolygone; ! ! import org.fudaa.fudaa.ressource.FudaaResource; /** * @author deniger --- 25,29 ---- import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.geometrie.GrPolygone; ! import org.fudaa.fudaa.meshviewer.MvResource; /** * @author deniger *************** *** 45,49 **** public MvNodeNumberLayer(MvNodeNumberModel _m) { model_= _m; ! setTitle(FudaaResource.getS("Numéros des points")); } public boolean isPtToDisplayEmpty() { --- 42,46 ---- public MvNodeNumberLayer(MvNodeNumberModel _m) { model_= _m; ! setTitle(MvResource.getS("Numéros des points")); } public boolean isPtToDisplayEmpty() { *************** *** 111,115 **** quick_repaint(); } ! public void paintComponent(Graphics g) { if (isRapide()) return; --- 108,112 ---- quick_repaint(); } ! public void paintDonnees(Graphics g) { if (isRapide()) return; *************** *** 227,231 **** * */ ! public int[] getPtIdx() { return null; } --- 224,228 ---- * */ ! public int[] getSelectedPtIdx() { return null; } *************** *** 250,254 **** * */ ! public int[] getElementIdx() { return null; } --- 247,251 ---- * */ ! public int[] getSelectedElementIdx() { return null; } *************** *** 278,280 **** --- 275,278 ---- public void fillWithInfo(MvPanelInfo.InfoData _m) {} + public void paintSelection(Graphics _g) {} } |