41 |
import org.apache.log4j.Logger; |
import org.apache.log4j.Logger; |
42 |
import org.geotools.data.FeatureSource; |
import org.geotools.data.FeatureSource; |
43 |
import org.geotools.feature.FeatureCollection; |
import org.geotools.feature.FeatureCollection; |
44 |
import org.geotools.feature.NameImpl; |
import org.geotools.geometry.jts.ReferencedEnvelope; |
45 |
import org.geotools.styling.Style; |
import org.geotools.styling.Style; |
46 |
import org.opengis.feature.simple.SimpleFeature; |
import org.opengis.feature.simple.SimpleFeature; |
47 |
import org.opengis.feature.simple.SimpleFeatureType; |
import org.opengis.feature.simple.SimpleFeatureType; |
|
import org.opengis.feature.type.AttributeDescriptor; |
|
48 |
import org.opengis.filter.Filter; |
import org.opengis.filter.Filter; |
49 |
import org.opengis.referencing.crs.CoordinateReferenceSystem; |
import org.opengis.referencing.crs.CoordinateReferenceSystem; |
50 |
|
|
86 |
private File sldFile; |
private File sldFile; |
87 |
|
|
88 |
/** A map of simple attribute names to their meta-data **/ |
/** A map of simple attribute names to their meta-data **/ |
89 |
private AttributeMetadataMap<AttributeMetadataImpl> map; |
private AttributeMetadataMap<AttributeMetadataImpl> attMap; |
90 |
|
|
91 |
private Filter filter = Filter.INCLUDE; |
private Filter filter = Filter.INCLUDE; |
92 |
|
|
269 |
/** |
/** |
270 |
* |
* |
271 |
*/ |
*/ |
272 |
|
@Override |
273 |
public AttributeMetadataMap<AttributeMetadataImpl> getAttributeMetaDataMap() { |
public AttributeMetadataMap<AttributeMetadataImpl> getAttributeMetaDataMap() { |
274 |
if (map == null) { |
if (attMap == null) { |
275 |
|
attMap = StyledLayerUtil |
276 |
map = new AttributeMetadataImplMap(); |
.createDefaultAttributeMetadataMap(getSchema()); |
|
|
|
|
// // Leaving out the first one, it will be the_geom |
|
|
// for (int i = 1; i < fs.getSchema().getAttributeCount(); i++) { |
|
|
// AttributeDescriptor attDesc = fs.getSchema().getDescriptor(i); |
|
|
// |
|
|
// AttributeMetadataImpl attMetaData = new AttributeMetadataImpl( |
|
|
// new NameImpl(attDesc |
|
|
// .getName().getNamespaceURI(), attDesc |
|
|
// .getName().getLocalPart()), map.getLanguages()); |
|
|
// map.put(attDesc.getName(), attMetaData); |
|
|
// } |
|
|
|
|
|
// Leaving out the first one, it will be the_geom |
|
|
for (int i = 1; i < fs.getSchema().getAttributeCount(); i++) { |
|
|
AttributeDescriptor attDesc = fs.getSchema().getDescriptor(i); |
|
|
|
|
|
// TODO AttributeMetadataAS would be nicer, which would not work |
|
|
// with Translations ;-) |
|
|
AttributeMetadataImpl attMetaData = new AttributeMetadataImpl( |
|
|
new NameImpl(attDesc.getName().getNamespaceURI(), |
|
|
attDesc.getName().getLocalPart()), |
|
|
map.getLanguages()); |
|
|
if (String.class.isAssignableFrom(attDesc.getType() |
|
|
.getBinding())) { |
|
|
// For Strings we add the "" as NODATA values |
|
|
attMetaData.addNodataValue(""); |
|
|
} |
|
|
map.put(attDesc.getName(), attMetaData); |
|
|
} |
|
277 |
} |
} |
278 |
return map; |
return attMap; |
279 |
} |
} |
280 |
|
|
281 |
/** |
/** |
393 |
crs = crs2; |
crs = crs2; |
394 |
} |
} |
395 |
|
|
396 |
|
@Override |
397 |
|
public ReferencedEnvelope getReferencedEnvelope() { |
398 |
|
return new ReferencedEnvelope(getEnvelope(), getCrs()); |
399 |
|
} |
400 |
|
|
401 |
} |
} |