/[schmitzm]/trunk/src/skrueger/geotools/StyledLayerUtil.java
ViewVC logotype

Diff of /trunk/src/skrueger/geotools/StyledLayerUtil.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

branches/2.0-RC2/src/skrueger/geotools/StyledLayerUtil.java revision 658 by alfonx, Wed Feb 3 15:32:21 2010 UTC trunk/src/skrueger/geotools/StyledLayerUtil.java revision 685 by alfonx, Wed Feb 10 15:04:02 2010 UTC
# Line 307  public class StyledLayerUtil { Line 307  public class StyledLayerUtil {
307           *           *
308           * @param element           * @param element
309           *            {@link Element} to parse           *            {@link Element} to parse
310           *                       *
311           *            TODO Since GP 1.3 the {@link AttributeMetadata} class has more           *            TODO Since GP 1.3 the {@link AttributeMetadata} class has more
312           *            attributes which are not used by Xulu/ISDSS. GP           *            attributes which are not used by Xulu/ISDSS. GP
313           *            exports/imports the AMD via AMLExporter and AMLImporter           *            exports/imports the AMD via AMLExporter and AMLImporter
314           *            classes. (SK, 3.2.2010)    *                       *            classes. (SK, 3.2.2010) *
315           */           */
316          public static AttributeMetadataMap parseAttributeMetaDataMap(          public static AttributeMetadataMap parseAttributeMetaDataMap(
317                          final Element element) {                          final Element element) {
# Line 1229  public class StyledLayerUtil { Line 1229  public class StyledLayerUtil {
1229           * After loading an atlas, the AttribteMetaData contains whatever is written           * After loading an atlas, the AttribteMetaData contains whatever is written
1230           * in the XML. But the DBF may have changed!           * in the XML. But the DBF may have changed!
1231           */           */
1232          public static void checkAttribMetaData(AttributeMetadataMap attributeMetaDataMap,          public static void checkAttribMetaData(
1233                          SimpleFeatureType schema) {                          AttributeMetadataMap attributeMetaDataMap, SimpleFeatureType schema) {
1234    
1235                  ArrayList<Name> willRemove = new ArrayList<Name>();                  ArrayList<Name> willRemove = new ArrayList<Name>();
1236    
# Line 1256  public class StyledLayerUtil { Line 1256  public class StyledLayerUtil {
1256    
1257                  // Remove the ones that were not findable in the schema                  // Remove the ones that were not findable in the schema
1258                  for (Name removeName : willRemove) {                  for (Name removeName : willRemove) {
1259                          if (attributeMetaDataMap.remove(removeName) == null){                          if (attributeMetaDataMap.remove(removeName) == null) {
1260                                  LOGGER.warn("removing the AMData didn't work");                                  LOGGER.warn("removing the AMData didn't work");
1261                          }                          }
1262                  }                  }
# Line 1267  public class StyledLayerUtil { Line 1267  public class StyledLayerUtil {
1267                                  continue;                                  continue;
1268                          if (!attributeMetaDataMap.containsKey(ad.getName())) {                          if (!attributeMetaDataMap.containsKey(ad.getName())) {
1269                                  attributeMetaDataMap.put(ad.getName(), new AttributeMetadata(                                  attributeMetaDataMap.put(ad.getName(), new AttributeMetadata(
1270                                                  ad, schema.getAttributeDescriptors().indexOf(ad), attributeMetaDataMap                                                  ad, schema.getAttributeDescriptors().indexOf(ad),
1271                                                                  .getLanguages()));                                                  attributeMetaDataMap.getLanguages()));
1272                          }                          }
1273                  }                  }
   
1274          }          }
1275    
1276            /**
1277             * Checks every attribute name in the {@link AttributeMetadataMap} for its
1278             * binding type. It the type is textual, add the mrpty string as a NODATA
1279             * value.
1280             *
1281             * @param attributeMetaDataMap
1282             * @param schema
1283             */
1284            public static void addEmptyStringToAllTextualAttributes(
1285                            AttributeMetadataMap attributeMetaDataMap, SimpleFeatureType schema) {
1286    
1287                    for (Name name : attributeMetaDataMap.keySet()) {
1288                            if (String.class.isAssignableFrom(schema.getDescriptor(name)
1289                                            .getType().getBinding())) {
1290                                    attributeMetaDataMap.get(name).getNodataValues().add("");
1291                            }
1292                    }
1293            }
1294  }  }

Legend:
Removed from v.658  
changed lines
  Added in v.685

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26