deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.portal.context
Interface MapModelAccess

All Known Implementing Classes:
DefaultMapModelAccess

public interface MapModelAccess

This interface defines access to the model (

Version:
$Revision: 18195 $ $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
Author:
Andreas Poth, last edited by: $Author:wanhoff$
See Also:
) a map based on. A concret implementation is responsible for handling the context. E.g. an implementation may adds additional capabilities like a history function.

Several methods expects beside the name of a layer the address (URL) of the OWS that serves this layer. This is required because a ViewContext may offeres layers from more than one OWS and there is no rule that says that a layers name must be unique across several OWS. So the only way to identify a layer is to use the combination of layer name, service address and service type (maybe several services are published to the same address; e.g. deegree 2 will do this).

Notice: All changed e.g. removeLayer just will be made to a ViewContext and not to the service providing a layer.


Field Summary
static int PAN_EAST
          The pan east constant.
static int PAN_NORTH
          The pan north constant.
static int PAN_NORTHEAST
          The pan north east constant.
static int PAN_NORTHWEST
          The pan north west constant.
static int PAN_SOUTH
          The pan south constant.
static int PAN_SOUTHEAST
          The pan south east constant.
static int PAN_SOUTHWEST
          The pan south west constant.
static int PAN_WEST
          The pan west constant.
 
Method Summary
 ViewContext addCRSToLayer(String name, URL owsAddress, String type, String crsName)
          Adds a CRS to a layer if a ViewContext.
 ViewContext addFormatToLayer(String name, URL owsAddress, String type, String mimeType)
          adds a new image format to a layer of a ViewContext.
 ViewContext addLayer(int index, Layer layer)
          adds a layer to the defined index position of the layer list of a ViewContext.
 ViewContext addLayer(int index, QualifiedName name, URL owsAddress, String type)
          adds a layer provided by the passed OWS to the defined index position of the layer list of a ViewContext.
 ViewContext addLayer(Layer layer)
          adds a layer to the end of the layer list of a ViewContext.
 ViewContext addLayer(QualifiedName name, URL owsAddress, String type)
          adds a layer provided by the passed OWS to the end of the layer list of a ViewContext.
 ViewContext addLayers(Layer[] layers)
          adds a number of layers to the end of the layer list of a ViewContext.
 ViewContext addLayers(QualifiedName[] names, URL[] owsAddresses, String type)
          adds a number of layers provided by the passed OWS to the end of the layer list of a ViewContext.
 ViewContext addStyleToLayer(QualifiedName name, URL owsAddress, String type, String styleName)
          adds a named style to a layer to be available within a context.
 ViewContext assignSLDToLayer(QualifiedName name, URL owsAddress, String type, StyledLayerDescriptor sld)
          assignes a SLD document instead of a style to a layer.
 ViewContext destroyGroup(String groupName)
          destroys a group.
 ViewContext groupLayers(int first, int last, String groupName, String parentGroupName)
          the difference to
 ViewContext groupLayers(String[] layers, URL[] owsAddresses, String[] types, String groupName, String parentGroupName)
          groups a set of layers identified by their names, the address of the OWS that provides it und its type.
 ViewContext pan(double directionDegree, double factor)
          moves a map view to a free definable direction with a given factor
 ViewContext pan(int direction, double factor)
          moves the boundingbox of the map to a well known direction.
 ViewContext recenterMap(Point point)
          centers he map described by a ViewContext to the passed point.
 ViewContext recenterMap(Point point)
          centers he map described by a ViewContext to the passed point.
 ViewContext removeCRSFromLayer(String name, URL owsAddress, String type, String crsName)
          removes a CRS from the list of availabe CRS of a layer.
 ViewContext removeFormatFromLayer(String name, URL owsAddress, String type, String mimeType)
          removes a format from a layer in a ViewContext.
 ViewContext removeLayer(QualifiedName name, URL owsAddress, String type)
          removes a named layer served by the passsed OWS from a ViewContext. if a layer with this name does not exist in a context, the unchanged ViewContext will be returned
 ViewContext removeStyleFromLayer(QualifiedName name, URL owsAddress, String type, String styleName)
          removes a style from the layer defined in a ViewContext.
 ViewContext setCurrentMapFormat(String mimeType, URL owsAddress, String type)
          sets the current image format a map shall be rendered.
 ViewContext setLayerActiveStyle(QualifiedName name, URL owsAddress, String type, String styleName)
          sets the active style (style to be used for rendering) of a layer
 ViewContext setLayers(Layer[] layers)
          sets the layers to a ViewContext.
 ViewContext setLayers(QualifiedName[] names, URL[] owsAddresses, String type)
          sets the layers provided by the passed OWS to a ViewContext.
 ViewContext setLayersVisible(String name, URL owsAddress, String type, boolean visible)
          set a layer to be visible or invisible
 ViewContext setMapBoundingBox(Envelope boundingBox)
          sets the bounding box a map/VieContext
 ViewContext setMapCRS(String crs)
          sets the CRS to be used by the map created from a ViewContext.
 ViewContext setMapSize(int width, int height)
          sets the width and height of a map described by a ViewContext
 ViewContext swapGroups(QualifiedName name, boolean up)
          swaps to groups in their order
 ViewContext swapLayers(QualifiedName name, URL owsAddress, String type, boolean up)
          swaps two layers in their order.
 ViewContext zoom(Point point, double factor)
          zoom in or out of the map described by a ViewContext and recenters it to the passed point.
 ViewContext zoom(Point point, double factor)
          zoom in or out of the map described by a ViewContext and recenters it to the passed point.
 

Field Detail

PAN_NORTH

static final int PAN_NORTH
The pan north constant.

See Also:
Constant Field Values

PAN_NORTHEAST

static final int PAN_NORTHEAST
The pan north east constant.

See Also:
Constant Field Values

PAN_NORTHWEST

static final int PAN_NORTHWEST
The pan north west constant.

See Also:
Constant Field Values

PAN_SOUTH

static final int PAN_SOUTH
The pan south constant.

See Also:
Constant Field Values

PAN_SOUTHEAST

static final int PAN_SOUTHEAST
The pan south east constant.

See Also:
Constant Field Values

PAN_SOUTHWEST

static final int PAN_SOUTHWEST
The pan south west constant.

See Also:
Constant Field Values

PAN_WEST

static final int PAN_WEST
The pan west constant.

See Also:
Constant Field Values

PAN_EAST

static final int PAN_EAST
The pan east constant.

See Also:
Constant Field Values
Method Detail

setLayers

ViewContext setLayers(QualifiedName[] names,
                      URL[] owsAddresses,
                      String type)
                      throws PortalException
sets the layers provided by the passed OWS to a ViewContext. A layer may be a WMS layer, a WFS feature type or a WCS coverage.

Parameters:
names - names of the layer
owsAddresses - addresses of the OWS that serves the layer. each passed layername is assigned to the OWS URL at the same index position.
type - OWS type (WCS, WMS or WFS)
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if of the layers already is registered to a ViewContext or the OWS does not serves one the layers or names and owsAddresses are not of the same size.

setLayers

ViewContext setLayers(Layer[] layers)
                      throws PortalException
sets the layers to a ViewContext. A layer may be a WMS layer, a WFS feature type or a WCS coverage.

Parameters:
layers - layers to add
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if of the layers already is registered to a ViewContext.

addLayer

ViewContext addLayer(QualifiedName name,
                     URL owsAddress,
                     String type)
                     throws PortalException
adds a layer provided by the passed OWS to the end of the layer list of a ViewContext. A layer may be a WMS layer, a WFS feature type or a WCS coverage.

Parameters:
name - name of the layer
owsAddress - address of the OWS that serves the layer
type - OWS type (WCS, WMS or WFS)
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if the layer already is registered to a ViewContext or the OWS does not serves a layer with this name.

addLayer

ViewContext addLayer(Layer layer)
                     throws PortalException
adds a layer to the end of the layer list of a ViewContext. A layer may be a WMS layer, a WFS feature type or a WCS coverage.

Parameters:
layer - layer to add
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if the layer already is registered to a ViewContext.

addLayer

ViewContext addLayer(int index,
                     QualifiedName name,
                     URL owsAddress,
                     String type)
                     throws PortalException
adds a layer provided by the passed OWS to the defined index position of the layer list of a ViewContext. A layer may be a WMS layer, a WFS feature type or a WCS coverage.

Parameters:
index - index position where to insert the layer
name - name of the layer
owsAddress - address of the OWS that serves the layer
type - OWS type (WCS, WMS or WFS)
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if the layer already is registered to a ViewContext or the OWS does not serves a layer with this name or the index is < 0 or > the number of layers -1;

addLayer

ViewContext addLayer(int index,
                     Layer layer)
                     throws PortalException
adds a layer to the defined index position of the layer list of a ViewContext. A layer may be a WMS layer, a WFS feature type or a WCS coverage.

Parameters:
index - index position where to insert the layer
layer - layer to add
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if the layer already is registered to a ViewContext or the index is < 0 or > the number of layers -1;

addLayers

ViewContext addLayers(QualifiedName[] names,
                      URL[] owsAddresses,
                      String type)
                      throws PortalException
adds a number of layers provided by the passed OWS to the end of the layer list of a ViewContext. A layer may be a WMS layer, a WFS feature type or a WCS coverage.

Parameters:
names - names of the layer
owsAddresses - addresses of the OWS's that serves the layer
type - OWS type (WCS, WMS or WFS)
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if of the layers already is registered to a ViewContext or the OWS does not serves one the layers or the OWS does not serves one the layers or names and owsAddresses are not of the same size.

addLayers

ViewContext addLayers(Layer[] layers)
                      throws PortalException
adds a number of layers to the end of the layer list of a ViewContext. A layer may be a WMS layer, a WFS feature type or a WCS coverage.

Parameters:
layers - layers to add
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if of the layers already is registered to a ViewContext.

removeLayer

ViewContext removeLayer(QualifiedName name,
                        URL owsAddress,
                        String type)
removes a named layer served by the passsed OWS from a ViewContext. if a layer with this name does not exist in a context, the unchanged ViewContext will be returned

Parameters:
name - name of the layer to be removed
owsAddress - address of the OWS that serves the layer
type - OWS type (WCS, WMS or WFS)
Returns:
modified ViewContext

swapLayers

ViewContext swapLayers(QualifiedName name,
                       URL owsAddress,
                       String type,
                       boolean up)
                       throws PortalException
swaps two layers in their order. The layer identified by the passed name and OWS can be moved up or down for one position. If a layer can not be moved up or down because it is already the top or bottom most layer the unchanged ViewContext will be returned

Notice: if to layers to be swaped are served by differend OWS at least one new image-layer must be created by the client.

Parameters:
name - name of the layer to be moved up or down in the list
owsAddress - address of the OWS that serves the layer
type - OWS type (WCS, WMS or WFS)
up - true if layer should be moved up otherwise it will be moved down.
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if the layer does not exists in a ViewContext.

swapGroups

ViewContext swapGroups(QualifiedName name,
                       boolean up)
                       throws PortalException
swaps to groups in their order

Parameters:
name - name of the group to be moved up or down
up - true if a group should be moved up otherwise it will be moved down.
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if a group with the passed name does not exist in a ViewContext
See Also:
swapLayers(QualifiedName, URL, String, boolean)

setLayerActiveStyle

ViewContext setLayerActiveStyle(QualifiedName name,
                                URL owsAddress,
                                String type,
                                String styleName)
                                throws PortalException
sets the active style (style to be used for rendering) of a layer

Parameters:
name - name of the layer a style shall be set to
owsAddress - address of the OWS that serves this layer
type - OWS type (WCS, WMS or WFS)
styleName - name of the style to be assigned
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if the layer or style are not known by a ViewContext or the style is not available for this layer

addStyleToLayer

ViewContext addStyleToLayer(QualifiedName name,
                            URL owsAddress,
                            String type,
                            String styleName)
                            throws PortalException
adds a named style to a layer to be available within a context.

Parameters:
name - name of the layer
owsAddress - address of the OWS that serves this layer
type - OWS type (WCS, WMS or WFS)
styleName - name of the style to be set
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if the layer is not known by a ViewContext or the style is not available for this layer

removeStyleFromLayer

ViewContext removeStyleFromLayer(QualifiedName name,
                                 URL owsAddress,
                                 String type,
                                 String styleName)
removes a style from the layer defined in a ViewContext. If a style with passed named is not assigned to a layer the ViewContext will be returend unchanged.

Parameters:
name - name of the layer
owsAddress - address of the OWS that serves this layer
type - OWS type (WCS, WMS or WFS)
styleName - name of the style to be removed
Returns:
modified ViewContext

assignSLDToLayer

ViewContext assignSLDToLayer(QualifiedName name,
                             URL owsAddress,
                             String type,
                             StyledLayerDescriptor sld)
                             throws PortalException
assignes a SLD document instead of a style to a layer. Usually this should be a SLD containing one named layer or one user layer and one user style. But it also will be possible to have a SLD with several layers (named layers as well as user layers). But this may cause some irritations so it should be avoided.

Parameters:
name - name of the layer the SLD should be assigned to
owsAddress - address of the OWS that serves this layer(s) if the SLD contains named layer(s). Otherwise the parameter can be null
type - OWS type (WCS, WMS or WFS)
sld - SLD that shall be assigned
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if the layer is not known by a ViewContext or if the SLD contains a named layer but owsAddress is passed.

setLayersVisible

ViewContext setLayersVisible(String name,
                             URL owsAddress,
                             String type,
                             boolean visible)
                             throws PortalException
set a layer to be visible or invisible

Parameters:
name - name of the layer
owsAddress - address of the OWS that serves this layer
type - OWS type (WCS, WMS or WFS)
visible - true if a layer shall be visible; false if not.
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if the layer is not known by a ViewContext.

setMapCRS

ViewContext setMapCRS(String crs)
                      throws PortalException
sets the CRS to be used by the map created from a ViewContext.

Parameters:
crs - name of the CRS e.g. EPSG:4326
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if the CRS is not known by all layers available through a ViewContext

addCRSToLayer

ViewContext addCRSToLayer(String name,
                          URL owsAddress,
                          String type,
                          String crsName)
                          throws PortalException
Adds a CRS to a layer if a ViewContext.

Parameters:
name - name of the layer
owsAddress - address of the OWS that serves this layer
type - OWS type (WCS, WMS or WFS)
crsName - name of the CRS to be added (e.g. EPSG:4326)
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if the layer is not known by a ViewContext or the CRS is not supported for this layer/OWS

removeCRSFromLayer

ViewContext removeCRSFromLayer(String name,
                               URL owsAddress,
                               String type,
                               String crsName)
removes a CRS from the list of availabe CRS of a layer. If the layer or the CRS does not exist in a ViewContext the ViewContext will be returned unchanged.

Parameters:
name - name of the layer
owsAddress - address of the OWS that serves this layer
type - OWS type (WCS, WMS or WFS)
crsName - name of the CRS to be removed from a layers CRS list
Returns:
modified ViewContext

setMapBoundingBox

ViewContext setMapBoundingBox(Envelope boundingBox)
                              throws ContextException
sets the bounding box a map/VieContext

Parameters:
boundingBox - new boundingbox
Returns:
modified ViewContext
Throws:
ContextException

setMapSize

ViewContext setMapSize(int width,
                       int height)
                       throws PortalException
sets the width and height of a map described by a ViewContext

Parameters:
width - map width measured in pixel
height - map height measured in pixel
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if width or height < 1 (even a width or height of 1 pixel is not really useful but formal it is valid);

zoom

ViewContext zoom(Point point,
                 double factor)
                 throws ContextException
zoom in or out of the map described by a ViewContext and recenters it to the passed point.
  • factor > 0: zoomout
  • factor < 0: zoomin
  • factor == 0: recenter

Parameters:
factor - zoom factor in % of the boundingbox size
point - point (pixel coordinates) of the current map that marks the new center of the map
Returns:
modified ViewContext
Throws:
ContextException

zoom

ViewContext zoom(Point point,
                 double factor)
                 throws ContextException
zoom in or out of the map described by a ViewContext and recenters it to the passed point.
  • factor > 0: zoomout
  • factor < 0: zoomin
  • factor == 0: recenter

Parameters:
factor - zoom factor in % of the boundingbox size
point - point (map coordinates) of the current map that marks the new center of the map
Returns:
modified ViewContext
Throws:
ContextException

recenterMap

ViewContext recenterMap(Point point)
                        throws ContextException
centers he map described by a ViewContext to the passed point. The behavior of this method is the same as

Parameters:
point - point (pixel coordinates) of the current map that marks the new center of the map
Returns:
modified ViewContext
Throws:
ContextException
See Also:
with a passed factor == 0;

recenterMap

ViewContext recenterMap(Point point)
                        throws ContextException
centers he map described by a ViewContext to the passed point. The behavior of this method is the same as

Parameters:
point - point (map coordinates) of the current map that marks the new center of the map
Returns:
modified ViewContext
Throws:
ContextException
See Also:
with a passed factor == 0;

pan

ViewContext pan(int direction,
                double factor)
                throws PortalException,
                       ContextException
moves the boundingbox of the map to a well known direction. Directions that are known:

Parameters:
direction - direction the map view shall be moved to
factor - factor measured in % the map view shall be moved
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if passed direction is not valid or factor is <= 0
ContextException
See Also:
PAN_NORTH, PAN_NORTHEAST, PAN_NORTHWEST, PAN_SOUTH, PAN_SOUTHEAST, PAN_SOUTHWEST, PAN_WEST, PAN_EAST

pan

ViewContext pan(double directionDegree,
                double factor)
                throws PortalException
moves a map view to a free definable direction with a given factor

Parameters:
directionDegree - direction measured in degree that map view shall be moved to
factor - factor measured in % the map view shall be moved
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if factor is <= 0

setCurrentMapFormat

ViewContext setCurrentMapFormat(String mimeType,
                                URL owsAddress,
                                String type)
                                throws PortalException
sets the current image format a map shall be rendered. In theory OGC WMC specification allows rendering of each layer in a different image format but this seems to be very complicated, slow and not very useful, so deegree just supports one format for each OWS.

Parameters:
mimeType - image format
owsAddress - address of the OWS the format shall be used for
type - OWS type
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if the passed mimeType is not suported by the passed OWS or one of its layers as defined in a ViewContext

addFormatToLayer

ViewContext addFormatToLayer(String name,
                             URL owsAddress,
                             String type,
                             String mimeType)
                             throws PortalException
adds a new image format to a layer of a ViewContext. This method is useful because not every image format e.g.a WMS offers must be registered to be available through a Web Map Context.

Parameters:
name - name of the layer
owsAddress - address of the OWS
type - OWS type (WCS, WMS or WFS)
mimeType - new format to add to the layer
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if the passed mimeType is not suported by the passed OWS

removeFormatFromLayer

ViewContext removeFormatFromLayer(String name,
                                  URL owsAddress,
                                  String type,
                                  String mimeType)
                                  throws PortalException
removes a format from a layer in a ViewContext.

Parameters:
name - name of the layer
owsAddress - address of the OWS
type - OWS type (WCS, WMS or WFS)
mimeType - format to be removed
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if the removed format is the current format of the layer.
See Also:
addFormatToLayer(String, URL, String, String)

groupLayers

ViewContext groupLayers(String[] layers,
                        URL[] owsAddresses,
                        String[] types,
                        String groupName,
                        String parentGroupName)
                        throws PortalException
groups a set of layers identified by their names, the address of the OWS that provides it und its type. A group has a name that must be unique and a parent that may is null. If no parent is given the group will be located underneath the root node.

Parameters:
layers - layers to be grouped.
owsAddresses -
types -
groupName - unique name of the group
parentGroupName - name of the parent group. may be null
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if one of the layers is not served by the assigned OWS or a layer is already member of a group

groupLayers

ViewContext groupLayers(int first,
                        int last,
                        String groupName,
                        String parentGroupName)
                        throws PortalException
the difference to

Parameters:
first - zero based index of the first layer to add to the group
last - zero based index of the last layer to add to the group
groupName - unique name of the group
parentGroupName - name of the parent group. may be null
Returns:
modified ViewContext
Throws:
PortalException - will be thrown if first or last is < 0 or larger than the total number of layers -1 or a layer is already member of a group
See Also:
is that the layers are identified by theri index position in a ViewContext

destroyGroup

ViewContext destroyGroup(String groupName)
destroys a group. If a group with the passed name does not exist a ViewContext will be returned unchanged

Parameters:
groupName - name of the group to be removed
Returns:
modified ViewContext

deegree 2.3 (2010/04/09 10:10 build-4-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org