[Schmitzm-commits] r1047 - in trunk/src/skrueger: . geotools
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Sep 22 14:11:15 CEST 2010
Author: mojays
Date: 2010-09-22 14:11:15 +0200 (Wed, 22 Sep 2010)
New Revision: 1047
Modified:
trunk/src/skrueger/AttributeMetaDataAttributeTypeFilter.java
trunk/src/skrueger/geotools/AttributeMetadataMap.java
trunk/src/skrueger/geotools/StyledFeatureCollection.java
Log:
BugFix: deal with "auto-put" behavior of AttributeMetadataMapImpl.get(.) in AttributeMetaDataAttributeTypeFilter, so that "the_geom" is never (automatically) inserted in the AMD
StyledFeatureCollection: check for geometry attribute by FeatureUtil.isGeometryAttribute(.)
Modified: trunk/src/skrueger/AttributeMetaDataAttributeTypeFilter.java
===================================================================
--- trunk/src/skrueger/AttributeMetaDataAttributeTypeFilter.java 2010-09-22 12:10:52 UTC (rev 1046)
+++ trunk/src/skrueger/AttributeMetaDataAttributeTypeFilter.java 2010-09-22 12:11:15 UTC (rev 1047)
@@ -77,10 +77,21 @@
// are treated as visible
if ( attrMetaDataMap == null )
return NO_GEOMETRY.accept(type);
-
+
+ // no geometry attributes at all
+ if ( !NO_GEOMETRY.accept(type) )
+ return false;
+
+ // Auto-Insert-Behavior of AttributeMetaDataMapImpl.get(.) constrains
+ // us to first check the containing of the attribute in the, so that we
+ // do not accidentally insert an attribute to the map (especially
+ // "the_geom"!!!)
+ // --> if meta data is not specified, do not except it by the filter
+ if ( !attrMetaDataMap.containsKey(type.getName()) )
+ return false;
+
+ // Check the visible property of meta data
final AttributeMetadataImpl metaData = attrMetaDataMap.get(type.getName());
- return NO_GEOMETRY.accept(type) // no geometry attributes at all
- && metaData != null // meta data must be present for column
- && metaData.isVisible(); // attribute must be visible
+ return metaData.isVisible();
}
}
Modified: trunk/src/skrueger/geotools/AttributeMetadataMap.java
===================================================================
--- trunk/src/skrueger/geotools/AttributeMetadataMap.java 2010-09-22 12:10:52 UTC (rev 1046)
+++ trunk/src/skrueger/geotools/AttributeMetadataMap.java 2010-09-22 12:11:15 UTC (rev 1047)
@@ -161,5 +161,14 @@
}
return list;
}
+
+ /**
+ * Just for debuggung. Simply returns {@code super.put(.)}.
+ * TODO: remove this method.
+ */
+ @Override
+ public AMD_IMPL put(Name key, AMD_IMPL value) {
+ return super.put(key, value);
+ };
}
Modified: trunk/src/skrueger/geotools/StyledFeatureCollection.java
===================================================================
--- trunk/src/skrueger/geotools/StyledFeatureCollection.java 2010-09-22 12:10:52 UTC (rev 1046)
+++ trunk/src/skrueger/geotools/StyledFeatureCollection.java 2010-09-22 12:11:15 UTC (rev 1047)
@@ -319,7 +319,7 @@
SimpleFeatureType ftype = fc.getSchema();
for (int i = 0; i < ftype.getAttributeCount(); i++) {
AttributeDescriptor aDesc = ftype.getAttributeDescriptors().get(i);
- if (aDesc != ftype.getGeometryDescriptor())
+ if ( !FeatureUtil.isGeometryAttribute(aDesc) )
metaDataMap.put(aDesc.getName(), new AttributeMetadataImpl( new NameImpl( aDesc.getName().getNamespaceURI(), aDesc.getName().getLocalPart()),
true, // visible
new Translation(aDesc.getLocalName()), // Column name
More information about the Schmitzm-commits
mailing list