Revision 21047 branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/operation/GeometryOperation.java
GeometryOperation.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import org.gvsig.fmap.geom.Geometry; |
4 | 4 |
|
5 |
/** |
|
6 |
* Every geometry operation that is registered dynamically must extend this class.<br> |
|
7 |
* |
|
8 |
* The following example shows how to implement and register a custom operation: |
|
9 |
* |
|
10 |
* <pre> |
|
11 |
* public class MyOperation extends GeometryOperation { |
|
12 |
* |
|
13 |
* // Check GeometryManager for alternative methods to register an operation |
|
14 |
* public static final int OPERATION_INDEX = |
|
15 |
* GeometryManager.getInstance() |
|
16 |
* .registerGeometryOperation("MyOperation", new MyOperation(), geomType); |
|
17 |
* |
|
18 |
* public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException { |
|
19 |
* // Operation logic goes here |
|
20 |
* } |
|
21 |
* |
|
22 |
* public int getOperationIndex() { |
|
23 |
* return OPERATION_INDEX; |
|
24 |
* } |
|
25 |
* |
|
26 |
* } |
|
27 |
* </pre> |
|
28 |
* |
|
29 |
* @author jiyarza |
|
30 |
* |
|
31 |
*/ |
|
5 | 32 |
public abstract class GeometryOperation { |
6 | 33 |
|
34 |
/** |
|
35 |
* Invokes this operation given the geometry and context |
|
36 |
* @param geom Geometry to which apply this operation |
|
37 |
* @param ctx Parameter container |
|
38 |
* @return Place-holder object that may contain any specific return value. |
|
39 |
* @throws GeometryOperationException The implementation is responsible to throw this exception when needed. |
|
40 |
*/ |
|
7 | 41 |
public abstract Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException; |
8 | 42 |
|
43 |
/** |
|
44 |
* Returns the constant value that identifies this operation and that was obtained upon registering it. |
|
45 |
* @return operation unique index |
|
46 |
*/ |
|
9 | 47 |
public abstract int getOperationIndex(); |
10 | 48 |
} |
Also available in: Unified diff