MapContent
.public class MapContext extends MapContent
The following OGC specifications (or working drafts) are the inspiration for this class:
LOGGER, viewport
Constructor and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
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
MapBoundsEvent s. |
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
BoundingBoxEvent s. |
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.
|
addLayer, addLayers, dispose, finalize, fireLayerAdded, fireLayerEvent, fireLayerMoved, fireLayerPreDispose, fireLayerRemoved, fireProperty, getMaxBounds, getUserData, getViewport, layers, listenToMapLayers, removeLayer, setViewport
public MapContext()
addLayer
prior to using the context.public MapContext(MapContent content)
This method is used to prevent duplication in classes supporting deprecated getMapContext() methods.
content
- MapContent to be representedpublic MapContext(CoordinateReferenceSystem crs)
crs
- the coordindate reference system to be used with this context (may be null and set
later)public MapContext(MapLayer[] layers)
Note, the coordinate reference system for the context will be set from that of the first layer with an available CRS.
layers
- an array of MapLayer objects (may be empty or null) to be added to this contextpublic MapContext(MapLayer[] layers, CoordinateReferenceSystem crs)
layers
- an array of MapLayer objects (may be empty or null) to be added to this contextcrs
- the coordindate reference system to be used with this context (may be null and set
later)public MapContext(MapLayer[] layers, String title, String contextAbstract, String contactInformation, String[] keywords)
Note, the coordinate reference system for the context will be set from that of the first layer with an available CRS.
layers
- an array of MapLayer objects (may be empty or null) to be added to this contexttitle
- 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 stringcontextAbstract
- a short description of the context and its contents; may be null or an
empty stringcontactInformation
- 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 stringkeywords
- 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 arraypublic MapContext(MapLayer[] layers, String title, String contextAbstract, String contactInformation, String[] keywords, CoordinateReferenceSystem crs)
layers
- an array of MapLayer objects (may be empty or null) to be added to this contexttitle
- 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 stringcontextAbstract
- a short description of the context and its contents; may be null or an
empty stringcontactInformation
- 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 stringkeywords
- 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 arraycrs
- the coordindate reference system to be used with this context (may be null and set
later)public boolean addLayer(MapLayer mapLayer)
LayerListEvent
.layer
- the layer to be insertedpublic boolean addLayer(int index, MapLayer mapLayer)
LayerListEvent
. Layer won't
be added if it's already in the list.index
- index at which the layer will be insertedlayer
- the layer to be insertedpublic void addLayer(FeatureSource featureSource, Style style)
LayerListEvent
.featureSource
- a SimpleFeatureSource with the new layer that will be added.public void addLayer(FeatureCollection featureCollection, Style style)
LayerListEvent
.collection
- a SimpleFeatureCollection with the new layer that will be added.public void addLayer(Collection collection, Style style)
LayerListEvent
.collection
- Collection with the new layer that will be added.public void addLayer(GridCoverage gridCoverage, Style style)
LayerListEvent
gridCoverage
- a GridCoverage with the new layer that will be added.public void addLayer(GridCoverage2DReader reader, Style style)
LayerListEvent
gridCoverage
- an AbstractGridCoverage2DReader with the new layer that will be added.public boolean removeLayer(MapLayer layer)
LayerListEvent
.layer
- a MapLayer that will be added.public MapLayer removeLayer(int index)
LayerListEvent
.index
- The index of the layer that it's going to be removedpublic int addLayers(MapLayer[] array)
LayerListEvent
.layers
- The new layers that are to be added.public void removeLayers(MapLayer[] array)
LayerListEvent
.layers
- The layers that are to be removed.public void clearLayerList()
public MapLayer[] getLayers()
public MapLayer getLayer(int index) throws IndexOutOfBoundsException
index
- index of layer to return.IndexOutOfBoundsException
- if the index is out of rangepublic void moveLayer(int sourcePosition, int destPosition)
moveLayer
in class MapContent
sourcePosition
- the layer current positiondestPosition
- the layer new positionpublic Iterator<MapLayer> iterator()
public int indexOf(MapLayer mapLayer)
layer
- the MapLayer to search forpublic int getLayerCount()
public ReferencedEnvelope getLayerBounds() throws IOException
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.
IOException
- if an IOException occurs while accessing the FeatureSource boundspublic 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.addMapLayerListListener
in class MapContent
listener
- The object to notify when Layers have changed.public void removeMapLayerListListener(MapLayerListListener listener)
LayerListEvent
.removeMapLayerListListener
in class MapContent
listener
- The object to stop sending LayerListEvent
s.public void setAreaOfInterest(Envelope areaOfInterest, CoordinateReferenceSystem crs) throws IllegalArgumentException
areaOfInterest
- the new area of interestcoordinateReferenceSystem
- the CRS for the new area of interestIllegalArgumentException
- if either argument is null
public void setAreaOfInterest(ReferencedEnvelope bounds) throws IllegalArgumentException
bounds
- the new area of interestIllegalArgumentException
- if the provided areaOfInterest is null
or does not
have a coordinate reference systempublic ReferencedEnvelope getAreaOfInterest()
#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()
.
public CoordinateReferenceSystem getCoordinateReferenceSystem()
getCoordinateReferenceSystem
in class MapContent
public void transform(AffineTransform transform)
transform
- The transform to change map viewportpublic void addMapBoundsListener(MapBoundsListener listener)
MapBoundsEvent
s.addMapBoundsListener
in class MapContent
listener
- The object to notify when the area of interest has changed.public void removeMapBoundsListener(MapBoundsListener listener)
BoundingBoxEvent
s.removeMapBoundsListener
in class MapContent
listener
- The object to stop sending change events.public String getAbstract()
public void setAbstract(String contextAbstract)
conAbstract
- the Abstract.public String getContactInformation()
public void setContactInformation(String contactInformation)
contactInformation
- the ContactInformation.public void setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
crs
- FactoryException
TransformException
public String[] getKeywords()
public void setKeywords(String[] keywords)
keywords
- the Keywords.public String getTitle()
getTitle
in class MapContent
public void setTitle(String title)
setTitle
in class MapContent
title
- the title.public void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in class MapContent
listener
- The listener to register.public void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in class MapContent
listener
- The listener to remove.Copyright © 1996–2019 Geotools. All rights reserved.