/[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-RC1/src/skrueger/geotools/StyledLayerUtil.java revision 607 by alfonx, Wed Dec 9 15:13:42 2009 UTC trunk/src/skrueger/geotools/StyledLayerUtil.java revision 694 by alfonx, Fri Feb 12 11:28:41 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
312             *            attributes which are not used by Xulu/ISDSS. GP
313             *            exports/imports the AMD via AMLExporter and AMLImporter
314             *            classes. (SK, 3.2.2010) *
315           */           */
316          public static AttributeMetadataMap parseAttributeMetaDataMap(          public static AttributeMetadataMap parseAttributeMetaDataMap(
317                          final Element element) {                          final Element element) {
# Line 339  public class StyledLayerUtil { Line 344  public class StyledLayerUtil {
344           *           *
345           * @param amd           * @param amd
346           *            meta data for one attribute           *            meta data for one attribute
347             *
348             *            TODO Since GP 1.3 the {@link AttributeMetadata} class has more
349             *            attributes which are not used by Xulu/ISDSS. GP
350             *            exports/imports the AMD via AMLExporter and AMLImporter
351             *            classes. (SK, 3.2.2010)
352           */           */
353          public static Element createAttributeMetaDataElement(          public static Element createAttributeMetaDataElement(
354                          final AttributeMetadata amd) {                          final AttributeMetadata amd) {
# Line 904  public class StyledLayerUtil { Line 914  public class StyledLayerUtil {
914          }          }
915    
916          /**          /**
917             * *If appended to the name of a rule, this rule shall not be shown in the
918             * legend
919             */
920            public final static String HIDE_IN_LAYER_LEGEND_HINT = "HIDE_IN_LEGEND";
921    
922            /**
923           * Creates a {@link JPanel} that shows a legend for a list of           * Creates a {@link JPanel} that shows a legend for a list of
924           * {@link FeatureTypeStyle}s and a targeted featureType           * {@link FeatureTypeStyle}s and a targeted featureType
925           *           *
# Line 934  public class StyledLayerUtil { Line 950  public class StyledLayerUtil {
950                          final List<Rule> rules = ftStyle.rules();                          final List<Rule> rules = ftStyle.rules();
951                          for (final Rule rule : rules) {                          for (final Rule rule : rules) {
952    
953                                    // Check if this RULE shall actually appear in the legend
954                                    if (rule.getName().endsWith(HIDE_IN_LAYER_LEGEND_HINT))
955                                            continue;
956    
957                                  /**                                  /**
958                                   * Let's not create a hbox for Rules that only contain                                   * Let's not create a hbox for Rules that only contain
959                                   * TextSymbolizers                                   * TextSymbolizers
# Line 1219  public class StyledLayerUtil { Line 1239  public class StyledLayerUtil {
1239           * After loading an atlas, the AttribteMetaData contains whatever is written           * After loading an atlas, the AttribteMetaData contains whatever is written
1240           * in the XML. But the DBF may have changed!           * in the XML. But the DBF may have changed!
1241           */           */
1242          public static void checkAttribMetaData(AttributeMetadataMap attributeMetaDataMap,          public static void checkAttribMetaData(
1243                          SimpleFeatureType schema) {                          AttributeMetadataMap attributeMetaDataMap, SimpleFeatureType schema) {
1244    
1245                  ArrayList<Name> willRemove = new ArrayList<Name>();                  ArrayList<Name> willRemove = new ArrayList<Name>();
1246    
# Line 1246  public class StyledLayerUtil { Line 1266  public class StyledLayerUtil {
1266    
1267                  // Remove the ones that were not findable in the schema                  // Remove the ones that were not findable in the schema
1268                  for (Name removeName : willRemove) {                  for (Name removeName : willRemove) {
1269                          if (attributeMetaDataMap.remove(removeName) == null){                          if (attributeMetaDataMap.remove(removeName) == null) {
1270                                  LOGGER.warn("removing the AMData didn't work");                                  LOGGER.warn("removing the AMData didn't work");
1271                          }                          }
1272                  }                  }
# Line 1257  public class StyledLayerUtil { Line 1277  public class StyledLayerUtil {
1277                                  continue;                                  continue;
1278                          if (!attributeMetaDataMap.containsKey(ad.getName())) {                          if (!attributeMetaDataMap.containsKey(ad.getName())) {
1279                                  attributeMetaDataMap.put(ad.getName(), new AttributeMetadata(                                  attributeMetaDataMap.put(ad.getName(), new AttributeMetadata(
1280                                                  ad, schema.getAttributeDescriptors().indexOf(ad), attributeMetaDataMap                                                  ad, schema.getAttributeDescriptors().indexOf(ad),
1281                                                                  .getLanguages()));                                                  attributeMetaDataMap.getLanguages()));
1282                          }                          }
1283                  }                  }
   
1284          }          }
1285    
1286            /**
1287             * Checks every attribute name in the {@link AttributeMetadataMap} for its
1288             * binding type. It the type is textual, add the mrpty string as a NODATA
1289             * value.
1290             *
1291             * @param attributeMetaDataMap
1292             * @param schema
1293             */
1294            public static void addEmptyStringToAllTextualAttributes(
1295                            AttributeMetadataMap attributeMetaDataMap, SimpleFeatureType schema) {
1296    
1297                    for (Name name : attributeMetaDataMap.keySet()) {
1298                            if (String.class.isAssignableFrom(schema.getDescriptor(name)
1299                                            .getType().getBinding())) {
1300                                    attributeMetaDataMap.get(name).getNodataValues().add("");
1301                            }
1302                    }
1303            }
1304  }  }

Legend:
Removed from v.607  
changed lines
  Added in v.694

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26