org.deegree.protocol.wms.client
Class WMSClient111

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

public class WMSClient111
extends java.lang.Object

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

Version:
$Revision: 27834 $, $Date: 2010-11-08 14:23:07 +0100 (Mo, 08. Nov 2010) $
Author:
Andreas Schmitz, last edited by: $Author: aschmitz $

Constructor Summary
WMSClient111(java.net.URL url)
           
WMSClient111(XMLAdapter capabilities)
           
 
Method Summary
 java.lang.String getAddress(WMSConstants.WMSRequestType request, boolean get)
           
 Envelope getBoundingBox(java.lang.String srs, java.util.List<java.lang.String> layers)
           
 Envelope getBoundingBox(java.lang.String srs, java.lang.String layer)
           
 java.util.LinkedList<java.lang.String> getCoordinateSystems(java.lang.String name)
           
 java.util.LinkedList<java.lang.String> getFormats(WMSConstants.WMSRequestType request)
           
 Envelope getLatLonBoundingBox(java.util.List<java.lang.String> layers)
           
 Envelope getLatLonBoundingBox(java.lang.String layer)
           
 Pair<java.awt.image.BufferedImage,java.lang.String> getMap(java.util.List<java.lang.String> layers, int width, int height, Envelope bbox, CRS srs, java.lang.String format, boolean transparent, boolean errorsInImage, int timeout, boolean validate, java.util.List<java.lang.String> validationErrors)
           
 Pair<SimpleRaster,java.lang.String> getMapAsSimpleRaster(java.util.List<java.lang.String> layers, int width, int height, Envelope bbox, CRS srs, java.lang.String format, boolean transparent, boolean errorsInImage, int timeout, boolean validate, java.util.List<java.lang.String> validationErrors)
           
 java.util.List<java.lang.String> getNamedLayers()
           
 java.lang.String getSystemId()
           
 boolean hasLayer(java.lang.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(java.net.URL url)
Parameters:
url -

WMSClient111

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

getSystemId

public java.lang.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 java.util.LinkedList<java.lang.String> getFormats(WMSConstants.WMSRequestType request)
Parameters:
request -
Returns:
the image formats defined for the request, or null, if request is not supported

getAddress

public java.lang.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(java.lang.String name)
Parameters:
name -
Returns:
true, if the WMS advertises a layer with that name

getCoordinateSystems

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

getLatLonBoundingBox

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

getLatLonBoundingBox

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

getBoundingBox

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

getNamedLayers

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

getBoundingBox

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

getMap

public Pair<java.awt.image.BufferedImage,java.lang.String> getMap(java.util.List<java.lang.String> layers,
                                                                  int width,
                                                                  int height,
                                                                  Envelope bbox,
                                                                  CRS srs,
                                                                  java.lang.String format,
                                                                  boolean transparent,
                                                                  boolean errorsInImage,
                                                                  int timeout,
                                                                  boolean validate,
                                                                  java.util.List<java.lang.String> validationErrors)
                                                           throws java.io.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:
java.io.IOException

getMapAsSimpleRaster

public Pair<SimpleRaster,java.lang.String> getMapAsSimpleRaster(java.util.List<java.lang.String> layers,
                                                                int width,
                                                                int height,
                                                                Envelope bbox,
                                                                CRS srs,
                                                                java.lang.String format,
                                                                boolean transparent,
                                                                boolean errorsInImage,
                                                                int timeout,
                                                                boolean validate,
                                                                java.util.List<java.lang.String> validationErrors)
                                                         throws java.io.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:
java.io.IOException


Copyright © 2011. All Rights Reserved.