[Schmitzm-commits] r1999 - trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Thu May 17 16:02:50 CEST 2012


Author: mojays
Date: 2012-05-17 16:02:50 +0200 (Thu, 17 May 2012)
New Revision: 1999

Modified:
   trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureUtil.java
Log:
FeatureUtil: new method to determine default geometry from Feature


Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureUtil.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureUtil.java	2012-05-14 15:16:24 UTC (rev 1998)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureUtil.java	2012-05-17 14:02:50 UTC (rev 1999)
@@ -94,6 +94,7 @@
 import org.geotools.styling.Symbolizer;
 import org.geotools.util.SimpleInternationalString;
 import org.opengis.coverage.grid.GridCoverageReader;
+import org.opengis.feature.Feature;
 import org.opengis.feature.IllegalAttributeException;
 import org.opengis.feature.simple.SimpleFeature;
 import org.opengis.feature.simple.SimpleFeatureType;
@@ -3075,5 +3076,20 @@
 
 		return strings;
 	}
+	
+	/**
+	 * Returns the value of the default geometry attribute.
+	 * @param f a feature
+	 * @return {@code null} if feature is {@code null} or feature 
+	 *         has no default geometry property.
+	 * 
+	 */
+	public static Geometry getDefaultGeometry(Feature f) {
+	  if ( f == null )
+	    return null;
+	  if ( f.getDefaultGeometryProperty() == null )
+	    return null;
+	  return (Geometry)f.getDefaultGeometryProperty().getValue();
+	}
 
 }



More information about the Schmitzm-commits mailing list