|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectDefaultMapContext
public class DefaultMapContext
The default implementation of the MapContext interface
modules/library/render (gt-render.jar)
Field Summary | |
---|---|
protected String |
abstracts
Holds value of property abstracts. |
protected String |
contactInformation
Holds value of property contactInformation. |
protected String[] |
keywords
Holds value of property keywords. |
protected MapLayerListener |
layerListener
|
protected EventListenerList |
listenerList
Utility field used by event firing mechanism. |
static Logger |
LOGGER
The logger for the map module. |
protected PropertyChangeSupport |
propertyChangeSupport
Utility field used by bound properties. |
protected String |
title
Holds value of property title. |
Constructor Summary | |
---|---|
DefaultMapContext()
Creates a default empty map context. |
|
DefaultMapContext(CoordinateReferenceSystem crs)
Creates a default empty map context |
|
DefaultMapContext(MapLayer[] layers)
Creates a map context with the provided layers. |
|
DefaultMapContext(MapLayer[] layers,
CoordinateReferenceSystem crs)
Creates a map context with the provided layers and coordinate reference system |
|
DefaultMapContext(MapLayer[] layers,
String title,
String contextAbstract,
String contactInformation,
String[] keywords)
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)
Creates a new map context |
Method Summary | |
---|---|
void |
addLayer(AbstractGridCoverage2DReader reader,
Style style)
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(CollectionSource source,
Style style)
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)
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<SimpleFeatureType,SimpleFeature> collection,
Style style)
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<SimpleFeatureType,SimpleFeature> featureSource,
Style style)
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(GridCoverage gc,
Style style)
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 layer)
Add a new layer if not already present and trigger a MapLayerListEvent. |
boolean |
addLayer(MapLayer layer)
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[] layers)
Add an array of new layers to this context and trigger a MapLayerListEvent . |
void |
addMapBoundsListener(MapBoundsListener listener)
Registers MapBoundsListener to receive events. |
void |
addMapLayerListListener(MapLayerListListener listener)
Registers MapLayerListListener to receive events. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Registers PropertyChangeListener to receive events. |
void |
clearLayerList()
Remove all of the map layers from this context. |
String |
getAbstract()
Getter for property abstracts. |
ReferencedEnvelope |
getAreaOfInterest()
Gets the current area of interest. |
String |
getContactInformation()
Getter for property contactInformation. |
CoordinateReferenceSystem |
getCoordinateReferenceSystem()
Get the current coordinate system of this context |
String[] |
getKeywords()
Getter for property keywords. |
MapLayer |
getLayer(int index)
Return the requested layer. |
ReferencedEnvelope |
getLayerBounds()
Get the bounding box of all the layers in this MapContext. |
int |
getLayerCount()
Returns the number of layers in this map context |
MapLayer[] |
getLayers()
Return this model's list of layers. |
String |
getTitle()
Getter for property title. |
int |
indexOf(MapLayer layer)
Returns the index of the first occurrence of the specified layer, or -1 if this list does not contain this element. |
Iterator |
iterator()
Returns an iterator over the layers in this context in proper sequence. |
void |
moveLayer(int sourcePosition,
int destPosition)
Change the position of a layer in this context's list of map layers. |
MapLayer |
removeLayer(int index)
Remove the layer at the given position in the list of layers held by this context. |
boolean |
removeLayer(MapLayer layer)
Remove the given layer from this context, if present, and trigger a MapLayerListEvent |
void |
removeLayers(MapLayer[] layers)
Remove an array of layers, if present, and trigger a MapLayerListEvent . |
void |
removeMapBoundsListener(MapBoundsListener listener)
Removes MapBoundsListener from the list of listeners. |
void |
removeMapLayerListListener(MapLayerListListener listener)
Removes MapLayerListListener from the list of listeners. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes PropertyChangeListener from the list of listeners. |
void |
setAbstract(String abstractValue)
Setter for property abstracts. |
void |
setAreaOfInterest(Envelope areaOfInterest)
Deprecated. Use of this method is not safe. Please use setAreaOfInterest(Envelope, CoordinateReferenceSystem) instead. |
void |
setAreaOfInterest(Envelope areaOfInterest,
CoordinateReferenceSystem crs)
Set the area of interest. |
void |
setAreaOfInterest(ReferencedEnvelope areaOfInterest)
Set the area of interest. |
void |
setContactInformation(String contactInformation)
Setter for property contactInformation. |
void |
setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
Set or change the coordinate reference system for this context. |
void |
setKeywords(String[] keywords)
Setter for property keywords. |
void |
setTitle(String title)
Setter for property title. |
void |
transform(AffineTransform transform)
Transform the current area of interest for this context using the provided transform. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Logger LOGGER
protected EventListenerList listenerList
protected MapLayerListener layerListener
protected String abstracts
protected PropertyChangeSupport propertyChangeSupport
protected String contactInformation
protected String[] keywords
protected String title
Constructor Detail |
---|
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)Method Detail |
---|
public boolean addLayer(int index, MapLayer layer)
addLayer
in interface MapContext
index
- the position at which to insert the layer in the list of layers
held by this contextlayer
- the map layer to add
public boolean addLayer(MapLayer layer)
addLayer
in interface MapContext
layer
- the map layer to add
public void addLayer(FeatureSource<SimpleFeatureType,SimpleFeature> 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 interface 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 interface MapContext
gc
- the grid coveragestyle
- a Style to be used when rendering the new layerpublic void addLayer(AbstractGridCoverage2DReader 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 interface MapContext
reader
- the grid coverage readerstyle
- a Style to be used when rendering the new layerpublic void addLayer(FeatureCollection<SimpleFeatureType,SimpleFeature> collection, Style style)
addLayer
in interface 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 interface 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 interface MapContext
layer
- the layer to be removed
public MapLayer removeLayer(int index)
removeLayer
in interface MapContext
index
- the position of the layer in this context's list of layers
public int addLayers(MapLayer[] layers)
MapLayerListEvent
.
addLayers
in interface MapContext
layers
- the new layers that are to be added.
public void removeLayers(MapLayer[] layers)
MapLayerListEvent
.
removeLayers
in interface MapContext
layers
- The layers that are to be removed.public MapLayer[] getLayers()
getLayers
in interface MapContext
public MapLayer getLayer(int index) throws IndexOutOfBoundsException
getLayer
in interface MapContext
index
- index of layer to return.
IndexOutOfBoundsException
- if the index is out of rangepublic int indexOf(MapLayer layer)
MapContext
indexOf
in interface MapContext
layer
- the MapLayer to search for
MapContext.indexOf(org.geotools.map.MapLayer)
public Iterator iterator()
iterator
in interface MapContext
public ReferencedEnvelope getLayerBounds() throws IOException
getLayerBounds
in interface MapContext
IOException
- DOCUMENT ME!public ReferencedEnvelope getAreaOfInterest()
getAreaOfInterest
in interface MapContext
public CoordinateReferenceSystem getCoordinateReferenceSystem()
getCoordinateReferenceSystem
in interface MapContext
public void transform(AffineTransform transform)
transform
in interface MapContext
transform
- The transform to change area of interest.public void moveLayer(int sourcePosition, int destPosition)
moveLayer
in interface MapContext
sourcePosition
- the layer's current positiondestPosition
- the new position
IndexOutOfBoundsException
- if either position is less than zero or
not less than the number of layers.public void clearLayerList()
clearLayerList
in interface MapContext
public int getLayerCount()
getLayerCount
in interface MapContext
public String getAbstract()
getAbstract
in interface MapContext
public void setAbstract(String abstractValue)
setAbstract
in interface MapContext
abstractValue
- New value of property abstracts.public String getContactInformation()
getContactInformation
in interface MapContext
public void setContactInformation(String contactInformation)
setContactInformation
in interface MapContext
contactInformation
- New value of property contactInformation.public String[] getKeywords()
getKeywords
in interface MapContext
public void setKeywords(String[] keywords)
setKeywords
in interface MapContext
keywords
- New value of property keywords.public String getTitle()
getTitle
in interface MapContext
public void setTitle(String title)
setTitle
in interface MapContext
title
- New value of property title.public void addMapLayerListListener(MapLayerListListener listener)
addMapLayerListListener
in interface MapContext
listener
- The listener to register.public void removeMapLayerListListener(MapLayerListListener listener)
removeMapLayerListListener
in interface MapContext
listener
- The listener to remove.public void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in interface MapContext
listener
- The listener to register.public void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in interface MapContext
listener
- The listener to remove.public void addMapBoundsListener(MapBoundsListener listener)
addMapBoundsListener
in interface MapContext
listener
- The listener to register.public void removeMapBoundsListener(MapBoundsListener listener)
removeMapBoundsListener
in interface MapContext
listener
- The listener to remove.public void setAreaOfInterest(Envelope areaOfInterest) throws IllegalArgumentException
setAreaOfInterest
in interface MapContext
areaOfInterest
- the new area of interest
IllegalArgumentException
- if the argument is null
public void setAreaOfInterest(Envelope areaOfInterest, CoordinateReferenceSystem crs) throws IllegalArgumentException
setAreaOfInterest
in interface MapContext
areaOfInterest
- the new area of interestcoordinateReferenceSystem
- the CRS for the new area of interest
IllegalArgumentException
- if areaOfInterest is null
public void setAreaOfInterest(ReferencedEnvelope areaOfInterest)
setAreaOfInterest
in interface MapContext
areaOfInterest
- the new area of interest
IllegalArgumentException
- if the provided areaOfInterest is null
or does not have a coordinate reference systempublic void setCoordinateReferenceSystem(CoordinateReferenceSystem crs) throws TransformException, FactoryException
setCoordinateReferenceSystem
in interface MapContext
FactoryException
TransformException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |