org.geotools.map
Interface MapContext

All Known Implementing Classes:
DefaultMapContext

public interface MapContext

Store context information about a map display. This object is based on the OGC Web Map Context Specification.

Version:
$Id: MapContext.java 17701 2006-01-23 00:00:51Z desruisseaux $
Author:
Cameron Shorter

Method Summary
 void addLayer(FeatureCollection collection, Style style)
          Add a new layer and trigger a LayerListEvent.
 void addLayer(FeatureSource featureSource, Style style)
          Add a new layer and trigger a LayerListEvent.
 void addLayer(org.opengis.coverage.grid.GridCoverage gridCoverage, Style style)
          Add a new layer and trigger a LayerListEvent
 boolean addLayer(int index, MapLayer layer)
          Add a new layer in the specified position and trigger a LayerListEvent.
 boolean addLayer(MapLayer layer)
          Add a new layer if not already present and trigger a LayerListEvent.
 int addLayers(MapLayer[] layers)
          Add an array of new layers and trigger a LayerListEvent.
 void addMapBoundsListener(MapBoundsListener listener)
          Register interest in receiving MapBoundsEvents.
 void addMapLayerListListener(MapLayerListListener listener)
          Register interest in receiving a LayerListEvent.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Registers PropertyChangeListener to receive events.
 void clearLayerList()
          Clears the whole layer list.
 java.lang.String getAbstract()
          Get the abstract which describes this interface, returns an empty string if this has not been set yet.
 com.vividsolutions.jts.geom.Envelope getAreaOfInterest()
          Gets the current area of interest.
 java.lang.String getContactInformation()
          Get the contact information associated with this context, returns an empty string if contactInformation has not been set.
 org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
          Get the current coordinate system.
 java.lang.String[] getKeywords()
          Get an array of keywords associated with this context, returns an empty array if no keywords have been set.
 MapLayer getLayer(int index)
          Return the requested layer.
 com.vividsolutions.jts.geom.Envelope getLayerBounds()
          Get the bounding box of all the layers in this MapContext.
 int getLayerCount()
          Returns the number of layers in this map context
 MapLayer[] getLayers()
          Return this model's list of layers.
 java.lang.String getTitle()
          Get the title, returns an empty string if it has not been set yet.
 int indexOf(MapLayer layer)
          Returns the index of the first occurrence of the specified layer, or -1 if this list does not contain this element.
 java.util.Iterator iterator()
          Returns an iterator over the layers in this context in proper sequence.
 void moveLayer(int sourcePosition, int destPosition)
          Moves a layer from a position to another.
 MapLayer removeLayer(int index)
          Remove a layer and trigger a LayerListEvent.
 boolean removeLayer(MapLayer layer)
          Remove a layer, if present, and trigger a LayerListEvent.
 void removeLayers(MapLayer[] layers)
          Remove an array of layers and trigger a LayerListEvent.
 void removeMapBoundsListener(MapBoundsListener listener)
          Remove interest in receiving a BoundingBoxEvents.
 void removeMapLayerListListener(MapLayerListListener listener)
          Remove interest in receiving LayerListEvent.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes PropertyChangeListener from the list of listeners.
 void setAbstract(java.lang.String conAbstract)
          Set an abstract which describes this context.
 void setAreaOfInterest(com.vividsolutions.jts.geom.Envelope areaOfInterest)
          Set a new area of interest and trigger an BoundingBoxEvent.
 void setAreaOfInterest(com.vividsolutions.jts.geom.Envelope areaOfInterest, org.opengis.referencing.crs.CoordinateReferenceSystem coordinateReferenceSystem)
          Set a new area of interest and trigger a BoundingBoxEvent.
 void setContactInformation(java.lang.String contactInformation)
          Set contact inforation associated with this class.
 void setKeywords(java.lang.String[] keywords)
          Set an array of keywords to associate with this context.
 void setTitle(java.lang.String title)
          Set the title of this context.
 void transform(java.awt.geom.AffineTransform transform)
          Transform the coordinates according to the provided transform.
 

Method Detail

addLayer

public boolean addLayer(MapLayer layer)
Add a new layer if not already present and trigger a LayerListEvent.

Parameters:
layer - the layer to be inserted
Returns:
true if the layer has been added, false otherwise

addLayer

public boolean addLayer(int index,
                        MapLayer layer)
Add a new layer in the specified position and trigger a LayerListEvent. Layer won't be added if it's already in the list.

Parameters:
index - index at which the layer will be inserted
layer - the layer to be inserted
Returns:
true if the layer has been added, false otherwise

addLayer

public void addLayer(FeatureSource featureSource,
                     Style style)
Add a new layer and trigger a LayerListEvent.


addLayer

public void addLayer(FeatureCollection collection,
                     Style style)
Add a new layer and trigger a LayerListEvent.


addLayer

public void addLayer(org.opengis.coverage.grid.GridCoverage gridCoverage,
                     Style style)
Add a new layer and trigger a LayerListEvent

Returns:

removeLayer

public boolean removeLayer(MapLayer layer)
Remove a layer, if present, and trigger a LayerListEvent.

Returns:
true if the layer has been removed

removeLayer

public MapLayer removeLayer(int index)
Remove a layer and trigger a LayerListEvent.

Parameters:
index - The index of the layer that it's going to be removed
Returns:
the layer removed, if any

addLayers

public int addLayers(MapLayer[] layers)
Add an array of new layers and trigger a LayerListEvent.

Parameters:
layers - The new layers that are to be added.
Returns:
the number of layers actually added to the MapContext

removeLayers

public void removeLayers(MapLayer[] layers)
Remove an array of layers and trigger a LayerListEvent.

Parameters:
layers - The layers that are to be removed.

clearLayerList

public void clearLayerList()
Clears the whole layer list. Will fire a LayerListChangedEvent


getLayers

public MapLayer[] getLayers()
Return this model's list of layers. If no layers are present, then an empty array is returned.

Returns:
This model's list of layers.

getLayer

public MapLayer getLayer(int index)
                  throws java.lang.IndexOutOfBoundsException
Return the requested layer.

Parameters:
index - index of layer to return.
Returns:
the layer at the specified position
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range

moveLayer

public void moveLayer(int sourcePosition,
                      int destPosition)
Moves a layer from a position to another. Will fire a MapLayerListEvent

Parameters:
sourcePosition - the layer current position
destPosition - the layer new position

iterator

public java.util.Iterator iterator()
Returns an iterator over the layers in this context in proper sequence.

Returns:
an iterator over the layers in this context in proper sequence.

indexOf

public int indexOf(MapLayer layer)
Returns the index of the first occurrence of the specified layer, or -1 if this list does not contain this element.

Returns:
DOCUMENT ME!

getLayerCount

public int getLayerCount()
Returns the number of layers in this map context

Returns:
the number of layers in this map context

getLayerBounds

public com.vividsolutions.jts.geom.Envelope getLayerBounds()
                                                    throws java.io.IOException
Get the bounding box of all the layers in this MapContext. If all the layers cannot determine the bounding box in the speed required for each layer, then null is returned. The bounds will be expressed in the MapContext coordinate system.

Returns:
The bounding box of the features or null if unknown and too expensive for the method to calculate.
Throws:
java.io.IOException - if an IOException occurs while accessing the FeatureSource bounds

addMapLayerListListener

public void addMapLayerListListener(MapLayerListListener listener)
Register interest in receiving a LayerListEvent. A LayerListEvent is sent if a layer is added or removed, but not if the data within a layer changes.

Parameters:
listener - The object to notify when Layers have changed.

removeMapLayerListListener

public void removeMapLayerListListener(MapLayerListListener listener)
Remove interest in receiving LayerListEvent.

Parameters:
listener - The object to stop sending LayerListEvents.

setAreaOfInterest

public void setAreaOfInterest(com.vividsolutions.jts.geom.Envelope areaOfInterest,
                              org.opengis.referencing.crs.CoordinateReferenceSystem coordinateReferenceSystem)
                       throws java.lang.IllegalArgumentException
Set a new area of interest and trigger a BoundingBoxEvent. Note that this is the only method to change coordinate system. A setCoordinateReferenceSystem method is not provided to ensure this class is not dependant on transform classes.

Parameters:
areaOfInterest - The new areaOfInterest.
Throws:
java.lang.IllegalArgumentException - if an argument is null.

setAreaOfInterest

public void setAreaOfInterest(com.vividsolutions.jts.geom.Envelope areaOfInterest)
Set a new area of interest and trigger an BoundingBoxEvent.

Parameters:
areaOfInterest - The new area of interest.
Throws:
java.lang.IllegalArgumentException - if an argument is null.

getAreaOfInterest

public com.vividsolutions.jts.geom.Envelope getAreaOfInterest()
Gets the current area of interest.

Returns:
Current area of interest

getCoordinateReferenceSystem

public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
Get the current coordinate system.

Returns:
the coordinate system of this box.

transform

public void transform(java.awt.geom.AffineTransform transform)
Transform the coordinates according to the provided transform. Useful for zooming and panning processes.

Parameters:
transform - The transform to change area of interest.

addMapBoundsListener

public void addMapBoundsListener(MapBoundsListener listener)
Register interest in receiving MapBoundsEvents.

Parameters:
listener - The object to notify when the area of interest has changed.

removeMapBoundsListener

public void removeMapBoundsListener(MapBoundsListener listener)
Remove interest in receiving a BoundingBoxEvents.

Parameters:
listener - The object to stop sending change events.

getAbstract

public java.lang.String getAbstract()
Get the abstract which describes this interface, returns an empty string if this has not been set yet.

Returns:
The Abstract.

setAbstract

public void setAbstract(java.lang.String conAbstract)
Set an abstract which describes this context.

Parameters:
conAbstract - the Abstract.

getContactInformation

public java.lang.String getContactInformation()
Get the contact information associated with this context, returns an empty string if contactInformation has not been set.

Returns:
the ContactInformation.

setContactInformation

public void setContactInformation(java.lang.String contactInformation)
Set contact inforation associated with this class.

Parameters:
contactInformation - the ContactInformation.

getKeywords

public java.lang.String[] getKeywords()
Get an array of keywords associated with this context, returns an empty array if no keywords have been set. The array returned is a copy, changes to the returned array won't influence the MapContextState

Returns:
array of keywords

setKeywords

public void setKeywords(java.lang.String[] keywords)
Set an array of keywords to associate with this context.

Parameters:
keywords - the Keywords.

getTitle

public java.lang.String getTitle()
Get the title, returns an empty string if it has not been set yet.

Returns:
the title, or an empty string if it has not been set.

setTitle

public void setTitle(java.lang.String title)
Set the title of this context.

Parameters:
title - the title.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Registers PropertyChangeListener to receive events.

Parameters:
listener - The listener to register.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes PropertyChangeListener from the list of listeners.

Parameters:
listener - The listener to remove.


Copyright © GeoTools. All Rights Reserved.