MapContent
insteadpublic class DefaultMapContext extends MapContext
This implementation produces defaults as needed for:
LOGGER, viewport
Constructor and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
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 . |
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
addLayer, addLayers, dispose, finalize, fireLayerAdded, fireLayerEvent, fireLayerMoved, fireLayerPreDispose, fireLayerRemoved, fireProperty, getMaxBounds, getUserData, layers, listenToMapLayers, removeLayer, setViewport
public DefaultMapContext()
addLayer
prior to using the context.public DefaultMapContext(CoordinateReferenceSystem crs)
crs
- the coordindate reference system to be used with this context (may be null and set
later)public DefaultMapContext(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 DefaultMapContext(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 DefaultMapContext(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 DefaultMapContext(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(int index, MapLayer mapLayer)
addLayer
in class MapContext
index
- the position at which to insert the layer in the list of layers held by this
contextlayer
- the map layer to addpublic boolean addLayer(MapLayer mapLayer)
addLayer
in class MapContext
layer
- the map layer to addpublic void addLayer(FeatureSource featureSource, Style 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).
addLayer
in class MapContext
featureSource
- the source of the features for the new layerstyle
- a Style object to be used in rendering this layer.public void addLayer(CollectionSource source, Style 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.
source
- the source of the features for the new layerstyle
- a Style object to be used in rendering this layerpublic void addLayer(GridCoverage gc, Style style)
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.
addLayer
in class MapContext
gc
- the grid coveragestyle
- a Style to be used when rendering the new layerpublic void addLayer(GridCoverage2DReader reader, Style style)
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.
addLayer
in class MapContext
reader
- the grid coverage readerstyle
- a Style to be used when rendering the new layerpublic void addLayer(FeatureCollection featureCollection, Style style)
addLayer
in class MapContext
collection
- the collection of features for the new layerstyle
- a Style object to be used in rendering this layerpublic void addLayer(Collection collection, Style style)
addLayer
in class MapContext
collection
- the collection of features for the new layerstyle
- a Style object to be used in rendering this layerpublic boolean removeLayer(MapLayer layer)
removeLayer
in class MapContext
layer
- the layer to be removedpublic MapLayer removeLayer(int index)
removeLayer
in class MapContext
index
- the position of the layer in this context's list of layerspublic int addLayers(MapLayer[] array)
MapLayerListEvent
.addLayers
in class MapContext
layers
- the new layers that are to be added.public void removeLayers(MapLayer[] array)
MapLayerListEvent
.removeLayers
in class MapContext
layers
- The layers that are to be removed.public MapLayer[] getLayers()
getLayers
in class MapContext
public MapLayer getLayer(int index) throws IndexOutOfBoundsException
getLayer
in class MapContext
index
- index of layer to return.IndexOutOfBoundsException
- if the index is out of rangepublic void clearLayerList()
clearLayerList
in class MapContext
public MapViewport getViewport()
MapContent
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:
MapContent.getMaxBounds()
.
MapViewport.getBounds()
if no layers have been
added yet.
getViewport
in class MapContent
Copyright © 1996–2019 Geotools. All rights reserved.