|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectMapContent
public class MapContent
Stores the contents of a map for display, including a list of layers, a MapViewport defining the device and world bounds of display area, and optional user data.
Methods are provided to add, remove and reorder layers. Alternatively, the list of layers can be accessed directly with the layers(). For example:
mapContent.layers().add( newLayer );
Operations on the list returned by the layers{}
method are guaranteed to
be thread safe, and modifying the list contents will result in MapLayerListEvents
being published.
Note: This object is similar to early drafts of the OGC Open Web Service Context specification.
Field Summary | |
---|---|
protected static Logger |
LOGGER
The logger for the map module. |
protected MapViewport |
viewport
Viewport for map rendering. |
Constructor Summary | |
---|---|
MapContent()
Creates a new map content. |
|
MapContent(CoordinateReferenceSystem crs)
Deprecated. |
|
MapContent(MapContext context)
|
|
MapContent(MapLayer[] array)
Deprecated. |
|
MapContent(MapLayer[] array,
CoordinateReferenceSystem crs)
Deprecated. |
|
MapContent(MapLayer[] array,
String title,
String contextAbstract,
String contactInformation,
String[] keywords)
Deprecated. |
|
MapContent(MapLayer[] array,
String title,
String contextAbstract,
String contactInformation,
String[] keywords,
CoordinateReferenceSystem crs)
Deprecated. |
Method Summary | |
---|---|
boolean |
addLayer(Layer layer)
Add a new layer (if not already present). |
int |
addLayers(Collection<? extends Layer> layers)
Adds all layers from the input collection that are not already present in this map content. |
void |
addMapBoundsListener(MapBoundsListener listener)
Register interest in receiving MapBoundsEvent s. |
void |
addMapLayerListListener(MapLayerListListener listener)
Register interest in receiving a LayerListEvent . |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Registers PropertyChangeListener to receive events. |
void |
dispose()
Clean up any listeners or cached state associated with this MapContent. |
protected void |
finalize()
Checks that dispose has been called; producing a warning if needed. |
protected void |
fireLayerAdded(Layer element,
int fromIndex,
int toIndex)
|
protected void |
fireLayerEvent(Layer element,
int index,
MapLayerEvent layerEvent)
|
protected void |
fireLayerMoved(Layer element,
int toIndex)
|
protected void |
fireLayerPreDispose(Layer element,
int toIndex)
|
protected void |
fireLayerRemoved(Layer element,
int fromIndex,
int toIndex)
|
protected void |
fireProperty(String propertyName,
Object old,
Object value)
|
CoordinateReferenceSystem |
getCoordinateReferenceSystem()
The coordinate reference system used for rendering the map. |
ReferencedEnvelope |
getMaxBounds()
Get the bounding box of all the layers in this Map. |
String |
getTitle()
Get the title, returns an empty string if it has not been set yet. |
Map<String,Object> |
getUserData()
As an example it can be used to record contact details, map abstract, keywords and so forth for an OGC "Open Web Service Context" document. |
MapViewport |
getViewport()
Viewport describing the area visible on screen. |
List<Layer> |
layers()
Gets the list of layers for this map content. |
protected void |
listenToMapLayers(boolean listen)
Listen to the map layers; passing any events on to our own mapListListeners. |
void |
moveLayer(int sourcePosition,
int destPosition)
Moves a layer in the layer list. |
boolean |
removeLayer(Layer layer)
Removes the given layer, if present, and publishes a MapLayerListEvent. |
void |
removeMapBoundsListener(MapBoundsListener listener)
Remove interest in receiving a BoundingBoxEvent s. |
void |
removeMapLayerListListener(MapLayerListListener listener)
Remove interest in receiving LayerListEvent . |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes PropertyChangeListener from the list of listeners. |
void |
setTitle(String title)
Set the title of this context. |
void |
setViewport(MapViewport viewport)
Sets the viewport for this map content. |
Methods inherited from class Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Logger LOGGER
protected MapViewport viewport
Constructor Detail |
---|
public MapContent()
public MapContent(MapContext context)
@Deprecated public MapContent(CoordinateReferenceSystem crs)
@Deprecated public MapContent(MapLayer[] array)
@Deprecated public MapContent(MapLayer[] array, CoordinateReferenceSystem crs)
@Deprecated public MapContent(MapLayer[] array, String title, String contextAbstract, String contactInformation, String[] keywords)
@Deprecated public MapContent(MapLayer[] array, String title, String contextAbstract, String contactInformation, String[] keywords, CoordinateReferenceSystem crs)
Method Detail |
---|
protected void finalize() throws Throwable
finalize
in class Object
Throwable
public void dispose()
Please note that open connections (FeatureSources and GridCoverage readers) are the responsibility of your application and are not cleaned up by this method.
public void addMapLayerListListener(MapLayerListListener listener)
LayerListEvent
. A LayerListEvent
is
sent if a layer is added or removed, but not if the data within a layer changes.
listener
- The object to notify when Layers have changed.protected void listenToMapLayers(boolean listen)
This method only has an effect if we have any actuall mapListListeners.
listen
- True to connect to all the layers and listen to eventspublic void removeMapLayerListListener(MapLayerListListener listener)
LayerListEvent
.
listener
- The object to stop sending LayerListEvent
s.public boolean addLayer(Layer layer)
In an interactive setting this will trigger a LayerListEvent
layer
-
public int addLayers(Collection<? extends Layer> layers)
layers
- layers to add (may be null
or empty)
public boolean removeLayer(Layer layer)
layer
- the layer to be removed
true
if the layer was removedpublic void moveLayer(int sourcePosition, int destPosition)
sourcePosition
- existing position of the layerdestPosition
- new position of the layerpublic List<Layer> layers()
protected void fireLayerAdded(Layer element, int fromIndex, int toIndex)
protected void fireLayerRemoved(Layer element, int fromIndex, int toIndex)
protected void fireLayerMoved(Layer element, int toIndex)
protected void fireLayerPreDispose(Layer element, int toIndex)
protected void fireLayerEvent(Layer element, int index, MapLayerEvent layerEvent)
public ReferencedEnvelope getMaxBounds()
IOException
- if an IOException occurs while accessing the FeatureSource boundspublic MapViewport getViewport()
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:
getMaxBounds()
.MapViewport.getBounds()
if no layers have been
added yet.
public void setViewport(MapViewport viewport)
viewport
argument may
be null
, in which case a subsequent to getViewport()
will return a new instance with default settings.
viewport
- the new viewportpublic void addMapBoundsListener(MapBoundsListener listener)
MapBoundsEvent
s.
listener
- The object to notify when the area of interest has changed.public void removeMapBoundsListener(MapBoundsListener listener)
BoundingBoxEvent
s.
listener
- The object to stop sending change events.public CoordinateReferenceSystem getCoordinateReferenceSystem()
The coordinate reference system used for rendering is often considered to be the "world" coordinate reference system; this is distinct from the coordinate reference system used for each layer (which is often data dependent).
public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- The listener to register.public void removePropertyChangeListener(PropertyChangeListener listener)
listener
- The listener to remove.public Map<String,Object> getUserData()
Modifications to the userData will result in a propertyChange event.
public String getTitle()
public void setTitle(String title)
title
- the title.protected void fireProperty(String propertyName, Object old, Object value)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |