org.geotools.map
Class WMSMapLayer

Object
  extended by DefaultMapLayer
      extended by WMSMapLayer
All Implemented Interfaces:
MapLayer

public class WMSMapLayer
extends DefaultMapLayer

Wraps a WMS layer into a MapLayer for interactive rendering usage TODO: expose a GetFeatureInfo that returns a feature collection TODO: expose the list of named styles and allow choosing which style to use

Author:
Andrea Aime - OpenGeo

Field Summary
static Logger LOGGER
          The logger for the map module.
 
Fields inherited from class DefaultMapLayer
featureSource, listenerList, query, selected, sourceListener, style, title, visible
 
Constructor Summary
WMSMapLayer(WebMapServer wms, Layer layer)
          Builds a new WMS alyer
 
Method Summary
 void addLayer(Layer layer)
          Allows to add another WMS layer into the GetMap requests
 ReferencedEnvelope getBounds()
          find out the bounds of the layer
 CoordinateReferenceSystem getCoordinateReferenceSystem()
          Returns the CRS used to make requests to the remote WMS
 InputStream getFeatureInfo(DirectPosition2D pos, String infoFormat, int featureCount)
          Retrieves the feature info as a generic input stream, it's the duty of the caller to interpret the contents and ensure the stream is closed feature info format)
 InputStream getFeatureInfo(ReferencedEnvelope bbox, int width, int height, int x, int y, String infoFormat, int featureCount)
          Allows to run a standalone GetFeatureInfo request, without the need to have previously run a GetMap request on this layer.
 String getFeatureInfoAsText(DirectPosition2D pos, int featureCount)
          Retrieves the feature info as text (assuming "text/plain" is a supported feature info format)
 GetMapRequest getLastGetMap()
          Returns last GetMap request performed by this layer
 WebMapServer getWebMapServer()
          Returns the WebMapServer used by this layer
 List<Layer> getWMSLayers()
          Returns the WMS Layer used by this layer
 boolean isNativelySupported(CoordinateReferenceSystem crs)
          Returns true if the specified CRS can be used directly to perform WMS requests.
 
Methods inherited from class DefaultMapLayer
addMapLayerListener, fireMapLayerListenerLayerChanged, fireMapLayerListenerLayerDeselected, fireMapLayerListenerLayerHidden, fireMapLayerListenerLayerSelected, fireMapLayerListenerLayerShown, getFeatureSource, getQuery, getSource, getStyle, getTitle, isSelected, isVisible, removeMapLayerListener, setQuery, setSelected, setStyle, setTitle, setVisible, toString
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOGGER

public static final Logger LOGGER
The logger for the map module.

Constructor Detail

WMSMapLayer

public WMSMapLayer(WebMapServer wms,
                   Layer layer)
Builds a new WMS alyer

Parameters:
wms -
layer -
Method Detail

getBounds

public ReferencedEnvelope getBounds()
Description copied from interface: MapLayer
find out the bounds of the layer

Specified by:
getBounds in interface MapLayer
Overrides:
getBounds in class DefaultMapLayer
Returns:
- the layer's bounds

getFeatureInfoAsText

public String getFeatureInfoAsText(DirectPosition2D pos,
                                   int featureCount)
                            throws IOException
Retrieves the feature info as text (assuming "text/plain" is a supported feature info format)

Parameters:
pos - the position to be checked, in real world coordinates
Returns:
Throws:
IOException

getFeatureInfo

public InputStream getFeatureInfo(DirectPosition2D pos,
                                  String infoFormat,
                                  int featureCount)
                           throws IOException
Retrieves the feature info as a generic input stream, it's the duty of the caller to interpret the contents and ensure the stream is closed feature info format)

Parameters:
pos - the position to be checked, in real world coordinates
infoFormat - The INFO_FORMAT parameter in the GetFeatureInfo request
Returns:
Throws:
IOException

getFeatureInfo

public InputStream getFeatureInfo(ReferencedEnvelope bbox,
                                  int width,
                                  int height,
                                  int x,
                                  int y,
                                  String infoFormat,
                                  int featureCount)
                           throws IOException
Allows to run a standalone GetFeatureInfo request, without the need to have previously run a GetMap request on this layer. Mostly useful for stateless users that rebuild the map context for each rendering operation (e.g., GeoServer)

Parameters:
pos -
infoFormat - The INFO_FORMAT parameter in the GetFeatureInfo request
Returns:
Throws:
IOException

getWebMapServer

public WebMapServer getWebMapServer()
Returns the WebMapServer used by this layer

Returns:

getWMSLayers

public List<Layer> getWMSLayers()
Returns the WMS Layer used by this layer

Returns:

getCoordinateReferenceSystem

public CoordinateReferenceSystem getCoordinateReferenceSystem()
Returns the CRS used to make requests to the remote WMS

Returns:

getLastGetMap

public GetMapRequest getLastGetMap()
Returns last GetMap request performed by this layer

Returns:

addLayer

public void addLayer(Layer layer)
Allows to add another WMS layer into the GetMap requests

Parameters:
layer -

isNativelySupported

public boolean isNativelySupported(CoordinateReferenceSystem crs)
Returns true if the specified CRS can be used directly to perform WMS requests. Natively supported crs will provide the best rendering quality as no client side reprojection is necessary, the image coming from the WMS server will be used as-is

Parameters:
crs -
Returns:


Copyright © 1996-2010 Geotools. All Rights Reserved.