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: 31619 $, $Date: 2011-08-23 14:56:28 +0200 (Tue, 23 Aug 2011) $
Author:
Andreas Schmitz, last edited by: $Author: mschneider $

Constructor Summary
WMSClient111(URL url)
           
WMSClient111(URL url, int connectionTimeout, int requestTimeout)
           
WMSClient111(URL url, int connectionTimeout, int requestTimeout, String user, String pass)
           
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)
           
 FeatureCollection getFeatureInfo(List<String> queryLayers, int width, int height, int x, int y, Envelope bbox, ICRS srs, int count, Map<String,String> hardParameters)
           
 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, ICRS srs, String format, boolean transparent, boolean errorsInImage, int timeout, boolean validate, List<String> validationErrors)
           
 Pair<BufferedImage,String> getMap(List<String> layers, int width, int height, Envelope bbox, ICRS srs, String format, boolean transparent, boolean errorsInImage, int timeout, boolean validate, List<String> validationErrors, Map<String,String> hardParameters)
           
 Pair<SimpleRaster,String> getMapAsSimpleRaster(List<String> layers, int width, int height, Envelope bbox, ICRS srs, String format, boolean transparent, boolean errorsInImage, int timeout, boolean validate, List<String> validationErrors)
           
 List<String> getNamedLayers()
           
 String getSystemId()
           
 boolean hasLayer(String name)
           
 boolean isOperationSupported(WMSConstants.WMSRequestType request)
           
 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
 

Constructor Detail

WMSClient111

public WMSClient111(URL url,
                    int connectionTimeout,
                    int requestTimeout,
                    String user,
                    String pass)
Parameters:
url -
connectionTimeout - default is 5 seconds
requestTimeout - default is 60 seconds
user - http basic username
pass - http basic password

WMSClient111

public WMSClient111(URL url,
                    int connectionTimeout,
                    int requestTimeout)
Parameters:
url -
connectionTimeout - default is 5 seconds
requestTimeout - default is 60 seconds

WMSClient111

public WMSClient111(URL url)
Parameters:
url -

WMSClient111

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

getSystemId

public String getSystemId()
Returns:
the system id of the capabilities document.

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

getNamedLayers

public List<String> getNamedLayers()
Returns:
the names of all layers that have a name

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,
                                         ICRS 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

getMap

public Pair<BufferedImage,String> getMap(List<String> layers,
                                         int width,
                                         int height,
                                         Envelope bbox,
                                         ICRS srs,
                                         String format,
                                         boolean transparent,
                                         boolean errorsInImage,
                                         int timeout,
                                         boolean validate,
                                         List<String> validationErrors,
                                         Map<String,String> hardParameters)
                                  throws IOException
Parameters:
hardParameters - parameters to override in the request, may be null
Throws:
IOException

getFeatureInfo

public FeatureCollection getFeatureInfo(List<String> queryLayers,
                                        int width,
                                        int height,
                                        int x,
                                        int y,
                                        Envelope bbox,
                                        ICRS srs,
                                        int count,
                                        Map<String,String> hardParameters)
                                 throws IOException
Parameters:
hardParameters - parameters to override in the request, may be null
Throws:
IOException

getMapAsSimpleRaster

public Pair<SimpleRaster,String> getMapAsSimpleRaster(List<String> layers,
                                                      int width,
                                                      int height,
                                                      Envelope bbox,
                                                      ICRS 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


Copyright © 2011. All Rights Reserved.