31 |
|
|
32 |
import java.io.IOException; |
import java.io.IOException; |
33 |
import java.net.URL; |
import java.net.URL; |
|
import java.util.HashMap; |
|
|
import java.util.Map; |
|
34 |
|
|
35 |
import javax.swing.ImageIcon; |
import javax.swing.ImageIcon; |
36 |
|
|
61 |
StyledFeatureCollectionInterface { |
StyledFeatureCollectionInterface { |
62 |
|
|
63 |
/** Holds the meta data for displaying a legend. */ |
/** Holds the meta data for displaying a legend. */ |
64 |
protected Map<Integer, AttributeMetaData> attrMetaData = null; |
protected AttributeMetadataMap attrMetaData = null; |
65 |
|
|
66 |
/** |
/** |
67 |
* We be filled with a "virtual" {@link FeatureSource} on demand. |
* We be filled with a "virtual" {@link FeatureSource} on demand. |
93 |
*/ |
*/ |
94 |
public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id, |
public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id, |
95 |
Translation title, Translation desc, Translation keywords, |
Translation title, Translation desc, Translation keywords, |
96 |
Style style, Map<Integer, AttributeMetaData> attrMetaData, |
Style style, AttributeMetadataMap attrMetaData, |
97 |
ImageIcon icon) { |
ImageIcon icon) { |
98 |
super(fc, fc.getBounds(), fc.getSchema().getGeometryDescriptor() |
super(fc, fc.getBounds(), fc.getSchema().getGeometryDescriptor() |
99 |
.getCoordinateReferenceSystem(), id, title, desc, keywords, style, icon); |
.getCoordinateReferenceSystem(), id, title, desc, keywords, style, icon); |
123 |
*/ |
*/ |
124 |
public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id, |
public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id, |
125 |
Translation title, Translation desc, Translation keywords, |
Translation title, Translation desc, Translation keywords, |
126 |
StyledLayerStyle<Map<Integer, AttributeMetaData>> style, |
StyledLayerStyle<AttributeMetadataMap> style, |
127 |
ImageIcon icon) { |
ImageIcon icon) { |
128 |
super(fc, fc.getBounds(), fc.getSchema().getGeometryDescriptor() |
super(fc, fc.getBounds(), fc.getSchema().getGeometryDescriptor() |
129 |
.getCoordinateReferenceSystem(), id, title, desc, keywords, |
.getCoordinateReferenceSystem(), id, title, desc, keywords, |
178 |
*/ |
*/ |
179 |
public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id, |
public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id, |
180 |
String title, String desc, String keywords, Style style, |
String title, String desc, String keywords, Style style, |
181 |
Map<Integer, AttributeMetaData> attrMetaData, ImageIcon icon) { |
AttributeMetadataMap attrMetaData, ImageIcon icon) { |
182 |
this(fc, id, (Translation) null, null, null, style, attrMetaData, icon); |
this(fc, id, (Translation) null, null, null, style, attrMetaData, icon); |
183 |
setTitle(title); |
setTitle(title); |
184 |
setDesc(desc); |
setDesc(desc); |
208 |
*/ |
*/ |
209 |
public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id, |
public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id, |
210 |
String title, String desc, String keywords, |
String title, String desc, String keywords, |
211 |
StyledLayerStyle<Map<Integer, AttributeMetaData>> style, |
StyledLayerStyle<AttributeMetadataMap> style, |
212 |
ImageIcon icon) { |
ImageIcon icon) { |
213 |
this(fc, id, title, desc, keywords, style != null ? style |
this(fc, id, title, desc, keywords, style != null ? style |
214 |
.getGeoObjectStyle() : null, style != null ? style |
.getGeoObjectStyle() : null, style != null ? style |
255 |
* @see #createDefaultAttributeMetaDataMap(FeatureCollection) |
* @see #createDefaultAttributeMetaDataMap(FeatureCollection) |
256 |
*/ |
*/ |
257 |
public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id, |
public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id, |
258 |
String title, StyledLayerStyle<Map<Integer, AttributeMetaData>> style) { |
String title, StyledLayerStyle<AttributeMetadataMap> style) { |
259 |
this(fc, id, title, null, null, style != null ? style |
this(fc, id, title, null, null, style != null ? style |
260 |
.getGeoObjectStyle() : null, style != null ? style |
.getGeoObjectStyle() : null, style != null ? style |
261 |
.getMetaData() : null, null); |
.getMetaData() : null, null); |
273 |
/** |
/** |
274 |
* Returns the meta data needed for displaying a legend. |
* Returns the meta data needed for displaying a legend. |
275 |
*/ |
*/ |
276 |
public Map<Integer, AttributeMetaData> getAttributeMetaDataMap() { |
public AttributeMetadataMap getAttributeMetaDataMap() { |
277 |
return attrMetaData; |
return attrMetaData; |
278 |
} |
} |
279 |
|
|
286 |
* map of attribute meta data |
* map of attribute meta data |
287 |
*/ |
*/ |
288 |
public void setAttributeMetaData( |
public void setAttributeMetaData( |
289 |
Map<Integer, AttributeMetaData> attrMetaData) { |
AttributeMetadataMap attrMetaData) { |
290 |
this.attrMetaData = (attrMetaData != null) ? attrMetaData |
this.attrMetaData = (attrMetaData != null) ? attrMetaData |
291 |
: createDefaultAttributeMetaDataMap(geoObject); |
: createDefaultAttributeMetaDataMap(geoObject); |
292 |
} |
} |
298 |
* @param fc |
* @param fc |
299 |
* a {@link FeatureCollection} |
* a {@link FeatureCollection} |
300 |
*/ |
*/ |
301 |
public static Map<Integer, AttributeMetaData> createDefaultAttributeMetaDataMap( |
public static AttributeMetadataMap createDefaultAttributeMetaDataMap( |
302 |
FeatureCollection<SimpleFeatureType,SimpleFeature> fc) { |
FeatureCollection<SimpleFeatureType,SimpleFeature> fc) { |
303 |
HashMap<Integer, AttributeMetaData> metaDataMap = new HashMap<Integer, AttributeMetaData>(); |
AttributeMetadataMap metaDataMap = new AttributeMetadataMap(); |
304 |
SimpleFeatureType ftype = fc.getSchema(); |
SimpleFeatureType ftype = fc.getSchema(); |
305 |
for (int i = 0; i < ftype.getAttributeCount(); i++) { |
for (int i = 0; i < ftype.getAttributeCount(); i++) { |
306 |
AttributeDescriptor aType = ftype.getAttributeDescriptors().get(i); |
AttributeDescriptor aType = ftype.getAttributeDescriptors().get(i); |