Package org.locationtech.jts.wms
Class MapRequest
- java.lang.Object
-
- org.locationtech.jts.wms.MapRequest
-
public class MapRequest extends Object
Represents all of the parameters of a getMap request from a WMS server.- Author:
- Chris Hodgson chodgson@refractions.net
-
-
Constructor Summary
Constructors Constructor Description MapRequest(WMService service)
Creates a new MapRequest.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BoundingBox
getBoundingBox()
Gets the BoundingBox of the image being requested.String
getFormat()
Returns the format of this request.Image
getImage()
Connect to the service and get an Image of the map.int
getImageHeight()
Gets the height of the requested image, in pixels.int
getImageWidth()
Gets the width of the requested image, in pixels.List
getLayers()
Returns the list of layers to be requested.WMService
getService()
Gets the WMService that this object will make requests from.boolean
getTransparent()
Gets whether or not a transparent image is being requested.URL
getURL()
void
setBoundingBox(BoundingBox bbox)
Sets the BoundingBox of the image being requested.void
setFormat(String format)
Sets the format of this request.void
setImageHeight(int imageHeight)
Sets the height of the image being requested.void
setImageSize(int imageWidth, int imageHeight)
Sets the width and height of the image being requested.void
setImageWidth(int imageWidth)
Sets the width of the image being requested.void
setLayers(List layerList)
Sets the layers to be requested.void
setTransparent(boolean transparent)
Sets whether or not to request an image with a transparent background.
-
-
-
Constructor Detail
-
MapRequest
public MapRequest(WMService service)
Creates a new MapRequest.- Parameters:
service
- the WMService which this MapRequest will use
-
-
Method Detail
-
getService
public WMService getService()
Gets the WMService that this object will make requests from.- Returns:
- the WMService that this object will make requests from
-
getFormat
public String getFormat()
Returns the format of this request. This may be a string such as GIF, JPEG, or PNG for a WMS 1.0 server, or a mime-type string in the case of a WMS 1.1 server. It may also be null if the format has not yet been set.- Returns:
- the string representing the format of this request
-
getImageWidth
public int getImageWidth()
Gets the width of the requested image, in pixels. The default image width is 100.- Returns:
- the width of the requested image
-
getImageHeight
public int getImageHeight()
Gets the height of the requested image, in pixels. The default image height is 100.- Returns:
- the height of the requested image
-
getLayers
public List getLayers()
Returns the list of layers to be requested. Each item in the list should be a String which is the name of a layer.- Returns:
- the list of layer names to be requested
-
getBoundingBox
public BoundingBox getBoundingBox()
Gets the BoundingBox of the image being requested.- Returns:
- the BoundingBox of the image being requested
-
getTransparent
public boolean getTransparent()
Gets whether or not a transparent image is being requested.- Returns:
- true if a transparent image is being requested, false otherwise
-
setFormat
public void setFormat(String format) throws IllegalArgumentException
Sets the format of this request. The format must be a string which is in the list of supported formats as provided by getSupportedFormatList() (not necessarily the same String object, but the same sequence of characters). This will be an unformatted string for a WMS 1.0 server (GIF, JPEG, PNG) or a mime-type string for a WMS 1.1 server (image/gif, image/jpeg, image/png). If the format specified is not in the list, an IllegalArgumentException will be thrown.- Parameters:
format
- a format string which is in the list of supported formats- Throws:
IllegalArgumentException
- See Also:
MapImageFormatChooser
-
setImageWidth
public void setImageWidth(int imageWidth)
Sets the width of the image being requested.- Parameters:
imageWidth
- the width of the image being requested
-
setImageHeight
public void setImageHeight(int imageHeight)
Sets the height of the image being requested.- Parameters:
imageHeight
- the height of the image being requested
-
setImageSize
public void setImageSize(int imageWidth, int imageHeight)
Sets the width and height of the image being requested.- Parameters:
imageWidth
- the width of the image being requestedimageHeight
- the height of the image being requested
-
setLayers
public void setLayers(List layerList)
Sets the layers to be requested. Each item in the list should be a string which corresponds to the name of a layer. The order of the list is important as the layers are rendered in the same order they are listed.- Parameters:
layerList
- an ordered List of the names of layers to be displayed
-
setBoundingBox
public void setBoundingBox(BoundingBox bbox)
Sets the BoundingBox of the image being requested.- Parameters:
bbox
- the BoundingBox of the image being requested
-
setTransparent
public void setTransparent(boolean transparent)
Sets whether or not to request an image with a transparent background. Requesting a transparent background doesn't guarantee that the resulting image will actually have a transparent background. Not all servers support transparency, and not all formats support transparency.- Parameters:
transparent
- true to request a transparent background, false otherwise.
-
getURL
public URL getURL() throws MalformedURLException
- Throws:
MalformedURLException
-
getImage
public Image getImage() throws MalformedURLException
Connect to the service and get an Image of the map.- Returns:
- the retrieved map Image
- Throws:
MalformedURLException
-
-