Package org.geotools.ows.wms.map
Class WMSLayer
- Object
-
- Layer
-
- StyleLayer
-
- RasterLayer
-
- GridReaderLayer
-
- WMSLayer
-
public class WMSLayer extends GridReaderLayer
Wraps a WMS layer into aLayerfor 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
-
Fields inherited from class GridReaderLayer
params, reader
-
Fields inherited from class RasterLayer
source
-
Fields inherited from class StyleLayer
style
-
-
Constructor Summary
Constructors Constructor Description WMSLayer(WebMapServer wms, Layer layer)Builds a new WMS layerWMSLayer(WebMapServer wms, Layer layer, String style)Builds a new WMS layerWMSLayer(WebMapServer wms, Layer layer, String style, String imageFromat)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLayer(Layer layer)Allows to add another WMS layer into the GetMap requestsvoidaddLayer(Layer layer, String style)Allows to add another WMS layer into the GetMap requestsReferencedEnvelopegetBounds()The bounds of the Layer content (if known).CoordinateReferenceSystemgetCoordinateReferenceSystem()Returns the CRS used to make requests to the remote WMSInputStreamgetFeatureInfo(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.InputStreamgetFeatureInfo(Position2D 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)StringgetFeatureInfoAsText(Position2D pos, int featureCount)Retrieves the feature info as text (assuming "text/plain" is a supported feature info format)GetMapRequestgetLastGetMap()Returns last GetMap request performed by this layerWMSCoverageReadergetReader()Reader used for efficient access to raster content.WebMapServergetWebMapServer()Returns theWebMapServerused by this layerList<Layer>getWMSLayers()Returns the WMSLayers used by this layerList<String>getWMSStyles()return the names of the styles used by this layer.booleanisNativelySupported(CoordinateReferenceSystem crs)Returns true if the specified CRS can be used directly to perform WMS requests.-
Methods inherited from class GridReaderLayer
dispose, getParams, toFeatureCollection
-
Methods inherited from class RasterLayer
getFeatureSource
-
Methods inherited from class StyleLayer
getStyle, setStyle
-
Methods inherited from class Layer
addMapLayerListener, connectDataListener, finalize, fireMapLayerListenerLayerChanged, fireMapLayerListenerLayerDeselected, fireMapLayerListenerLayerHidden, fireMapLayerListenerLayerPreDispose, fireMapLayerListenerLayerSelected, fireMapLayerListenerLayerShown, getQuery, getTitle, getUserData, isSelected, isVisible, preDispose, removeMapLayerListener, setSelected, setTitle, setVisible, toString
-
-
-
-
Constructor Detail
-
WMSLayer
public WMSLayer(WebMapServer wms, Layer layer)
Builds a new WMS layer
-
WMSLayer
public WMSLayer(WebMapServer wms, Layer layer, String style)
Builds a new WMS layer
-
WMSLayer
public WMSLayer(WebMapServer wms, Layer layer, String style, String imageFromat)
-
-
Method Detail
-
getReader
public WMSCoverageReader getReader()
Description copied from class:GridReaderLayerReader used for efficient access to raster content.- Overrides:
getReaderin classGridReaderLayer
-
getBounds
public ReferencedEnvelope getBounds()
Description copied from class:LayerThe bounds of the Layer content (if known). The bounds can be used to determine if any of the layers content is "on screen" when rendering the map; however often it is expensive to calculate a layers bounds up front so we are allowing this value to be optional.The returned bounds are a ReferencedEnvelope using the same CoordinateReferenceSystem as the layers contents.
- Overrides:
getBoundsin classGridReaderLayer- Returns:
- layer bounds, null if unknown
-
getFeatureInfoAsText
public String getFeatureInfoAsText(Position2D 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- Throws:
IOException
-
getFeatureInfo
public InputStream getFeatureInfo(Position2D 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 coordinatesinfoFormat- The INFO_FORMAT parameter in the GetFeatureInfo request- 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:
infoFormat- The INFO_FORMAT parameter in the GetFeatureInfo request- Throws:
IOException
-
getWebMapServer
public WebMapServer getWebMapServer()
Returns theWebMapServerused by this layer
-
getCoordinateReferenceSystem
public CoordinateReferenceSystem getCoordinateReferenceSystem()
Returns the CRS used to make requests to the remote WMS
-
getLastGetMap
public GetMapRequest getLastGetMap()
Returns last GetMap request performed by this layer
-
addLayer
public void addLayer(Layer layer)
Allows to add another WMS layer into the GetMap requests
-
addLayer
public void addLayer(Layer layer, String style)
Allows to add another WMS layer into the GetMap requests
-
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
-
-