org.gvsig.fmap.geom.operation
Class GeometryOperation

java.lang.Object
  extended by org.gvsig.fmap.geom.operation.GeometryOperation
Direct Known Subclasses:
Area, Contains, Crosses, Disjoint, EnsureOrientation, Equals, Flip, FromJTS, FromWKB, FromWKT, Intersects, IsCCW, Out, Overlaps, Perimeter, Perpendicular, PerpendicularPoint, PointDistance, PointGetAngle, ToJTS, Touches, ToWKB, ToWKBNative, ToWKT, UnitVector, Within

public abstract class GeometryOperation
extends Object

Every geometry operation that is registered dynamically must extend this class.
The following example shows how to implement and register a custom operation:

 public class MyOperation extends GeometryOperation {
 
   // Check GeometryManager for alternative methods to register an operation  
   public static final int CODE = 
     GeometryManager.getInstance()
        .registerGeometryOperation("MyOperation", new MyOperation(), geomType);
   
   public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException {
        // Operation logic goes here
   }     
   
   public int getOperationIndex() {
      return CODE;
   }
   
 }
 

Author:
jiyarza

Field Summary
static int OPERATION_CONTAINS_CODE
           
static String OPERATION_CONTAINS_NAME
           
static int OPERATION_INTERSECTS_CODE
           
static String OPERATION_INTERSECTS_NAME
           
 
Constructor Summary
GeometryOperation()
           
 
Method Summary
abstract  int getOperationIndex()
          Returns the constant value that identifies this operation and that was obtained upon registering it.
abstract  Object invoke(Geometry geom, GeometryOperationContext ctx)
          Invokes this operation given the geometry and context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPERATION_INTERSECTS_NAME

public static final String OPERATION_INTERSECTS_NAME
See Also:
Constant Field Values

OPERATION_CONTAINS_NAME

public static final String OPERATION_CONTAINS_NAME
See Also:
Constant Field Values

OPERATION_INTERSECTS_CODE

public static int OPERATION_INTERSECTS_CODE

OPERATION_CONTAINS_CODE

public static int OPERATION_CONTAINS_CODE
Constructor Detail

GeometryOperation

public GeometryOperation()
Method Detail

invoke

public abstract Object invoke(Geometry geom,
                              GeometryOperationContext ctx)
                       throws GeometryOperationException
Invokes this operation given the geometry and context

Parameters:
geom - Geometry to which apply this operation
ctx - Parameter container
Returns:
Place-holder object that may contain any specific return value.
Throws:
GeometryOperationException - The implementation is responsible to throw this exception when needed.

getOperationIndex

public abstract int getOperationIndex()
Returns the constant value that identifies this operation and that was obtained upon registering it.

Returns:
operation unique index


Copyright © 2004-2012 gvSIG. All Rights Reserved.