[Schmitzm-commits] r1481 - trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Feb 2 22:38:26 CET 2011
Author: alfonx
Date: 2011-02-02 22:38:25 +0100 (Wed, 02 Feb 2011)
New Revision: 1481
Modified:
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureUtil.java
Log:
Fixed a bug the was found with a GP JUnit-test... When cloning a AttribtueFeatureType, settings the CRS is not enough to indicate that it is a a geometry Attribute Type.. since the crs may be null...
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 2011-02-02 21:06:48 UTC (rev 1480)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureUtil.java 2011-02-02 21:38:25 UTC (rev 1481)
@@ -757,22 +757,14 @@
// Create a default value for the attribute
Object defaultValue = nillable ? null : getDefaultAttributeValue(aType);
- CoordinateReferenceSystem crs = null;
- if (aType instanceof GeometryDescriptor)
- crs = ((GeometryDescriptor) aType).getCoordinateReferenceSystem();
-
// combine the restrictions of the attribute type for the
// AttributeTypeFactory
Filter restrictions = FilterUtil.FILTER_FAC.and(aType.getType()
.getRestrictions());
- if (crs == null) {
- // Create the clone
- return AttributeTypeFactory.newAttributeDescriptor(
- aType.getLocalName(), aType.getType().getBinding(),
- nillable, restrictions, defaultValue);
-
- } else {
+ if ((aType instanceof GeometryDescriptor)) {
+ CoordinateReferenceSystem crs = ((GeometryDescriptor) aType)
+ .getCoordinateReferenceSystem();
// Create the clone as a GeometryAttributeDescriptor
final Class<? extends Geometry> binding = (Class<? extends Geometry>) aType
.getType().getBinding();
@@ -780,6 +772,12 @@
return AttributeTypeFactory.newGeometryAttributeDescriptor(
aType.getLocalName(), binding, nillable, restrictions,
(Geometry) defaultValue, crs);
+
+ } else {
+ // Create the clone
+ return AttributeTypeFactory.newAttributeDescriptor(
+ aType.getLocalName(), aType.getType().getBinding(),
+ nillable, restrictions, defaultValue);
}
}
@@ -2696,7 +2694,12 @@
SimpleFeatureType sType = sourceFs.getSchema();
SimpleFeatureTypeBuilder typebuilder = new SimpleFeatureTypeBuilder();
typebuilder.setName(sType.getTypeName());
+ typebuilder.setCRS(sType.getCoordinateReferenceSystem());
+ if (sType.getGeometryDescriptor() != null)
+ typebuilder.setDefaultGeometry(sType.getGeometryDescriptor()
+ .getLocalName());
+
// ***** Create the new attribute type for the destination FeatureSource
// *****
// Loop the attributes, which should be transfered to the
More information about the Schmitzm-commits
mailing list