Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| deegree 2.4 (2010/11/11 10:47 build-27-official)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.deegree.portal.standard.wfs.control
Class GeometryValidator

    java.lang.Object
      org.deegree.enterprise.control.AbstractListener
          org.deegree.portal.standard.wfs.control.GeometryValidator

All Implemented Interfaces:
  EventListener, WebListener

    public class GeometryValidator

extends AbstractListener

This listener validates simple geometries. The geometries to be validated are passed in as the value of the `'GEOMETRY'` parameter of such an RPC request:

       <methodCall>
       <methodName>dig:checkGeometry</methodName>
       <params>
       <param><value><struct><member>
       <name>GEOMETRY</name>
       <value><string>POLYGON(( 7.38 49.64, 12.03 48.7, 11.34 51.66, 11.34 51.66, 7.38 49.64 ))</string></value>
       </member></struct></value></param>
       </params>
       </methodCall>

Subclasses may override `validateRequest( RPCWebEvent rpcEvent )`, `createGeometry( RPCWebEvent rpcEvent )` and/or validateGeometry() if they want to change the behaviour regarding request validation, geometry creation and/or geometry validation, respectively. Especially the last method may be different according to use-cases. The result of the validation is put in the session under the key `GeometryValidator.GEOMETRY_STATE`.

Version:
  $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
Author:
  Ugo Taddei, last edited by: $Author: mschneider $

Field Summary
`protected Geometry` | `geometry`
`static String` | `GEOMETRY_STATE` Attribute name for the geometry validity state
`static String` | `INFORMALLY_VALID_GEOMETRY` Indicates that the geometry is OK, although it may not be considered formally correct in most GIS contexts.
`static String` | `INVALID_GEOMETRY` Indicates that the geometry is invalid (self intersection, missing points, etc)
`static String` | `VALID_GEOMETRY` Indicates that the geometry is perfectly valid

Constructor Summary
`GeometryValidator()`

Method Summary
`void` | `actionPerformed(FormEvent event)` This method validates the RPC-encoded request (`validateRequest(RPCWebEvent)`), create some geometry from the request parameters (`createGeometry(RPCWebEvent)` and then validate this geometry (`validateGeometry()`.
`protected Geometry` | `createGeometry(RPCWebEvent rpcEvent)` Creates the geometry from the data provided it the request (rpcEvent).
`protected Object` | `validateGeometry()` Validates this object's `Geometry` and return an object, preferably a code, indicating the validity state of the geometry.
`protected void` | `validateRequest(RPCWebEvent rpcEvent)` Validates the incoming RPc request.

Methods inherited from class org.deegree.enterprise.control.AbstractListener
`getAlternativeNextPage, getHomePath, getInitParameter, getInitParameterList, getNextPage, getRequest, getReturnValue, gotoErrorPage, handle, setAlternativeNextPage, setDefaultAlternativeNextPage, setDefaultNextPage, setNextPage, setReturnValue, toModel`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### GEOMETRY_STATE

    public static final String GEOMETRY_STATE

  Attribute name for the geometry validity state

  See Also:
    Constant Field Values

### VALID_GEOMETRY

    public static final String VALID_GEOMETRY

  Indicates that the geometry is perfectly valid

  See Also:
    Constant Field Values

### INVALID_GEOMETRY

    public static final String INVALID_GEOMETRY

  Indicates that the geometry is invalid (self intersection, missing points, etc)

  See Also:
    Constant Field Values

### INFORMALLY_VALID_GEOMETRY

    public static final String INFORMALLY_VALID_GEOMETRY

  Indicates that the geometry is OK, although it may not be considered formally correct in most GIS contexts.

  See Also:
    Constant Field Values

### geometry

    protected Geometry geometry

Constructor Detail

### GeometryValidator

    public GeometryValidator()

Method Detail

### actionPerformed

    public void actionPerformed(FormEvent event)

  This method validates the RPC-encoded request (`validateRequest(RPCWebEvent)`), create some geometry from the request parameters (`createGeometry(RPCWebEvent)` and then validate this geometry (`validateGeometry()`. The result of this validate is made available to the request object as an attribute under the key `GeometryValidator.GEOMETRY_STATE`.

  Specified by:
    `actionPerformed` in interface `WebListener`
  Specified by:
    `actionPerformed` in class `AbstractListener`
  Parameters:
    `event` - the event containing the RPC-emcoded request.

### validateRequest

    protected void validateRequest(RPCWebEvent rpcEvent)
                            throws Exception

  Validates the incoming RPc request. This method looks for an RPC parameter (struct) named `'GEOMETRY'`, checks if the valeu is empty and looks no further. The expected value is a well-known geometry representation.

  Parameters:
    `rpcEvent` - the event containing at least a struct with a string type parameter named `'GEOMETRY'`.
  Throws:
    `Exception` - If no such parameter is found or if the value is empty. This is interpreted as an exception and the resulting message is sent back to the client.

### createGeometry

    protected Geometry createGeometry(RPCWebEvent rpcEvent)
                               throws Exception

  Creates the geometry from the data provided it the request (rpcEvent).

  Parameters:
    `rpcEvent` - the `RPCWebEvent` conatining the request
  Returns:
    a new geometry. This method uses `WKTAdapter.wrap(String, org.deegree.model.crs.CoordinateSystem)` to create the new `Geometry`.
  Throws:
    `Exception` - if the `Geometry` creation failed.
  See Also:
    `validateRequest(RPCWebEvent)`

### validateGeometry

    protected Object validateGeometry()

  Validates this object's `Geometry` and return an object, preferably a code, indicating the validity state of the geometry. There are three type of geometry validity states.
  - `GeometryValidator.VALID_GEOMETRY`: The geometry is perfecly OK,
  - `GeometryValidator.INVALID_GEOMETRY`: The geometry is not OK (self intersection, missing points, etc),
  - `GeometryValidator.INFORMALLY_VALID_GEOMETRY`: The geometry is OK, although it may not be considered formally correct in most GIS contexts. For example, polygons are supposed to have counter-clockwise outter rings, lines may no self-intersect, etc.
  The meaning of those may also vary according to the use-case, e.g. a polygon that is counter-clockwise but is required to have at least 4 vertices.
  This method employs the Java Topology Suite to check for geometry validity (`Geometry.isValid()`) and, in the case of polygons, for the order of the coordinates (in other words, whether they are counter-clockwise}.
  The result of the validation is available in the request under the key `GeometryValidator.GEOMETRY_STATE`.

  Returns:
    the geometry's validity state

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| deegree 2.4 (2010/11/11 10:47 build-27-official)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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