org.geotools.map
Class DefaultMapContext

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

Deprecated. Use MapContent instead

public class DefaultMapContext
extends MapContext

A kinder gentler implementation of MapContext that produces defaults as needed.

This implementation produces defaults as needed for:

Author:
Andrea Aime

Field Summary
 
Fields inherited from class MapContent
LOGGER, viewport
 
Constructor Summary
DefaultMapContext()
          Deprecated. Creates a default empty map context.
DefaultMapContext(CoordinateReferenceSystem crs)
          Deprecated. Creates a default empty map context
DefaultMapContext(MapLayer[] layers)
          Deprecated. Creates a map context with the provided layers.
DefaultMapContext(MapLayer[] layers, CoordinateReferenceSystem crs)
          Deprecated. Creates a map context with the provided layers and coordinate reference system
DefaultMapContext(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.
DefaultMapContext(MapLayer[] layers, String title, String contextAbstract, String contactInformation, String[] keywords, CoordinateReferenceSystem crs)
          Deprecated. Creates a new map context
 
Method Summary
 void addLayer(CollectionSource source, Style style)
          Deprecated. Add the given collection source as a new layer to the end of the list of layers held by this context and trigger a MapLayerListEvent.
 void addLayer(Collection collection, Style style)
          Deprecated. Add the given collection as a new layer to the end of the list of layers held by this context and trigger a MapLayerListEvent.
 void addLayer(FeatureCollection featureCollection, Style style)
          Deprecated. Add the given feature collection as a new layer to the end of the list of layers held by this context and trigger a MapLayerListEvent.
 void addLayer(FeatureSource featureSource, Style style)
          Deprecated. Add the given feature source as a new layer to the end of the list of layers held by this context and trigger a MapLayerListEvent.
 void addLayer(GridCoverage2DReader reader, Style style)
          Deprecated. Add a grid coverage data to be supplied by the given reader as a new layer to the end of the list of layers held by this context.
 void addLayer(GridCoverage gc, Style style)
          Deprecated. Add a grid coverage as a new layer to the end of the list of layers held by this context.
 boolean addLayer(int index, MapLayer mapLayer)
          Deprecated. Add a new layer if not already present and trigger a MapLayerListEvent.
 boolean addLayer(MapLayer mapLayer)
          Deprecated. Add a new layer, if not already present, to the end of the list of layers held by this context and trigger a MapLayerListEvent If a coordinate reference system has not been set for the context an attempt is made to retrieve one from the new layer and use that as the context's CRS.
 int addLayers(MapLayer[] array)
          Deprecated. Add an array of new layers to this context and trigger a MapLayerListEvent.
 void clearLayerList()
          Deprecated. Remove all of the map layers from this context.
 MapLayer getLayer(int index)
          Deprecated. Return the requested layer.
 MapLayer[] getLayers()
          Deprecated. Return this model's list of layers.
 MapViewport getViewport()
          Deprecated. Viewport describing the area visible on screen.
 MapLayer removeLayer(int index)
          Deprecated. Remove the layer at the given position in the list of layers held by this context.
 boolean removeLayer(MapLayer layer)
          Deprecated. Remove the given layer from this context, if present, and trigger a MapLayerListEvent
 void removeLayers(MapLayer[] array)
          Deprecated. Remove an array of layers, if present, and trigger a MapLayerListEvent.
 
Methods inherited from class MapContext
addMapBoundsListener, addMapLayerListListener, addPropertyChangeListener, getAbstract, getAreaOfInterest, getContactInformation, getCoordinateReferenceSystem, getKeywords, getLayerBounds, getLayerCount, getTitle, indexOf, iterator, moveLayer, removeMapBoundsListener, removeMapLayerListListener, removePropertyChangeListener, setAbstract, setAreaOfInterest, setAreaOfInterest, setContactInformation, setCoordinateReferenceSystem, setKeywords, setTitle, toLayerList, transform
 
Methods inherited from class MapContent
addLayer, addLayers, dispose, finalize, fireLayerAdded, fireLayerEvent, fireLayerMoved, fireLayerPreDispose, fireLayerRemoved, fireProperty, getMaxBounds, getUserData, layers, listenToMapLayers, removeLayer, setViewport
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMapContext

public DefaultMapContext()
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.


DefaultMapContext

public DefaultMapContext(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)

DefaultMapContext

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

DefaultMapContext

public DefaultMapContext(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)

DefaultMapContext

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

DefaultMapContext

public DefaultMapContext(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(int index,
                        MapLayer mapLayer)
Deprecated. 
Add a new layer if not already present and trigger a MapLayerListEvent. If a coordinate reference system has not been set for the context an attempt is made to retrieve one from the new layer and use that as the context's CRS.

Overrides:
addLayer in class MapContext
Parameters:
index - the position at which to insert the layer in the list of layers held by this context
layer - the map layer to add
Returns:
true if the layer was added; false otherwise (layer was already present)

addLayer

public boolean addLayer(MapLayer mapLayer)
Deprecated. 
Add a new layer, if not already present, to the end of the list of layers held by this context and trigger a MapLayerListEvent If a coordinate reference system has not been set for the context an attempt is made to retrieve one from the new layer and use that as the context's CRS.

Overrides:
addLayer in class MapContext
Parameters:
layer - the map layer to add
Returns:
true if the layer was added; false otherwise (layer was already present)

addLayer

public void addLayer(FeatureSource featureSource,
                     Style style)
Deprecated. 
Add the given feature source as a new layer to the end of the list of layers held by this context and trigger a MapLayerListEvent. This is a convenience method equivalent to addLayer(int, org.geotools.map.MapLayer)(new DefaultMapLayer(featureSource, style).

If a coordinate reference system has not been set for the context an attempt is made to retrieve one from the new layer and use that as the context's CRS.

If style is null, a default style is created using SLD#createSimpleStyle(org.opengis.feature.simple.SimpleFeatureType).

Overrides:
addLayer in class MapContext
Parameters:
featureSource - the source of the features for the new layer
style - a Style object to be used in rendering this layer.

addLayer

public void addLayer(CollectionSource source,
                     Style style)
Deprecated. 
Add the given collection source as a new layer to the end of the list of layers held by this context and trigger a MapLayerListEvent. This is a convenience method equivalent to addLayer(int, org.geotools.map.MapLayer)(new DefaultMapLayer(source, style).

If a coordinate reference system has not been set for the context an attempt is made to retrieve one from the new layer and use that as the context's CRS.

Parameters:
source - the source of the features for the new layer
style - a Style object to be used in rendering this layer

addLayer

public void addLayer(GridCoverage gc,
                     Style style)
Deprecated. 
Add a grid coverage as a new layer to the end of the list of layers held by this context.

If a coordinate reference system has not been set for the context an attempt is made to retrieve one from the grid coverage and use that as the context's CRS.

Overrides:
addLayer in class MapContext
Parameters:
gc - the grid coverage
style - a Style to be used when rendering the new layer

addLayer

public void addLayer(GridCoverage2DReader reader,
                     Style style)
Deprecated. 
Add a grid coverage data to be supplied by the given reader as a new layer to the end of the list of layers held by this context.

If a coordinate reference system has not been set for the context an attempt is made to retrieve one from the reader and use that as the context's CRS.

Overrides:
addLayer in class MapContext
Parameters:
reader - the grid coverage reader
style - a Style to be used when rendering the new layer

addLayer

public void addLayer(FeatureCollection featureCollection,
                     Style style)
Deprecated. 
Add the given feature collection as a new layer to the end of the list of layers held by this context and trigger a MapLayerListEvent. This is a convenience method equivalent to addLayer(int, org.geotools.map.MapLayer)(new DefaultMapLayer(collection, style).

Overrides:
addLayer in class MapContext
Parameters:
collection - the collection of features for the new layer
style - a Style object to be used in rendering this layer

addLayer

public void addLayer(Collection collection,
                     Style style)
Deprecated. 
Add the given collection as a new layer to the end of the list of layers held by this context and trigger a MapLayerListEvent. This is a convenience method equivalent to addLayer(int, org.geotools.map.MapLayer)(new DefaultMapLayer(collection, style).

Overrides:
addLayer in class MapContext
Parameters:
collection - the collection of features for the new layer
style - a Style object to be used in rendering this layer

removeLayer

public boolean removeLayer(MapLayer layer)
Deprecated. 
Remove the given layer from this context, if present, and trigger a MapLayerListEvent

Overrides:
removeLayer in class MapContext
Parameters:
layer - the layer to be removed
Returns:
true if the layer was present; false otherwise

removeLayer

public MapLayer removeLayer(int index)
Deprecated. 
Remove the layer at the given position in the list of layers held by this context. The position must be valid or an IndexOutOfBoundsException will result. CAlling this method triggers a MapLayerListEvent.

Overrides:
removeLayer in class MapContext
Parameters:
index - the position of the layer in this context's list of layers
Returns:
the layer that was removed

addLayers

public int addLayers(MapLayer[] array)
Deprecated. 
Add an array of new layers to this context and trigger a MapLayerListEvent.

Overrides:
addLayers in class MapContext
Parameters:
layers - the new layers that are to be added.
Returns:
the number of new layers actually added (will be less than the length of the layers array if some layers were already present)

removeLayers

public void removeLayers(MapLayer[] array)
Deprecated. 
Remove an array of layers, if present, and trigger a MapLayerListEvent.

Overrides:
removeLayers in class MapContext
Parameters:
layers - The layers that are to be removed.

getLayers

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

Overrides:
getLayers in class MapContext
Returns:
This model's list of layers.

getLayer

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

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

clearLayerList

public void clearLayerList()
Deprecated. 
Remove all of the map layers from this context. This triggers a MapLayerListEvent.

Overrides:
clearLayerList in class MapContext

getViewport

public MapViewport getViewport()
Deprecated. 
Description copied from class: MapContent
Viewport describing the area visible on screen.

Applications may create multiple viewports (perhaps to render tiles of content); the viewport recorded here is intended for interactive applications where it is helpful to have a single viewport representing what the user is seeing on screen.

With that in mind; if the user has not already supplied a viewport one will be created:

Overrides:
getViewport in class MapContent
Returns:
MapViewport describing how to draw this map


Copyright © 1996-2014 Geotools. All Rights Reserved.