org.deegree_impl.services.wms
Class GetFeatureInfoHandler_Impl

java.lang.Object
  extended byorg.deegree_impl.services.wms.GetFeatureInfoHandler_Impl
All Implemented Interfaces:
GetFeatureInfoHandler

class GetFeatureInfoHandler_Impl
extends java.lang.Object
implements GetFeatureInfoHandler

Version:
$Revision: 1.1 $
Author:
Andreas Poth

Nested Class Summary
private  class GetFeatureInfoHandler_Impl.ServiceInvoker
          Inner class for accessing the data of one layer and creating a GML document from it.
 
Field Summary
private  WMSCapabilities capabilities
           
private  int count
           
protected  WMSGetMapRequest getMapRequest
           
private  java.lang.Object[] gml
           
protected  CS_CoordinateSystem reqCRS
           
protected  WMSGetFeatureInfoRequest request
           
protected  double scale
           
 
Constructor Summary
GetFeatureInfoHandler_Impl(WMSCapabilities capabilities, WMSGetFeatureInfoRequest 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  WMSGetFeatureInfoResponse createExceptionResponse(java.lang.Exception e)
          creates a WMSGetMapResponse containing an OGCWebServiceException
private  WMSGetFeatureInfoResponse createFeatureInfoResponse()
          generates the desired output from the GMLs
private  CS_CoordinateSystem createRequestCRS()
          creates an object that represents the CRS of the GetMap request
protected  void increaseCounter()
          increases the counter variable that holds the number of services that has sent a response.
 WMSGetFeatureInfoResponse performGetFeatureInfo()
          performs a GetFeatureInfo request and retruns the result encapsulated within a WMSFeatureInfoResponse object.
protected  void putGML(int index, java.lang.Object o)
          put a GML document to the passed index of the gml array.
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.
private  void waitForFinish()
          waits until the requested layers are available as DisplayElements or the time limit has been reached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

protected WMSGetFeatureInfoRequest request

getMapRequest

protected WMSGetMapRequest getMapRequest

capabilities

private WMSCapabilities capabilities

gml

private java.lang.Object[] gml

scale

protected double scale

count

private int count

reqCRS

protected CS_CoordinateSystem reqCRS
Constructor Detail

GetFeatureInfoHandler_Impl

public GetFeatureInfoHandler_Impl(WMSCapabilities capabilities,
                                  WMSGetFeatureInfoRequest 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.


performGetFeatureInfo

public WMSGetFeatureInfoResponse performGetFeatureInfo()
                                                throws WebServiceException
performs a GetFeatureInfo request and retruns the result encapsulated within a WMSFeatureInfoResponse 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 (GetFeatureInfo-Request EXCEPTION-Parameter).

Specified by:
performGetFeatureInfo in interface GetFeatureInfoHandler
Returns:
response to the GetFeatureInfo response
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

createExceptionResponse

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

Parameters:
e - exception to encapsulate into the response

waitForFinish

private void waitForFinish()
                    throws WebServiceException,
                           java.lang.Exception
waits until the requested layers are available as DisplayElements or the time limit has been reached. If the waiting is terminated by reaching the time limit an WebServiceException will be thrown to indicated that the request couldn't be performed correctly.

Throws:
WebServiceException - if the time limit has been reached
java.lang.Exception

putGML

protected void putGML(int index,
                      java.lang.Object o)
put a GML document to the passed index of the gml array. The second param passed is a GML document or an exception


createFeatureInfoResponse

private WMSGetFeatureInfoResponse createFeatureInfoResponse()
generates the desired output from the GMLs