org.geotools.map
Interface MapLayer

All Known Implementing Classes:
DefaultMapLayer, FeatureSourceMapLayer, WMSMapLayer

public interface MapLayer

A layer to be rendered on a device. A layer is an aggregation of both a FeatureCollection, a Style and, optionally, a Query

Version:
$Id: MapLayer.java 32675 2009-03-24 00:11:46Z mbedward $
Author:
Cameron Shorter, Martin Desruisseaux

Method Summary
 void addMapLayerListener(MapLayerListener listener)
          Add a listener to notify when a layer property changes.
 ReferencedEnvelope getBounds()
          find out the bounds of the layer
 FeatureSource<? extends org.opengis.feature.type.FeatureType,? extends org.opengis.feature.Feature> getFeatureSource()
          Get the feature collection for this layer.
 Query getQuery()
          Returns the definition query (filter) for this layer.
 CollectionSource getSource()
          Get the data source for this layer.
 Style getStyle()
          Get the style for this layer.
 java.lang.String getTitle()
          Get the title of this layer.
 boolean isSelected()
          Determine whether this layer is currently selected.
 boolean isVisible()
          Determine whether this layer is visible on a map pane or whether the layer is hidden.
 void removeMapLayerListener(MapLayerListener listener)
          Removes a listener from the listener list for this layer.
 void setQuery(Query query)
          Sets a definition query for the layer wich acts as a filter for the features that the layer will draw.
 void setSelected(boolean selected)
          Specify whether this layer is selected.
 void setStyle(Style style)
          Sets the style for this layer.
 void setTitle(java.lang.String title)
          Set the title of this layer.
 void setVisible(boolean visible)
          Specify whether this layer is visible on a map pane or whether the layer is hidden.
 

Method Detail

getFeatureSource

FeatureSource<? extends org.opengis.feature.type.FeatureType,? extends org.opengis.feature.Feature> getFeatureSource()
Get the feature collection for this layer.

Returns:
The features for this layer, null if not yet set or if Source is used.

getSource

CollectionSource getSource()
Get the data source for this layer.

Returns:
Data source for this layer, null if not yet set or if FeatureSource is used

getStyle

Style getStyle()
Get the style for this layer. If style has not been set, then null is returned.

Returns:
The style (SLD).

setStyle

void setStyle(Style style)
Sets the style for this layer. If a style has not been defined a default one is used.

Parameters:
style - The new style

getTitle

java.lang.String getTitle()
Get the title of this layer. If title has not been defined then an empty string is returned.

Returns:
The title of this layer.

setTitle

void setTitle(java.lang.String title)
Set the title of this layer. A LayerEvent is fired if the new title is different from the previous one.

Parameters:
title - The title of this layer.

isVisible

boolean isVisible()
Determine whether this layer is visible on a map pane or whether the layer is hidden.

Returns:
true if the layer is visible, or false if the layer is hidden.

setVisible

void setVisible(boolean visible)
Specify whether this layer is visible on a map pane or whether the layer is hidden. A LayerEvent is fired if the visibility changed.

Parameters:
visible - Show the layer if true, or hide the layer if false

isSelected

boolean isSelected()
Determine whether this layer is currently selected.

Returns:
true if the layer is selected, or false otherwise

setSelected

void setSelected(boolean selected)
Specify whether this layer is selected. A LayerEvent iw fired if the selected status is changed.

Parameters:
selected - Set the layer as selected if true or as unselected if false

getQuery

Query getQuery()
Returns the definition query (filter) for this layer. If no definition query has been defined Query.ALL is returned.


setQuery

void setQuery(Query query)
Sets a definition query for the layer wich acts as a filter for the features that the layer will draw.

A consumer must ensure that this query is used in combination with the bounding box filter generated on each map interaction to limit the number of features returned to those that complains both the definition query and relies inside the area of interest.

IMPORTANT: only include attribute names in the query if you want them to be ALWAYS returned. It is desirable to not include attributes at all but let the layer user (a renderer?) to decide wich attributes are actually needed to perform its requiered operation.

Parameters:
query -

getBounds

ReferencedEnvelope getBounds()
find out the bounds of the layer

Returns:
- the layer's bounds

addMapLayerListener

void addMapLayerListener(MapLayerListener listener)
Add a listener to notify when a layer property changes. Changes include layer visibility and the title text.

Parameters:
listener - The listener to add to the listener list.

removeMapLayerListener

void removeMapLayerListener(MapLayerListener listener)
Removes a listener from the listener list for this layer.

Parameters:
listener - The listener to remove from the listener list.


Copyright © 1996-2010 Geotools. All Rights Reserved.