|
From: <bma...@us...> - 2010-10-26 10:17:32
|
Revision: 6011
http://fudaa.svn.sourceforge.net/fudaa/?rev=6011&view=rev
Author: bmarchan
Date: 2010-10-26 10:17:26 +0000 (Tue, 26 Oct 2010)
Log Message:
-----------
removeAll() generalis?\195?\169 ?\195?\160 GISZoneCollection
Modified Paths:
--------------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollection.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionPoint.java
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollection.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollection.java 2010-10-25 09:44:10 UTC (rev 6010)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollection.java 2010-10-26 10:17:26 UTC (rev 6011)
@@ -284,6 +284,16 @@
super.geometry_.remove(_idx, _cmd);
}
+ /**
+ * Supprime toutes les g\xE9om\xE9tries.
+ * @param _cmd Le container de commande
+ */
+ public void removeAll(final CtuluCommandContainer _cmd) {
+ if (isGeomModifiable_ && getNumGeometries() > 0) {
+ geometry_.removeAll(_cmd);
+ }
+ }
+
public GISAttributeModel[] getAtomicAttributeSubModel(final int _geomIdx) {
final int nb = getNbAttributes();
final List<GISAttributeModel> r = new ArrayList<GISAttributeModel>(nb);
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java 2010-10-25 09:44:10 UTC (rev 6010)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java 2010-10-26 10:17:26 UTC (rev 6011)
@@ -438,14 +438,6 @@
super.geometry_.remove(_idx, _cmd);
}
- /**
- * Supprime toutes les lignes.
- * @param _cmd Le container de commande
- */
- public void removeAll(final CtuluCommandContainer _cmd) {
- super.geometry_.removeAll(_cmd);
- }
-
@Override
public void setCoordinateSequence(final int _idx, final CoordinateSequence _newSeq, final CtuluCommandContainer _cmd) {
final LineString old = (LineString) super.geometry_.getValueAt(_idx);
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionPoint.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionPoint.java 2010-10-25 09:44:10 UTC (rev 6010)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionPoint.java 2010-10-26 10:17:26 UTC (rev 6011)
@@ -283,12 +283,6 @@
return geometry_.remove(_indiceDuPointAEnlever, _cmd);
}
- public void removeAll(final CtuluCommandContainer _cmd) {
- if (isGeomModifiable_ && getNumGeometries() > 0) {
- geometry_.removeAll(_cmd);
- }
- }
-
public final boolean get(final int _i, final GISPointMutable _p) {
_p.initWith(get(_i));
return true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bma...@us...> - 2011-07-05 09:27:54
|
Revision: 6320
http://fudaa.svn.sourceforge.net/fudaa/?rev=6320&view=rev
Author: bmarchan
Date: 2011-07-05 09:27:45 +0000 (Tue, 05 Jul 2011)
Log Message:
-----------
Add : Methode GISAttribute.getComparator()
Modified Paths:
--------------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttribute.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttributeConstants.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttributeInterface.java
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttribute.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttribute.java 2011-07-05 09:25:29 UTC (rev 6319)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttribute.java 2011-07-05 09:27:45 UTC (rev 6320)
@@ -8,6 +8,7 @@
package org.fudaa.ctulu.gis;
import java.util.Arrays;
+import java.util.Comparator;
import org.fudaa.ctulu.CtuluLib;
import org.fudaa.ctulu.CtuluLibString;
@@ -257,4 +258,24 @@
isUserVisible_ = _isUserVisible;
}
+ /**
+ * @return Un comparateur g\xE9n\xE9rique des valeurs stock\xE9es par le modele.
+ */
+ public Comparator<?> getComparator() {
+ if (Comparable.class.isAssignableFrom(getDataClass())) {
+ return new Comparator<Object>() {
+ public int compare(Object o1, Object o2) {
+ return ((Comparable)o1).compareTo(o2);
+ }
+ };
+ }
+ else {
+ return new Comparator<Object>() {
+ public int compare(Object o1, Object o2) {
+ return o1==null ? (o2==null ? 0 : 1) : (o2==null ? -1 : o1.toString().compareTo(o2.toString()));
+ }
+ };
+ }
+ }
+
}
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttributeConstants.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttributeConstants.java 2011-07-05 09:25:29 UTC (rev 6319)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttributeConstants.java 2011-07-05 09:27:45 UTC (rev 6320)
@@ -9,6 +9,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Comparator;
import java.util.List;
import org.fudaa.ctulu.CtuluLib;
@@ -165,9 +166,25 @@
* Un attribut commentaire hydraulique, utilis\xE9 dans la lecture/ecriture des fichiers.
*/
public final static GISAttributeString COMMENTAIRE_HYDRO = new GISAttributeString(CtuluLib.getS("Commentaire hydro"), false) {
+ @Override
public String getID() {
return "ATTRIBUTE_HYDRO_COMMENT";
}
+
+ /**
+ * La comparaison se fait uniquement sur le PK pour le moment.
+ */
+ @Override
+ public Comparator<?> getComparator() {
+ return new Comparator<String>() {
+ public int compare(String o1, String o2) {
+ double v=GISLib.getHydroCommentDouble(o1,ATT_COMM_HYDRO_PK)-GISLib.getHydroCommentDouble(o2,ATT_COMM_HYDRO_PK);
+ return v==0 ? 0 : v>0 ? 1 : -1;
+ }
+ };
+ }
+
+
};
/**
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttributeInterface.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttributeInterface.java 2011-07-05 09:25:29 UTC (rev 6319)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttributeInterface.java 2011-07-05 09:27:45 UTC (rev 6320)
@@ -7,6 +7,7 @@
*/
package org.fudaa.ctulu.gis;
+import java.util.Comparator;
import org.fudaa.ctulu.CtuluVariable;
import org.fudaa.ctulu.editor.CtuluValueEditorI;
@@ -92,6 +93,11 @@
* @return l'\xE9diteur associe
*/
CtuluValueEditorI getEditor();
+
+ /**
+ * @return Le comparateur de valeur, pour le tri sur un modele par exemple.
+ */
+ Comparator<?> getComparator();
/**
* @return le nombre de chiffres apr\xE8s la virgule
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bma...@us...> - 2011-11-30 13:57:33
|
Revision: 6735
http://fudaa.svn.sourceforge.net/fudaa/?rev=6735&view=rev
Author: bmarchan
Date: 2011-11-30 13:57:26 +0000 (Wed, 30 Nov 2011)
Log Message:
-----------
Fix GISZone : addAtomic et removeAtomics
Modified Paths:
--------------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneAttributeFactory.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollection.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionGeometry.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionMultiPoint.java
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneAttributeFactory.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneAttributeFactory.java 2011-11-30 13:33:42 UTC (rev 6734)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneAttributeFactory.java 2011-11-30 13:57:26 UTC (rev 6735)
@@ -9,8 +9,8 @@
import java.util.Arrays;
+import com.vividsolutions.jts.geom.CoordinateSequence;
import com.vividsolutions.jts.geom.Geometry;
-import com.vividsolutions.jts.geom.LineString;
/**
* @author Fred Deniger
@@ -31,24 +31,7 @@
*/
public static GISReprojectInterpolateurI create1DInterpolateur(final GISAttributeInterface _att,
final GISCoordinateSequenceContainerInterface _src, final GISCoordinateSequenceContainerInterface _target, final GISAttributeModel _model) {
- final Class clazz = _att.getDataClass();
- if (clazz == Integer.class) {
- return new GISReprojectInterpolateur1DInteger(_src.getCoordinateSequence(), _target.getCoordinateSequence(),
- (GISAttributeModelIntegerInterface) _model);
- } else if (clazz == Double.class) {
- return new GISReprojectInterpolateur1DDouble(_src.getCoordinateSequence(), _target.getCoordinateSequence(),
- (GISAttributeModelDoubleInterface) _model);
- } else if (clazz == Boolean.class) {
- return new GISReprojectInterpolateur1DBoolean(_src.getCoordinateSequence(), _target.getCoordinateSequence(),
- (GISAttributeModelBooleanInterface) _model);
- } else if (clazz == Long.class) {
- return new GISReprojectInterpolateur1DLong(_src.getCoordinateSequence(), _target.getCoordinateSequence(),
- (GISAttributeModelLongInterface) _model);
- } else {
- return new GISReprojectInterpolateur1DObject(_src.getCoordinateSequence(), _target.getCoordinateSequence(),
- (GISAttributeModelObjectInterface) _model);
- }
-
+ return create1DInterpolateur(_att,_src.getCoordinateSequence(),_target.getCoordinateSequence(), _model);
}
/**
@@ -60,34 +43,33 @@
*/
public static GISReprojectInterpolateurI create1DInterpolateur(final GISAttributeInterface _att,
final Geometry _src, final Geometry _target, final GISAttributeModel _model) {
+ return create1DInterpolateur(_att,new GISCoordinateSequence(_src.getCoordinates()),new GISCoordinateSequence(_target.getCoordinates()), _model);
+ }
+
+ /**
+ * @param _att l'attribut
+ * @param _src la liste des points source
+ * @param _target la liste des points cible
+ * @param _model le model initial
+ * @return l'interpolateur 1d
+ */
+ public static GISReprojectInterpolateurI create1DInterpolateur(final GISAttributeInterface _att, final CoordinateSequence _src, final CoordinateSequence _target, final GISAttributeModel _model) {
final Class clazz = _att.getDataClass();
if (clazz == Integer.class) {
- return new GISReprojectInterpolateur1DInteger(
- new GISCoordinateSequence(_src.getCoordinates()),
- new GISCoordinateSequence(_target.getCoordinates()),
- (GISAttributeModelIntegerInterface) _model);
- } else if (clazz == Double.class) {
- return new GISReprojectInterpolateur1DDouble(
- new GISCoordinateSequence(_src.getCoordinates()),
- new GISCoordinateSequence(_target.getCoordinates()),
- (GISAttributeModelDoubleInterface) _model);
- } else if (clazz == Boolean.class) {
- return new GISReprojectInterpolateur1DBoolean(
- new GISCoordinateSequence(_src.getCoordinates()),
- new GISCoordinateSequence(_target.getCoordinates()),
- (GISAttributeModelBooleanInterface) _model);
- } else if (clazz == Long.class) {
- return new GISReprojectInterpolateur1DLong(
- new GISCoordinateSequence(_src.getCoordinates()),
- new GISCoordinateSequence(_target.getCoordinates()),
- (GISAttributeModelLongInterface) _model);
- } else {
- return new GISReprojectInterpolateur1DObject(
- new GISCoordinateSequence(_src.getCoordinates()),
- new GISCoordinateSequence(_target.getCoordinates()),
- (GISAttributeModelObjectInterface) _model);
+ return new GISReprojectInterpolateur1DInteger(_src, _target, (GISAttributeModelIntegerInterface) _model);
}
-
+ else if (clazz == Double.class) {
+ return new GISReprojectInterpolateur1DDouble(_src, _target, (GISAttributeModelDoubleInterface) _model);
+ }
+ else if (clazz == Boolean.class) {
+ return new GISReprojectInterpolateur1DBoolean(_src, _target, (GISAttributeModelBooleanInterface) _model);
+ }
+ else if (clazz == Long.class) {
+ return new GISReprojectInterpolateur1DLong(_src, _target, (GISAttributeModelLongInterface) _model);
+ }
+ else {
+ return new GISReprojectInterpolateur1DObject(_src, _target, (GISAttributeModelObjectInterface) _model);
+ }
}
public static GISAttributeModel createModelList(final GISAttributeInterface _att, final Object _valatt, final int _capacity,
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollection.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollection.java 2011-11-30 13:33:42 UTC (rev 6734)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollection.java 2011-11-30 13:57:26 UTC (rev 6735)
@@ -269,7 +269,7 @@
* @param _geom La g\xE9om\xE9trie.
* @param _datas Les valeurs d'attributs, dans l'ordre.
* @param _cmd Le manager de commandes.
- * @return l'index de l'attribut cr\xE9e, -1 si rien n'est cr\xE9e
+ * @return l'index de la g\xE9om\xE9trie cr\xE9\xE9e, -1 si rien n'est cr\xE9e
*/
public abstract int addGeometry(Geometry _geom, Object[] _datas, CtuluCommandContainer _cmd);
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionGeometry.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionGeometry.java 2011-11-30 13:33:42 UTC (rev 6734)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionGeometry.java 2011-11-30 13:57:26 UTC (rev 6735)
@@ -115,13 +115,14 @@
* @param _idxBefore L'indice du point juste avant. Si _idxBefore est \xE9gal \xE0 -1, le point est ajout\xE9 en d\xE9but de g\xE9om\xE9trie
* @param _x La coordonn\xE9e X du sommet ajout\xE9.
* @param _y La coordonn\xE9e Y du sommet ajout\xE9.
- * @param _cmd Le manager de commandes.
+ * @param _cmd Le manager de commandes.
+ * @return L'index du point ins\xE9r\xE9, ou -1 si non ins\xE9r\xE9.
*/
- public void addAtomic(final int _idxGeom, final int _idxBefore, final double _x, final double _y,
+ public int addAtomic(final int _idxGeom, final int _idxBefore, final double _x, final double _y,
final CtuluCommandContainer _cmd) {
if (!isGeomModifiable_) {
- return;
+ return -1;
}
Geometry geom = (Geometry)super.geometry_.getValueAt(_idxGeom);
final Coordinate[] oldcs = geom.getCoordinates();
@@ -137,12 +138,22 @@
cs[idx++] = new Coordinate(_x, _y, 0.);
}
}
+
+ // Polygone => La derni\xE8re coordonn\xE9e doit \xEAtre egale a la premiere
+ if (geom instanceof GISPolygone) {
+ cs[initSize]=cs[0];
+ }
geom = GISGeometryFactory.INSTANCE.createGeometry(geom.getClass(),cs);
- setGeometry(_idxGeom,geom, _cmd);
+ setGeometry(_idxGeom,geom, _cmd);
+
+ return _idxBefore+1;
}
/**
+ * Remplace une geometrie et modifie la valeur de ses attributs atomiques par interpolation
+ * si le nombre de sommets est diff\xE9rent de la geometrie initiale.
+ *
* @param _idx l'indice de la ligne a changer
* @param _geom la nouvelle ligne
* @param _cmd le receveur de commande
@@ -238,24 +249,25 @@
boolean r = true;
final Geometry old = (Geometry) getGeometry(_idxGeom);
int nbPt = old.getNumPoints();
-
+
// Raccourci si tous les sommets sont s\xE9lectionn\xE9s.
int nbSel=_sel.getNbSelectedIndex();
- if (nbSel==nbPt) {
+ if (nbSel==nbPt || (nbSel+1==nbPt && old instanceof GISPolygone)) {
removeGeometries(new int[]{_idxGeom}, _cmd);
return true;
- }
-
- // dans le cas polygone le dernier point n'est pas a considerer=premier point
- if (old instanceof GISPolygone) {
- nbPt--;
- }
+ }
+
// les nouvelles coordonnees.
final Coordinate[] newCs = new Coordinate[nbPt-nbSel];
// cette liste contient les indices a enlever : creee que si necessaire
// si des attributes atomics existent
final TIntArrayList idxToRemove = containsAtomicAttribute() ? new TIntArrayList(nbPt-nbSel) : null;
+ // dans le cas polygone le dernier point n'est pas a considerer=premier point
+ if (old instanceof GISPolygone) {
+ nbPt--;
+ }
+
// compteur tempo
int count = 0;
for (int idxPt = 0; idxPt < nbPt; idxPt++) {
@@ -268,6 +280,11 @@
// newCs[count++] = (Coordinate)old.getCoordinates()[idxPt].clone();
}
}
+
+ if (old instanceof GISPolygone) {
+ newCs[count]=newCs[0];
+ }
+
Geometry newGeom = null;
// Un polygone
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java 2011-11-30 13:33:42 UTC (rev 6734)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionLigneBrisee.java 2011-11-30 13:57:26 UTC (rev 6735)
@@ -11,27 +11,16 @@
*/
package org.fudaa.ctulu.gis;
-import gnu.trove.TIntArrayList;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import java.util.Map;
-import com.memoire.fu.FuLog;
-import com.vividsolutions.jts.geom.Coordinate;
+import org.fudaa.ctulu.CtuluCommandContainer;
+
import com.vividsolutions.jts.geom.CoordinateSequence;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.LineString;
-import org.fudaa.ctulu.CtuluCommandComposite;
-import org.fudaa.ctulu.CtuluCommandCompositeInverse;
-import org.fudaa.ctulu.CtuluCommandContainer;
-import org.fudaa.ctulu.CtuluLib;
-import org.fudaa.ctulu.CtuluLibString;
-import org.fudaa.ctulu.CtuluListSelectionInterface;
-import org.fudaa.ctulu.CtuluUI;
-
/**
* @author Fred Deniger
* @version $Id: GISZoneCollectionLigneBrisee.java,v 1.20.6.4 2008-04-01 07:22:47 bmarchan Exp $
@@ -221,110 +210,4 @@
public Class getDataStoreClass() {
return LineString.class;
}
-
- /*
- * Surcharge, en attendant d'etre sur que la methode m\xE8re fonctionne dans tous les cas.
- */
- public boolean removeAtomics(final int _idxGeom, final CtuluListSelectionInterface _sel, final CtuluUI _ui,
- final CtuluCommandContainer _cmd) {
- if (_sel == null || _sel.isEmpty()) { return false; }
- boolean r = true;
- final LineString line = (LineString) getGeometry(_idxGeom);
- int nbPt = line.getCoordinateSequence().size();
-
- // Raccourci si tous les sommets sont s\xE9lectionn\xE9s.
- int nbSel=_sel.getNbSelectedIndex();
- if (nbSel==nbPt||(nbSel+1==nbPt&&(geometry_.getValueAt(_idxGeom) instanceof GISPolygone))) {
- removeGeometries(new int[]{_idxGeom}, _cmd);
- return true;
- }
-
- // les nouvelles coordonnees.
- final Coordinate[] newCs = new Coordinate[nbPt];
- // cette liste contient les indice a enlever : creee que si necessaire
- // si des attribute atomics existent
- final TIntArrayList idxToRemove = containsAtomicAttribute() ? new TIntArrayList(nbPt) : null;
- // dans le cas polygone le dernier point n'est pas a considerer=premier
- // point
- if (line/* .isClosed() */instanceof GISPolygone) {
- nbPt--;
- }
-
- // compteur tempo
- int count = 0;
- for (int idxPt = 0; idxPt < nbPt; idxPt++) {
- if (_sel.isSelected(idxPt)) {
- if (idxToRemove != null) {
- idxToRemove.add(idxPt);
- }
- } else {
- newCs[count++] = line.getCoordinateSequence().getCoordinateCopy(idxPt);
- }
- }
- LineString newString = null;
-
- // Un polygone
- if (line/* .isClosed() */instanceof GISPolygone) {
- if (count < 3) {
- r = false;
- if (_ui != null) {
- _ui.error(null, CtuluLib.getS("La ligne brisee doit contenir {0} points au moins", CtuluLibString.TROIS),
- false);
- }
-
- } else {
- newCs[count++] = newCs[0];
- final Coordinate[] coord = new Coordinate[count];
- System.arraycopy(newCs, 0, coord, 0, coord.length);
- newString = GISGeometryFactory.INSTANCE.createLinearRing(coord);
- newString.setUserData(line.getUserData());
- }
- }
-
- // Une polyligne
- else if (line instanceof GISPolyligne) {
- if (count < 2) {
- r = false;
- if (_ui != null) {
- _ui.error(null, CtuluLib.getS("La ligne brisee doit contenir {0} points au moins", CtuluLibString.DEUX),
- false);
- }
- if (FuLog.isTrace()) {
- FuLog.trace("EBLI: polylignes: not enough points");
- // message
- }
- } else {
- final Coordinate[] coord = new Coordinate[count];
- System.arraycopy(newCs, 0, coord, 0, coord.length);
- newString = GISGeometryFactory.INSTANCE.createLineString(coord);
- newString.setUserData(line.getUserData());
- }
- }
-
- if (r) {
- final CtuluCommandComposite cmp = new CtuluCommandCompositeInverse();
-
- // si des attributs atomics sont concerne
- if (idxToRemove != null && idxToRemove.size() > 0) {
- final int[] idx = idxToRemove.toNativeArray();
- Arrays.sort(idx);
- for (int i = getNbAttributes() - 1; i >= 0; i--) {
- // attribut atomic
- if (getAttribute(i).isAtomicValue()) {
- // dans ce cas on recupere le model contenant cet attribut
- final GISAttributeModel m = getModelListener(i);
- // on recupere le sous-model concerne par la modif de geometrie
- final GISAttributeModel atomicModel = (GISAttributeModel) m.getObjectValueAt(_idxGeom);
- // on le change
- m.setObject(_idxGeom, atomicModel.createSubModel(idx), cmp);
- }
- }
- }
- super.geometry_.setObject(_idxGeom, newString, cmp);
- if (_cmd != null) {
- _cmd.addCmd(cmp.getSimplify());
- }
- }
- return r;
- }
}
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionMultiPoint.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionMultiPoint.java 2011-11-30 13:33:42 UTC (rev 6734)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISZoneCollectionMultiPoint.java 2011-11-30 13:57:26 UTC (rev 6735)
@@ -64,23 +64,28 @@
}
/*
- * Le sommet est ajout\xE9 sans interpolation des valeurs atomiques.
+ * Surcharge pour sommet ajout\xE9 sans interpolation des valeurs atomiques.
*/
- public void addAtomic(final int _idxGeom, final int _idxBefore, final double _x, final double _y,
+ @Override
+ public int addAtomic(final int _idxGeom, final int _idxBefore, final double _x, final double _y,
final CtuluCommandContainer _cmd) {
if (!isGeomModifiable_) {
- return;
+ return -1;
}
Geometry geom = (Geometry)super.geometry_.getValueAt(_idxGeom);
final Coordinate[] oldcs = geom.getCoordinates();
final int initSize = oldcs.length;
+ if(_idxBefore<-1||_idxBefore>=initSize)
+ throw new IllegalArgumentException("L'index du point \xE0 ajouter doit appartenir \xE0 la g\xE9om\xE9trie.");
TIntIntHashMap newIdxOldIdx=new TIntIntHashMap(initSize);
final Coordinate[] cs = new Coordinate[initSize + 1];
int idx = 0;
- for (int i = 0; i < initSize; i++) {
- newIdxOldIdx.put(idx,i); // Pour les attributs
- cs[idx++] = (Coordinate)oldcs[i].clone();
+ for (int i = -1; i < initSize; i++) {
+ if (i>=0) {
+ newIdxOldIdx.put(idx,i); // Pour les attributs
+ cs[idx++] = (Coordinate)oldcs[i].clone();
+ }
if (i == _idxBefore) {
cs[idx++] = new Coordinate(_x, _y, 0);
}
@@ -106,6 +111,8 @@
if (_cmd!=null) {
_cmd.addCmd(cmp.getSimplify());
}
+
+ return _idxBefore+1;
}
public Class getDataStoreClass() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2012-06-22 06:44:57
|
Revision: 7381
http://fudaa.svn.sourceforge.net/fudaa/?rev=7381&view=rev
Author: deniger
Date: 2012-06-22 06:44:51 +0000 (Fri, 22 Jun 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttribute.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttributeConstants.java
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttribute.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttribute.java 2012-06-22 06:38:35 UTC (rev 7380)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttribute.java 2012-06-22 06:44:51 UTC (rev 7381)
@@ -122,7 +122,7 @@
return editor_ != null;
}
- protected final void setInternEditor(final CtuluValueEditorI _v) {
+ public final void setInternEditor(final CtuluValueEditorI _v) {
editor_ = _v;
}
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttributeConstants.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttributeConstants.java 2012-06-22 06:38:35 UTC (rev 7380)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISAttributeConstants.java 2012-06-22 06:44:51 UTC (rev 7381)
@@ -17,7 +17,6 @@
import org.fudaa.ctulu.editor.CtuluValueEditorChoice;
import com.memoire.fu.FuLib;
-import org.fudaa.ctulu.CtuluActivity;
import org.fudaa.ctulu.editor.CtuluValueEditorDefaults;
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2013-01-14 08:29:18
|
Revision: 8202
http://fudaa.svn.sourceforge.net/fudaa/?rev=8202&view=rev
Author: deniger
Date: 2013-01-14 08:29:05 +0000 (Mon, 14 Jan 2013)
Log Message:
-----------
Ajout support filtre de points
Added Paths:
-----------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemover.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZonePointCollectionPointFiltered.java
Added: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemover.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemover.java (rev 0)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemover.java 2013-01-14 08:29:05 UTC (rev 8202)
@@ -0,0 +1,61 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ctulu.gis.process;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+import org.fudaa.ctulu.CtuluLib;
+import org.fudaa.ctulu.ProgressionInterface;
+import org.fudaa.ctulu.ProgressionUpdater;
+import org.fudaa.ctulu.gis.comparator.CoordinateComparator;
+import org.fudaa.ctulu.interpolation.SupportLocationI;
+
+/**
+ *
+ * Permet de construire une liste de points en s'assurant qu'il n'y ait pas de doublons dans les points.
+ *
+ * @author Frederic Deniger
+ */
+public class GisZoneCollectionPointDoublonRemover {
+
+ private double eps = 1e-3;
+ private final SupportLocationI in;
+
+ public GisZoneCollectionPointDoublonRemover(SupportLocationI in) {
+ this.in = in;
+ }
+
+ public GisZoneCollectionPointDoublonRemover(SupportLocationI in, double eps) {
+ this.in = in;
+ this.eps = eps;
+ }
+
+ public GisZonePointCollectionPointFiltered createFiltered(ProgressionInterface prog) {
+ ProgressionUpdater updater = new ProgressionUpdater(prog);
+ updater.majProgessionStateOnly(CtuluLib.getS("Indexation des points"));
+ TreeMap<Coordinate, Integer> indexs = new TreeMap<Coordinate, Integer>(new CoordinateComparator(eps));
+ updater.setValue(10, in.getPtsNb());
+ for (int i = 0; i < in.getPtsNb(); i++) {
+ Coordinate c = new Coordinate(in.getPtX(i), in.getPtY(i));
+ Integer index = indexs.get(c);
+ //le point n'existe pas
+ if (index == null) {
+ indexs.put(c, i);
+ }
+ updater.majAvancement();
+ }
+ Coordinate[] coordinate = new Coordinate[indexs.size()];
+ int[] correspondance = new int[coordinate.length];
+ int idx = 0;
+ updater.majProgessionStateOnly(CtuluLib.getS("Construction filtre"));
+ updater.setValue(10, coordinate.length);
+ for (Entry<Coordinate, Integer> entry : indexs.entrySet()) {
+ coordinate[idx] = entry.getKey();
+ correspondance[idx++] = entry.getValue();
+ updater.majAvancement();
+ }
+ return new GisZonePointCollectionPointFiltered(correspondance, in);
+ }
+}
Added: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZonePointCollectionPointFiltered.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZonePointCollectionPointFiltered.java (rev 0)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZonePointCollectionPointFiltered.java 2013-01-14 08:29:05 UTC (rev 8202)
@@ -0,0 +1,41 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ctulu.gis.process;
+
+import org.fudaa.ctulu.interpolation.SupportLocationI;
+
+/**
+ * Le r\xE9sultat d'un filtre de points.
+ *
+ * @author Frederic Deniger
+ */
+public class GisZonePointCollectionPointFiltered implements SupportLocationI {
+
+ private int[] correspondance;
+ SupportLocationI init;
+
+ public GisZonePointCollectionPointFiltered(int[] correspondance, SupportLocationI init) {
+ this.correspondance = correspondance;
+ this.init = init;
+ }
+
+ @Override
+ public int getPtsNb() {
+ return correspondance.length;
+ }
+
+ public int getInitialIdx(int _i) {
+ return correspondance[_i];
+ }
+
+ @Override
+ public double getPtX(int _i) {
+ return init.getPtX(correspondance[_i]);
+ }
+
+ @Override
+ public double getPtY(int _i) {
+ return init.getPtY(correspondance[_i]);
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2013-04-06 02:14:05
|
Revision: 8388
http://fudaa.svn.sourceforge.net/fudaa/?rev=8388&view=rev
Author: deniger
Date: 2013-04-06 02:13:52 +0000 (Sat, 06 Apr 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISDataModelAttributeToAtomicSubstitutionAdapter.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISLib.java
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISDataModelAttributeToAtomicSubstitutionAdapter.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISDataModelAttributeToAtomicSubstitutionAdapter.java 2013-04-06 02:12:17 UTC (rev 8387)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISDataModelAttributeToAtomicSubstitutionAdapter.java 2013-04-06 02:13:52 UTC (rev 8388)
@@ -153,7 +153,7 @@
String[] svals = initStringValue.split(GISDataModelFeatureAdapter.VALUE_SEPARATOR);
int max = Math.min(svals.length, values.length);
for (int j = 0; j < svals.length; j++) {
- StringUtils.replace(svals[j], GISDataModelFeatureAdapter.VALUE_SEPARATOR_AS_STRING, GISDataModelFeatureAdapter.VALUE_SEPARATOR);
+ svals[j] = StringUtils.replace(svals[j], GISDataModelFeatureAdapter.VALUE_SEPARATOR_AS_STRING, GISDataModelFeatureAdapter.VALUE_SEPARATOR);
}
final Class targetDataClass = targetAtomic.getDataClass();
if (targetDataClass.equals(Integer.class)) {
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISLib.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISLib.java 2013-04-06 02:12:17 UTC (rev 8387)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GISLib.java 2013-04-06 02:13:52 UTC (rev 8388)
@@ -887,11 +887,11 @@
tbType = "[B]";
}
- type = AttributeTypeFactory.newAttributeType(tbType + (_useIdAsName ? _att.getID() : _att.getName()), String.class, true, 18);
+ type = AttributeTypeFactory.newAttributeType(tbType + (_useIdAsName ? _att.getID() : _att.getName()), String.class, true, 250);
} // 18 pour les shapefiles ...;
else {
type = AttributeTypeFactory.newAttributeType(_useIdAsName ? _att.getID() : _att.getName(), _att
- .getDataClass(), true, 18);
+ .getDataClass(), true, 250);
}
return type;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|