org.geotools.map
Class DefaultMapLayer

Object
  extended by DefaultMapLayer
All Implemented Interfaces:
MapLayer

public class DefaultMapLayer
extends Object
implements MapLayer

Default implementation of the MapLayer implementation

Author:
wolf
Module:

Field Summary
protected  FeatureSource<SimpleFeatureType,SimpleFeature> featureSource
          Holds value of property FeatureSource.
protected  EventListenerList listenerList
          Utility field used by event firing mechanism.
protected  Query query
          The query to limit the number of rendered features based on its filter
protected  FeatureListener sourceListener
          Listener to forward feature source events as layer events
protected  Style style
          The style to symbolize the features of this layer
protected  String title
          Holds value of property title.
protected  boolean visible
          Whether this layer is visible or not.
 
Constructor Summary
DefaultMapLayer(AbstractGridCoverage2DReader reader, Style style)
          Constructor which adds a new layer and triggers a LayerListEvent.
DefaultMapLayer(AbstractGridCoverage2DReader reader, Style style, String title)
          Constructor which adds a new layer and trigger a LayerListEvent.
DefaultMapLayer(CollectionSource source, Style style, String title)
           
DefaultMapLayer(Collection collection, Style style)
           
DefaultMapLayer(Collection collection, Style style, String title)
           
DefaultMapLayer(FeatureCollection<SimpleFeatureType,SimpleFeature> collection, Style style)
          Creates a new instance of DefaultMapLayer using a non-emtpy feature collection as a parameter
DefaultMapLayer(FeatureCollection<SimpleFeatureType,SimpleFeature> collection, Style style, String title)
          Creates a new instance of DefaultMapLayer using a non-emtpy feature collection as a parameter
DefaultMapLayer(FeatureSource<SimpleFeatureType,SimpleFeature> featureSource, Style style)
          Creates a new instance of DefaultMapLayer
DefaultMapLayer(FeatureSource<SimpleFeatureType,SimpleFeature> featureSource, Style style, String title)
          Creates a new instance of DefaultMapLayer
DefaultMapLayer(GridCoverage coverage, Style style)
          * Add a new layer and trigger a LayerListEvent.
DefaultMapLayer(GridCoverage coverage, Style style, String title)
          * Add a new layer and trigger a LayerListEvent.
 
Method Summary
 void addMapLayerListener(MapLayerListener listener)
          Registers MapLayerListener to receive events.
protected  void fireMapLayerListenerLayerChanged(MapLayerEvent event)
          Notifies all registered listeners about the event.
protected  void fireMapLayerListenerLayerHidden(MapLayerEvent event)
          Notifies all registered listeners about the event.
protected  void fireMapLayerListenerLayerShown(MapLayerEvent event)
          Notifies all registered listeners about the event.
 ReferencedEnvelope getBounds()
          find out the bounds of the layer
 FeatureSource<SimpleFeatureType,SimpleFeature> getFeatureSource()
          Getter for property featureSource.
 Query getQuery()
          Returns the definition query established for this layer.
 CollectionSource getSource()
          Get the data source for this layer.
 Style getStyle()
          Getter for property style.
 String getTitle()
          Getter for property title.
 boolean isVisible()
          Getter for property visible.
 void removeMapLayerListener(MapLayerListener listener)
          Removes MapLayerListener from the list of listeners.
 void setQuery(Query query)
          Sets a definition query for this layer.
 void setStyle(Style style)
          Setter for property style.
 void setTitle(String title)
          Setter for property title.
 void setVisible(boolean visible)
          Setter for property visible.
 String toString()
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

featureSource

protected FeatureSource<SimpleFeatureType,SimpleFeature> featureSource
Holds value of property FeatureSource.


style

protected Style style
The style to symbolize the features of this layer


query

protected Query query
The query to limit the number of rendered features based on its filter


title

protected String title
Holds value of property title.


visible

protected boolean visible
Whether this layer is visible or not.


listenerList

protected EventListenerList listenerList
Utility field used by event firing mechanism.


sourceListener

protected FeatureListener sourceListener
Listener to forward feature source events as layer events

Constructor Detail

DefaultMapLayer

public DefaultMapLayer(FeatureSource<SimpleFeatureType,SimpleFeature> featureSource,
                       Style style,
                       String title)
Creates a new instance of DefaultMapLayer

Parameters:
featureSource - the data source for this layer
style - the style used to represent this layer
title - the layer title
Throws:
NullPointerException - DOCUMENT ME!

DefaultMapLayer

public DefaultMapLayer(CollectionSource source,
                       Style style,
                       String title)

DefaultMapLayer

public DefaultMapLayer(FeatureSource<SimpleFeatureType,SimpleFeature> featureSource,
                       Style style)
Creates a new instance of DefaultMapLayer

Parameters:
featureSource - the data source for this layer
style - the style used to represent this layer

DefaultMapLayer

public DefaultMapLayer(FeatureCollection<SimpleFeatureType,SimpleFeature> collection,
                       Style style,
                       String title)
Creates a new instance of DefaultMapLayer using a non-emtpy feature collection as a parameter

Parameters:
collection - the source feature collection
style - the style used to represent this layer
title - DOCUMENT ME!

DefaultMapLayer

public DefaultMapLayer(Collection collection,
                       Style style,
                       String title)

DefaultMapLayer

public DefaultMapLayer(FeatureCollection<SimpleFeatureType,SimpleFeature> collection,
                       Style style)
Creates a new instance of DefaultMapLayer using a non-emtpy feature collection as a parameter

Parameters:
collection - the source feature collection
style - the style used to represent this layer

DefaultMapLayer

public DefaultMapLayer(Collection collection,
                       Style style)

DefaultMapLayer

public DefaultMapLayer(GridCoverage coverage,
                       Style style)
                throws TransformException,
                       FactoryRegistryException,
                       SchemaException,
                       IllegalAttributeException
* Add a new layer and trigger a LayerListEvent.

Parameters:
coverage - The new layer that has been added.
style -
Throws:
IllegalAttributeException
SchemaException
FactoryRegistryException
TransformException

DefaultMapLayer

public DefaultMapLayer(AbstractGridCoverage2DReader reader,
                       Style style,
                       String title)
                throws TransformException,
                       FactoryRegistryException,
                       SchemaException,
                       IllegalAttributeException
Constructor which adds a new layer and trigger a LayerListEvent.

Parameters:
reader - a reader with the new layer that will be added.
style -
title -
Throws:
IllegalAttributeException
SchemaException
FactoryRegistryException
TransformException

DefaultMapLayer

public DefaultMapLayer(AbstractGridCoverage2DReader reader,
                       Style style)
                throws TransformException,
                       FactoryRegistryException,
                       SchemaException,
                       IllegalAttributeException
Constructor which adds a new layer and triggers a LayerListEvent.

Parameters:
reader - a reader with the new layer that will be added
style -
Throws:
IllegalAttributeException
SchemaException
FactoryRegistryException
TransformException

DefaultMapLayer

public DefaultMapLayer(GridCoverage coverage,
                       Style style,
                       String title)
                throws TransformException,
                       FactoryRegistryException,
                       SchemaException,
                       IllegalAttributeException
* Add a new layer and trigger a LayerListEvent.

Parameters:
coverage - The new layer that has been added.
style -
title -
Throws:
IllegalAttributeException
SchemaException
FactoryRegistryException
TransformException
Method Detail

getFeatureSource

public FeatureSource<SimpleFeatureType,SimpleFeature> getFeatureSource()
Getter for property featureSource.

Specified by:
getFeatureSource in interface MapLayer
Returns:
Value of property featureSource.

getSource

public CollectionSource getSource()
Description copied from interface: MapLayer
Get the data source for this layer.

Specified by:
getSource in interface MapLayer
Returns:
Data source for this layer, null if not yet set or if FeatureSource is used

getStyle

public Style getStyle()
Getter for property style.

Specified by:
getStyle in interface MapLayer
Returns:
Value of property style.

setStyle

public void setStyle(Style style)
Setter for property style.

Specified by:
setStyle in interface MapLayer
Parameters:
style - New value of property style.
Throws:
NullPointerException - DOCUMENT ME!

getTitle

public String getTitle()
Getter for property title.

Specified by:
getTitle in interface MapLayer
Returns:
Value of property title.

setTitle

public void setTitle(String title)
Setter for property title.

Specified by:
setTitle in interface MapLayer
Parameters:
title - New value of property title.
Throws:
NullPointerException - DOCUMENT ME!

isVisible

public boolean isVisible()
Getter for property visible.

Specified by:
isVisible in interface MapLayer
Returns:
Value of property visible.

setVisible

public void setVisible(boolean visible)
Setter for property visible.

Specified by:
setVisible in interface MapLayer
Parameters:
visible - New value of property visible.

getQuery

public Query getQuery()
Returns the definition query established for this layer.

Specified by:
getQuery in interface MapLayer
Returns:
the definition query established for this layer. If not set, just returns Query.ALL, if set, returns a copy of the actual query object to avoid external modification
See Also:
MapLayer.getQuery()

setQuery

public void setQuery(Query query)
Sets a definition query for this layer.

If present (other than Query.ALL, a renderer or consumer must use it to limit the number of returned features based on the filter it holds and the value of the maxFeatures attributes, and also can use it as a performance hto limit the number of requested attributes

Specified by:
setQuery in interface MapLayer
Parameters:
query - the full filter for this layer.
Throws:
NullPointerException - if no query is passed on. If you want to reset a definition query, pass it Query.ALL instead of null
See Also:
MapLayer.setQuery(org.geotools.data.Query)
TODO:
TODO: test that the query filter is siutable for the layer's FeatureSource schema

getBounds

public ReferencedEnvelope getBounds()
Description copied from interface: MapLayer
find out the bounds of the layer

Specified by:
getBounds in interface MapLayer
Returns:
- the layer's bounds

addMapLayerListener

public void addMapLayerListener(MapLayerListener listener)
Registers MapLayerListener to receive events.

Specified by:
addMapLayerListener in interface MapLayer
Parameters:
listener - The listener to register.

removeMapLayerListener

public void removeMapLayerListener(MapLayerListener listener)
Removes MapLayerListener from the list of listeners.

Specified by:
removeMapLayerListener in interface MapLayer
Parameters:
listener - The listener to remove.

fireMapLayerListenerLayerChanged

protected void fireMapLayerListenerLayerChanged(MapLayerEvent event)
Notifies all registered listeners about the event.

Parameters:
event - The event to be fired

fireMapLayerListenerLayerShown

protected void fireMapLayerListenerLayerShown(MapLayerEvent event)
Notifies all registered listeners about the event.

Parameters:
event - The event to be fired

fireMapLayerListenerLayerHidden

protected void fireMapLayerListenerLayerHidden(MapLayerEvent event)
Notifies all registered listeners about the event.

Parameters:
event - The event to be fired

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1996-2009 Geotools. All Rights Reserved.