org.geotools.map
Class MapContext

Object
  extended by MapContent
      extended by MapContext
Direct Known Subclasses:
DefaultMapContext

Deprecated. This class is being phased out, please use MapContent.

public class MapContext
extends MapContent

Extension of MapContent to cover the requirements of the OGC Map Context specifications.

The following OGC specifications (or working drafts) are the inspiration for this class:

At this time the primary difference is the provision of contact details, map abstract and keywords.

Author:
Cameron Shorter

Field Summary
 
Fields inherited from class MapContent
LOGGER, viewport
 
Constructor Summary
MapContext()
          Deprecated. Creates a default empty map context.
MapContext(CoordinateReferenceSystem crs)
          Deprecated. Creates a default empty map context
MapContext(MapContent content)
          Deprecated. Creates a context from the provided map content.
MapContext(MapLayer[] layers)
          Deprecated. Creates a map context with the provided layers.
MapContext(MapLayer[] layers, CoordinateReferenceSystem crs)
          Deprecated. Creates a map context with the provided layers and coordinate reference system
MapContext(MapLayer[] layers, String title, String contextAbstract, String contactInformation, String[] keywords)
          Deprecated. Creates a map context Note, the coordinate reference system for the context will be set from that of the first layer with an available CRS.
MapContext(MapLayer[] layers, String title, String contextAbstract, String contactInformation, String[] keywords, CoordinateReferenceSystem crs)
          Deprecated. Creates a new map context
 
Method Summary
 void addLayer(Collection collection, Style style)
          Deprecated. Add a new layer and trigger a LayerListEvent.
 void addLayer(FeatureCollection featureCollection, Style style)
          Deprecated. Add a new layer and trigger a LayerListEvent.
 void addLayer(FeatureSource featureSource, Style style)
          Deprecated. Add a new layer and trigger a LayerListEvent.
 void addLayer(GridCoverage2DReader reader, Style style)
          Deprecated. Add a new layer and trigger a LayerListEvent
 void addLayer(GridCoverage gridCoverage, Style style)
          Deprecated. Add a new layer and trigger a LayerListEvent
 boolean addLayer(int index, MapLayer mapLayer)
          Deprecated. Add a new layer in the specified position and trigger a LayerListEvent.
 boolean addLayer(MapLayer mapLayer)
          Deprecated. Add a new layer if not already present and trigger a LayerListEvent.
 int addLayers(MapLayer[] array)
          Deprecated. Add an array of new layers and trigger a LayerListEvent.
 void addMapBoundsListener(MapBoundsListener listener)
          Deprecated. Register interest in receiving MapBoundsEvents.
 void addMapLayerListListener(MapLayerListListener listener)
          Deprecated. Register interest in receiving a LayerListEvent.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Deprecated. Registers PropertyChangeListener to receive events.
 void clearLayerList()
          Deprecated. Clears the whole layer list.
 String getAbstract()
          Deprecated. Get the abstract which describes this interface, returns an empty string if this has not been set yet.
 ReferencedEnvelope getAreaOfInterest()
          Deprecated. Gets the current area of interest provided by #getViewport()#getBounds().
 String getContactInformation()
          Deprecated. Get the contact information associated with this context, returns an empty string if contactInformation has not been set.
 CoordinateReferenceSystem getCoordinateReferenceSystem()
          Deprecated. Get the current coordinate system.
 String[] getKeywords()
          Deprecated. Get an array of keywords associated with this context, returns an empty array if no keywords have been set.
 MapLayer getLayer(int index)
          Deprecated. Return the requested layer.
 ReferencedEnvelope getLayerBounds()
          Deprecated. Get the bounding box of all the layers in this MapContext.
 int getLayerCount()
          Deprecated. Returns the number of layers in this map context
 MapLayer[] getLayers()
          Deprecated. Return this model's list of layers.
 String getTitle()
          Deprecated. Get the title, returns an empty string if it has not been set yet.
 int indexOf(MapLayer mapLayer)
          Deprecated. Returns the index of the first occurrence of the specified layer, or -1 if this list does not contain this element.
 Iterator<MapLayer> iterator()
          Deprecated. Returns an iterator over the layers in this context in proper sequence.
 void moveLayer(int sourcePosition, int destPosition)
          Deprecated. Moves a layer from a position to another.
 MapLayer removeLayer(int index)
          Deprecated. Remove a layer and trigger a LayerListEvent.
 boolean removeLayer(MapLayer layer)
          Deprecated. Remove a layer, if present, and trigger a LayerListEvent.
 void removeLayers(MapLayer[] array)
          Deprecated. Remove an array of layers and trigger a LayerListEvent.
 void removeMapBoundsListener(MapBoundsListener listener)
          Deprecated. Remove interest in receiving a BoundingBoxEvents.
 void removeMapLayerListListener(MapLayerListListener listener)
          Deprecated. Remove interest in receiving LayerListEvent.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Deprecated. Removes PropertyChangeListener from the list of listeners.
 void setAbstract(String contextAbstract)
          Deprecated. Set an abstract which describes this context.
 void setAreaOfInterest(Envelope areaOfInterest, CoordinateReferenceSystem crs)
          Deprecated. Set the area of interest.
 void setAreaOfInterest(ReferencedEnvelope bounds)
          Deprecated. Set the area of interest.
 void setContactInformation(String contactInformation)
          Deprecated. Set contact information associated with this class.
 void setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
          Deprecated. Set or change the coordinate reference system for this context.
 void setKeywords(String[] keywords)
          Deprecated. Set an array of keywords to associate with this context.
 void setTitle(String title)
          Deprecated. Set the title of this context.
protected  List<Layer> toLayerList(MapLayer[] array)
          Deprecated.  
 void transform(AffineTransform transform)
          Deprecated. Transform the current area of interest for this context using the provided transform.
 
Methods inherited from class MapContent
addLayer, addLayers, dispose, finalize, fireLayerAdded, fireLayerEvent, fireLayerMoved, fireLayerPreDispose, fireLayerRemoved, fireProperty, getMaxBounds, getUserData, getViewport, layers, listenToMapLayers, removeLayer, setViewport
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapContext

public MapContext()
Deprecated. 
Creates a default empty map context. The coordinate reference system for the map context should be set explicitly, or implicitly via addLayer prior to using the context.


MapContext

public MapContext(MapContent content)
Deprecated. 
Creates a context from the provided map content.

This method is used to prevent duplication in classes supporting deprecated getMapContext() methods.

Parameters:
content - MapContent to be represented

MapContext

public MapContext(CoordinateReferenceSystem crs)
Deprecated. 
Creates a default empty map context

Parameters:
crs - the coordindate reference system to be used with this context (may be null and set later)

MapContext

public MapContext(MapLayer[] layers)
Deprecated. 
Creates a map context with the provided layers.

Note, the coordinate reference system for the context will be set from that of the first layer with an available CRS.

Parameters:
layers - an array of MapLayer objects (may be empty or null) to be added to this context

MapContext

public MapContext(MapLayer[] layers,
                  CoordinateReferenceSystem crs)
Deprecated. 
Creates a map context with the provided layers and coordinate reference system

Parameters:
layers - an array of MapLayer objects (may be empty or null) to be added to this context
crs - the coordindate reference system to be used with this context (may be null and set later)

MapContext

public MapContext(MapLayer[] layers,
                  String title,
                  String contextAbstract,
                  String contactInformation,
                  String[] keywords)
Deprecated. 
Creates a map context

Note, the coordinate reference system for the context will be set from that of the first layer with an available CRS.

Parameters:
layers - an array of MapLayer objects (may be empty or null) to be added to this context
title - a title for this context (e.g. might be used by client-code that is displaying the context's layers); may be null or an empty string
contextAbstract - a short description of the context and its contents; may be null or an empty string
contactInformation - can be used, for example, to record the creators or custodians of the data that are, or will be, held by this context; may be null or an empty string
keywords - an optional array of key words pertaining to the data that are, or will be, held by this context; may be null or a zero-length String array

MapContext

public MapContext(MapLayer[] layers,
                  String title,
                  String contextAbstract,
                  String contactInformation,
                  String[] keywords,
                  CoordinateReferenceSystem crs)
Deprecated. 
Creates a new map context

Parameters:
layers - an array of MapLayer objects (may be empty or null) to be added to this context
title - a title for this context (e.g. might be used by client-code that is displaying the context's layers); may be null or an empty string
contextAbstract - a short description of the context and its contents; may be null or an empty string
contactInformation - can be used, for example, to record the creators or custodians of the data that are, or will be, held by this context; may be null or an empty string
keywords - an optional array of key words pertaining to the data that are, or will be, held by this context; may be null or a zero-length String array
crs - the coordindate reference system to be used with this context (may be null and set later)
Method Detail

addLayer

public boolean addLayer(MapLayer mapLayer)
Deprecated. 
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 mapLayer)
Deprecated. 
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)
Deprecated. 
Add a new layer and trigger a LayerListEvent.

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

addLayer

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

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

addLayer

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

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

addLayer

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

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

addLayer

public void addLayer(GridCoverage2DReader reader,
                     Style style)
Deprecated. 
Add a new layer and trigger a LayerListEvent

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

removeLayer

public boolean removeLayer(MapLayer layer)
Deprecated. 
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

public MapLayer removeLayer(int index)
Deprecated. 
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[] array)
Deprecated. 
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[] array)
Deprecated. 
Remove an array of layers and trigger a LayerListEvent.

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

clearLayerList

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


getLayers

public MapLayer[] getLayers()
Deprecated. 
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 IndexOutOfBoundsException
Deprecated. 
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

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

Overrides:
moveLayer in class MapContent
Parameters:
sourcePosition - the layer current position
destPosition - the layer new position

iterator

public Iterator<MapLayer> iterator()
Deprecated. 
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 mapLayer)
Deprecated. 
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:
index of mapLayer or -1 if not found

getLayerCount

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

Returns:
the number of layers in this map context

getLayerBounds

public ReferencedEnvelope getLayerBounds()
                                  throws IOException
Deprecated. 
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.

This implementation is more forgiving then getMaxBounds() as it is willing to consider the bounds of layers that are incomplete and not record a coordinate reference 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

public void addMapLayerListListener(MapLayerListListener listener)
Deprecated. 
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.

Overrides:
addMapLayerListListener in class MapContent
Parameters:
listener - The object to notify when Layers have changed.

removeMapLayerListListener

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

Overrides:
removeMapLayerListListener in class MapContent
Parameters:
listener - The object to stop sending LayerListEvents.

setAreaOfInterest

public void setAreaOfInterest(Envelope areaOfInterest,
                              CoordinateReferenceSystem crs)
                       throws IllegalArgumentException
Deprecated. 
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

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

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

getAreaOfInterest

public ReferencedEnvelope getAreaOfInterest()
Deprecated. 
Gets the current area of interest provided by #getViewport()#getBounds(). If the viewport has not been created, it will be filled in by default based on the layer bounds provided by MapContent.getMaxBounds().

Returns:
Current area of interest

getCoordinateReferenceSystem

public CoordinateReferenceSystem getCoordinateReferenceSystem()
Deprecated. 
Get the current coordinate system.

Overrides:
getCoordinateReferenceSystem in class MapContent
Returns:
the coordinate system of this box.

transform

public void transform(AffineTransform transform)
Deprecated. 
Transform the current area of interest for this context using the provided transform. This may be useful for zooming and panning processes. Does nothing if no area of interest is set.

Parameters:
transform - The transform to change map viewport

addMapBoundsListener

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

Overrides:
addMapBoundsListener in class MapContent
Parameters:
listener - The object to notify when the area of interest has changed.

removeMapBoundsListener

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

Overrides:
removeMapBoundsListener in class MapContent
Parameters:
listener - The object to stop sending change events.

getAbstract

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

Returns:
The Abstract or an empty string if not present

setAbstract

public void setAbstract(String contextAbstract)
Deprecated. 
Set an abstract which describes this context.

Parameters:
conAbstract - the Abstract.

getContactInformation

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

Returns:
the ContactInformation or an empty string if not present

setContactInformation

public void setContactInformation(String contactInformation)
Deprecated. 
Set contact information associated with this class.

Parameters:
contactInformation - the ContactInformation.

setCoordinateReferenceSystem

public void setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
Deprecated. 
Set or change the coordinate reference system for this context. This will trigger a MapBoundsEvent to be published to listeners.

Parameters:
crs -
Throws:
FactoryException
TransformException

getKeywords

public String[] getKeywords()
Deprecated. 
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(String[] keywords)
Deprecated. 
Set an array of keywords to associate with this context.

Parameters:
keywords - the Keywords.

getTitle

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

Overrides:
getTitle in class MapContent
Returns:
the title, or an empty string if it has not been set.

setTitle

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

Overrides:
setTitle in class MapContent
Parameters:
title - the title.

addPropertyChangeListener

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

Overrides:
addPropertyChangeListener in class MapContent
Parameters:
listener - The listener to register.

removePropertyChangeListener

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

Overrides:
removePropertyChangeListener in class MapContent
Parameters:
listener - The listener to remove.

toLayerList

protected List<Layer> toLayerList(MapLayer[] array)
Deprecated. 


Copyright © 1996-2014 Geotools. All Rights Reserved.