Revision: 6513
          http://sourceforge.net/p/jump-pilot/code/6513
Author:   edso
Date:     2020-09-22 11:26:31 +0000 (Tue, 22 Sep 2020)
Log Message:
-----------
some rephrasing/formatting

Modified Paths:
--------------
    core/trunk/src/org/openjump/sigle/utilities/geom/FeatureCollectionUtil.java

Modified: 
core/trunk/src/org/openjump/sigle/utilities/geom/FeatureCollectionUtil.java
===================================================================
--- core/trunk/src/org/openjump/sigle/utilities/geom/FeatureCollectionUtil.java 
2020-09-22 10:25:35 UTC (rev 6512)
+++ core/trunk/src/org/openjump/sigle/utilities/geom/FeatureCollectionUtil.java 
2020-09-22 11:26:31 UTC (rev 6513)
@@ -105,15 +105,18 @@
        /**
         * Method to make valid all the geometries of a FeatureCollection
         * using the class MakeValidOp.
+        * 
         * A geometry is not valid if it is not simple:
-        * This condition occurs when any of the following conditions are true:
-        * Incorrect ring orientation (polygon), self-intersection rings 
(polygon)
-        * self-intersection path (polyline), unclosed ring (polygon)
-        * (see also 
https://desktop.arcgis.com/en/arcmap/latest/extensions/data-reviewer/finding-invalid-geometry.htm
-        * for the complete list).
-        * This method should be applied before merge feature
-        * [see method unionByAttributeValue(FeatureCollection 
featureCollection, String attrbuteName)]
-        * as not simple geometries will be not processed
+        *  This condition occurs when any of the following conditions are true:
+        *  Incorrect ring orientation (polygon), self-intersection rings 
(polygon)
+        *  self-intersection path (polyline), unclosed ring (polygon)
+        *  (see also 
https://desktop.arcgis.com/en/arcmap/latest/extensions/data-reviewer/finding-invalid-geometry.htm
+        *  for the complete list).
+        * 
+        * This method should be applied before merging features via
+        * {@link #unionByAttributeValue(FeatureCollection, String)
+        * because not simple geometries will be not processed
+        * 
         * @param FeatureCollection fc
         */
        public static void validFeatureCollection(FeatureCollection fc) {
@@ -128,13 +131,14 @@
           }
        
        /**
-        * Mathod to merge geometries of a FeaureCollection according
-        * to the values of an attribute name
+        * Merge features and their geometries in the FeatureCollection given 
+        * when the given attribute name contains identical values
+        * 
         * @param FeatureCollection fc
-        * @param String attrbuteName
+        * @param String attributeName
         * @throws Exception
         */
-        public static void unionByAttributeValue(FeatureCollection 
featureCollection, String attrbuteName) throws Exception {
+        public static void unionByAttributeValue(FeatureCollection 
featureCollection, String attributeName) throws Exception {
                  FeatureSchema schema = featureCollection.getFeatureSchema();
              if (featureCollection.getFeatures().size() > 1 &&
                                
featureCollection.getFeatures().get(0).getGeometry() != null) {
@@ -149,7 +153,7 @@
                    newSchema = schema;
                Map<Object, FeatureCollection> map = new HashMap<Object, 
FeatureCollection>();
                for (Feature feature  : featureCollection.getFeatures()) {
-                    Object key = feature.getAttribute(attrbuteName);
+                    Object key = feature.getAttribute(attributeName);
                     if (!map.containsKey(key)) {
                         FeatureCollection fd = new 
FeatureDataset(featureCollection.getFeatureSchema());
                         fd.add(feature);
@@ -164,7 +168,7 @@
                        FeatureCollection fca = map.get(key);
                        if (fca.size() > 0) {
                          Feature feature = union(fca);
-                         feature.setAttribute(attrbuteName, key);
+                         feature.setAttribute(attributeName, key);
                          Feature newFeature = new BasicFeature(newSchema);
                            // Copy feature attributes in newFeature
                          for (int j = 0, max = newSchema.getAttributeCount() ; 
j < max ; j++) {



_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to