[Schmitzm-commits] r1033 - trunk/src/skrueger/geotools

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Sep 21 16:40:11 CEST 2010


Author: mojays
Date: 2010-09-21 16:40:11 +0200 (Tue, 21 Sep 2010)
New Revision: 1033

Modified:
   trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java
Log:
Workaround, because schema.getDescriptor(Name) does not work everytime, although Name-compare should be equal. 

Modified: trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java
===================================================================
--- trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java	2010-09-21 14:39:42 UTC (rev 1032)
+++ trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java	2010-09-21 14:40:11 UTC (rev 1033)
@@ -41,6 +41,7 @@
 import org.opengis.feature.simple.SimpleFeature;
 import org.opengis.feature.simple.SimpleFeatureType;
 import org.opengis.feature.type.AttributeDescriptor;
+import org.opengis.feature.type.Name;
 import org.opengis.filter.Filter;
 
 import schmitzm.geotools.feature.FeatureUtil;
@@ -209,7 +210,12 @@
 			// Pruefen, welche Attribute angezeigt werden
 			attrTypes.clear();
 			for (AttributeMetadataInterface amd : amdMapVisibleOnly) {
-				AttributeDescriptor type = schema.getDescriptor(amd.getName());
+                Name name = amd.getName();
+                AttributeDescriptor type = schema.getDescriptor(name);
+                // if type can not be determined by complete name,
+                // try only the local name
+                if ( type == null )
+                  type = schema.getDescriptor(name.getLocalPart());
 				if (attrFilter == null || attrFilter.accept(type))
 					attrTypes.add(type);
 			}
@@ -220,8 +226,12 @@
 			colClass = new Class[attrTypes.size()];
 			attrIdxForCol = new int[attrTypes.size()];
 			for (int i = 0; i < colNames.length; i++) {
-				AttributeDescriptor descriptor = schema
-						.getDescriptor(amdMapVisibleOnly.get(i).getName());
+                Name name = amdMapVisibleOnly.get(i).getName();
+                AttributeDescriptor descriptor = schema.getDescriptor(name);
+                // if type can not be determined by complete name,
+                // try only the local name
+                if ( descriptor == null )
+                  descriptor = schema.getDescriptor(name.getLocalPart());
 
 				// Not so nice in 26: find the index of an attribute...
 				int idx = schema.getAttributeDescriptors().indexOf(descriptor);



More information about the Schmitzm-commits mailing list