skrueger.geotools
Class StyledFeatureCollection

java.lang.Object
  extended by skrueger.geotools.AbstractStyledLayer<>
      extended by skrueger.geotools.StyledFeatureCollection
All Implemented Interfaces:
StyledFeatureCollectionInterface, StyledFeaturesInterface<>, StyledLayerInterface<>

public class StyledFeatureCollection
extends AbstractStyledLayer<>
implements StyledFeatureCollectionInterface

This class provides a simple implementation of StyledLayerInterface for FeatureCollection. The uncache functionality is not supported, because this class bases on an existing FeatureCollection object in memory.

Version:
1.0
Author:
Martin Schmitz (University of Bonn/Germany)

Field Summary
protected  AttributeMetadataMap attrMetaData
          Holds the meta data for displaying a legend.
 
Fields inherited from class skrueger.geotools.AbstractStyledLayer
crs, desc, envelope, geoObject, icon, id, keywords, LOGGER, style, title
 
Constructor Summary
StyledFeatureCollection( fc, String id, String title, String desc, String keywords, Style style, AttributeMetadataMap attrMetaData, ImageIcon icon)
          Creates a styled FeatureCollection with non-translated informations.
StyledFeatureCollection( fc, String id, String title, String desc, String keywords, StyledLayerStyle<AttributeMetadataMap> style, ImageIcon icon)
          Creates a styled FeatureCollection with non-translated informations.
StyledFeatureCollection( fc, String id, String title, Style style)
          Creates a styled FeatureCollection with a non-translated title, no long description, no keywords, default attribute meta data and no icon.
StyledFeatureCollection( fc, String id, String title, StyledLayerStyle<AttributeMetadataMap> style)
          Creates a styled FeatureCollection with a non-translated title, no long description, no keywords, default attribute meta data and no icon.
StyledFeatureCollection( fc, String id, Translation title, Style style)
          Creates a styled FeatureCollection with a language-specific title, no long description, no keywords, default attribute meta data and no icon.
StyledFeatureCollection( fc, String id, Translation title, Translation desc, Translation keywords, Style style, AttributeMetadataMap attrMetaData, ImageIcon icon)
          Creates a styled FeatureCollection with language-specific informations.
StyledFeatureCollection( fc, String id, Translation title, Translation desc, Translation keywords, StyledLayerStyle<AttributeMetadataMap> style, ImageIcon icon)
          Creates a styled FeatureCollection with language-specific informations.
 
Method Summary
static AttributeMetadataMap createDefaultAttributeMetaDataMap( fc)
          Creates non-translated default meta data for a FeatureCollection with all attributes visible and no unit set.
protected  Style createDefaultStyle()
          Creates a default style for the FeatureCollection.
 void dispose()
          Simply sets the AbstractStyledLayer.geoObject, AbstractStyledLayer.crs, AbstractStyledLayer.envelope and attrMetaData to null.
 AttributeMetadataMap getAttributeMetaDataMap()
          Returns the meta data needed for displaying a legend.
  getFeatureCollection()
          Same as AbstractStyledLayer.getGeoObject() method, but complies to the StyledFeaturesInterface.
  getFeatureCollectionFiltered()
          Same as AbstractStyledLayer.getGeoObject() method, but complies to the StyledFeaturesInterface.
  getFeatureSource()
          Returns a virtual FeatureSource to access the FeatureCollection.
 Filter getFilter()
          Returns the Filter a filter that is associated with this StyledFeaturesInterface Never shall return null, but rather Filter.INCLUDE.
 URL getInfoURL()
          Returns the URL to a (HTML) file that provides more information about this layer.
 SimpleFeatureType getSchema()
           
 boolean isDisposed()
          Tests whether the geo object is disposed.
 void setAttributeMetaData(AttributeMetadataMap attrMetaData)
          Sets the meta data needed for displaying a legend.
 void setFilter(Filter filter)
          Stores Filter that is NOT automatically applied.
 void uncache()
          Does nothing, because the AbstractStyledLayer bases on existing objects (in memory) which can not be uncached and reloaded.
 
Methods inherited from class skrueger.geotools.AbstractStyledLayer
getCrs, getCRSString, getDesc, getEnvelope, getGeoObject, getId, getImageIcon, getKeywords, getStyle, getTitle, setDesc, setDesc, setImageIcon, setKeywords, setKeywords, setStyle, setTitle, setTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface skrueger.geotools.StyledFeaturesInterface
getGeoObject
 
Methods inherited from interface skrueger.geotools.StyledLayerInterface
getCrs, getCRSString, getDesc, getEnvelope, getId, getImageIcon, getKeywords, getStyle, getTitle, setDesc, setImageIcon, setKeywords, setStyle, setTitle
 

Field Detail

attrMetaData

protected AttributeMetadataMap attrMetaData
Holds the meta data for displaying a legend.

Constructor Detail

StyledFeatureCollection

public StyledFeatureCollection( fc,
                               String id,
                               Translation title,
                               Translation desc,
                               Translation keywords,
                               Style style,
                               AttributeMetadataMap attrMetaData,
                               ImageIcon icon)
Creates a styled FeatureCollection with language-specific informations.

Parameters:
fc - the FeatureCollection
id - a unique ID for the object
title - a (language-specific) short description
desc - a (language-specific) long description
keywords - (language-specific) keywords for the geo objects
style - a display style (if null, a default style is created)
attrMetaData - meta data for displaying a legend
icon - an icon for the object (can be null)
Throws:
IllegalArgumentException - if null is given as ID or geo object

StyledFeatureCollection

public StyledFeatureCollection( fc,
                               String id,
                               Translation title,
                               Translation desc,
                               Translation keywords,
                               StyledLayerStyle<AttributeMetadataMap> style,
                               ImageIcon icon)
Creates a styled FeatureCollection with language-specific informations.

Parameters:
fc - the FeatureCollection
id - a unique ID for the object
title - a (language-specific) short description
desc - a (language-specific) long description
keywords - (language-specific) keywords for the geo objects
style - a display style with attribute meta data information
icon - an icon for the object (can be null)
Throws:
IllegalArgumentException - if null is given as ID or geo object

StyledFeatureCollection

public StyledFeatureCollection( fc,
                               String id,
                               Translation title,
                               Style style)
Creates a styled FeatureCollection with a language-specific title, no long description, no keywords, default attribute meta data and no icon.

Parameters:
fc - the FeatureCollection
id - a unique ID for the object
title - a short description
style - a display style (if null, a default style is created)
Throws:
IllegalArgumentException - if null is given as ID or geo object
See Also:
#createDefaultAttributeMetaDataMap(FeatureCollection)

StyledFeatureCollection

public StyledFeatureCollection( fc,
                               String id,
                               String title,
                               String desc,
                               String keywords,
                               Style style,
                               AttributeMetadataMap attrMetaData,
                               ImageIcon icon)
Creates a styled FeatureCollection with non-translated informations.

Parameters:
fc - the FeatureCollection
id - a unique ID for the object
title - a short description
desc - a long description
keywords - keywords for the geo objects
style - a display style (if null, a default style is created)
attrMetaData - meta data for displaying a legend
icon - an icon for the object (can be null)
Throws:
IllegalArgumentException - if null is given as ID or geo object

StyledFeatureCollection

public StyledFeatureCollection( fc,
                               String id,
                               String title,
                               String desc,
                               String keywords,
                               StyledLayerStyle<AttributeMetadataMap> style,
                               ImageIcon icon)
Creates a styled FeatureCollection with non-translated informations.

Parameters:
fc - the FeatureCollection
id - a unique ID for the object
title - a short description
desc - a long description
keywords - keywords for the geo objects
style - a display style with attribute meta data information
icon - an icon for the object (can be null)
Throws:
IllegalArgumentException - if null is given as ID or geo object

StyledFeatureCollection

public StyledFeatureCollection( fc,
                               String id,
                               String title,
                               Style style)
Creates a styled FeatureCollection with a non-translated title, no long description, no keywords, default attribute meta data and no icon.

Parameters:
fc - the FeatureCollection
id - a unique ID for the object
title - a short description
style - a display style (if null, a default style is created)
Throws:
IllegalArgumentException - if null is given as ID or geo object
See Also:
#createDefaultAttributeMetaDataMap(FeatureCollection)

StyledFeatureCollection

public StyledFeatureCollection( fc,
                               String id,
                               String title,
                               StyledLayerStyle<AttributeMetadataMap> style)
Creates a styled FeatureCollection with a non-translated title, no long description, no keywords, default attribute meta data and no icon.

Parameters:
fc - the FeatureCollection
id - a unique ID for the object
title - a short description
style - a display style (if null, a default style is created)
Throws:
IllegalArgumentException - if null is given as ID or geo object
See Also:
#createDefaultAttributeMetaDataMap(FeatureCollection)
Method Detail

createDefaultStyle

protected Style createDefaultStyle()
Creates a default style for the FeatureCollection.

Specified by:
createDefaultStyle in class AbstractStyledLayer<>
See Also:
FeatureUtil#createDefaultStyle(FeatureCollection)

getAttributeMetaDataMap

public AttributeMetadataMap getAttributeMetaDataMap()
Returns the meta data needed for displaying a legend.

Specified by:
getAttributeMetaDataMap in interface StyledFeaturesInterface<>

setAttributeMetaData

public void setAttributeMetaData(AttributeMetadataMap attrMetaData)
Sets the meta data needed for displaying a legend. If legendData is null an empty map is set, so getAttributeMetaDataMap() never returns null.

Parameters:
attrMetaData - map of attribute meta data

createDefaultAttributeMetaDataMap

public static AttributeMetadataMap createDefaultAttributeMetaDataMap( fc)
Creates non-translated default meta data for a FeatureCollection with all attributes visible and no unit set.

Parameters:
fc - a FeatureCollection

dispose

public void dispose()
Simply sets the AbstractStyledLayer.geoObject, AbstractStyledLayer.crs, AbstractStyledLayer.envelope and attrMetaData to null.

Specified by:
dispose in interface StyledLayerInterface<>

isDisposed

public boolean isDisposed()
Tests whether the geo object is disposed.

Specified by:
isDisposed in interface StyledLayerInterface<>

uncache

public void uncache()
Does nothing, because the AbstractStyledLayer bases on existing objects (in memory) which can not be uncached and reloaded.

Specified by:
uncache in interface StyledLayerInterface<>

getInfoURL

public URL getInfoURL()
Description copied from interface: StyledLayerInterface
Returns the URL to a (HTML) file that provides more information about this layer. If no HTML if associated with this StyledLayerInterface, then null will be returned.

Specified by:
getInfoURL in interface StyledLayerInterface<>
Returns:
null or an URL

getFeatureCollection

public  getFeatureCollection()
Same as AbstractStyledLayer.getGeoObject() method, but complies to the StyledFeaturesInterface. The associated Filter is NOT automatically applied.

Specified by:
getFeatureCollection in interface StyledFeaturesInterface<>
Returns:
The features of this layer as a FeatureCollection. The filter is NOT automatically applied.
See Also:
StyledFeaturesInterface}, getFeatureCollectionFiltered()

getFeatureCollectionFiltered

public  getFeatureCollectionFiltered()
Same as AbstractStyledLayer.getGeoObject() method, but complies to the StyledFeaturesInterface. The associated Filter is automatically applied by creating a SubFeatureCollection.

Specified by:
getFeatureCollectionFiltered in interface StyledFeaturesInterface<>
Returns:
The features of this layer as a FeatureCollection. The associated Filter is automatically applied.
See Also:
StyledFeaturesInterface}, getFeatureCollectionFiltered()

getFeatureSource

public  getFeatureSource()
Returns a virtual FeatureSource to access the FeatureCollection. Once created, it will be reused until uncache() is called.

Specified by:
getFeatureSource in interface StyledFeaturesInterface<>
Returns:
The features of this layer as a FeatureSource. The filter is NOT automatically applied.
See Also:
StyledFeaturesInterface}

getFilter

public Filter getFilter()
Description copied from interface: StyledFeaturesInterface
Returns the Filter a filter that is associated with this StyledFeaturesInterface Never shall return null, but rather Filter.INCLUDE.

Specified by:
getFilter in interface StyledFeaturesInterface<>

setFilter

public void setFilter(Filter filter)
Description copied from interface: StyledFeaturesInterface
Stores Filter that is NOT automatically applied. null is not allowed, use Filter.INCLUDE.

Specified by:
setFilter in interface StyledFeaturesInterface<>

getSchema

public SimpleFeatureType getSchema()
Specified by:
getSchema in interface StyledFeaturesInterface<>
Returns:
As the fastest way to get the Schema is depending on the underlying geoObject (FeatureSource or FeatureCollection), this method shall be implemented in the classes.