92 |
import schmitzm.lang.LangUtil; |
import schmitzm.lang.LangUtil; |
93 |
import schmitzm.swing.JPanel; |
import schmitzm.swing.JPanel; |
94 |
import schmitzm.swing.SwingUtil; |
import schmitzm.swing.SwingUtil; |
95 |
import skrueger.AttributeMetadata; |
import skrueger.AttributeMetadataInterface; |
96 |
import skrueger.AttributeMetadataImpl; |
import skrueger.AttributeMetadataImpl; |
97 |
import skrueger.RasterLegendData; |
import skrueger.RasterLegendData; |
98 |
import skrueger.i8n.Translation; |
import skrueger.i8n.Translation; |
254 |
* TODO replace with |
* TODO replace with |
255 |
* {@link AttributeMetadataMap#sortedValuesVisibleOnly()} |
* {@link AttributeMetadataMap#sortedValuesVisibleOnly()} |
256 |
*/ |
*/ |
257 |
public static AttributeMetadataMap<? extends AttributeMetadata > getVisibleAttributeMetaData( |
public static AttributeMetadataMap<? extends AttributeMetadataInterface > getVisibleAttributeMetaData( |
258 |
final AttributeMetadataMap<? extends AttributeMetadata> amdMap, |
final AttributeMetadataMap<? extends AttributeMetadataInterface> amdMap, |
259 |
final boolean visible) { |
final boolean visible) { |
260 |
|
|
261 |
final AttributeMetadataMap<AttributeMetadata> filteredMap = (AttributeMetadataMap<AttributeMetadata>) amdMap.clone(); |
final AttributeMetadataMap<AttributeMetadataInterface> filteredMap = (AttributeMetadataMap<AttributeMetadataInterface>) amdMap.clone(); |
262 |
if (filteredMap.size() > 0 ) { |
if (filteredMap.size() > 0 ) { |
263 |
filteredMap.clear(); // Just in case the close copies the contents |
filteredMap.clear(); // Just in case the close copies the contents |
264 |
} |
} |
265 |
|
|
266 |
for (final AttributeMetadata amd : amdMap.values()) |
for (final AttributeMetadataInterface amd : amdMap.values()) |
267 |
if (amd.isVisible() == visible) |
if (amd.isVisible() == visible) |
268 |
filteredMap.put(amd.getName(), amd); |
filteredMap.put(amd.getName(), amd); |
269 |
|
|
289 |
.getAttributeValue("namespace")); |
.getAttributeValue("namespace")); |
290 |
final String localname = String.valueOf(element |
final String localname = String.valueOf(element |
291 |
.getAttributeValue("localname")); |
.getAttributeValue("localname")); |
292 |
final Name aName = new NameImpl(namespace, localname); |
final NameImpl aName = new NameImpl(namespace, localname); |
293 |
final Boolean visible = Boolean.valueOf(element |
final Boolean visible = Boolean.valueOf(element |
294 |
.getAttributeValue("visible")); |
.getAttributeValue("visible")); |
295 |
final String unit = element.getAttributeValue("unit"); |
final String unit = element.getAttributeValue("unit"); |
358 |
* classes. (SK, 3.2.2010) |
* classes. (SK, 3.2.2010) |
359 |
*/ |
*/ |
360 |
public static Element createAttributeMetaDataElement( |
public static Element createAttributeMetaDataElement( |
361 |
final AttributeMetadata amd) { |
final AttributeMetadataInterface amd) { |
362 |
final Element element = new Element(ELEM_NAME_ATTRIBUTE, AMLURI); |
final Element element = new Element(ELEM_NAME_ATTRIBUTE, AMLURI); |
363 |
element.setAttribute("namespace", String.valueOf(amd.getName() |
element.setAttribute("namespace", String.valueOf(amd.getName() |
364 |
.getNamespaceURI())); |
.getNamespaceURI())); |
380 |
* map of attribute meta data |
* map of attribute meta data |
381 |
*/ |
*/ |
382 |
public static Element createAttributeMetaDataMapElement( |
public static Element createAttributeMetaDataMapElement( |
383 |
final AttributeMetadataMap<? extends AttributeMetadata> amdMap) { |
final AttributeMetadataMap<? extends AttributeMetadataInterface> amdMap) { |
384 |
final Element element = new Element(ELEM_NAME_AMD, AMLURI); |
final Element element = new Element(ELEM_NAME_AMD, AMLURI); |
385 |
for (final AttributeMetadata amd : amdMap.values()) |
for (final AttributeMetadataInterface amd : amdMap.values()) |
386 |
element.addContent(createAttributeMetaDataElement(amd)); |
element.addContent(createAttributeMetaDataElement(amd)); |
387 |
return element; |
return element; |
388 |
} |
} |
1260 |
// 1. Check.. all attributes in the atm should be in the schema as well. |
// 1. Check.. all attributes in the atm should be in the schema as well. |
1261 |
// maybe correct some upperCase/loweCase stuff |
// maybe correct some upperCase/loweCase stuff |
1262 |
|
|
1263 |
for (AttributeMetadata atm : attributeMetaDataMap.values()) { |
for (AttributeMetadataInterface atm : attributeMetaDataMap.values()) { |
1264 |
|
|
1265 |
AttributeDescriptor foundDescr = schema |
AttributeDescriptor foundDescr = schema |
1266 |
.getDescriptor(atm.getName()); |
.getDescriptor(atm.getName()); |
1267 |
if (foundDescr == null) { |
if (foundDescr == null) { |
1268 |
Name bestMatch = FeatureUtil.findBestMatchingAttribute(schema, |
NameImpl bestMatch = FeatureUtil.findBestMatchingAttribute(schema, |
1269 |
atm.getLocalName()); |
atm.getLocalName()); |
1270 |
if (bestMatch == null) |
if (bestMatch == null) |
1271 |
willRemove.add(atm.getName()); |
willRemove.add(atm.getName()); |
1289 |
if (ad instanceof GeometryDescriptor) |
if (ad instanceof GeometryDescriptor) |
1290 |
continue; |
continue; |
1291 |
if (!attributeMetaDataMap.containsKey(ad.getName())) { |
if (!attributeMetaDataMap.containsKey(ad.getName())) { |
1292 |
attributeMetaDataMap.put(ad.getName(), |
attributeMetaDataMap.put( new NameImpl(ad.getName().getNamespaceURI(), ad.getName().getLocalPart()), |
1293 |
new AttributeMetadataImpl(ad, schema |
new AttributeMetadataImpl(ad, schema |
1294 |
.getAttributeDescriptors().indexOf(ad), |
.getAttributeDescriptors().indexOf(ad), |
1295 |
attributeMetaDataMap.getLanguages())); |
attributeMetaDataMap.getLanguages())); |
1306 |
* @param schema |
* @param schema |
1307 |
*/ |
*/ |
1308 |
public static void addEmptyStringToAllTextualAttributes( |
public static void addEmptyStringToAllTextualAttributes( |
1309 |
AttributeMetadataMap<? extends AttributeMetadata> attributeMetaDataMap, |
AttributeMetadataMap<? extends AttributeMetadataInterface> attributeMetaDataMap, |
1310 |
SimpleFeatureType schema) { |
SimpleFeatureType schema) { |
1311 |
|
|
1312 |
for (Name name : attributeMetaDataMap.keySet()) { |
for (Name name : attributeMetaDataMap.keySet()) { |
1319 |
|
|
1320 |
/** |
/** |
1321 |
* @return a nicely formatted String containing all NODATA values of any |
* @return a nicely formatted String containing all NODATA values of any |
1322 |
* {@link AttributeMetadata} object. Strings are quoted so that any |
* {@link AttributeMetadataInterface} object. Strings are quoted so that any |
1323 |
* empty {@link String} can be seen. |
* empty {@link String} can be seen. |
1324 |
*/ |
*/ |
1325 |
public static String formatNoDataValues(Set<Object> nodataValuesList) { |
public static String formatNoDataValues(Set<Object> nodataValuesList) { |