2 |
* Copyright (c) 2009 Martin O. J. Schmitz. |
* Copyright (c) 2009 Martin O. J. Schmitz. |
3 |
* |
* |
4 |
* This file is part of the SCHMITZM library - a collection of utility |
* This file is part of the SCHMITZM library - a collection of utility |
5 |
* classes based on Java 1.6, focussing (not only) on Java Swing |
* classes based on Java 1.6, focusing (not only) on Java Swing |
6 |
* and the Geotools library. |
* and the Geotools library. |
7 |
* |
* |
8 |
* The SCHMITZM project is hosted at: |
* The SCHMITZM project is hosted at: |
40 |
import org.geotools.data.collection.CollectionDataStore; |
import org.geotools.data.collection.CollectionDataStore; |
41 |
import org.geotools.feature.AttributeType; |
import org.geotools.feature.AttributeType; |
42 |
import org.geotools.feature.FeatureCollection; |
import org.geotools.feature.FeatureCollection; |
|
import org.geotools.feature.FeatureType; |
|
43 |
import org.geotools.styling.Style; |
import org.geotools.styling.Style; |
44 |
|
import org.opengis.feature.simple.SimpleFeature; |
45 |
|
import org.opengis.feature.simple.SimpleFeatureType; |
46 |
|
|
47 |
import schmitzm.geotools.feature.FeatureUtil; |
import schmitzm.geotools.feature.FeatureUtil; |
48 |
import skrueger.AttributeMetaData; |
import skrueger.AttributeMetaData; |
59 |
* @version 1.0 |
* @version 1.0 |
60 |
*/ |
*/ |
61 |
public class StyledFeatureCollection extends |
public class StyledFeatureCollection extends |
62 |
AbstractStyledLayer<FeatureCollection> implements |
AbstractStyledLayer<FeatureCollection<SimpleFeatureType, SimpleFeature> > implements |
63 |
StyledFeatureCollectionInterface { |
StyledFeatureCollectionInterface { |
64 |
|
|
65 |
/** Holds the meta data for displaying a legend. */ |
/** Holds the meta data for displaying a legend. */ |
68 |
/** |
/** |
69 |
* We be filled with a "virtual" {@link FeatureSource} on demand. |
* We be filled with a "virtual" {@link FeatureSource} on demand. |
70 |
*/ |
*/ |
71 |
private FeatureSource featureSource = null; |
private FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = null; |
72 |
|
|
73 |
/** |
/** |
74 |
* Creates a styled {@link FeatureCollection} with language-specific |
* Creates a styled {@link FeatureCollection} with language-specific |
303 |
public static Map<Integer, AttributeMetaData> createDefaultAttributeMetaDataMap( |
public static Map<Integer, AttributeMetaData> createDefaultAttributeMetaDataMap( |
304 |
FeatureCollection fc) { |
FeatureCollection fc) { |
305 |
HashMap<Integer, AttributeMetaData> metaDataMap = new HashMap<Integer, AttributeMetaData>(); |
HashMap<Integer, AttributeMetaData> metaDataMap = new HashMap<Integer, AttributeMetaData>(); |
306 |
FeatureType ftype = fc.getSchema(); |
SimpleFeatureType ftype = fc.getSchema(); |
307 |
for (int i = 0; i < ftype.getAttributeCount(); i++) { |
for (int i = 0; i < ftype.getAttributeCount(); i++) { |
308 |
AttributeType aType = ftype.getAttributeType(i); |
AttributeType aType = ftype.getAttributeType(i); |
309 |
if (aType != ftype.getDefaultGeometry()) |
if (aType != ftype.getDefaultGeometry()) |