99 |
import skrueger.RasterLegendData; |
import skrueger.RasterLegendData; |
100 |
import skrueger.i8n.Translation; |
import skrueger.i8n.Translation; |
101 |
|
|
102 |
|
import com.vividsolutions.jts.geom.Geometry; |
103 |
|
|
104 |
/** |
/** |
105 |
* This class provides static helper methods for dealing with |
* This class provides static helper methods for dealing with |
106 |
* {@link StyledLayerInterface} stuff. |
* {@link StyledLayerInterface} stuff. |
1365 |
} |
} |
1366 |
return nicelyFormatted; |
return nicelyFormatted; |
1367 |
} |
} |
1368 |
|
|
1369 |
|
/** |
1370 |
|
* Creates a new {@link AttributeMetadataMap} with instances of |
1371 |
|
* {@link AttributeMetadataInterface} for every non-geometry attribute. |
1372 |
|
* Default NODATA values (like "" for String) are set. |
1373 |
|
*/ |
1374 |
|
public static AttributeMetadataMap<AttributeMetadataImpl> createDefaultAttributeMetadataMap( |
1375 |
|
SimpleFeatureType schema) { |
1376 |
|
AttributeMetadataImplMap attMap = new AttributeMetadataImplMap(); |
1377 |
|
|
1378 |
|
for (int i = 0; i < schema.getAttributeCount(); i++) { |
1379 |
|
AttributeDescriptor attDesc = schema.getDescriptor(i); |
1380 |
|
|
1381 |
|
if (Geometry.class.isAssignableFrom(attDesc.getType().getBinding())) { |
1382 |
|
// Ignore the Geometry column |
1383 |
|
continue; |
1384 |
|
} |
1385 |
|
|
1386 |
|
// TODO AttributeMetadataAS would be nicer, which would not work |
1387 |
|
// with Translations ;-) |
1388 |
|
AttributeMetadataImpl attMetaData = new AttributeMetadataImpl( |
1389 |
|
new NameImpl(attDesc.getName().getNamespaceURI(), attDesc |
1390 |
|
.getName().getLocalPart()), attMap.getLanguages()); |
1391 |
|
|
1392 |
|
if (String.class.isAssignableFrom(attDesc.getType().getBinding())) { |
1393 |
|
// For Strings we add the "" as NODATA values |
1394 |
|
attMetaData.addNodataValue(""); |
1395 |
|
} |
1396 |
|
|
1397 |
|
attMap.put(attDesc.getName(), attMetaData); |
1398 |
|
} |
1399 |
|
return attMap; |
1400 |
|
} |
1401 |
} |
} |