skrueger.geotools
Class StyledGridCoverageReader

java.lang.Object
  extended by skrueger.geotools.AbstractStyledLayer<AbstractGridCoverage2DReader>
      extended by skrueger.geotools.StyledGridCoverageReader
All Implemented Interfaces:
StyledGridCoverageReaderInterface, StyledLayerInterface<AbstractGridCoverage2DReader>, StyledRasterInterface<AbstractGridCoverage2DReader>

public class StyledGridCoverageReader
extends AbstractStyledLayer<AbstractGridCoverage2DReader>
implements StyledGridCoverageReaderInterface

This class provides a simple implementation of StyledLayerInterface for AbstractGridCoverage2DReader. The uncache functionality is not supported, because if the coverage is read once this class bases on an existing GridCoverage2D object in memory.

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

Field Summary
protected  RasterLegendData legendData
          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
StyledGridCoverageReader(AbstractGridCoverage2DReader gcr, String id, String title, String desc, String keywords, StyledLayerStyle<RasterLegendData> style, ImageIcon icon)
          Creates a styled grid with non-translated informations.
StyledGridCoverageReader(AbstractGridCoverage2DReader gcr, String id, String title, String desc, String keywords, Style style, RasterLegendData legendData, ImageIcon icon)
          Creates a styled grid with non-translated informations.
StyledGridCoverageReader(AbstractGridCoverage2DReader gcr, String id, String title, StyledLayerStyle<RasterLegendData> style)
          Creates a styled grid with a non-translated title, no long description, no keywords and no icon.
StyledGridCoverageReader(AbstractGridCoverage2DReader gcr, String id, String title, Style style, RasterLegendData legendData)
          Creates a styled grid with a non-translated title, no long description, no keywords and no icon.
StyledGridCoverageReader(AbstractGridCoverage2DReader gcr, String id, Translation title, Style style, RasterLegendData legendData)
          Creates a styled grid with a language-specific title, no long description, no keywords and no icon.
StyledGridCoverageReader(AbstractGridCoverage2DReader gcr, String id, Translation title, Translation desc, Translation keywords, StyledLayerStyle<RasterLegendData> style, ImageIcon icon)
          Creates a styled grid with language-specific informations.
StyledGridCoverageReader(AbstractGridCoverage2DReader gcr, String id, Translation title, Translation desc, Translation keywords, Style style, RasterLegendData legendData, ImageIcon icon)
          Creates a styled grid with language-specific informations.
 
Method Summary
protected  Style createDefaultStyle()
          Creates a default style for a GridCoverage2D.
 void dispose()
          Simply sets the AbstractStyledLayer.geoObject, AbstractStyledLayer.crs, AbstractStyledLayer.envelope and legendData to null.
 URL getInfoURL()
          Returns the URL to a (HTML) file that provides more information about this layer.
 RasterLegendData getLegendMetaData()
          Returns the meta data needed for displaying a legend.
 boolean isDisposed()
          Tests whether the geo object is disposed.
 void setLegendMetaData(RasterLegendData legendData)
          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

legendData

protected RasterLegendData legendData
Holds the meta data for displaying a legend.

Constructor Detail

StyledGridCoverageReader

public StyledGridCoverageReader(AbstractGridCoverage2DReader gcr,
                                String id,
                                Translation title,
                                Translation desc,
                                Translation keywords,
                                Style style,
                                RasterLegendData legendData,
                                ImageIcon icon)
Creates a styled grid with language-specific informations.

Parameters:
gcr - the grid reader
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)
legendData - 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

StyledGridCoverageReader

public StyledGridCoverageReader(AbstractGridCoverage2DReader gcr,
                                String id,
                                Translation title,
                                Translation desc,
                                Translation keywords,
                                StyledLayerStyle<RasterLegendData> style,
                                ImageIcon icon)
Creates a styled grid with language-specific informations.

Parameters:
gcr - the grid reader
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 legend information
icon - an icon for the object (can be null)
Throws:
IllegalArgumentException - if null is given as ID or geo object

StyledGridCoverageReader

public StyledGridCoverageReader(AbstractGridCoverage2DReader gcr,
                                String id,
                                Translation title,
                                Style style,
                                RasterLegendData legendData)
Creates a styled grid with a language-specific title, no long description, no keywords and no icon.

Parameters:
gcr - the grid reader
id - a unique ID for the object
title - a short description
style - a display style (if null, a default style is created)
legendData - meta data for displaying a legend
Throws:
IllegalArgumentException - if null is given as ID or geo object

StyledGridCoverageReader

public StyledGridCoverageReader(AbstractGridCoverage2DReader gcr,
                                String id,
                                String title,
                                String desc,
                                String keywords,
                                Style style,
                                RasterLegendData legendData,
                                ImageIcon icon)
Creates a styled grid with non-translated informations.

Parameters:
gcr - the grid reader
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)
legendData - 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

StyledGridCoverageReader

public StyledGridCoverageReader(AbstractGridCoverage2DReader gcr,
                                String id,
                                String title,
                                String desc,
                                String keywords,
                                StyledLayerStyle<RasterLegendData> style,
                                ImageIcon icon)
Creates a styled grid with non-translated informations.

Parameters:
gcr - the grid reader
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 legend information
icon - an icon for the object (can be null)
Throws:
IllegalArgumentException - if null is given as ID or geo object

StyledGridCoverageReader

public StyledGridCoverageReader(AbstractGridCoverage2DReader gcr,
                                String id,
                                String title,
                                Style style,
                                RasterLegendData legendData)
Creates a styled grid with a non-translated title, no long description, no keywords and no icon.

Parameters:
gcr - the grid reader
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

StyledGridCoverageReader

public StyledGridCoverageReader(AbstractGridCoverage2DReader gcr,
                                String id,
                                String title,
                                StyledLayerStyle<RasterLegendData> style)
Creates a styled grid with a non-translated title, no long description, no keywords and no icon.

Parameters:
gcr - the grid reader
id - a unique ID for the object
title - a short description
style - a display style with legend information
Throws:
IllegalArgumentException - if null is given as ID or geo object
Method Detail

createDefaultStyle

protected Style createDefaultStyle()
Creates a default style for a GridCoverage2D.

Specified by:
createDefaultStyle in class AbstractStyledLayer<AbstractGridCoverage2DReader>
See Also:
GridUtil.createDefaultStyle()

getLegendMetaData

public RasterLegendData getLegendMetaData()
Returns the meta data needed for displaying a legend.

Specified by:
getLegendMetaData in interface StyledRasterInterface<AbstractGridCoverage2DReader>
Returns:
A RasterLegendData object with pairs of value / label information

setLegendMetaData

public void setLegendMetaData(RasterLegendData legendData)
Sets the meta data needed for displaying a legend. If legendData is null an empty RasterLegendData (without gaps) is set, so getLegendMetaData() never returns null.

Parameters:
legendData - legend meta data

dispose

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

Specified by:
dispose in interface StyledLayerInterface<AbstractGridCoverage2DReader>

isDisposed

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

Specified by:
isDisposed in interface StyledLayerInterface<AbstractGridCoverage2DReader>
Returns:
boolean

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

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