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) { |
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) { |
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 |
* |
* |
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 |
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 |
|
|
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 |
} |
} |
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 |
} |
} |