[Schmitzm-commits] r355 - branches/1.0-gt2-2.6/src/schmitzm/geotools/feature
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Aug 31 15:11:04 CEST 2009
Author: mojays
Date: 2009-08-31 15:11:03 +0200 (Mon, 31 Aug 2009)
New Revision: 355
Modified:
branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureTableModel.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureUtil.java
Log:
gt2-2.6.x conversion bugs eliminated
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureTableModel.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureTableModel.java 2009-08-31 13:05:45 UTC (rev 354)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureTableModel.java 2009-08-31 13:11:03 UTC (rev 355)
@@ -99,9 +99,7 @@
public void setFeature(SimpleFeatureType fType) {
try {
if ( fType != null )
- setFeature(
- fType.create( FeatureUtil.getDefaultAttributeValues(fType) )
- );
+ setFeature( FeatureUtil.createSampleFeature(fType) );
else
setFeature( (SimpleFeature)null );
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureUtil.java 2009-08-31 13:05:45 UTC (rev 354)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureUtil.java 2009-08-31 13:11:03 UTC (rev 355)
@@ -60,6 +60,7 @@
import org.geotools.feature.DefaultFeatureCollections;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureIterator;
+import org.geotools.feature.FeatureTypeBuilder;
import org.geotools.feature.GeometryAttributeType;
import org.geotools.feature.SchemaException;
import org.geotools.feature.simple.SimpleFeatureBuilder;
@@ -1216,19 +1217,45 @@
}
/**
+ * Creates a default {@link SimpleFeatureType} for a given
+ * Geometry class
+ * @param geomType
+ * LineString.class, Point.class or Polygon.class from com.jts...
+ * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
+ * Krüger</a>
+ */
+ public static SimpleFeatureType createFeatureType(final Class<?> geomType) {
+ // Create the only attribute
+ final AttributeDescriptor geometryAttribut = AttributeTypeFactory.newAttributeType("the_geom", geomType);
+ // Create the FeatureType with the only attribute
+ final SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
+ builder.setName( geomType.getSimpleName() );
+ builder.add(geometryAttribut);
+ return builder.buildFeatureType();
+ }
+
+ /**
* Erzeugt einen Geometrie-Attribut-Typ.
* @param geomType Art der Geometrie
* @param defGeom Standard-Wert
* @param crs Koordinatensystem
*/
- public static GeometricAttributeType createGeometryAttributeType(Class<? extends Geometry> geomType, Geometry defGeom, CoordinateReferenceSystem crs) {
- return new GeometricAttributeType(
- "the_geom",
- geomType,
- false,
- defGeom,
- crs,
- null
+ public static GeometryAttributeType createGeometryAttributeType(Class<? extends Geometry> geomType, Geometry defGeom, CoordinateReferenceSystem crs) {
+// return new GeometricAttributeType(
+// "the_geom",
+// geomType,
+// false,
+// defGeom,
+// crs,
+// null
+// );
+ return (GeometryAttributeType)AttributeTypeFactory.newAttributeType(
+ "the_geom",
+ geomType,
+ false, // nillable
+ null, // restrictions
+ defGeom,
+ crs // metadata used for CRS
);
}
@@ -1368,6 +1395,7 @@
}
+
// /**
// * Extrahiert alle Geometrien aus einer FeatureCollection. Fuer jedes
// * Geometry-Attribut der FeatureCollection wird eine GeometrieCollection
More information about the Schmitzm-commits
mailing list