org.geotools.map
Interface MapLayer

All Known Implementing Classes:
DefaultMapLayer

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 17701 2006-01-23 00:00:51Z desruisseaux $
Author:
Cameron Shorter, Martin Desruisseaux

Method Summary
 void addMapLayerListener(MapLayerListener listener)
          Add a listener to notify when a layer property changes.
 FeatureSource getFeatureSource()
          Get the feature collection for this layer.
 Query getQuery()
          Returns the definition query (filter) for this layer.
 Style getStyle()
          Get the style for this layer.
 java.lang.String getTitle()
          Get the title of this layer.
 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 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

public FeatureSource getFeatureSource()
Get the feature collection for this layer. If features has not been set yet, then null is returned.

Returns:
the features for this layer.

getStyle

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

Returns:
The style (SLD).

setStyle

public 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

public 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

public 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

public 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

public 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

getQuery

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

Returns:

setQuery

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

addMapLayerListener

public 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

public 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 © GeoTools. All Rights Reserved.