org.geotools.map
Interface MapContext

All Known Implementing Classes:
DefaultMapContext, GraphicEnhancedMapContext

public interface MapContext

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

Author:
Cameron Shorter
Module:
modules/library/render (gt-render.jar)

Method Summary
 void addLayer(AbstractGridCoverage2DReader gridCoverage, Style style)
          Add a new layer and trigger a LayerListEvent
 void addLayer(Collection collection, Style style)
          Add a new layer and trigger a LayerListEvent.
 void addLayer(FeatureCollection<SimpleFeatureType,SimpleFeature> collection, Style style)
          Add a new layer and trigger a LayerListEvent.
 void addLayer(FeatureSource<SimpleFeatureType,SimpleFeature> featureSource, Style style)
          Add a new layer and trigger a LayerListEvent.
 void addLayer(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(PropertyChangeListener listener)
          Registers PropertyChangeListener to receive events.
 void clearLayerList()
          Clears the whole layer list.
 String getAbstract()
          Get the abstract which describes this interface, returns an empty string if this has not been set yet.
 ReferencedEnvelope getAreaOfInterest()
          Gets the current area of interest.
 String getContactInformation()
          Get the contact information associated with this context, returns an empty string if contactInformation has not been set.
 CoordinateReferenceSystem getCoordinateReferenceSystem()
          Get the current coordinate system.
 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.
 ReferencedEnvelope 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.
 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.
 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(PropertyChangeListener listener)
          Removes PropertyChangeListener from the list of listeners.
 void setAbstract(String conAbstract)
          Set an abstract which describes this context.
 void setAreaOfInterest(Envelope areaOfInterest)
          Deprecated. Use of this method is not safe. Please use setAreaOfInterest(Envelope, CoordinateReferenceSystem) instead.
 void setAreaOfInterest(Envelope areaOfInterest, CoordinateReferenceSystem crs)
          Set the area of interest.
 void setAreaOfInterest(ReferencedEnvelope areaOfInterest)
          Set the area of interest.
 void setContactInformation(String contactInformation)
          Set contact inforation associated with this class.
 void setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
          Set the CoordinateReferenceSystem for this map context.
 void setKeywords(String[] keywords)
          Set an array of keywords to associate with this context.
 void setTitle(String title)
          Set the title of this context.
 void transform(AffineTransform transform)
          Transform the coordinates according to the provided transform.
 

Method Detail

addLayer

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

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

void addLayer(FeatureSource<SimpleFeatureType,SimpleFeature> featureSource,
              Style style)
Add a new layer and trigger a LayerListEvent.

Parameters:
featureSource - a FeatureSource with the new layer that will be added.

addLayer

void addLayer(FeatureCollection<SimpleFeatureType,SimpleFeature> collection,
              Style style)
Add a new layer and trigger a LayerListEvent.

Parameters:
collection - a FeatureCollection with the new layer that will be added.

addLayer

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

Parameters:
collection - Collection with the new layer that will be added.

addLayer

void addLayer(GridCoverage gridCoverage,
              Style style)
Add a new layer and trigger a LayerListEvent

Parameters:
gridCoverage - a GridCoverage with the new layer that will be added.

addLayer

void addLayer(AbstractGridCoverage2DReader gridCoverage,
              Style style)
Add a new layer and trigger a LayerListEvent

Parameters:
gridCoverage - an AbstractGridCoverage2DReader with the new layer that will be added.

removeLayer

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

Parameters:
layer - a MapLayer that will be added.
Returns:
true if the layer has been removed

removeLayer

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

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

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

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

clearLayerList

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


getLayers

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

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

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

moveLayer

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

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

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.

Parameters:
layer - the MapLayer to search for
Returns:
DOCUMENT ME!

getLayerCount

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

Returns:
the number of layers in this map context

getLayerBounds

ReferencedEnvelope getLayerBounds()
                                  throws 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:
IOException - if an IOException occurs while accessing the FeatureSource bounds

addMapLayerListListener

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

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

Parameters:
listener - The object to stop sending LayerListEvents.

setAreaOfInterest

void setAreaOfInterest(Envelope areaOfInterest)
                       throws IllegalArgumentException
Deprecated. Use of this method is not safe. Please use setAreaOfInterest(Envelope, CoordinateReferenceSystem) instead.

Set the area of interest. This triggers a MapBoundsEvent to be published.

Parameters:
areaOfInterest - the new area of interest
Throws:
IllegalArgumentException - if the argument is null

setAreaOfInterest

void setAreaOfInterest(Envelope areaOfInterest,
                       CoordinateReferenceSystem crs)
                       throws IllegalArgumentException
Set the area of interest. This triggers a MapBoundsEvent to be published.

Parameters:
areaOfInterest - the new area of interest
coordinateReferenceSystem - the CRS for the new area of interest
Throws:
IllegalArgumentException - if either argument is null

setAreaOfInterest

void setAreaOfInterest(ReferencedEnvelope areaOfInterest)
                       throws IllegalArgumentException
Set the area of interest. This triggers a MapBoundsEvent to be published.

Parameters:
areaOfInterest - the new area of interest
Throws:
IllegalArgumentException - if the provided areaOfInterest is null or does not have a coordinate reference system

getAreaOfInterest

ReferencedEnvelope getAreaOfInterest()
Gets the current area of interest.

Returns:
Current area of interest

getCoordinateReferenceSystem

CoordinateReferenceSystem getCoordinateReferenceSystem()
Get the current coordinate system.

Returns:
the coordinate system of this box.

transform

void transform(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

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

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

removeMapBoundsListener

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

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

getAbstract

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

Returns:
The Abstract.

setAbstract

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

Parameters:
conAbstract - the Abstract.

getContactInformation

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

Returns:
the ContactInformation.

setContactInformation

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

Parameters:
contactInformation - the ContactInformation.

setCoordinateReferenceSystem

void setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
                                  throws TransformException,
                                         FactoryException
Set the CoordinateReferenceSystem for this map context.

Parameters:
crs -
Throws:
FactoryException
TransformException

getKeywords

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

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

Parameters:
keywords - the Keywords.

getTitle

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

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

Parameters:
title - the title.

addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener listener)
Registers PropertyChangeListener to receive events.

Parameters:
listener - The listener to register.

removePropertyChangeListener

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

Parameters:
listener - The listener to remove.


Copyright © 1996-2010 Geotools. All Rights Reserved.