deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

org.deegree.protocol.wms.client
Class WMSClient111

java.lang.Object
  extended by org.deegree.protocol.wms.client.WMSClient111

public class WMSClient111
extends Object

Allows for easy performing of requests again WMS 1.1.1 compliant map services. TODO refactor timeout and tiled request code

Version:
$Revision: 22077 $, $Date: 2010-01-21 13:21:27 +0100 (Do, 21 Jan 2010) $
Author:
Andreas Schmitz, last edited by: $Author: rbezema $

Field Summary
(package private)  XMLAdapter capabilities
           
(package private) static org.slf4j.Logger LOG
           
(package private)  int maxMapHeight
           
(package private)  int maxMapWidth
           
 
Constructor Summary
WMSClient111(URL url)
           
WMSClient111(XMLAdapter capabilities)
           
 
Method Summary
 String getAddress(WMSConstants.WMSRequestType request, boolean get)
           
 Envelope getBoundingBox(String srs, List<String> layers)
           
 Envelope getBoundingBox(String srs, String layer)
           
 LinkedList<String> getCoordinateSystems(String name)
           
 LinkedList<String> getFormats(WMSConstants.WMSRequestType request)
           
 Envelope getLatLonBoundingBox(List<String> layers)
           
 Envelope getLatLonBoundingBox(String layer)
           
 Pair<BufferedImage,String> getMap(List<String> layers, int width, int height, Envelope bbox, CRS srs, String format, boolean transparent, boolean errorsInImage, int timeout, boolean validate, List<String> validationErrors)
           
 Pair<SimpleRaster,String> getMapAsSimpleRaster(List<String> layers, int width, int height, Envelope bbox, CRS srs, String format, boolean transparent, boolean errorsInImage, int timeout, boolean validate, List<String> validationErrors)
           
 boolean hasLayer(String name)
           
 boolean isOperationSupported(WMSConstants.WMSRequestType request)
           
static void main(String[] args)
           
 void refreshCapabilities()
          TODO implement updateSequence handling to improve network performance
 void setMaxMapDimensions(int maxWidth, int maxHeight)
          Sets the maximum map size that the server will process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

static final org.slf4j.Logger LOG

maxMapWidth

int maxMapWidth

maxMapHeight

int maxMapHeight

capabilities

XMLAdapter capabilities
Constructor Detail

WMSClient111

public WMSClient111(URL url)
Parameters:
url -

WMSClient111

public WMSClient111(XMLAdapter capabilities)
Parameters:
capabilities -
Method Detail

setMaxMapDimensions

public void setMaxMapDimensions(int maxWidth,
                                int maxHeight)
Sets the maximum map size that the server will process. If a larger map is requested, it will be broken down into multiple GetMap requests.

Parameters:
maxWidth - maximum number of pixels in x-direction, or -1 for unrestricted width
maxHeight - maximum number of pixels in y-direction, or -1 for unrestricted height

refreshCapabilities

public void refreshCapabilities()
TODO implement updateSequence handling to improve network performance


isOperationSupported

public boolean isOperationSupported(WMSConstants.WMSRequestType request)
Parameters:
request -
Returns:
true, if an according section was found in the capabilities

getFormats

public LinkedList<String> getFormats(WMSConstants.WMSRequestType request)
Parameters:
request -
Returns:
the image formats defined for the request, or null, if request is not supported

getAddress

public String getAddress(WMSConstants.WMSRequestType request,
                         boolean get)
Parameters:
request -
get - true means HTTP GET, false means HTTP POST
Returns:
the address, or null, if not defined or request unavailable

hasLayer

public boolean hasLayer(String name)
Parameters:
name -
Returns:
true, if the WMS advertises a layer with that name

getCoordinateSystems

public LinkedList<String> getCoordinateSystems(String name)
Parameters:
name -
Returns:
all coordinate system names, also inherited ones

getLatLonBoundingBox

public Envelope getLatLonBoundingBox(String layer)
Parameters:
layer -
Returns:
the envelope, or null, if none was found

getLatLonBoundingBox

public Envelope getLatLonBoundingBox(List<String> layers)
Parameters:
layers -
Returns:
a merged envelope of all the layer's envelopes

getBoundingBox

public Envelope getBoundingBox(String srs,
                               String layer)
Parameters:
srs -
layer -
Returns:
the envelope, or null, if none was found

getBoundingBox

public Envelope getBoundingBox(String srs,
                               List<String> layers)
Parameters:
srs -
layers -
Returns:
the merged envelope, or null, if none was found

getMap

public Pair<BufferedImage,String> getMap(List<String> layers,
                                         int width,
                                         int height,
                                         Envelope bbox,
                                         CRS srs,
                                         String format,
                                         boolean transparent,
                                         boolean errorsInImage,
                                         int timeout,
                                         boolean validate,
                                         List<String> validationErrors)
                                  throws IOException
Parameters:
layers -
width -
height -
bbox -
srs -
format -
transparent -
errorsInImage - if true, no exceptions are thrown or validation errors are returned. The returned pair allows contains an image of the expected size.
timeout - number of seconds to wait for a response from the WMS, use -1 for no constraints
validate - whether to validate the values against the capabilities. Example: a format is requested that the server does not advertise. So the first advertised format will be used, and an entry will be put in the validationErrors list that says just that.
validationErrors - a list of validation actions
Returns:
an image from the server, or an error message from the service exception
Throws:
IOException

getMapAsSimpleRaster

public Pair<SimpleRaster,String> getMapAsSimpleRaster(List<String> layers,
                                                      int width,
                                                      int height,
                                                      Envelope bbox,
                                                      CRS srs,
                                                      String format,
                                                      boolean transparent,
                                                      boolean errorsInImage,
                                                      int timeout,
                                                      boolean validate,
                                                      List<String> validationErrors)
                                               throws IOException
Parameters:
layers -
width -
height -
bbox -
srs -
format -
transparent -
errorsInImage - if true, no exceptions are thrown or validation errors are returned. The returned pair allows contains an image of the expected size.
timeout - number of seconds to wait for a response from the WMS, use -1 for no constraints
validate - whether to validate the values against the capabilities. Example: a format is requested that the server does not advertise. So the first advertised format will be used, and an entry will be put in the validationErrors list that says just that.
validationErrors - a list of validation actions
Returns:
an image from the server (using RGB or RGB color model, encoded as PixelInterleavedRasterData), or an error message from the service exception
Throws:
IOException

main

public static void main(String[] args)
                 throws MalformedURLException
Throws:
MalformedURLException

deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org

]]>