Revision 37331 branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/GeometryManager.java
GeometryManager.java | ||
---|---|---|
969 | 969 |
* GeometryManager gm = GeometryLocator.getGeometryManager() |
970 | 970 |
* GeometryOperation geomOp = null; |
971 | 971 |
* try { |
972 |
* geomOp = gm.getGeometryOperation(Draw2D.CODE); |
|
972 |
* geomOp = gm.getGeometryOperation(Draw2D.CODE, Geometry.TYPES.POINT, |
|
973 |
* Geometry.SUBTYPES.GEOM2D); |
|
973 | 974 |
* } catch (GeometryTypeNotSupportedException gtnse) { |
974 | 975 |
* // treat exception |
975 | 976 |
* } catch (GeometryOperationNotSupportedException gonse) { |
... | ... | |
980 | 981 |
* GeometryOperationContext ctx = new GeometryOperationContext(); |
981 | 982 |
* |
982 | 983 |
* // Here is the main loop where you call the operation |
983 |
* for (int i=0; i<MyGeometries.length; i++) {
|
|
984 |
* for (int i=0; i<myGeometries.length; i++) {
|
|
984 | 985 |
* Object result = geomOp.invoke(myGeometries[i], ctx); |
985 | 986 |
* } |
986 | 987 |
* </pre> |
... | ... | |
1013 | 1014 |
|
1014 | 1015 |
/** |
1015 | 1016 |
* <p> |
1017 |
* Returns an common operation with given operation code. A common operation |
|
1018 |
* is an operation registered for all geometries. |
|
1019 |
* </p> |
|
1020 |
* <p> |
|
1021 |
* For better performance, if you need to call an operation multiple times, |
|
1022 |
* use this method only once and keep the returned object in a local |
|
1023 |
* variable over which you can iterate. For instance: |
|
1024 |
* |
|
1025 |
* <pre> |
|
1026 |
* // Get the operation you need |
|
1027 |
* GeometryManager gm = GeometryLocator.getGeometryManager() |
|
1028 |
* GeometryOperation geomOp = null; |
|
1029 |
* try { |
|
1030 |
* geomOp = gm.getGeometryOperation(FromWKB.CODE); |
|
1031 |
* } catch (GeometryOperationNotSupportedException gonse) { |
|
1032 |
* // treat exception |
|
1033 |
* } |
|
1034 |
* |
|
1035 |
* // Fill the operation context with required params |
|
1036 |
* FromWKBGeometryOperationContext ctx = new FromWKBGeometryOperationContext(); |
|
1037 |
* |
|
1038 |
* // Here is the main loop where you call the operation |
|
1039 |
* for (int i=0; i<myGeometriesWKB.length; i++) { |
|
1040 |
* ctx.setData(myGeometriesWKB[i]); |
|
1041 |
* Object result = geomOp.invoke(null, ctx); |
|
1042 |
* } |
|
1043 |
* </pre> |
|
1044 |
* |
|
1045 |
* </p> |
|
1046 |
* |
|
1047 |
* @param opCode |
|
1048 |
* The operation code |
|
1049 |
* @return Geometry operation |
|
1050 |
* @throws GeometryOperationNotSupportedException |
|
1051 |
* Returns this exception if there is not a registered operation |
|
1052 |
* with |
|
1053 |
* this operation code |
|
1054 |
*/ |
|
1055 |
public GeometryOperation getGeometryOperation(int opCode) |
|
1056 |
throws GeometryOperationNotSupportedException; |
|
1057 |
|
|
1058 |
/** |
|
1059 |
* <p> |
|
1016 | 1060 |
* Invokes an operation given its code, the geometry and the operation |
1017 | 1061 |
* context holding the parameters required for the operation. |
1018 | 1062 |
* </p> |
... | ... | |
1053 | 1097 |
|
1054 | 1098 |
/** |
1055 | 1099 |
* <p> |
1056 |
* Invokes an operation given its code, the geometry and the operation
|
|
1057 |
* context holding the parameters required for the operation.
|
|
1100 |
* Invokes an operation given its code, and the operation context holding
|
|
1101 |
* the parameters required for the operation. |
|
1058 | 1102 |
* </p> |
1059 | 1103 |
* |
1060 | 1104 |
* @param geomOpName |
Also available in: Unified diff