Package org.geotools.ows.wms.request
Class AbstractGetMapRequest
- Object
-
- AbstractRequest
-
- AbstractWMSRequest
-
- AbstractGetMapRequest
-
- All Implemented Interfaces:
Request
,GetMapRequest
- Direct Known Subclasses:
WMS1_0_0.GetMapRequest
public abstract class AbstractGetMapRequest extends AbstractWMSRequest implements GetMapRequest
- Author:
- Richard Gould
-
-
Field Summary
-
Fields inherited from class AbstractRequest
EXCEPTION_XML, hints, onlineResource, properties
-
Fields inherited from interface GetMapRequest
BBOX, BGCOLOR, ELEVATION, EXCEPTION_BLANK, EXCEPTION_INIMAGE, EXCEPTION_XML, EXCEPTIONS, FORMAT, HEIGHT, LAYERS, REMOTE_OWS_TYPE, REMOTE_OWS_WCS, REMOTE_OWS_WFS, REMOVE_OWS_URL, SLD, SLD_BODY, SRS, STYLES, TIME, TRANSPARENT, WFS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description AbstractGetMapRequest(URL onlineResource, Properties properties)
Constructs a GetMapRequest.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addLayer(String layerName, String style)
Adds a Layer to the list of layers to be requested.void
addLayer(String layerName, StyleImpl style)
Adds a Layer to the list of layers to be requested.void
addLayer(Layer layer)
Adds a Layer to the list of layers to be requested.void
addLayer(Layer layer, String style)
Adds a Layer to the list of layers to be requested.void
addLayer(Layer layer, StyleImpl style)
Adds a Layer to the list of layers to be requested.URL
getFinalURL()
Once the properties of the request are configured, this will return the URL that points to the server and contains all of the appropriate name/value parameters.protected void
initRequest()
protected abstract void
initVersion()
Sets up the version number for this request.protected static boolean
isGeotoolsLongitudeFirstAxisOrderForced()
void
setBBox(String bbox)
From the Web Map Service Implementation Specification: "The required BBOX parameter allows a Client to request a particular Bounding Box.void
setBBox(Bounds envelope)
Sets BBOX and SRS using the provided Envelope.void
setBGColour(String bgColour)
Specifies the colour, in hexidecimal format, to be used as the background of the map.void
setDimensions(int width, int height)
void
setDimensions(Dimension imageDimension)
void
setDimensions(String width, String height)
From the Web Map Service Implementation Specification: "The required WIDTH and HEIGHT parameters specify the size in integer pixels of the map image to be produced.void
setElevation(String elevation)
See the Web Map Server Implementation Specification 1.1.1, Annex C, in particular section C.4void
setExceptions(String exceptions)
The exceptions type specifies what format the server should return exceptions in.void
setFormat(String format)
From the Web Map Service Implementation Specification: "The required FORMAT parameter states the desired format of the response to an operation.void
setProperties(Properties p)
create a request using a properties file to save timevoid
setSampleDimensionValue(String name, String value)
See the Web Map Server Implementation Specification 1.1.1, Annex C, in particular section C.4.2void
setSRS(String srs)
From the Web Map Service Implementation Specification: "The required SRS parameter states which Spatial Reference System applies to the values in the BBOX parameter.void
setTime(String time)
See the Web Map Server Implementation Specification 1.1.1, Annexes B and Cvoid
setTransparent(boolean transparent)
From the Web Map Service Implementation Specification: "The optional TRANSPARENT parameter specifies whether the map background is to be made transparent or not.void
setVendorSpecificParameter(String name, String value)
Used to implement vendor specific parameters.void
setVersion(String version)
Sets the version number of the request.static CoordinateReferenceSystem
toServerCRS(String srsName, boolean forceXY)
-
Methods inherited from class AbstractWMSRequest
initService
-
Methods inherited from class AbstractRequest
getPostContentType, getProperties, getRequestHints, performPostOutput, processKey, requiresPost, setProperty, setRequestHints
-
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface Request
createResponse, getPostContentType, getProperties, getRequestHints, performPostOutput, requiresPost, setProperty, setRequestHints
-
-
-
-
Constructor Detail
-
AbstractGetMapRequest
public AbstractGetMapRequest(URL onlineResource, Properties properties)
Constructs a GetMapRequest. The data passed in represents valid values that can be used.- Parameters:
onlineResource
- the location that the request should be applied toproperties
- pre-set properties to be used. Can be null.
-
-
Method Detail
-
getFinalURL
public URL getFinalURL()
Description copied from interface:Request
Once the properties of the request are configured, this will return the URL that points to the server and contains all of the appropriate name/value parameters.- Specified by:
getFinalURL
in interfaceRequest
- Overrides:
getFinalURL
in classAbstractRequest
- Returns:
- a URL that can be used to issue the request
- See Also:
org.geotools.data.wms.request.Request#getFinalURL()
-
initVersion
protected abstract void initVersion()
Description copied from class:AbstractRequest
Sets up the version number for this request. Typically something like setProperty("VERSION", "1.1.1");- Specified by:
initVersion
in classAbstractRequest
-
initRequest
protected void initRequest()
- Specified by:
initRequest
in classAbstractRequest
-
setVersion
public void setVersion(String version)
Sets the version number of the request.- Specified by:
setVersion
in interfaceGetMapRequest
- Parameters:
version
- A String indicting a WMS Version ("1.0.0", "1.1.0", "1.1.1", or "1.3.0")
-
addLayer
public void addLayer(Layer layer, String style)
Description copied from interface:GetMapRequest
Adds a Layer to the list of layers to be requested. This layer will be drawn below any previously added layers.- Specified by:
addLayer
in interfaceGetMapRequest
- Parameters:
layer
- the Layer to usestyle
- the style to use to draw the layer, can also be NULL, "" or "default"
-
addLayer
public void addLayer(Layer layer)
Description copied from interface:GetMapRequest
Adds a Layer to the list of layers to be requested. This layer will be drawn below any previously added layers. The style will be the default one.- Specified by:
addLayer
in interfaceGetMapRequest
- Parameters:
layer
- the Layer to use
-
addLayer
public void addLayer(String layerName, String style)
Description copied from interface:GetMapRequest
Adds a Layer to the list of layers to be requested. This layer will be drawn below any previously added layers.- Specified by:
addLayer
in interfaceGetMapRequest
- Parameters:
layerName
- the name of the layer to usestyle
- the style to use to draw the layer, can also be NULL, "" or "default"
-
addLayer
public void addLayer(Layer layer, StyleImpl style)
Description copied from interface:GetMapRequest
Adds a Layer to the list of layers to be requested. This layer will be drawn below any previously added layers.- Specified by:
addLayer
in interfaceGetMapRequest
- Parameters:
layer
- the Layer to usestyle
- the style to use. If it is null, the default style is used.
-
addLayer
public void addLayer(String layerName, StyleImpl style)
Description copied from interface:GetMapRequest
Adds a Layer to the list of layers to be requested. This layer will be drawn below any previously added layers.- Specified by:
addLayer
in interfaceGetMapRequest
- Parameters:
layerName
- the Layer to usestyle
- the style to use. If it is null, the default style is used.
-
setSRS
public void setSRS(String srs)
From the Web Map Service Implementation Specification: "The required SRS parameter states which Spatial Reference System applies to the values in the BBOX parameter. The value of the SRS parameter shall be on of the values defined in the character data section of an <SRS> element defined or inherited by the requested layer. The same SRS applies to all layers in a single request. If the WMS has declared SRS=NONE for a Layer, then the Layer does not have a well-defined spatial reference system and should not be shown in conjunction with other layers. The client shall specify SRS as "none" in the GetMap request and the Server may issue a Service Exception otherwise."- Specified by:
setSRS
in interfaceGetMapRequest
- Parameters:
srs
- A String indicating the Spatial Reference System to render the layers in.
-
setBBox
public void setBBox(String bbox)
From the Web Map Service Implementation Specification: "The required BBOX parameter allows a Client to request a particular Bounding Box. The value of the BBOX parameter in a GetMap request is a list of comma-separated numbers of the form "minx,miny,maxx,maxy". If the WMS server has declared that a Layer is not subsettable, then the Client shall specify exactly the declared Bounding Box values in the GetMap request and the Server may issue a Service Exception otherwise."Yu must also call setSRS to provide the spatial reference system information (or CRS:84 will be assumed)
- Specified by:
setBBox
in interfaceGetMapRequest
- Parameters:
bbox
- A string representing a bounding box in the format "minx,miny,maxx,maxy"
-
toServerCRS
public static CoordinateReferenceSystem toServerCRS(String srsName, boolean forceXY)
-
isGeotoolsLongitudeFirstAxisOrderForced
protected static boolean isGeotoolsLongitudeFirstAxisOrderForced()
-
setBBox
public void setBBox(Bounds envelope)
Sets BBOX and SRS using the provided Envelope.- Specified by:
setBBox
in interfaceGetMapRequest
-
setFormat
public void setFormat(String format)
From the Web Map Service Implementation Specification: "The required FORMAT parameter states the desired format of the response to an operation. Supported values for a GetMap request on a WMS instance are listed in one or more <Format> elements in the &;ltRequest><GetMap> element of its Capabilities XML. The entire MIME type string in <Format> is used as the value of the FORMAT parameter."- Specified by:
setFormat
in interfaceGetMapRequest
- Parameters:
format
- The desired format for the GetMap response
-
setDimensions
public void setDimensions(String width, String height)
From the Web Map Service Implementation Specification: "The required WIDTH and HEIGHT parameters specify the size in integer pixels of the map image to be produced. WIDTH specifies the number of pixels to be used between the minimum and maximum X values (inclusive) in the BBOX parameter, while HEIGHT specifies the number of pixels between the minimum and maximum Y values. If the WMS server has declared that a Layer has fixed width and height, then the Client shall specify exactly those WIDTH and HEIGHT values in the GetMap request and the Server may issue a Service Exception otherwise."- Specified by:
setDimensions
in interfaceGetMapRequest
-
setDimensions
public void setDimensions(Dimension imageDimension)
- Specified by:
setDimensions
in interfaceGetMapRequest
-
setTransparent
public void setTransparent(boolean transparent)
From the Web Map Service Implementation Specification: "The optional TRANSPARENT parameter specifies whether the map background is to be made transparent or not. The default value is false if the parameter is absent from the request."- Specified by:
setTransparent
in interfaceGetMapRequest
- Parameters:
transparent
- true for transparency, false otherwise
-
setBGColour
public void setBGColour(String bgColour)
Specifies the colour, in hexidecimal format, to be used as the background of the map. It is a String representing RGB values in hexidecimal format, prefixed by "0x". The format is: 0xRRGGBB. The default value is 0xFFFFFF (white)- Specified by:
setBGColour
in interfaceGetMapRequest
- Parameters:
bgColour
- the background colour of the map, in the format 0xRRGGBB
-
setExceptions
public void setExceptions(String exceptions)
The exceptions type specifies what format the server should return exceptions in.Valid values are:
- "application/vnd.ogc.se_xml" (the default)
- "application/vnd.ogc.se_inimage"
- "application/vnd.ogc.se_blank"
- Specified by:
setExceptions
in interfaceGetMapRequest
-
setTime
public void setTime(String time)
See the Web Map Server Implementation Specification 1.1.1, Annexes B and C- Specified by:
setTime
in interfaceGetMapRequest
- Parameters:
time
- See the Web Map Server Implementation Specification 1.1.1, Annexes B and C
-
setElevation
public void setElevation(String elevation)
See the Web Map Server Implementation Specification 1.1.1, Annex C, in particular section C.4- Specified by:
setElevation
in interfaceGetMapRequest
- Parameters:
elevation
- See the Web Map Server Implementation Specification 1.1.1, Annex C
-
setSampleDimensionValue
public void setSampleDimensionValue(String name, String value)
See the Web Map Server Implementation Specification 1.1.1, Annex C, in particular section C.4.2Example use:
request.setSampleDimensionValue("DIM_WAVELENGTH", "4000");
- Specified by:
setSampleDimensionValue
in interfaceGetMapRequest
- Parameters:
name
- the request parameter name to set (usually with 'dim_' as prefix)value
- the value of the request parameter (value, interval or comma-separated list)
-
setVendorSpecificParameter
public void setVendorSpecificParameter(String name, String value)
Used to implement vendor specific parameters. Entirely optional.- Specified by:
setVendorSpecificParameter
in interfaceGetMapRequest
- Parameters:
name
- a request parameter namevalue
- a value to accompany the name
-
setDimensions
public void setDimensions(int width, int height)
- Specified by:
setDimensions
in interfaceGetMapRequest
-
setProperties
public void setProperties(Properties p)
Description copied from interface:GetMapRequest
create a request using a properties file to save time- Specified by:
setProperties
in interfaceGetMapRequest
-
-