skrueger.geotools
Class AbstractStyledLayer<E>

java.lang.Object
  extended by skrueger.geotools.AbstractStyledLayer<E>
All Implemented Interfaces:
StyledLayerInterface<E>
Direct Known Subclasses:
StyledFeatureCollection, StyledGridCoverage, StyledGridCoverageReader

public abstract class AbstractStyledLayer<E>
extends Object
implements StyledLayerInterface<E>

This class is a default implementation of StyledLayerInterface. StyledLayerInterface.dispose() and StyledLayerInterface.uncache() must be implemented by the sub class. This class only implements the "hold" of an geo object of type <E>.

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

Field Summary
protected  CoordinateReferenceSystem crs
          Holds the CRS of the geo object
protected  Translation desc
          Holds a long (language-specific) description of the geo object.
protected  Envelope envelope
          Holds the bounds of the geo object
protected  E geoObject
          Holds the geo object represeneted by the map
protected  ImageIcon icon
          Holds an icon to represent the geo object
protected  String id
          Holds the unique ID of the geo object.
protected  Translation keywords
          Holds the (language-specific) keywords to describe the geo object.
protected  Logger LOGGER
          Logger for warning- and error messages.
protected  Style style
          Holds the display style for the geo object
protected  Translation title
          Holds a short (language-specific) description of the geo object.
 
Constructor Summary
AbstractStyledLayer(E geoObject, Envelope envelope, CoordinateReferenceSystem crs, String id, String title, String desc, String keywords, Style style, ImageIcon icon)
          Creates a non-translated styled layer.
AbstractStyledLayer(E geoObject, Envelope envelope, CoordinateReferenceSystem crs, String id, Translation title, Translation desc, Translation keywords, Style style, ImageIcon icon)
          Creates a language specific styled layer.
 
Method Summary
protected abstract  Style createDefaultStyle()
          Creates a default style for the geo object.
 CoordinateReferenceSystem getCrs()
          Returns the CoordinateReferenceSystem of the geo object.
 String getCRSString()
          Returns CoordinateReferenceSystem.toString().
 Translation getDesc()
          Returns a long (language-specific) description of the object.
 Envelope getEnvelope()
          Returns the bounds of the geo object.
 E getGeoObject()
          Returns the geo object representet in the map.
 String getId()
          Returns a ID for the geo object.
 ImageIcon getImageIcon()
          Returns an icon, which represents the geo object.
 Translation getKeywords()
          Returns a (language-specific) key word sequence for the geo object.
 Style getStyle()
          Returns the display style for the geo object.
 Translation getTitle()
          Returns a short (language-specific) description of the geo object.
 void setDesc(String desc)
          Sets a long (non-translated) description of the object.
 void setDesc(Translation desc)
          Sets a long (language-specific) description of the object.
 void setImageIcon(ImageIcon icon)
          Sets an icon, which represents the geo object.
 void setKeywords(String keywords)
          Sets a (non-translated) key word sequence for the geo object.
 void setKeywords(Translation keywords)
          Sets a (language-specific) key word sequence for the geo object.
 void setStyle(Style style)
          Sets the display style for the geo object.
 void setTitle(String title)
          Sets a short (non-translated) description of the geo object.
 void setTitle(Translation title)
          Sets a short (language-specific) description of the geo object.
 
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
dispose, getInfoURL, isDisposed, uncache
 

Field Detail

LOGGER

protected Logger LOGGER
Logger for warning- and error messages.


id

protected String id
Holds the unique ID of the geo object.


title

protected Translation title
Holds a short (language-specific) description of the geo object.


desc

protected Translation desc
Holds a long (language-specific) description of the geo object.


keywords

protected Translation keywords
Holds the (language-specific) keywords to describe the geo object.


icon

protected ImageIcon icon
Holds an icon to represent the geo object


geoObject

protected E geoObject
Holds the geo object represeneted by the map


crs

protected CoordinateReferenceSystem crs
Holds the CRS of the geo object


envelope

protected Envelope envelope
Holds the bounds of the geo object


style

protected Style style
Holds the display style for the geo object

Constructor Detail

AbstractStyledLayer

public AbstractStyledLayer(E geoObject,
                           Envelope envelope,
                           CoordinateReferenceSystem crs,
                           String id,
                           Translation title,
                           Translation desc,
                           Translation keywords,
                           Style style,
                           ImageIcon icon)
Creates a language specific styled layer.

Parameters:
geoObject - the geo object
envelope - the bounds of the geo object
crs - the CRS of the geo object
id - a unique ID for the geo 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
icon - an icon for the object
Throws:
IllegalArgumentException - if null is given as ID or geo object

AbstractStyledLayer

public AbstractStyledLayer(E geoObject,
                           Envelope envelope,
                           CoordinateReferenceSystem crs,
                           String id,
                           String title,
                           String desc,
                           String keywords,
                           Style style,
                           ImageIcon icon)
Creates a non-translated styled layer.

Parameters:
geoObject - the geo object
envelope - the bounds of the geo object
crs - the CRS of the geo object
id - a unique ID for the geo object
title - a short description
desc - a long description
keywords - keywords for the geo objects
style - a display style
icon - an icon for the object
Throws:
IllegalArgumentException - if null is given as ID
Method Detail

getId

public String getId()
Returns a ID for the geo object. The ID should be unique in a map ob styled layer objects

Specified by:
getId in interface StyledLayerInterface<E>

getTitle

public Translation getTitle()
Returns a short (language-specific) description of the geo object.

Specified by:
getTitle in interface StyledLayerInterface<E>

setTitle

public void setTitle(Translation title)
Sets a short (language-specific) description of the geo object. If title is null an untranslated default title is set, so getTitle() never returns null.

Specified by:
setTitle in interface StyledLayerInterface<E>
Parameters:
title - new description for the geo object

setTitle

public void setTitle(String title)
Sets a short (non-translated) description of the geo object. If title is null an untranslated default title is set, so getTitle() never returns null.

Parameters:
title - new description for the geo object

getDesc

public Translation getDesc()
Returns a long (language-specific) description of the object.

Specified by:
getDesc in interface StyledLayerInterface<E>

setDesc

public void setDesc(Translation desc)
Sets a long (language-specific) description of the object. If desc is null an (untranslated) empty description is set, so getDesc() never returns null.

Specified by:
setDesc in interface StyledLayerInterface<E>
Parameters:
desc - new description for the geo object

setDesc

public void setDesc(String desc)
Sets a long (non-translated) description of the object. If desc is null an (untranslated) empty description is set, so getDesc() never returns null.

Parameters:
desc - new description for the geo object

getKeywords

public Translation getKeywords()
Returns a (language-specific) key word sequence for the geo object.

Specified by:
getKeywords in interface StyledLayerInterface<E>

setKeywords

public void setKeywords(Translation keywords)
Sets a (language-specific) key word sequence for the geo object. If keywords is null an (untranslated) empty string is set, so getKeywords() never returns null.

Specified by:
setKeywords in interface StyledLayerInterface<E>
Parameters:
keywords - Keywords

setKeywords

public void setKeywords(String keywords)
Sets a (non-translated) key word sequence for the geo object. If keywords is null an (untranslated) empty string is set, so getKeywords() never returns null.

Parameters:
keywords - Keywords

getGeoObject

public E getGeoObject()
Returns the geo object representet in the map. Sub classes must override this method to implement "late loading" on first call.

Specified by:
getGeoObject in interface StyledLayerInterface<E>
Returns:
geoObject

getEnvelope

public Envelope getEnvelope()
Returns the bounds of the geo object.

Specified by:
getEnvelope in interface StyledLayerInterface<E>

getCrs

public CoordinateReferenceSystem getCrs()
Returns the CoordinateReferenceSystem of the geo object.

Specified by:
getCrs in interface StyledLayerInterface<E>

getCRSString

public String getCRSString()
Returns CoordinateReferenceSystem.toString(). This method can be overriden to create a "nicer" description.

Specified by:
getCRSString in interface StyledLayerInterface<E>

getImageIcon

public ImageIcon getImageIcon()
Returns an icon, which represents the geo object.

Specified by:
getImageIcon in interface StyledLayerInterface<E>
Returns:
return an ImageIcon - null is valid and no icon or a default icon will then be shown

setImageIcon

public void setImageIcon(ImageIcon icon)
Sets an icon, which represents the geo object.

Specified by:
setImageIcon in interface StyledLayerInterface<E>
Parameters:
icon - an icon

getStyle

public Style getStyle()
Returns the display style for the geo object.

Specified by:
getStyle in interface StyledLayerInterface<E>

setStyle

public void setStyle(Style style)
Sets the display style for the geo object. If style is null an default style is set, so getStyle() never returns null.

Specified by:
setStyle in interface StyledLayerInterface<E>
See Also:
createDefaultStyle()

createDefaultStyle

protected abstract Style createDefaultStyle()
Creates a default style for the geo object. This style is used whenever the style is set to null.

See Also:
setStyle(Style)