com.vividsolutions.wms
Class MapRequest

java.lang.Object
  extended bycom.vividsolutions.wms.MapRequest

public class MapRequest
extends java.lang.Object

Represents all of the parameters of a getMap request from a WMS server.

Author:
Chris Hodgson chodgson@refractions.net

Constructor Summary
MapRequest(WMService service)
          Creates a new MapRequest.
 
Method Summary
 BoundingBox getBoundingBox()
          Gets the BoundingBox of the image being requested.
 java.lang.String getFormat()
          Returns the format of this request.
 java.awt.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.
 java.util.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.
 java.net.URL getURL()
           
 void setBoundingBox(BoundingBox bbox)
          Sets the BoundingBox of the image being requested.
 void setFormat(java.lang.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(java.util.List layerList)
          Sets the layers to be requested.
 void setTransparent(boolean transparent)
          Sets whether or not to request an image with a transparent background.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 java.lang.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 java.util.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(java.lang.String format)
               throws java.lang.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:
java.lang.IllegalArgumentException - if the specified format isn't in the list of supported formats
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 requested
imageHeight - the height of the image being requested

setLayers

public void setLayers(java.util.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 java.net.URL getURL()
                    throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException - if there is a problem building the URL for some reason

getImage

public java.awt.Image getImage()
                        throws java.net.MalformedURLException
Connect to the service and get an Image of the map.

Returns:
the retrieved map Image
Throws:
java.net.MalformedURLException