org.deegree_impl.services.wms
Class GetMapHandler_Impl

java.lang.Object
  extended byorg.deegree_impl.services.wms.GetMapHandler_Impl
All Implemented Interfaces:
GetMapHandler

public class GetMapHandler_Impl
extends java.lang.Object
implements GetMapHandler

Version:
$Revision: 1.1 $
Author:
Andreas Poth

Nested Class Summary
private  class GetMapHandler_Impl.ServiceInvokerForNL
          Inner class for accessing the data of one named layer and creating DisplayElements and a Thrme from it.
private  class GetMapHandler_Impl.ServiceInvokerForUL
          Inner class for accessing the data of one user layer and creating DisplayElements and a Thrme from it.
 
Field Summary
private  WMSCapabilities capabilities
           
private  int count
           
protected  CS_CoordinateSystem reqCRS
           
protected  WMSGetMapRequest request
           
protected  double scale
           
private  java.lang.Object[] themes
           
 
Constructor Summary
GetMapHandler_Impl(WMSCapabilities capabilities, WMSGetMapRequest request)
          Creates a new GetMapHandler object.
 
Method Summary
private  double calcDistance(double lon1, double lat1, double lon2, double lat2)
          calculates the distance between two points in EPSG:4326 coodinates.
private  double calcScale()
          calculates the map scale as defined in the OGC WMS 1.1.1 specifications
private  CS_CoordinateSystem createRequestCRS()
          creates an object that represents the CRS of the GetMap request
private  WMSGetMapResponse createResponse(java.lang.Exception e)
          creates a WMSGetMapResponse containing an OGCWebServiceException
private  UserStyle[] getStyles(NamedLayer sldLayer)
          returns the UserStyles assigned to a named layer
protected  void increaseCounter()
          increases the counter variable that holds the number of services that has sent a response.
 OGCWebServiceResponse performGetMap()
          performs a GetMap request and retruns the result encapsulated within a WMSGetMapResponse object.
private  void printCopyright(java.awt.Graphics g, int heigth)
          prints a copyright note at left side of the map bottom.
protected  void putTheme(int index, java.lang.Object o)
          put a theme to the passed index of the themes array.
private  WMSGetMapResponse renderMap()
          renders the map from the DisplayElements
private  boolean validate(Layer layer, java.lang.String name)
          validates if the requested layer matches the conditions of the request if not a WebServiceException will be thrown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

protected WMSGetMapRequest request

themes

private java.lang.Object[] themes

scale

protected double scale

count

private int count

reqCRS

protected CS_CoordinateSystem reqCRS

capabilities

private WMSCapabilities capabilities
Constructor Detail

GetMapHandler_Impl

public GetMapHandler_Impl(WMSCapabilities capabilities,
                          WMSGetMapRequest request)
                   throws WebServiceException
Creates a new GetMapHandler object.

Parameters:
request - request to perform
Method Detail

calcScale

private double calcScale()
                  throws java.lang.Exception
calculates the map scale as defined in the OGC WMS 1.1.1 specifications

Returns:
scale of the map
Throws:
java.lang.Exception

calcDistance

private double calcDistance(double lon1,
                            double lat1,
                            double lon2,
                            double lat2)
calculates the distance between two points in EPSG:4326 coodinates.


createRequestCRS

private CS_CoordinateSystem createRequestCRS()
creates an object that represents the CRS of the GetMap request


increaseCounter

protected void increaseCounter()
increases the counter variable that holds the number of services that has sent a response. All data are available if the counter value equals the number of requested layers.


performGetMap

public OGCWebServiceResponse performGetMap()
                                    throws WebServiceException
performs a GetMap request and retruns the result encapsulated within a WMSGetMapResponse object.

The method throws an WebServiceException that only shall be thrown if an fatal error occurs that makes it imposible to return a result. If something wents wrong performing the request (none fatal error) The exception shall be encapsulated within the response object to be returned to the client as requested (GetMap-Request EXCEPTION-Parameter).

Specified by:
performGetMap in interface GetMapHandler
Returns:
response to the GetMap response
Throws:
WebServiceException

getStyles

private UserStyle[] getStyles(NamedLayer sldLayer)
                       throws WebServiceException
returns the UserStyles assigned to a named layer

Parameters:
sldLayer - layer to get the styles for
Throws:
WebServiceException

validate

private boolean validate(Layer layer,
                         java.lang.String name)
                  throws WebServiceException
validates if the requested layer matches the conditions of the request if not a WebServiceException will be thrown. If the layer matches the request, but isn't able to deviever data for the requested area and/or scale false will be returned. If the layer matches the request and contains data for the requested area and/or scale true will be returned.

Parameters:
layer - layer as defined at the capabilities/configuration
name - name of the layer (must be submitted seperatly because the layer parameter can be null
Throws:
WebServiceException

createResponse

private WMSGetMapResponse createResponse(java.lang.Exception e)
creates a WMSGetMapResponse containing an OGCWebServiceException

Parameters:
e - exception to encapsulate into the response

putTheme

protected void putTheme(int index,
                        java.lang.Object o)
put a theme to the passed index of the themes array. The second param passed is a Theme or an exception


renderMap

private WMSGetMapResponse renderMap()
renders the map from the DisplayElements


printCopyright

private void printCopyright(java.awt.Graphics g,
                            int heigth)
prints a copyright note at left side of the map bottom. The copyright note will be extracted from the WMS capabilities/configuration

Parameters:
g - graphic context of the map
heigth - height of the map in pixel