skrueger.geotools
Class StyledFeatureCollection

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

public class StyledFeatureCollection
extends AbstractStyledLayer<FeatureCollection>
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  Map<Integer,AttributeMetaData> 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(FeatureCollection fc, String id, String title, String desc, String keywords, StyledLayerStyle<Map<Integer,AttributeMetaData>> style, ImageIcon icon)
          Creates a styled FeatureCollection with non-translated informations.
StyledFeatureCollection(FeatureCollection fc, String id, String title, String desc, String keywords, Style style, Map<Integer,AttributeMetaData> attrMetaData, ImageIcon icon)
          Creates a styled FeatureCollection with non-translated informations.
StyledFeatureCollection(FeatureCollection 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(FeatureCollection fc, String id, String title, StyledLayerStyle<Map<Integer,AttributeMetaData>> style)
          Creates a styled FeatureCollection with a non-translated title, no long description, no keywords, default attribute meta data and no icon.
StyledFeatureCollection(FeatureCollection 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(FeatureCollection fc, String id, Translation title, Translation desc, Translation keywords, StyledLayerStyle<Map<Integer,AttributeMetaData>> style, ImageIcon icon)
          Creates a styled FeatureCollection with language-specific informations.
StyledFeatureCollection(FeatureCollection fc, String id, Translation title, Translation desc, Translation keywords, Style style, Map<Integer,AttributeMetaData> attrMetaData, ImageIcon icon)
          Creates a styled FeatureCollection with language-specific informations.
 
Method Summary
static Map<Integer,AttributeMetaData> createDefaultAttributeMetaDataMap(FeatureCollection 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.
 Map<Integer,AttributeMetaData> getAttributeMetaDataMap()
          Returns the meta data needed for displaying a legend.
 FeatureCollection getFeatureCollection()
          Same as AbstractStyledLayer.getGeoObject() method, but complies to the StyledFeaturesInterface
 FeatureSource getFeatureSource()
          Returns a virtual FeatureSource to access the FeatureCollection.
 URL getInfoURL()
          Returns the URL to a (HTML) file that provides more information about this layer.
 boolean isDisposed()
          Tests whether the geo object is disposed.
 void setAttributeMetaData(Map<Integer,AttributeMetaData> attrMetaData)
          Sets the meta data needed for displaying a legend.
 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.StyledLayerInterface
getCrs, getCRSString, getDesc, getEnvelope, getGeoObject, getId, getImageIcon, getKeywords, getStyle, getTitle, setDesc, setImageIcon, setKeywords, setStyle, setTitle
 

Field Detail

attrMetaData

protected Map<Integer,AttributeMetaData> attrMetaData
Holds the meta data for displaying a legend.

Constructor Detail

StyledFeatureCollection

public StyledFeatureCollection(FeatureCollection fc,
                               String id,
                               Translation title,
                               Translation desc,
                               Translation keywords,
                               Style style,
                               Map<Integer,AttributeMetaData> 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(FeatureCollection fc,
                               String id,
                               Translation title,
                               Translation desc,
                               Translation keywords,
                               StyledLayerStyle<Map<Integer,AttributeMetaData>> 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(FeatureCollection 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(FeatureCollection fc,
                               String id,
                               String title,
                               String desc,
                               String keywords,
                               Style style,
                               Map<Integer,AttributeMetaData> 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(FeatureCollection fc,
                               String id,
                               String title,
                               String desc,
                               String keywords,
                               StyledLayerStyle<Map<Integer,AttributeMetaData>> 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(FeatureCollection 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(FeatureCollection fc,
                               String id,
                               String title,
                               StyledLayerStyle<Map<Integer,AttributeMetaData>> 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<FeatureCollection>
See Also:
FeatureUtil.createDefaultStyle(FeatureCollection)

getAttributeMetaDataMap

public Map<Integer,AttributeMetaData> getAttributeMetaDataMap()
Returns the meta data needed for displaying a legend.

Specified by:
getAttributeMetaDataMap in interface StyledFeaturesInterface<FeatureCollection>

setAttributeMetaData

public void setAttributeMetaData(Map<Integer,AttributeMetaData> 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 Map<Integer,AttributeMetaData> createDefaultAttributeMetaDataMap(FeatureCollection 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<FeatureCollection>

isDisposed

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

Specified by:
isDisposed in interface StyledLayerInterface<FeatureCollection>

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<FeatureCollection>

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<FeatureCollection>
Returns:
null or an URL

getFeatureCollection

public FeatureCollection getFeatureCollection()
Same as AbstractStyledLayer.getGeoObject() method, but complies to the StyledFeaturesInterface

Specified by:
getFeatureCollection in interface StyledFeaturesInterface<FeatureCollection>
Returns:
The features of this layer as a FeatureCollection.
See Also:
StyledFeaturesInterface}

getFeatureSource

public FeatureSource 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<FeatureCollection>
Returns:
The features of this layer as a FeatureSource.
See Also:
StyledFeaturesInterface}