From: <bma...@us...> - 2008-10-07 14:15:14
|
Revision: 4041 http://fudaa.svn.sourceforge.net/fudaa/?rev=4041&view=rev Author: bmarchan Date: 2008-10-07 14:12:32 +0000 (Tue, 07 Oct 2008) Log Message: ----------- ZCalqueGeometry devient calque pere generique de ZCalqueMultiPoint Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueGeometry.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueMultiPoint.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeEditable.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleMultiPointEditable.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrSiPlanLayer.java Property Changed: ---------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueMultiPoint.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeEditable.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleMultiPointEditable.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrSiPlanLayer.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueGeometry.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueGeometry.java 2008-10-07 13:59:38 UTC (rev 4040) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueGeometry.java 2008-10-07 14:12:32 UTC (rev 4041) @@ -136,7 +136,7 @@ surfModel_=new TraceSurfaceModel(TraceSurface.INVISIBLE, Color.BLACK,null); } - protected EbliListeSelectionMulti creeSelectionMutli() { + protected EbliListeSelectionMulti creeSelectionMulti() { return new EbliListeSelectionMulti(modeleDonnees().getNombre() / 2); } @@ -224,7 +224,7 @@ // Si la selection de modif est nulle, seule l'action de remplacement // est concernee. if (selectionMulti_ == null) { - selectionMulti_ = creeSelectionMutli(); + selectionMulti_ = creeSelectionMulti(); } boolean sentEvent = false; switch (_action) { @@ -329,15 +329,17 @@ final Envelope env = new Envelope(); if (isAtomicMode_) { final EbliListeSelectionMultiInterface multi = getLayerSelectionMulti(); + Coordinate c=new Coordinate(); final TIntObjectIterator it = multi.getIterator(); for (int i = multi.getNbListSelected(); i-- > 0;) { it.advance(); final CtuluListSelectionInterface atomSel = (CtuluListSelectionInterface) it.value(); - final Geometry g = (Geometry) modele_.getGeomData().getGeometry(it.key()); + final CoordinateSequence seq = modele_.getGeomData().getCoordinateSequence(it.key()); final int max = atomSel.getMaxIndex(); for (int j = atomSel.getMinIndex(); j <= max; j++) { if (atomSel.isSelected(j)) { - env.expandToInclude(g.getCoordinates()[j]); + seq.getCoordinate(j,c); + env.expandToInclude(c); } } } @@ -367,19 +369,26 @@ } public void inverseSelection() { - if (!isAtomicMode_) { - super.inverseSelection(); - return; - } if (isSelectionEmpty()) { return; } - for (int i = modele_.getNombre() - 1; i >= 0; i--) { - final CtuluListSelection s = selectionMulti_.get(i); - if (s != null) { - s.inverse(modele_.getNbPointForGeometry(i)); + if (!isAtomicMode_) { + initSelection(); + selection_.inverse(modeleDonnees().getNombre()); + for (int i=0; i<modele_.getNombre(); i++) { + if (!modele_.isGeometryVisible(i)) selection_.remove(i); } } + else { + for (int i=modele_.getNombre()-1; i>=0; i--) { + if (!modele_.isGeometryVisible(i)) continue; + + final CtuluListSelection s=selectionMulti_.get(i); + if (s!=null) { + s.inverse(modele_.getNbPointForGeometry(i)); + } + } + } fireSelectionEvent(); } @@ -417,7 +426,7 @@ } } - public ZModeleDonnees modeleDonnees() { + public ZModeleGeometry modeleDonnees() { return modele_; } @@ -467,6 +476,9 @@ final int nbPoints=modele_.getNbPointForGeometry(i); if (nbPoints <= 0) continue; + // La g\xE9ometrie n'est pas visible + if (!modele_.isGeometryVisible(i)) + continue; modele_.getDomaineForGeometry(i, bPoly); // Si la boite du polygone n'est pas dans la boite d'affichage on passe @@ -497,6 +509,9 @@ final int nbPoints=modele_.getNbPointForGeometry(i); if (nbPoints <= 0) continue; + // La g\xE9ometrie n'est pas visible + if (!modele_.isGeometryVisible(i)) + continue; modele_.getDomaineForGeometry(i, bPoly); // Si la boite du polygone n'est pas dans la boite d'affichage on passe @@ -533,6 +548,10 @@ if (modele_.getNbPointForGeometry(i) <= 0) { continue; } + // La g\xE9ometrie n'est pas visible + if (!modele_.isGeometryVisible(i)) + continue; + modele_.getDomaineForGeometry(i, bPoly); // Si la boite du polygone n'est pas dans la boite d'affichage on passe if (bPoly.intersectionXY(clip) == null) { @@ -638,19 +657,26 @@ if (!isVisible()) return; if (!isAtomicMode_) { - super.selectAll(); - return; + initSelection(); + selection_.addInterval(0, modele_.getNombre() - 1); + for (int i=0; i<modele_.getNombre(); i++) { + if (!modele_.isGeometryVisible(i)) selection_.remove(i); + } } - if (selectionMulti_ == null) { - selectionMulti_ = creeSelectionMutli(); - } - for (int i = modele_.getNombre() - 1; i >= 0; i--) { - CtuluListSelection s = selectionMulti_.get(i); - if (s == null) { - s = new CtuluListSelection(modele_.getNbPointForGeometry(i)); - selectionMulti_.set(i, s); + else { + if (selectionMulti_==null) { + selectionMulti_=creeSelectionMulti(); } - s.setSelectionInterval(0, modele_.getNbPointForGeometry(i) - 1); + for (int i=modele_.getNombre()-1; i>=0; i--) { + if (!modele_.isGeometryVisible(i)) continue; + + CtuluListSelection s=selectionMulti_.get(i); + if (s==null) { + s=new CtuluListSelection(modele_.getNbPointForGeometry(i)); + selectionMulti_.set(i, s); + } + s.setSelectionInterval(0, modele_.getNbPointForGeometry(i)-1); + } } fireSelectionEvent(); } @@ -671,6 +697,8 @@ final GrPoint pt=new GrPoint(); final GrBoite bPoly = new GrBoite(new GrPoint(), new GrPoint()); for (int i = modele_.getNombre() - 1; i >= 0; i--) { + if (!modele_.isGeometryVisible(i)) continue; + modele_.getDomaineForGeometry(i, bPoly); if (bPoly.contientXY(_pt)||bPoly.distanceXY(_pt)<distanceReel) { for (int j=modele_.getNbPointForGeometry(i)-1; j>=0; j--) { @@ -706,6 +734,8 @@ final GrPoint p = new GrPoint(); final GrBoite bPoly = new GrBoite(new GrPoint(), new GrPoint()); for (int i = modeleDonnees().getNombre() - 1; i >= 0; i--) { + if (!modele_.isGeometryVisible(i)) continue; + modele_.getDomaineForGeometry(i, bPoly); // si le poly est dans dans le poly de selection boolean selected = false; @@ -769,6 +799,8 @@ final GrPoint p = new GrPoint(); final GrBoite btLigne = new GrBoite(); for (int i = modele_.getNombre() - 1; i >= 0; i--) { + if (!modele_.isGeometryVisible(i)) continue; + modele_.getDomaineForGeometry(i, btLigne); if (btLigne.contientXY(_pt) || btLigne.distanceXY(_pt) < distanceReel) { for (int j = modele_.getNbPointForGeometry(i) - 1; j >= 0; j--) { @@ -797,11 +829,13 @@ if (!polyEnv.intersects(domaine)) { return null; } - final EbliListeSelectionMulti r = creeSelectionMutli(); + final EbliListeSelectionMulti r = creeSelectionMulti(); final GrPoint p = new GrPoint(); final SIRtreePointInRing tester = new SIRtreePointInRing(_poly); final Coordinate c = new Coordinate(); for (int i = modele_.getNombre() - 1; i >= 0; i--) { + if (!modele_.isGeometryVisible(i)) continue; + CtuluListSelection l = null; final int nbPt = modele_.getNbPointForGeometry(i); for (int j = nbPt - 1; j >= 0; j--) { @@ -841,11 +875,12 @@ } public boolean setSelection(final int[] _idx) { + // Aucun controle n'est fait sur la visibilit\xE9 ou non des objets d'indices pass\xE9s. if (!isAtomicMode_) { return super.setSelection(_idx); } // TODO : Traitement a faire si on est en mode atomique. - FuLog.warning("EBL:ZCalqueLigneBrisee.setSelection() can't be called in atomic mode"); + FuLog.warning("EBL:ZCalqueGeometry.setSelection() can't be called in atomic mode"); return false; } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2008-10-07 13:59:38 UTC (rev 4040) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2008-10-07 14:12:32 UTC (rev 4041) @@ -1,6 +1,6 @@ /* * @creation 31 mars 2005 - * @modification $Date: 2008-03-26 16:46:43 $ + * @modification $Date$ * @license GNU General Public License 2 * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail de...@fu... @@ -60,13 +60,13 @@ * {@link ZModeleLigneBrisee}. * * @author Fred Deniger - * @version $Id: ZCalqueLigneBrisee.java,v 1.29.6.4 2008-03-26 16:46:43 bmarchan Exp $ + * @version $Id$ */ public class ZCalqueLigneBrisee extends ZCalqueAffichageDonneesLineAbstract { /** * @author Fred Deniger - * @version $Id: ZCalqueLigneBrisee.java,v 1.29.6.4 2008-03-26 16:46:43 bmarchan Exp $ + * @version $Id$ */ private class VariableNonAtomicFindExpression extends CalqueFindExpression { @@ -930,7 +930,7 @@ } public boolean setSelection(final int[] _idx) { - // Pas de controle sur la visibilit\xE9 ou non des objets d'indices pass\xE9s. + // Aucun controle n'est fait sur la visibilit\xE9 ou non des objets d'indices pass\xE9s. if (!isAtomicMode_) { return super.setSelection(_idx); } Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueMultiPoint.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueMultiPoint.java 2008-10-07 13:59:38 UTC (rev 4040) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueMultiPoint.java 2008-10-07 14:12:32 UTC (rev 4041) @@ -1,57 +1,16 @@ /* * @creation 31 mars 2005 - * @modification $Date: 2008-04-01 17:05:16 $ + * @modification $Date$ * @license GNU General Public License 2 * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail de...@fu... */ package org.fudaa.ebli.calque; -import gnu.trove.TIntArrayList; -import gnu.trove.TIntObjectIterator; -import gnu.trove.TObjectIntHashMap; - import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import org.nfunk.jep.Variable; - -import com.memoire.fu.FuLog; -import com.vividsolutions.jts.algorithm.SIRtreePointInRing; -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.CoordinateSequence; -import com.vividsolutions.jts.geom.Envelope; -import com.vividsolutions.jts.geom.Geometry; -import com.vividsolutions.jts.geom.LineString; -import com.vividsolutions.jts.geom.LinearRing; - -import org.fudaa.ctulu.CtuluExpr; -import org.fudaa.ctulu.CtuluLib; -import org.fudaa.ctulu.CtuluLibArray; -import org.fudaa.ctulu.CtuluListSelection; -import org.fudaa.ctulu.CtuluListSelectionInterface; -import org.fudaa.ctulu.gis.GISAttributeInterface; -import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; -import org.fudaa.ctulu.gis.GISGeometryFactory; -import org.fudaa.ctulu.gis.GISLib; -import org.fudaa.ctulu.gis.GISZoneCollection; - -import org.fudaa.ebli.calque.edition.ZModeleEditable; -import org.fudaa.ebli.calque.find.CalqueFindExpression; -import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.commun.EbliListeSelectionMulti; -import org.fudaa.ebli.commun.EbliListeSelectionMultiInterface; -import org.fudaa.ebli.commun.EbliSelectionMode; -import org.fudaa.ebli.commun.EbliSelectionState; -import org.fudaa.ebli.commun.EbliUIProperties; -import org.fudaa.ebli.find.EbliFindExpressionContainerInterface; -import org.fudaa.ebli.geometrie.GrBoite; -import org.fudaa.ebli.geometrie.GrMorphisme; -import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.trace.TraceIcon; import org.fudaa.ebli.trace.TraceIconModel; -import org.fudaa.ebli.trace.TraceLigneModel; /** * Un calque g\xE9rant des multipoints, \xE0 un niveau global ou atomique.<p> @@ -59,747 +18,31 @@ * {@link ZModeleMultiPoint}. * * @author Bertrand Marchand - * @version $Id: ZCalqueMultiPoint.java,v 1.1.2.2 2008-04-01 17:05:16 bmarchan Exp $ + * @version $Id$ */ -public class ZCalqueMultiPoint extends ZCalqueAffichageDonneesLineAbstract { +public class ZCalqueMultiPoint extends ZCalqueGeometry { /** - * @author Fred Deniger - * @version $Id: ZCalqueMultiPoint.java,v 1.1.2.2 2008-04-01 17:05:16 bmarchan Exp $ - */ - private class VariableNonAtomicFindExpression extends CalqueFindExpression { - - TObjectIntHashMap varAtt_; - - public VariableNonAtomicFindExpression() { - super(ZCalqueMultiPoint.this.modeleDonnees()); - } - - public void initialiseExpr(final CtuluExpr _expr) { - super.initialiseExpr(_expr); - final GISZoneCollection coll = ((ZModeleEditable) super.data_).getGeomData(); - final int nb = coll.getNbAttributes(); - if (nb > 0) { - if (varAtt_ == null) { - varAtt_ = new TObjectIntHashMap(nb); - } else { - varAtt_.clear(); - } - for (int i = 0; i < nb; i++) { - final GISAttributeInterface att = coll.getAttribute(i); - if (!att.isAtomicValue() && Number.class.isAssignableFrom(att.getDataClass())) { - varAtt_.put(_expr.addVar(att.getName(), att.getLongName()), i); - } - } - } - - } - - public void majVariable(final int _idx, final Variable[] _varToUpdate) { - super.majVariable(_idx, _varToUpdate); - if (varAtt_ != null && !CtuluLibArray.isEmpty(_varToUpdate)) { - final GISZoneCollection coll = ((ZModeleEditable) super.data_).getGeomData(); - for (int i = _varToUpdate.length - 1; i >= 0; i--) { - if (varAtt_.containsKey(_varToUpdate[i])) { - _varToUpdate[i].setValue(CtuluLib.getDouble(((Number) coll.getDataModel(varAtt_.get(_varToUpdate[i])) - .getObjectValueAt(_idx)).doubleValue())); - } - } - } - } - - } - - /** true si edition de sommets */ - transient private boolean isAtomicMode_; - - protected ZModeleMultiPoint modele_; - - /** La selection a utilise dans le mode selection sommets */ - protected EbliListeSelectionMulti selectionMulti_; - /** Pour le trac\xE9 de la selection en mode atomique. */ - protected ZSelectionTrace traceAtomic_; - - - /** * Le seul constructeur, avec le mod\xE8le. * @param _modele le modele du calque */ public ZCalqueMultiPoint(final ZModeleMultiPoint _modele) { - modele_ = _modele; + super(_modele); iconModel_ = new TraceIconModel(TraceIcon.CARRE_PLEIN, 2, Color.BLACK); } - protected EbliListeSelectionMulti creeSelectionMutli() { - return new EbliListeSelectionMulti(modeleDonnees().getNombre() / 2); - } - - protected void initTrace(final TraceIconModel _icon, final int _idxPoly) { - _icon.updateData(getIconModel(0)); - if (isAttenue()) { - _icon.setCouleur(EbliLib.getAlphaColor(attenueCouleur(_icon.getCouleur()), alpha_)); - } else if (EbliLib.isAlphaChanged(alpha_)) { - _icon.setCouleur(EbliLib.getAlphaColor(_icon.getCouleur(), alpha_)); - } - } - - protected void paintSelectionMulti(final Graphics _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran, - final GrBoite _clipReel) { - if ((isRapide()) || (isSelectionEmpty())) { - return; - } - final GrBoite clip = _clipReel; - if (!getDomaine().intersectXY(clip)) { - return; - } - Color cs = _trace.getColor(); - if (isAttenue()) { - cs = attenueCouleur(cs); - } - _g.setColor(cs); - final TraceIcon ic = _trace.getIconeInterne(); - final TIntObjectIterator it = selectionMulti_.getIterator(); - final GrPoint p = new GrPoint(); - final GrMorphisme versEcran = _versEcran; - for (int i = selectionMulti_.getNbListSelected(); i-- > 0;) { - it.advance(); - final CtuluListSelectionInterface s = (CtuluListSelectionInterface) it.value(); - if (!s.isEmpty()) { - final int idxPoly = it.key(); - final int min = s.getMinIndex(); - for (int j = s.getMaxIndex(); j >= min; j--) { - if (s.isSelected(j)) { - modele_.point(p, idxPoly, j); - if (clip.contientXY(p)) { - p.autoApplique(versEcran); - ic.paintIconCentre(this, _g, p.x_, p.y_); - } - } - } - } - } - } - - public boolean changeSelection(final GrPoint _pt, final int _tolerancePixel, final int _action) { - if (isAtomicMode_) { - final EbliListeSelectionMulti l = selectionMulti(_pt, _tolerancePixel); - changeSelectionMulti(l, _action); - if ((l == null) || (l.isEmpty())) { - return false; - } - return true; - } - return super.changeSelection(_pt, _tolerancePixel, _action); - } - - public boolean changeSelection(final LinearRing _poly, final int _action, final int _mode) { - if (isAtomicMode_) { - final EbliListeSelectionMulti l = selectionMulti(_poly); - changeSelectionMulti(l, _action); - if ((l == null) || (l.isEmpty())) { - return false; - } - return true; - } - return super.changeSelection(_poly, _action, _mode); - } - - private void changeSelectionMulti(final EbliListeSelectionMulti _s, final int _action) { - // Si la selection de modif est nulle, seule l'action de remplacement - // est concernee. - if (selectionMulti_ == null) { - selectionMulti_ = creeSelectionMutli(); - } - boolean sentEvent = false; - switch (_action) { - case EbliSelectionState.ACTION_ADD: - sentEvent = selectionMulti_.add(_s); - break; - case EbliSelectionState.ACTION_DEL: - sentEvent = selectionMulti_.remove(_s); - break; - case EbliSelectionState.ACTION_XOR: - sentEvent = selectionMulti_.xor(_s); - break; - case EbliSelectionState.ACTION_REPLACE: - selectionMulti_.setSelection(_s); - sentEvent = true; - break; - default: - break; - } - if (sentEvent) { - fireSelectionEvent(); - } - } - - public void clearSelection() { - // dans le mode edition de noeuds - if (isAtomicMode_) { - if (selectionMulti_ != null && !selectionMulti_.isEmpty()) { - - selectionMulti_.clear(); - fireSelectionEvent(); - } - } else { - super.clearSelection(); - } - } - - public EbliFindExpressionContainerInterface getExpressionContainer() { - if (isAtomicMode_) { - return new CalqueFindExpression(modele_); - } - return new VariableNonAtomicFindExpression(); - } - - public EbliListeSelectionMultiInterface getLayerSelectionMulti() { - return selectionMulti_; - } - - public int getNbSelected() { - if (isSelectionEmpty()) { - return 0; - } - if (isAtomicMode_) { - return selectionMulti_.getNbListSelected(); - } - return super.getNbSelected(); - } - - public int[] getSelectedIndex() { - if (isSelectionEmpty()) { - return null; - } - if (isAtomicMode_) { - return selectionMulti_.getIdxSelected(); - } - return super.getSelectedIndex(); - } - - public int[] getSelectedObjectInTable() { - if (isSelectionEmpty()) { - return null; - } - if (!isAtomicMode_) { - return super.getSelectedObjectInTable(); - } - final EbliListeSelectionMultiInterface multi = getLayerSelectionMulti(); - int nb = 0; - // 20 points par lignes - final TIntArrayList list = new TIntArrayList(modele_.getNombre() * 20); - final int nbLigne = modele_.getNombre(); - for (int i = 0; i < nbLigne; i++) { - final CtuluListSelectionInterface sel = multi.getSelection(i); - if (sel != null) { - final int max = sel.getMaxIndex(); - for (int j = sel.getMinIndex(); j <= max; j++) { - if (sel.isSelected(j)) { - list.add(nb + j); - } - } - - } - nb += modele_.getNbPointForGeometry(i); - } - - return list.toNativeArray(); - } - - public GrBoite getDomaineOnSelected() { - if (isSelectionEmpty()) { - return null; - } - final Envelope env = new Envelope(); - if (isAtomicMode_) { - final EbliListeSelectionMultiInterface multi = getLayerSelectionMulti(); - Coordinate c=new Coordinate(); - final TIntObjectIterator it = multi.getIterator(); - for (int i = multi.getNbListSelected(); i-- > 0;) { - it.advance(); - final CtuluListSelectionInterface atomSel = (CtuluListSelectionInterface) it.value(); - final CoordinateSequence seq = modele_.getGeomData().getCoordinateSequence(it.key()); - final int max = atomSel.getMaxIndex(); - for (int j = atomSel.getMinIndex(); j <= max; j++) { - if (atomSel.isSelected(j)) { - seq.getCoordinate(j,c); - env.expandToInclude(c); - } - } - } - - } else { - final CtuluListSelectionInterface sel = getLayerSelection(); - final int max = sel.getMaxIndex(); - for (int i = sel.getMinIndex(); i <= max; i++) { - if (sel.isSelected(i)) { - env.expandToInclude(modele_.getGeomData().getGeometry(i).getEnvelopeInternal()); - } - } - } - final GrBoite r = new GrBoite(); - r.ajuste(env.getMaxX(), env.getMaxY(), 0); - r.ajuste(env.getMinX(), env.getMinY(), 0); - return r; - } - - public void initFrom(final EbliUIProperties _p) { - if (_p != null) { - super.initFrom(_p); - if (_p.isDefined("calqueGIS.ligneModel")) { - setLineModel(0, (TraceLigneModel) _p.get("calqueGIS.ligneModel")); - } - } - } - - public void inverseSelection() { - if (!isAtomicMode_) { - super.inverseSelection(); - return; - } - if (isSelectionEmpty()) { - return; - } - for (int i = modele_.getNombre() - 1; i >= 0; i--) { - final CtuluListSelection s = selectionMulti_.get(i); - if (s != null) { - s.inverse(modele_.getNbPointForGeometry(i)); - } - } - fireSelectionEvent(); - } - /** - * @return true si on est dans le mode edition de noeuds - */ - public boolean isAtomicMode() { - return isAtomicMode_; - } - - public boolean isPaletteModifiable() { - return false; - } - - /** - * Indique si la s\xE9lection est vide. - * @return true Si aucun objet ni aucun point en mode atomique selectionn\xE9. - */ - public boolean isSelectionEmpty() { - return isAtomicMode_ ? selectionMulti_ == null ? true : selectionMulti_.isEmpty() : super.isSelectionEmpty(); - } - - public boolean isTitleModifiable() { - return true; - } - - /** * @param _modele Modele */ public void modele(final ZModeleMultiPoint _modele) { if (modele_ != _modele) { - final ZModeleMultiPoint vp = modele_; + final ZModeleMultiPoint vp = (ZModeleMultiPoint)modele_; modele_ = _modele; firePropertyChange("modele", vp, modele_); } } - public ZModeleDonnees modeleDonnees() { - return modele_; + public ZModeleMultiPoint modeleDonnees() { + return (ZModeleMultiPoint)modele_; } - - /** - * @param _g - */ - public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { - if ((modele_ == null) || (modele_.getNombre() <= 0)) { - return; - } - final GrBoite clip = _clipReel; - final GrMorphisme versEcran = _versEcran; - final int nombre = modele_.getNombre(); - - final TraceIconModel iconeModel = iconModel_ == null ? null : new TraceIconModel(iconModel_); - - final TraceIcon icone; - if (isRapide()) { - icone=new TraceIcon(TraceIcon.CARRE,2,iconeModel.getCouleur()); - } - else - icone = iconeModel == null ? null : new TraceIcon(iconeModel); - - final GrBoite bPoly = new GrBoite(); - bPoly.o_ = new GrPoint(); - bPoly.e_ = new GrPoint(); - - // on trace les icones apres pour qu'ils soient dessin\xE9s au-dessus des lignes. - if (icone != null) { - for (int i = nombre - 1; i >= 0; i--) { - // il n'y a pas de points pour cette ligne - if (modele_.getNbPointForGeometry(i) <= 0) { - continue; - } - modele_.getDomaineForGeometry(i, bPoly); - // Si la boite du polygone n'est pas dans la boite d'affichage on passe - if (bPoly.intersectionXY(clip) == null) { - continue; - } - final int nbPoints = modele_.getNbPointForGeometry(i); - if (nbPoints <= 0) { - continue; - } - if (!isRapide()) initTrace(iconeModel, i); - final GrPoint ptDest = new GrPoint(); - for (int j = nbPoints - 1; j >= 0; j--) { - // le point de dest est initialise - modele_.point(ptDest, i, j); - if (!_clipReel.contientXY(ptDest)) { - continue; - } - ptDest.autoApplique(versEcran); - icone.paintIconCentre(this, _g, ptDest.x_, ptDest.y_); - } - } - } - } - - public void paintSelection(final Graphics2D _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran, - final GrBoite _clipReel) { - if (isSelectionEmpty()) return; - - if (isAtomicMode_) { - if (traceAtomic_==null) { - Color cg=attenueCouleur(_trace.getColor()); - Color cs=_trace.getColor(); - traceAtomic_=new ZSelectionTrace(cg,cs); - } - CtuluListSelection containers=new CtuluListSelection(selectionMulti_.getIdxSelection()); - paintSelectionSimple(_g, traceAtomic_, _versEcran, _clipReel, containers); - paintSelectionMulti(_g, traceAtomic_, _versEcran, _clipReel); - } else { - paintSelectionSimple(_g, _trace, _versEcran, _clipReel, selection_); - } - } - - public void paintSelectionSimple(final Graphics _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran, - final GrBoite _clipReel, CtuluListSelection _containers) { - if ((isRapide()) || (isSelectionEmpty())) { - return; - } - final GrBoite clip = _clipReel; - if (getDomaine() == null || !getDomaine().intersectXY(clip)) { - return; - } - final GrMorphisme versEcran = _versEcran; - Color cs = _trace.getColor(); - if (isAttenue()) { - cs = attenueCouleur(cs); - } - _g.setColor(cs); - final TraceIcon ic = _trace.getIcone(); - final int nb = Math.min(_containers.getMaxIndex(), modele_.getNombre() - 1); - - final GrBoite btgeom = new GrBoite(); - btgeom.e_ = new GrPoint(); - btgeom.o_ = new GrPoint(); - for (int i = nb; i >= 0; i--) { - if (!_containers.isSelected(i)) { - continue; - } - modele_.getDomaineForGeometry(i, btgeom); - // Si la boite de la geometrie n'est pas dans la boite d'affichage on passe - if (btgeom.intersectionXY(clip) == null) { - continue; - } - - final int nbPoints = modele_.getNbPointForGeometry(i); - final GrPoint pt = new GrPoint(); - for (int j=0; j<nbPoints; j++) { - modele_.point(pt, i, j); - pt.autoApplique(versEcran); - ic.paintIconCentre(this, _g, pt.x_, pt.y_); - } - } - } - - public void selectAll() { - if (!isVisible()) return; - - if (!isAtomicMode_) { - super.selectAll(); - return; - } - if (selectionMulti_ == null) { - selectionMulti_ = creeSelectionMutli(); - } - for (int i = modele_.getNombre() - 1; i >= 0; i--) { - CtuluListSelection s = selectionMulti_.get(i); - if (s == null) { - s = new CtuluListSelection(modele_.getNbPointForGeometry(i)); - selectionMulti_.set(i, s); - } - s.setSelectionInterval(0, modele_.getNbPointForGeometry(i) - 1); - } - fireSelectionEvent(); - } - - public CtuluListSelection selection(final GrPoint _pt, final int _tolerance) { - if (modele_.getNombre() == 0) { - return null; - } - final GrBoite bClip = getDomaine(); - if (bClip == null) { - return null; - } - final double distanceReel = GrMorphisme.convertDistanceXY(getVersReel(), _tolerance); - if ((!bClip.contientXY(_pt)) && (bClip.distanceXY(_pt) > distanceReel)) { - return null; - } - - final GrPoint pt=new GrPoint(); - final GrBoite bPoly = new GrBoite(new GrPoint(), new GrPoint()); - for (int i = modele_.getNombre() - 1; i >= 0; i--) { - modele_.getDomaineForGeometry(i, bPoly); - if (bPoly.contientXY(_pt)||bPoly.distanceXY(_pt)<distanceReel) { - for (int j=modele_.getNbPointForGeometry(i)-1; j>=0; j--) { - modele_.point(pt, i, j); - if (pt.distanceXY(_pt)<distanceReel) { - final CtuluListSelection r=new CtuluListSelection(1); - r.setSelectionInterval(i, i); - return r; - } - } - } - } - return null; - } - - public CtuluListSelection selection(final LinearRing _poly, final int _mode) { - if (modele_.getNombre() == 0 || !isVisible()) { - return null; - } - final Envelope polyEnv = _poly.getEnvelopeInternal(); - final GrBoite domaineBoite = getDomaine(); - final Envelope domaine = new Envelope(domaineBoite.e_.x_, domaineBoite.o_.x_, domaineBoite.e_.y_, - domaineBoite.o_.y_); - // si l'envelop du polygone n'intersect pas le domaine, il n'y a pas de - // selection - if (!polyEnv.intersects(domaine)) { - return null; - } - - final SIRtreePointInRing tester = new SIRtreePointInRing(_poly); - final Coordinate c = new Coordinate(); - final CtuluListSelection r = creeSelection(); - final GrPoint p = new GrPoint(); - final GrBoite bPoly = new GrBoite(new GrPoint(), new GrPoint()); - for (int i = modeleDonnees().getNombre() - 1; i >= 0; i--) { - modele_.getDomaineForGeometry(i, bPoly); - // si le poly est dans dans le poly de selection - boolean selected = false; - if (_mode == EbliSelectionMode.MODE_ALL) { - if (polyEnv.contains(bPoly.e_.x_, bPoly.e_.y_) && polyEnv.contains(bPoly.o_.x_, bPoly.o_.y_)) { - selected = true; - for (int j = modele_.getNbPointForGeometry(i) - 1; (j >= 0) && selected; j--) { - modele_.point(p, i, j); - c.x = p.x_; - c.y = p.y_; - if (!tester.isInside(c)) { - selected = false; - } - } - } - } else if (_mode == EbliSelectionMode.MODE_ONE) { - if (polyEnv.intersects(bPoly.getEnv())) { - for (int j = modele_.getNbPointForGeometry(i) - 1; (j >= 0) && !selected; j--) { - modele_.point(p, i, j); - c.x = p.x_; - c.y = p.y_; - if (GISLib.isSelectedEnv(c, _poly, polyEnv, tester)) { - selected = true; - } - } - } - - } else if (_mode == EbliSelectionMode.MODE_CENTER) { - final CoordinateSequence coordinateSequence = modele_.getGeomData().getCoordinateSequence(i); - c.x = GISLib.getMoyX(coordinateSequence); - c.y = GISLib.getMoyY(coordinateSequence); - selected = GISLib.isSelectedEnv(c, _poly, polyEnv, tester); - - } - if (selected) { - r.add(i); - } - } - if (r.isEmpty()) { - return null; - } - return r; - } - - /** - * Renvoie la liste des objets selectionnees pour le point <code>_pt</code> avec pour tolerance - * <code>_tolerance</code>. - * - * @param _pt - * @param _tolerance - * @return la liste des indexs selectionnes (ou null si aucune selection) - */ - public EbliListeSelectionMulti selectionMulti(final GrPoint _pt, final int _tolerance) { - final GrMorphisme versReel = getVersReel(); - GrBoite bClip = getDomaine(); - if (bClip == null || (!bClip.contientXY(_pt)) && (bClip.distanceXY(_pt) > _tolerance)) { - return null; - } - final double distanceReel = GrMorphisme.convertDistanceXY(versReel, _tolerance); - bClip = getClipReel(getGraphics()); - final GrPoint p = new GrPoint(); - final GrBoite btLigne = new GrBoite(); - for (int i = modele_.getNombre() - 1; i >= 0; i--) { - modele_.getDomaineForGeometry(i, btLigne); - if (btLigne.contientXY(_pt) || btLigne.distanceXY(_pt) < distanceReel) { - for (int j = modele_.getNbPointForGeometry(i) - 1; j >= 0; j--) { - modele_.point(p, i, j); - if (bClip.contientXY(p) && (p.distanceXY(_pt) < distanceReel)) { - final EbliListeSelectionMulti r = new EbliListeSelectionMulti(1); - r.set(i, j); - return r; - } - } - } - } - return null; - } - - public EbliListeSelectionMulti selectionMulti(final LinearRing _poly) { - if (modele_.getNombre() == 0 || !isVisible()) { - return null; - } - final Envelope polyEnv = _poly.getEnvelopeInternal(); - final GrBoite domaineBoite = getDomaine(); - final Envelope domaine = new Envelope(domaineBoite.e_.x_, domaineBoite.o_.x_, domaineBoite.e_.y_, - domaineBoite.o_.y_); - // si l'envelop du polygone n'intersect pas le domaine, il n'y a pas de - // selection - if (!polyEnv.intersects(domaine)) { - return null; - } - final EbliListeSelectionMulti r = creeSelectionMutli(); - final GrPoint p = new GrPoint(); - final SIRtreePointInRing tester = new SIRtreePointInRing(_poly); - final Coordinate c = new Coordinate(); - for (int i = modele_.getNombre() - 1; i >= 0; i--) { - CtuluListSelection l = null; - final int nbPt = modele_.getNbPointForGeometry(i); - for (int j = nbPt - 1; j >= 0; j--) { - modele_.point(p, i, j); - c.x = p.x_; - c.y = p.y_; - if ((polyEnv.contains(c)) && (tester.isInside(c))) { - if (l == null) { - l = new CtuluListSelection(nbPt); - } - l.add(j); - } - } - if (l != null) { - r.set(i, l); - } - } - if (r.isEmpty()) { - return null; - } - return r; - } - - /** - * D\xE9finit que les modifications d'objets auront lieu en mode atomique. - * @param _new true : Modifications en mode atomique. - * @return true si l'appel a produit un changement de mode. - */ - public boolean setAtomicMode(final boolean _new) { - if (_new != isAtomicMode_) { - isAtomicMode_ = _new; - firePropertyChange("mode", !isAtomicMode_, isAtomicMode_); - clearSelection(); - return true; - } - return false; - } - - public boolean setSelection(final int[] _idx) { - if (!isAtomicMode_) { - return super.setSelection(_idx); - } - // TODO : Traitement a faire si on est en mode atomique. - FuLog.warning("EBL:ZCalqueLigneBrisee.setSelection() can't be called in atomic mode"); - return false; - } - - public boolean setTitle(final String _title) { - final boolean r = super.setTitle(_title); - if (r && modele_ != null && modele_.getGeomData() != null) { - modele_.getGeomData().setTitle(_title, null); - } - return r; - } - - private LineString createLineFromSelection(final int _i, final CtuluListSelectionInterface _selection, final int _nbSelected) { - final LineString geom = (LineString) modele_.getGeomData().getGeometry(_i); - final Coordinate[] cs = new Coordinate[_nbSelected]; - final int[] idx = _selection.getSelectedIndex(); - for (int j = 0; j < _nbSelected; j++) { - cs[j] = geom.getCoordinateN(idx[j]); - } - return GISGeometryFactory.INSTANCE.createLineString(cs); - } - - public LineString getSelectedLine() { - if (isSelectionEmpty()) { - return null; - } - // en mode normal (pas de vertex selectionne), on renvoie la ligne s\xE9lectionn\xE9e - if (!isAtomicMode()) { -// return getLayerSelection().getNbSelectedIndex() == 1 ? (LineString) modele_.getGeomData().getGeometry( -// getLayerSelection().getMaxIndex()) : null; - throw new UnsupportedOperationException("Can't create line from vertices"); - } - // mode vertex - final EbliListeSelectionMultiInterface select = getLayerSelectionMulti(); - // mode vertex - // la selection se situe dans la meme ligne - if (select.getNbListSelected() == 1) { - final int i = select.getIdxSelected()[0]; - final CtuluListSelectionInterface selection = select.getSelection(i); - final int nbSelected = selection.getNbSelectedIndex(); - // deux sommets s\xE9lectionn\xE9s: on choisit la ligne en les 2 sommets - if (nbSelected == 2) { - return createLineFromSelection(i, selection, nbSelected); - - } else if (nbSelected >= 2) { - final int nbPointForLigne = modele_.getNbPointForGeometry(i); - final int[] res = CtuluListSelection.isSelectionContiguous(select.getSelection(i), nbPointForLigne); - if (res == null) { - return null; - } - // selection normale - if (res[0] < res[1]) { - return createLineFromSelection(i, selection, nbSelected); - } - } - } else if (select.getNbListSelected() == 2) { - final int[] idx = select.getIdxSelected(); - final CtuluListSelectionInterface selection1 = select.getSelection(idx[0]); - final CtuluListSelectionInterface selection2 = select.getSelection(idx[1]); - if (selection1.getNbSelectedIndex() == 1 && selection2.getNbSelectedIndex() == 1) { - final Coordinate[] cs = new Coordinate[2]; - cs[0] = ((Geometry)modele_.getGeomData().getGeometry(idx[0])).getCoordinates()[selection1.getMaxIndex()]; - cs[1] = ((Geometry)modele_.getGeomData().getGeometry(idx[1])).getCoordinates()[selection2.getMaxIndex()]; - return GISGeometryFactory.INSTANCE.createLineString(cs); - } - } - return null; - } - } Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueMultiPoint.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java 2008-10-07 13:59:38 UTC (rev 4040) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java 2008-10-07 14:12:32 UTC (rev 4041) @@ -1,6 +1,6 @@ /* * @creation 4 avr. 2005 - * @modification $Date: 2008-05-13 12:10:33 $ + * @modification $Date$ * @license GNU General Public License 2 * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail de...@fu... @@ -14,52 +14,48 @@ import javax.swing.table.AbstractTableModel; -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.CoordinateSequence; -import com.vividsolutions.jts.geom.Envelope; -import com.vividsolutions.jts.geom.Geometry; -import com.vividsolutions.jts.geom.LineString; -import com.vividsolutions.jts.geom.LinearRing; - -import com.memoire.bu.BuTable; -import com.memoire.fu.FuLog; - import org.fudaa.ctulu.CtuluAnalyze; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.collection.CtuluCollection; -import org.fudaa.ctulu.gis.GISAttributeConstants; import org.fudaa.ctulu.gis.GISAttributeInterface; import org.fudaa.ctulu.gis.GISAttributeModel; import org.fudaa.ctulu.gis.GISLib; import org.fudaa.ctulu.gis.GISZoneCollection; +import org.fudaa.ctulu.gis.GISZoneCollectionGeometry; import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; import org.fudaa.ctulu.gui.CtuluTable; - import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.calque.ZCalqueLigneBrisee; import org.fudaa.ebli.calque.ZModeleLigneBrisee; import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.geometrie.GrBoite; -import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; +import com.memoire.bu.BuTable; +import com.memoire.fu.FuLog; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.CoordinateSequence; +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.LinearRing; + /** * @author Fred Deniger - * @version $Id: ZModeleLigneBriseeDefault.java,v 1.20.6.3 2008-05-13 12:10:33 bmarchan Exp $ + * @version $Id$ */ -public class ZModeleLigneBriseeDefault implements ZModeleLigneBrisee, ZModeleEditable { +public class ZModeleLigneBriseeDefault extends ZModeleGeometryDefault + implements ZModeleLigneBrisee, ZModeleEditable { /** * @author Fred Deniger - * @version $Id: ZModeleLigneBriseeDefault.java,v 1.20.6.3 2008-05-13 12:10:33 bmarchan Exp $ + * @version $Id$ */ public static class AtomesTableModel extends AbstractTableModel { GISAttributeInterface[] att_; - final GISZoneCollectionLigneBrisee ligne_; + final GISZoneCollectionGeometry ligne_; final int[] nbLineAtoms_; @@ -67,7 +63,7 @@ final int nb_; - public AtomesTableModel(final GISZoneCollectionLigneBrisee _ligne) { + public AtomesTableModel(final GISZoneCollectionGeometry _ligne) { ligne_ = _ligne; nbLineAtoms_ = new int[_ligne.getNumGeometries()]; lineClosed_ = new boolean[_ligne.getNumGeometries()]; @@ -163,7 +159,7 @@ /** * @author Fred Deniger - * @version $Id: ZModeleLigneBriseeDefault.java,v 1.20.6.3 2008-05-13 12:10:33 bmarchan Exp $ + * @version $Id$ */ public static class LignesTableModel extends AbstractTableModel { @@ -237,8 +233,6 @@ } } - protected GISZoneCollectionLigneBrisee geometries_; - public ZModeleLigneBriseeDefault() {} /** @@ -250,15 +244,15 @@ } public final boolean containsPolygone() { - return geometries_ == null ? false : geometries_.containsPolygone(); + return geometries_ == null ? false : getGeomData().containsPolygone(); } public BuTable createValuesTable(final ZCalqueAffichageDonneesInterface _layer) { final BuTable r = new CtuluTable(); if (((ZCalqueLigneBrisee) _layer).isAtomicMode()) { - r.setModel(new AtomesTableModel(geometries_)); + r.setModel(new AtomesTableModel(getGeomData())); } else { - r.setModel(new LignesTableModel(true, geometries_)); + r.setModel(new LignesTableModel(true, getGeomData())); } return r; } @@ -335,48 +329,10 @@ } } - /** - * @return la collection a la base du modele. - */ - public final GISZoneCollectionLigneBrisee getCollection() { - return geometries_; + public final GISZoneCollectionLigneBrisee getGeomData() { + return (GISZoneCollectionLigneBrisee)geometries_; } - public final GrBoite getDomaine() { - if (geometries_ == null || geometries_.getNumGeometries() == 0) { - return null; - } - final Envelope e = geometries_.getEnvelopeInternal(); - if (e == null) { - return null; - } - return new GrBoite(new GrPoint(e.getMinX(), e.getMinY(), 0), new GrPoint(e.getMaxX(), e.getMaxY(), 0)); - } - - public final void getDomaineForGeometry(final int _idxLigne, final GrBoite _target) { - if (geometries_ == null || geometries_.getNumGeometries() == 0) { - return; - } - final Geometry g = geometries_.getGeometry(_idxLigne); - final Envelope e = g.getEnvelopeInternal(); - if (_target.o_ == null) { - _target.o_ = new GrPoint(); - } - if (_target.e_ == null) { - _target.e_ = new GrPoint(); - } - if (e != null && !e.isNull()) { - _target.o_.x_ = e.getMinX(); - _target.o_.y_ = e.getMinY(); - _target.e_.x_ = e.getMaxX(); - _target.e_.y_ = e.getMaxY(); - } - } - - public final GISZoneCollection getGeomData() { - return geometries_; - } - public final int getNbPolyligne() { return getNombre()-getNbPolygone(); } @@ -404,48 +360,14 @@ return GISLib.getNbGeomOf(LinearRing.class, geometries_); } - public final int getNombre() { - return geometries_ == null ? 0 : geometries_.getNumGeometries(); - } - - public final Object getObject(final int _ind) { - return geometries_ == null ? null : geometries_.getGeometry(_ind); - } - public boolean isCoordinateValid(final CoordinateSequence _seq, final CtuluAnalyze _analyze) { return false; } - public final boolean isGeometryFermee(final int _idxLigne) { - return geometries_ == null ? false : ((LineString) geometries_.getGeometry(_idxLigne)).isClosed(); - } - - public final boolean isGeometryReliee(final int _idxLigne) { - return true; - } - - public final boolean isGeometryVisible(final int _idxGeom) { - int iattVisibility=geometries_.getIndiceOf(GISAttributeConstants.VISIBILITE); - if (iattVisibility==-1) return true; - - return (Boolean)geometries_.getValue(iattVisibility, _idxGeom); - } - public boolean isValuesTableAvailable() { return true; } - public final boolean point(final GrPoint _pt, final int _ligneIdx, final int _pointIdx) { - final CoordinateSequence g = ((LineString) geometries_.getGeometry(_ligneIdx)).getCoordinateSequence(); - _pt.x_ = g.getX(_pointIdx); - _pt.y_ = g.getY(_pointIdx); - return true; - } - - public void prepareExport() { - geometries_.prepareExport(); - } - protected void fillWithAtomicInfo(final int _idxLigne, final int _idxPt, final InfoData _d) { final GISZoneCollection model = getGeomData(); final int nbAtt = model.getNbAttributes(); Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeEditable.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeEditable.java 2008-10-07 13:59:38 UTC (rev 4040) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeEditable.java 2008-10-07 14:12:32 UTC (rev 4041) @@ -1,6 +1,6 @@ /* * @creation 4 avr. 2005 - * @modification $Date: 2008-05-13 12:10:33 $ + * @modification $Date$ * @license GNU General Public License 2 * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail de...@fu... @@ -39,7 +39,7 @@ /** * @author Fred Deniger - * @version $Id: ZModeleLigneBriseeEditable.java,v 1.11.6.7 2008-05-13 12:10:33 bmarchan Exp $ + * @version $Id$ */ public class ZModeleLigneBriseeEditable extends ZModeleLigneBriseeDefault{ @@ -202,7 +202,7 @@ return false; } if (r) { - geometries_.addPolygone(poly, data, _cmd); + getGeomData().addPolygone(poly, data, _cmd); } return r; } @@ -246,7 +246,7 @@ return false; } if (r) { - geometries_.addPolyligne(poly, data, _cmd); + getGeomData().addPolyligne(poly, data, _cmd); } return r; } @@ -334,8 +334,8 @@ // Remplacement dans la collection. geometries_.removeGeometries(new int[]{_ligneIdx}, cmp); - geometries_.addPolyligne((GISPolyligne)GISGeometryFactory.INSTANCE.createLineString(cline1), dataline1, cmp); - geometries_.addPolyligne((GISPolyligne)GISGeometryFactory.INSTANCE.createLineString(cline2), dataline2, cmp); + getGeomData().addPolyligne((GISPolyligne)GISGeometryFactory.INSTANCE.createLineString(cline1), dataline1, cmp); + getGeomData().addPolyligne((GISPolyligne)GISGeometryFactory.INSTANCE.createLineString(cline2), dataline2, cmp); if (_cmd != null) { _cmd.addCmd(cmp.getSimplify()); @@ -431,7 +431,7 @@ } // Remplacement dans la collection. - geometries_.addPolyligne((GISPolyligne)GISGeometryFactory.INSTANCE.createLineString(cline), dataline, cmp); + getGeomData().addPolyligne((GISPolyligne)GISGeometryFactory.INSTANCE.createLineString(cline), dataline, cmp); geometries_.removeGeometries(_ligneIdx, cmp); if (_cmd != null) { Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeEditable.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleMultiPointEditable.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleMultiPointEditable.java 2008-10-07 13:59:38 UTC (rev 4040) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleMultiPointEditable.java 2008-10-07 14:12:32 UTC (rev 4041) @@ -1,6 +1,6 @@ /* * @creation 4 avr. 2005 - * @modification $Date: 2008-05-13 12:10:22 $ + * @modification $Date$ * @license GNU General Public License 2 * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail de...@fu... @@ -14,14 +14,6 @@ import javax.swing.table.AbstractTableModel; -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.CoordinateSequence; -import com.vividsolutions.jts.geom.Envelope; -import com.vividsolutions.jts.geom.Geometry; - -import com.memoire.bu.BuTable; -import com.memoire.fu.FuLog; - import org.fudaa.ctulu.CtuluAnalyze; import org.fudaa.ctulu.CtuluCommandComposite; import org.fudaa.ctulu.CtuluCommandContainer; @@ -40,26 +32,29 @@ import org.fudaa.ctulu.gis.GISZoneCollection; import org.fudaa.ctulu.gis.GISZoneCollectionMultiPoint; import org.fudaa.ctulu.gui.CtuluTable; - import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.calque.ZCalqueMultiPoint; import org.fudaa.ebli.calque.ZModeleMultiPoint; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.commun.EbliListeSelectionMultiInterface; -import org.fudaa.ebli.geometrie.GrBoite; -import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; +import com.memoire.bu.BuTable; +import com.memoire.fu.FuLog; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.CoordinateSequence; +import com.vividsolutions.jts.geom.Geometry; + /** * Une implementation par defaut d'un mod\xE8le \xE9ditable pour des multipoints. * @author Bertrand Marchand - * @version $Id: ZModeleMultiPointEditable.java,v 1.1.2.4 2008-05-13 12:10:22 bmarchan Exp $ + * @version $Id$ */ -public class ZModeleMultiPointEditable implements ZModeleMultiPoint, ZModeleEditable { +public class ZModeleMultiPointEditable extends ZModeleGeometryDefault implements ZModeleMultiPoint, ZModeleEditable { /** * @author Bertrand Marchand - * @version $Id: ZModeleMultiPointEditable.java,v 1.1.2.4 2008-05-13 12:10:22 bmarchan Exp $ + * @version $Id$ */ public static class AtomesTableModel extends AbstractTableModel { @@ -164,7 +159,7 @@ /** * @author Fred Deniger - * @version $Id: ZModeleMultiPointEditable.java,v 1.1.2.4 2008-05-13 12:10:22 bmarchan Exp $ + * @version $Id$ */ public static class LignesTableModel extends AbstractTableModel { @@ -223,8 +218,6 @@ } } - protected GISZoneCollectionMultiPoint geometries_; - /** * @param _zone la zone: non copiee */ @@ -236,9 +229,9 @@ public BuTable createValuesTable(final ZCalqueAffichageDonneesInterface _layer) { final BuTable r = new CtuluTable(); if (((ZCalqueMultiPoint) _layer).isAtomicMode()) { - r.setModel(new AtomesTableModel(geometries_)); + r.setModel(new AtomesTableModel(getGeomData())); } else { - r.setModel(new LignesTableModel(geometries_)); + r.setModel(new LignesTableModel(getGeomData())); } return r; } @@ -298,41 +291,13 @@ } } - public final GrBoite getDomaine() { - if (geometries_ == null || geometries_.getNumGeometries() == 0) { - return null; - } - final Envelope e = geometries_.getEnvelopeInternal(); - if (e == null) { - return null; - } - return new GrBoite(new GrPoint(e.getMinX(), e.getMinY(), 0), new GrPoint(e.getMaxX(), e.getMaxY(), 0)); + public final GISZoneCollectionMultiPoint getGeomData() { + return (GISZoneCollectionMultiPoint)geometries_; } - public final void getDomaineForGeometry(final int _idxLigne, final GrBoite _target) { - if (geometries_ == null || geometries_.getNumGeometries() == 0) { - return; - } - final Geometry g = geometries_.getGeometry(_idxLigne); - final Envelope e = g.getEnvelopeInternal(); - if (_target.o_ == null) { - _target.o_ = new GrPoint(); - } - if (_target.e_ == null) { - _target.e_ = new GrPoint(); - } - if (e != null && !e.isNull()) { - _target.o_.x_ = e.getMinX(); - _target.o_.y_ = e.getMinY(); - _target.e_.x_ = e.getMaxX(); - _target.e_.y_ = e.getMaxY(); - } - } - - public final GISZoneCollection getGeomData() { - return geometries_; - } - + /* + * Surcharge pour acceleration des traitements. + */ public final int getNbPointForGeometry(final int _idxLigne) { if (geometries_ == null) { return 0; @@ -342,14 +307,6 @@ // return gi.getNumPoints(); } - public final int getNombre() { - return geometries_ == null ? 0 : geometries_.getNumGeometries(); - } - - public final Object getObject(final int _ind) { - return geometries_ == null ? null : geometries_.getGeometry(_ind); - } - public boolean isCoordinateValid(final CoordinateSequence _seq, final CtuluAnalyze _analyze) { if (_seq == null || _seq.size()<=0) { _analyze.addFatalError(EbliLib.getS("Pas de coordonn\xE9es")); @@ -361,21 +318,7 @@ public boolean isValuesTableAvailable() { return true; } - - public final boolean point(final GrPoint _pt, final int _ligneIdx, final int _pointIdx) { - // On s'appuie sur la m\xE9thode GISMultiPoint.getCoordinateSequence() cr\xE9\xE9e pour l'occasion et non GISMultiPoint.getCoordinates() - // pour r\xE9cuperer les coordonn\xE9es d'un point. En effet, recup\xE9rer le tableau des coordonn\xE9es s'av\xE8re terriblement - // penalisant pour l'affichage. - final CoordinateSequence g = ((GISMultiPoint) geometries_.getGeometry(_ligneIdx)).getCoordinateSequence(); - _pt.x_ = g.getX(_pointIdx); - _pt.y_ = g.getY(_pointIdx); - return true; - } - public void prepareExport() { - geometries_.prepareExport(); - } - protected void fillWithAtomicInfo(final int _idxLigne, final int _idxPt, final InfoData _d) { final GISZoneCollection model = getGeomData(); final int nbAtt = model.getNbAttributes(); @@ -858,18 +801,6 @@ if (_cmd!=null) _cmd.addCmd(cmp.getSimplify()); return true; } - - public boolean isGeometryFermee(int _idxGeom) { - return false; - } - - public boolean isGeometryReliee(int _idxGeom) { - return false; - } - - public final boolean isGeometryVisible(final int _idxLigne) { - return true; - } /** * Fait passer la g\xE9om\xE9trie en Modifier Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZModeleMultiPointEditable.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrSiPlanLayer.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrSiPlanLayer.java 2008-10-07 13:59:38 UTC (rev 4040) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrSiPlanLayer.java 2008-10-07 14:12:32 UTC (rev 4041) @@ -1,6 +1,6 @@ /* * @creation 14 avr. 2005 - * @modification $Date: 2007-01-19 13:14:09 $ + * @modification $Date$ * @license GNU General Public License 2 * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail fud...@li... @@ -18,7 +18,7 @@ /** * @author Fred Deniger - * @version $Id: TrSiPlanLayer.java,v 1.25 2007-01-19 13:14:09 deniger Exp $ + * @version $Id$ */ public class TrSiPlanLayer extends FSigLayerLine { @@ -50,7 +50,7 @@ } public TrSiProfilModel.Zone getZone() { - return (TrSiProfilModel.Zone) ((ZModeleLigneBriseeDefault) getModele()).getCollection(); + return (TrSiProfilModel.Zone) ((ZModeleLigneBriseeDefault) getModele()).getGeomData(); } } Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/data/TrSiPlanLayer.java ___________________________________________________________________ Added: svn:keywords + Date Revision Author URL Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |