46 |
import org.opengis.filter.Filter; |
import org.opengis.filter.Filter; |
47 |
|
|
48 |
import schmitzm.geotools.feature.FeatureUtil; |
import schmitzm.geotools.feature.FeatureUtil; |
49 |
import skrueger.AttributeMetadata; |
import skrueger.AttributeMetadataImpl; |
50 |
import skrueger.i8n.Translation; |
import skrueger.i8n.Translation; |
51 |
|
|
52 |
/** |
/** |
65 |
implements StyledFeatureCollectionInterface { |
implements StyledFeatureCollectionInterface { |
66 |
|
|
67 |
/** Holds the meta data for displaying a legend. */ |
/** Holds the meta data for displaying a legend. */ |
68 |
protected AttributeMetadataMap attrMetaData = null; |
protected AttributeMetadataMap<AttributeMetadataImpl> attrMetaData = null; |
69 |
|
|
70 |
/** |
/** |
71 |
* We be filled with a "virtual" {@link FeatureSource} on demand. |
* We be filled with a "virtual" {@link FeatureSource} on demand. |
314 |
*/ |
*/ |
315 |
public static AttributeMetadataMap createDefaultAttributeMetaDataMap( |
public static AttributeMetadataMap createDefaultAttributeMetaDataMap( |
316 |
FeatureCollection<SimpleFeatureType, SimpleFeature> fc) { |
FeatureCollection<SimpleFeatureType, SimpleFeature> fc) { |
317 |
AttributeMetadataMap metaDataMap = new AttributeMetadataMap(); |
AttributeMetadataMap metaDataMap = new AttributeMetadataImplMap(); |
318 |
SimpleFeatureType ftype = fc.getSchema(); |
SimpleFeatureType ftype = fc.getSchema(); |
319 |
for (int i = 0; i < ftype.getAttributeCount(); i++) { |
for (int i = 0; i < ftype.getAttributeCount(); i++) { |
320 |
AttributeDescriptor aDesc = ftype.getAttributeDescriptors().get(i); |
AttributeDescriptor aDesc = ftype.getAttributeDescriptors().get(i); |
321 |
if (aDesc != ftype.getGeometryDescriptor()) |
if (aDesc != ftype.getGeometryDescriptor()) |
322 |
metaDataMap.put(aDesc.getName(), new AttributeMetadata(aDesc.getName(), |
metaDataMap.put(aDesc.getName(), new AttributeMetadataImpl(aDesc.getName(), |
323 |
true, // visible |
true, // visible |
324 |
new Translation(aDesc.getLocalName()), // Column name |
new Translation(aDesc.getLocalName()), // Column name |
325 |
new Translation(aDesc.getLocalName()), // description |
new Translation(aDesc.getLocalName()), // description |