Class GeometryOperation

java.lang.Object
org.gvsig.fmap.geom.operation.GeometryOperation

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 Details

    • OPERATION_INTERSECTS_NAME

      public static final String OPERATION_INTERSECTS_NAME
      See Also:
    • OPERATION_CONTAINS_NAME

      public static final String OPERATION_CONTAINS_NAME
      See Also:
    • OPERATION_INTERSECTS_CODE

      public static int OPERATION_INTERSECTS_CODE
    • OPERATION_CONTAINS_CODE

      public static int OPERATION_CONTAINS_CODE
  • Constructor Details

    • GeometryOperation

      public GeometryOperation()
  • Method Details

    • 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