org.geotools.map
Class FeatureSourceMapLayer

java.lang.Object
  extended by org.geotools.map.FeatureSourceMapLayer
All Implemented Interfaces:
MapLayer

public class FeatureSourceMapLayer
extends java.lang.Object
implements MapLayer

Implementation of MapLayer without restricting the return type of getFeatureSource() allows better support of the DataAccess API;

This implementation does not support a collection or grid coverage source.

This implementation was almost entirely stolen from that of DefaultMapLayer.

Author:
Ben Caradoc-Davies, CSIRO Exploration and Mining

Field Summary
protected  FeatureSource<? extends org.opengis.feature.type.FeatureType,? extends org.opengis.feature.Feature> featureSource
          Holds value of property FeatureSource.
protected  javax.swing.event.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  boolean selected
          Whether this layer is selected or not.
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  java.lang.String title
          Holds value of property title.
protected  boolean visible
          Whether this layer is visible or not.
 
Constructor Summary
FeatureSourceMapLayer(FeatureSource<? extends org.opengis.feature.type.FeatureType,? extends org.opengis.feature.Feature> featureSource, Style style)
          Convenience constructor that sets title to the empty string.
FeatureSourceMapLayer(FeatureSource<? extends org.opengis.feature.type.FeatureType,? extends org.opengis.feature.Feature> featureSource, Style style, java.lang.String title)
          Constructor
 
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 fireMapLayerListenerLayerDeselected(MapLayerEvent event)
          Notifies all registered listeners about the deselection event.
protected  void fireMapLayerListenerLayerHidden(MapLayerEvent event)
          Notifies all registered listeners about the event.
protected  void fireMapLayerListenerLayerSelected(MapLayerEvent event)
          Notifies all registered listeners about the selection event.
protected  void fireMapLayerListenerLayerShown(MapLayerEvent event)
          Notifies all registered listeners about the event.
 ReferencedEnvelope getBounds()
          find out the bounds of the layer
 FeatureSource<? extends org.opengis.feature.type.FeatureType,? extends org.opengis.feature.Feature> getFeatureSource()
          Getter for property featureSource.
 Query getQuery()
          Returns the definition query established for this layer.
 CollectionSource getSource()
          Returns null.
 Style getStyle()
          Getter for property style.
 java.lang.String getTitle()
          Getter for property title.
 boolean isSelected()
          Getter for property selected.
 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 setSelected(boolean selected)
          Setter for property selected.
 void setStyle(Style style)
          Setter for property style.
 void setTitle(java.lang.String title)
          Setter for property title.
 void setVisible(boolean visible)
          Setter for property visible.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

featureSource

protected FeatureSource<? extends org.opengis.feature.type.FeatureType,? extends org.opengis.feature.Feature> 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 java.lang.String title
Holds value of property title.


visible

protected boolean visible
Whether this layer is visible or not.


selected

protected boolean selected
Whether this layer is selected or not.


listenerList

protected javax.swing.event.EventListenerList listenerList
Utility field used by event firing mechanism.


sourceListener

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

Constructor Detail

FeatureSourceMapLayer

public FeatureSourceMapLayer(FeatureSource<? extends org.opengis.feature.type.FeatureType,? extends org.opengis.feature.Feature> featureSource,
                             Style style,
                             java.lang.String title)
Constructor

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

FeatureSourceMapLayer

public FeatureSourceMapLayer(FeatureSource<? extends org.opengis.feature.type.FeatureType,? extends org.opengis.feature.Feature> featureSource,
                             Style style)
Convenience constructor that sets title to the empty string.

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

getFeatureSource

public FeatureSource<? extends org.opengis.feature.type.FeatureType,? extends org.opengis.feature.Feature> getFeatureSource()
Getter for property featureSource.

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

getSource

public CollectionSource getSource()
Returns null.

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

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:
java.lang.NullPointerException - DOCUMENT ME!

getTitle

public java.lang.String getTitle()
Getter for property title.

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

setTitle

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

Specified by:
setTitle in interface MapLayer
Parameters:
title - New value of property title.
Throws:
java.lang.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.

isSelected

public boolean isSelected()
Getter for property selected.

Specified by:
isSelected in interface MapLayer
Returns:
Value of property selected.

setSelected

public void setSelected(boolean selected)
Setter for property selected.

Specified by:
setSelected in interface MapLayer
Parameters:
selected - New value of property selected.

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:
java.lang.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)

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

fireMapLayerListenerLayerSelected

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

Parameters:
event - The event to be fired

fireMapLayerListenerLayerDeselected

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

Parameters:
event - The event to be fired

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 1996-2010 Geotools. All Rights Reserved.