Package org.gvsig.fmap.geom.operation
Class GeometryOperation
java.lang.Object
org.gvsig.fmap.geom.operation.GeometryOperation
Every geometry operation that is registered dynamically must extend this class.
The following example shows how to implement and register a custom operation:
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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract intReturns the constant value that identifies this operation and that was obtained upon registering it.abstract Objectinvoke(Geometry geom, GeometryOperationContext ctx) Invokes this operation given the geometry and context
-
Field Details
-
OPERATION_INTERSECTS_NAME
- See Also:
-
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 operationctx- 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
-