Package org.gvsig.fmap.geom
Interface GeometryManager
- All Superinterfaces:
org.gvsig.tools.service.Manager,org.gvsig.tools.service.spi.ServiceManager
public interface GeometryManager
extends org.gvsig.tools.service.Manager, org.gvsig.tools.service.spi.ServiceManager
This singleton provides a centralized access to gvSIG's Geometry Model.
Its responsibilities are:
- Offering a set of convenient methods for registering and retrieving geometry types.
- Offering a set of convenient methods for registering and retrieving geometry operations associated to one or more geometry types.
- Offering a set of convenient methods for registering and retrieving new geometries.
- Author:
- jiyarza, Jorge Piera
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleancanAggregate(int geomTypeParent, int geomTypeChild) Check if geomTypeParent is a Multigeometry and geomTypeChild is compatiblecreate(int type, int subType) This method creates aGeometrywith a concrete type and subtype.This method creates aGeometrywith the type specified by this name.create(GeometryType geomType) This method creates aGeometrywith the type specified by this GeometryType.createCurve(int subType) createCurve(GeneralPathX generalPathX, int subType) Create a new curve with a concrete type and sets the value for the coordinates using a GeneralPathX.Create a memory spatial index with the default implementation.createEnvelope(double minX, double minY, double maxX, double maxY, int subType) Creates a Envelope with a concrete subtype.createEnvelope(int subType) Creates a Envelope with a concrete subtype.createFrom(byte[] wkb) Create a geometry from a WKB definition.createFrom(byte[] wkb, org.gvsig.crs.projection.lib.Projection srs) createFrom(Reader geom, org.gvsig.crs.projection.lib.Projection srs) createFrom(Object data) createFrom(String wkt) Create a geometry from a WKT or HexWKB definition.createFrom(String wkt, String srs) Create a geometry from a WKT definition.createFrom(String wkt, org.gvsig.crs.projection.lib.Projection srs) createFromQuietly(String wkt) createGeneralPath(int rule, PathIterator pathIterator) Create a GeneralPathX to populate a geometry.createLine(int subType) Create a new line with a concrete type.createMultiCurve(int subType) Create a new multicurve with a concrete subtype.createMultiCurve(GeneralPathX generalPathX, int subType) Create a new multicurve with a concrete type and sets the value for the coordinates using a GeneralPathX.createMultiLine(int subType) createMultiPoint(int subType) Create a new multipoint with a concrete subtype.createMultiPoint(GeneralPathX generalPathX, int subType) Create a new multipoint with a concrete type and sets the value for the coordinates using a GeneralPathX.createMultiPolygon(int subType) createMultiPrimitive(GeometryType geometryType) createMultiSurface(int subType) Create a new multisurface with a concrete subtype.createMultiSurface(GeneralPathX generalPathX, int subType) Create a new multisurface with a concrete type and sets the value for the coordinates using a GeneralPathX.createNullGeometry(int subType) It creates a null geometry with a concrete subtype.createPoint(double x, double y, int subType) Create a new point with a concrete type and sets the value for the X and the Y.createPolygon(int subType) Create a new polygon with a concrete type.createSpatialIndex(String name, org.gvsig.tools.dynobject.DynObject parameters) Create a spatial index with the implementation specified as name.createSurface(int subType) createSurface(GeneralPathX generalPathX, int subType) Create a new surface with a concrete type and sets the value for the coordinates using a GeneralPathX.doubleReturns the flatness used to convert a curve is a set of points.getGeometryOperation(int opCode) Returns an common operation with given operation code.getGeometryOperation(int opCode, int type, int subType) Returns an operation given the Geometry type, the Geometry subtype and and the operation code.intgetGeometryOperationCode(String geomOpName) Registers the unique name of one operation.Returns a list with the name of the operations that have been registered.getGeometryType(int type, int subType) Returns an instance of GeometryType given the Geometry type and the subtype.getGeometryType(String typeName) getSpatialIndexFactory(String name) Return the name of the factory of the spatial index required.invokeOperation(int opCode, Geometry geom, GeometryOperationContext ctx) Invokes an operation given its code, the geometry and the operation context holding the parameters required for the operation.invokeOperation(String geomOpName, Geometry geom, GeometryOperationContext ctx) Invokes an operation given its code, the geometry and the operation context holding the parameters required for the operation.invokeOperation(String geomOpName, GeometryOperationContext ctx) Invokes an operation given its code, and the operation context holding the parameters required for the operation.booleanisSubtype(int geomTypeParent, int geomTypeChild) Check if geomTypeChild is a geoemtry type deribed of geomTypeParentintregisterGeometryOperation(String geomOpName, GeometryOperation geomOp) Registers a GeometryOperation that is common for all GeometryType (registered yet or not).intregisterGeometryOperation(String geomOpName, GeometryOperation geomOp, int type) Registers a GeometryOperation associated to all the geometries with a concrete type.intregisterGeometryOperation(String geomOpName, GeometryOperation geomOp, int type, int subType) Registers a GeometryOperation associated to a GeometryType, that has been specified using the type code and the subtype code.intregisterGeometryOperation(String geomOpName, GeometryOperation geomOp, GeometryType geomType) Registers a GeometryOperation associated to a GeometryType.intregisterGeometryOperationBySubtype(String geomOpName, GeometryOperation geomOp, int subType) Registers a GeometryOperation associated to all the geometries with a concrete subtype.intregisterGeometryOperationBySuperSubType(String geomOpName, GeometryOperation geomOp, int superSubType) Registers a GeometryOperation associated to all the geometries which super subType matches with a concrete subType.intregisterGeometryOperationBySuperType(String geomOpName, GeometryOperation geomOp, int superType) Registers a GeometryOperation associated to all the geometries which super type matches with a concrete type.registerGeometryType(Class geomClass, int type, int subType) Registers a Geometry implementation class with a predefined geometry type and returns the associated GeometryType instance.registerGeometryType(Class geomClass, String name, int type, int subType) Registers a Geometry implementation class with a predefined geometry type and returns the associated GeometryType instance.registerGeometryType(Class geomClass, String name, int type, int subType, int superType) Registers a Geometry implementation class with a predefined geometry type and returns the associated GeometryType instance.registerGeometryType(Class geomClass, String name, int type, int subType, int[] superTypes) Registers a Geometry implementation class with a predefined geometry type and returns the associated GeometryType instance.registerGeometryType(Class geomClass, String name, int type, int subType, int[] superTypes, int[] superSubTypes) Registers a Geometry implementation class with a predefined geometry type and returns the associated GeometryType instance.registerGeometryType(Class geomClass, String name, int type, int subType, int superType, int superSubType) Registers a Geometry implementation class with a predefined geometry type and returns the associated GeometryType instance.registerGeometryType(GeometryType geometryType) Registers a GeometryType instance.voidsetFlatness(double flatness) Sets the application flatness.Methods inherited from interface org.gvsig.tools.service.Manager
createServiceParameters, getServiceMethods inherited from interface org.gvsig.tools.service.spi.ServiceManager
addServiceFactory, createService, createServiceParameters
-
Field Details
-
SPATIALINDEX_DEFAULT_RTREE
- See Also:
-
SPATIALINDEX_DEFAULT_QUADTREE
- See Also:
-
-
Method Details
-
registerGeometryOperation
Registers a GeometryOperation associated to a GeometryType. Returns an unique index that is used later to identify and invoke the operation. By convention this index should be in a final and static variable in the class that implements the operation. The value of this variable must be set using the methodgetGeometryOperationCode(String):public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }- Parameters:
geomOpName- Operation's unique namegeomOp- Specific GeometryOperation's instance implementing this operationgeomType- GeometryType instance to which this operation should be associated- Returns:
- Index assigned to this operation. This index is used later to access the operation.
-
registerGeometryOperation
Registers a GeometryOperation that is common for all GeometryType (registered yet or not). Returns an unique index that is used later to identify and invoke the operation. By convention this index should be in a final and static variable in the class that implements the operation. The value of this variable must be set using the methodgetGeometryOperationCode(String):public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }- Parameters:
geomOpName- Operation's unique namegeomOp- Specific GeometryOperation's instance implementing this operation- Returns:
- Index assigned to this operation. This index is used later to access the operation.
-
registerGeometryOperation
int registerGeometryOperation(String geomOpName, GeometryOperation geomOp, int type, int subType) throws GeometryTypeNotSupportedException, GeometryTypeNotValidException Registers a GeometryOperation associated to a GeometryType, that has been specified using the type code and the subtype code. Returns an unique index that is used later to identify and invoke the operation. By convention this index should be in a final and static variable in the class that implements the operation. The value of this variable must be set using the methodgetGeometryOperationCode(String):public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }This method is only used if you have not a reference to the GeometryType associated to the geometry class. If you have such reference then it is slightly faster to use the method that receives the GeometryType.- Parameters:
geomOpName- Operation's unique namegeomOp- Specific GeometryOperation's instance implementing this operationtype- Type of geometry. Must be a value defined inGeometry.TYPESsubType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- Index assigned to this operation. This index is used later to access the operation.
- Throws:
GeometryTypeNotSupportedException- Returns this exception if there is not a registered geometry with these type and subtypeGeometryTypeNotValidException- Returns if the type and subtype are not valid
-
registerGeometryOperation
Registers a GeometryOperation associated to all the geometries with a concrete type. Returns an unique index that is used later to identify and invoke the operation. By convention this index should be in a final and static variable in the class that implements the operation. The value of this variable must be set using the methodgetGeometryOperationCode(String):public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }- Parameters:
geomOpName- Operation's unique namegeomOp- Specific GeometryOperation's instance implementing this operationtype- Type of geometry. Must be a value defined inGeometry.TYPES- Returns:
- Index assigned to this operation. This index is used later to access the operation.
-
registerGeometryOperationBySuperType
int registerGeometryOperationBySuperType(String geomOpName, GeometryOperation geomOp, int superType) Registers a GeometryOperation associated to all the geometries which super type matches with a concrete type. Returns an unique index that is used later to identify and invoke the operation. By convention this index should be in a final and static variable in the class that implements the operation. The value of this variable must be set using the methodgetGeometryOperationCode(String):public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }- Parameters:
geomOpName- Operation's unique namegeomOp- Specific GeometryOperation's instance implementing this operationsuperType- super type of geometries that is used to register the operation. Must be a value defined inGeometry.TYPES- Returns:
- Index assigned to this operation. This index is used later to access the operation.
-
registerGeometryOperationBySuperSubType
int registerGeometryOperationBySuperSubType(String geomOpName, GeometryOperation geomOp, int superSubType) Registers a GeometryOperation associated to all the geometries which super subType matches with a concrete subType. Returns an unique index that is used later to identify and invoke the operation. By convention this index should be in a final and static variable in the class that implements the operation. The value of this variable must be set using the methodgetGeometryOperationCode(String):public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }- Parameters:
geomOpName- Operation's unique namegeomOp- Specific GeometryOperation's instance implementing this operationsuperSubType- super subType of geometries that is used to register the operation. Must be a value defined inGeometry.SUBTYPES- Returns:
- Index assigned to this operation. This index is used later to access the operation.
-
registerGeometryOperationBySubtype
Registers a GeometryOperation associated to all the geometries with a concrete subtype. Returns an unique index that is used later to identify and invoke the operation. By convention this index should be in a final and static variable in the class that implements the operation. The value of this variable must be set using the methodgetGeometryOperationCode(String):public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }- Parameters:
geomOpName- Operation's unique namegeomOp- Specific GeometryOperation's instance implementing this operationsubType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- Index assigned to this operation. This index is used later to access the operation.
-
registerGeometryType
Registers a GeometryType instance.- Parameters:
geometryType- AGeometryTypeinstance to createGeometryobjects
-
registerGeometryType
Registers a Geometry implementation class with a predefined geometry type and returns the associated GeometryType instance. Available predefined types are defined inGeometry.TYPESand the subtypes are defined inGeometry.SUBTYPES. How to register a geometry class with a predefined type:GeometryType geomType = GeometryLocator.getGeometryManager() .registerBasicGeometryType(Point2D.class, "Point2D", Geometry.TYPES.POINT, Geometry.SYBTYPES.GEOM2D);- Parameters:
geomClass- Geometry subclass. It must not be null and must implement Geometry, otherwise an exception is raised.name- Symbolic name for the geometry type, it can be null. If it is null then the symbolic name will be the simple class name.type- Type of geometry. Must be a value defined inGeometry.TYPESsubType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- Instance of GeometryType associated to the Geometry implementation class geomClass
- Throws:
IllegalArgumentException- If geomClass is null or does not implement Geometry
-
registerGeometryType
GeometryType registerGeometryType(Class geomClass, String name, int type, int subType, int superType, int superSubType) Registers a Geometry implementation class with a predefined geometry type and returns the associated GeometryType instance. Available predefined types are defined inGeometry.TYPESand the subtypes are defined inGeometry.SUBTYPES. It adds also the super type and the super subType of the geometry, that can be used to check if the type (or the subtype) inherits of other type (or subType) How to register a geometry class with a predefined type:GeometryType geomType = GeometryLocator.getGeometryManager() .registerBasicGeometryType(Arc3D.class, "Arc3D", Geometry.TYPES.ARC, Geometry.SYBTYPES.GEOM3D, Geometry.TYPES.CURVE, Geometry.SYBTYPES.GEOM2D);- Parameters:
geomClass- Geometry subclass. It must not be null and must implement Geometry, otherwise an exception is raised.name- Symbolic name for the geometry type, it can be null. If it is null then the symbolic name will be the simple class name.type- Type of geometry. Must be a value defined inGeometry.TYPESsubType- SubType of geometry. Must be a value defined inGeometry.SUBTYPESsuperType- Super type of a geometry. Must be a value defined inGeometry.TYPESsuperSubType- Super subType of a geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- Instance of GeometryType associated to the Geometry implementation class geomClass
- Throws:
IllegalArgumentException- If geomClass is null or does not implement Geometry
-
registerGeometryType
GeometryType registerGeometryType(Class geomClass, String name, int type, int subType, int superType) Registers a Geometry implementation class with a predefined geometry type and returns the associated GeometryType instance. Available predefined types are defined inGeometry.TYPESand the subtypes are defined inGeometry.SUBTYPES. It adds also the super type of the geometry, that can be used to check if the type inherits of other type. How to register a geometry class with a predefined type:GeometryType geomType = GeometryLocator.getGeometryManager() .registerBasicGeometryType(Arc3D.class, "Arc3D", Geometry.TYPES.ARC, Geometry.SYBTYPES.GEOM3D, Geometry.TYPES.CURVE);- Parameters:
geomClass- Geometry subclass. It must not be null and must implement Geometry, otherwise an exception is raised.name- Symbolic name for the geometry type, it can be null. If it is null then the symbolic name will be the simple class name.type- Type of geometry. Must be a value defined inGeometry.TYPESsubType- SubType of geometry. Must be a value defined inGeometry.SUBTYPESsuperType- Super type of a geometry. Must be a value defined inGeometry.TYPES- Returns:
- Instance of GeometryType associated to the Geometry implementation class geomClass
- Throws:
IllegalArgumentException- If geomClass is null or does not implement Geometry
-
registerGeometryType
GeometryType registerGeometryType(Class geomClass, String name, int type, int subType, int[] superTypes, int[] superSubTypes) Registers a Geometry implementation class with a predefined geometry type and returns the associated GeometryType instance. Available predefined types are defined inGeometry.TYPESand the subtypes are defined inGeometry.SUBTYPES. It adds also the super types and the super subTypes of the geometry, that can be used to check if the type (or the subtype) inherits of other types (or subTypes) How to register a geometry class with a predefined type:GeometryType geomType = GeometryLocator.getGeometryManager() .registerBasicGeometryType(Circle3DM.class, "Circle3DM", Geometry.TYPES.CIRCLE, Geometry.SYBTYPES.GEOM3DM, new int[]{Geometry.TYPES.CURVE, Geometry.TYPES.GEOMETRY}, new int[]{Geometry.SYBTYPES.GEOM2D, Geometry.SYBTYPES.GEOM3D});- Parameters:
geomClass- Geometry subclass. It must not be null and must implement Geometry, otherwise an exception is raised.name- Symbolic name for the geometry type, it can be null. If it is null then the symbolic name will be the simple class name.type- Type of geometry. Must be a value defined inGeometry.TYPESsubType- SubType of geometry. Must be a value defined inGeometry.SUBTYPESsuperTypes- List of the super types of a geometry. Must be a value defined inGeometry.TYPESsuperSubTypes- List of the super subType of a geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- Instance of GeometryType associated to the Geometry implementation class geomClass
- Throws:
IllegalArgumentException- If geomClass is null or does not implement Geometry
-
registerGeometryType
GeometryType registerGeometryType(Class geomClass, String name, int type, int subType, int[] superTypes) Registers a Geometry implementation class with a predefined geometry type and returns the associated GeometryType instance. Available predefined types are defined inGeometry.TYPESand the subtypes are defined inGeometry.SUBTYPES. It adds also the super types and the super subTypes of the geometry, that can be used to check if the type inherits of other types. How to register a geometry class with a predefined type:GeometryType geomType = GeometryLocator.getGeometryManager() .registerBasicGeometryType(Circle2D.class, "Circle2DM", Geometry.TYPES.CIRCLE, Geometry.SYBTYPES.GEOM2D, new int[]{Geometry.TYPES.CURVE, Geometry.TYPES.SURFACE});- Parameters:
geomClass- Geometry subclass. It must not be null and must implement Geometry, otherwise an exception is raised.name- Symbolic name for the geometry type, it can be null. If it is null then the symbolic name will be the simple class name.type- Type of geometry. Must be a value defined inGeometry.TYPESsubType- SubType of geometry. Must be a value defined inGeometry.SUBTYPESsuperTypes- List of the super types of a geometry. Must be a value defined inGeometry.TYPES- Returns:
- Instance of GeometryType associated to the Geometry implementation class geomClass
- Throws:
IllegalArgumentException- If geomClass is null or does not implement Geometry
-
registerGeometryType
Registers a Geometry implementation class with a predefined geometry type and returns the associated GeometryType instance. Available predefined types are defined inGeometry.TYPESand the subtypes are defined inGeometry.SUBTYPES. In this case the symbolic name will be the geometry's simple class name How to register a new geometry type:GeometryType geomType = GeometryLocator.getGeometryManager() .registerBasicGeometryType(Point2D.class, Geometry.TYPES.POINT, Geometry.SYBTYPES.GEOM2D);- Parameters:
geomClass- Geometry implementation class. It must not be null and must implement Geometry, otherwise an exception is thrown.type- Type of geometry. Must be a value defined inGeometry.TYPESsubType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- Instance of GeometryType associated to the Geometry implementation class
- Throws:
IllegalArgumentException- If geomClass is null or does not implement Geometry
-
getGeometryType
GeometryType getGeometryType(String typeName) throws GeometryTypeNotSupportedException, GeometryTypeNotValidException -
getGeometryType
GeometryType getGeometryType(int type, int subType) throws GeometryTypeNotSupportedException, GeometryTypeNotValidException Returns an instance of GeometryType given the Geometry type and the subtype.- Parameters:
type- Type of geometry. Must be a value defined inGeometry.TYPESsubType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- Instance of GeometryType associated to the type and the subtype
- Throws:
GeometryTypeNotSupportedException- Returns this exception if there is not a registered geometry with these type and subtypeGeometryTypeNotValidException- Returns if the type and subtype are not valid
-
create
This method creates aGeometrywith the type specified by this GeometryType. The geometry is empty, and all the internal attributes must be assigned to a value when the geometry has been created. This example creates a point2D and sets the coordinates to 1,1:Point point = (Point) GeometryLocator.getGeometryManager().create(GEOMETRY.TYPES.POINT, GEOMETRY.SUBTYPES.GEOM2D); point.setX(1); point.setY(1);- Parameters:
geomType- The geometry type- Returns:
- A instance of a geometry.
- Throws:
CreateGeometryException- This exception is thrown when the manager can not create the geometry.
-
createEnvelope
Creates a Envelope with a concrete subtype. The envelope is empty and it have to be filled with the corners once has been created.- Parameters:
subType- SubType of envelope. Must be a value defined inGeometry.SUBTYPES- Returns:
- A Envelope
- Throws:
CreateEnvelopeException- If it is not possible to create the envelope.
-
createEnvelope
Envelope createEnvelope(double minX, double minY, double maxX, double maxY, int subType) throws CreateEnvelopeException Creates a Envelope with a concrete subtype. It sets the values for the lower corner and the upper corner (in 2D) using the method parameters.- Parameters:
minX- The minimum value for the X coordinate.minY- The minimum value for the Y coordinate.maxX- The maximum value for the X coordinate.maxY- The maximum value for the Y coordinate.subType- SubType of envelope. Must be a value defined inGeometry.SUBTYPES- Returns:
- Throws:
CreateEnvelopeException
-
create
This method creates aGeometrywith the type specified by this name. If a geometry with this name doesn't exist, aIllegalArgumentExceptionis thrown. The geometry is empty, and all the internal attributes must be assigned to a value when the geometry has been created. This example creates a point2D and sets the coordinates to 1,1: It supposes that there is a Point2D class with name "Point2D".Point point = (Point) GeometryLocator.getGeometryManager().create("Point2D"); point.setX(1); point.setY(1);- Parameters:
name- The name of the geometry type- Returns:
- A instance of a geometry.
- Throws:
CreateGeometryException- This exception is thrown when the manager can not create the geometry.
-
createFrom
- Parameters:
data-- Returns:
- Throws:
CreateGeometryExceptionGeometryException
-
createFrom
Create a geometry from a WKT definition. This is a utility method to wrap the invocation to the operationGeometryManager.OPERATIONS.FROMWKT.- Parameters:
wkt- geometry in Well-known text formatsrs-- Returns:
- the geometry as a Geometry
- Throws:
CreateGeometryExceptionGeometryException
-
createFrom
Geometry createFrom(String wkt, org.gvsig.crs.projection.lib.Projection srs) throws CreateGeometryException, GeometryException -
createFrom
Geometry createFrom(Reader geom, org.gvsig.crs.projection.lib.Projection srs) throws GeometryException - Throws:
GeometryException
-
createFrom
Create a geometry from a WKT or HexWKB definition.- Parameters:
wkt- geometry in WKT or HexWKB text format. If null return null.- Returns:
- the geometry as a Geometry
- Throws:
CreateGeometryExceptionGeometryException
-
createFromQuietly
-
createFrom
Create a geometry from a WKB definition. This is a utility method to wrap the invocation to the operationGeometryManager.OPERATIONS.FROMWKB.- Parameters:
wkb- geometry in well-known binary format- Returns:
- the geometry as a Geometry
- Throws:
CreateGeometryExceptionGeometryException
-
createFrom
Geometry createFrom(byte[] wkb, org.gvsig.crs.projection.lib.Projection srs) throws CreateGeometryException, GeometryException -
create
This method creates aGeometrywith a concrete type and subtype. The geometry is empty, and all the internal attributes must be assigned to a value when the geometry has been created. This example creates a point2D and sets the coordinates to 1,1. It supposes that there is a Point2D class with the id 1.Point point = (Point) GeometryLocator.getGeometryManager().create(Geometry.TYPES.POINT, Geometry.SYBTYPES.GEOM2D); point.setX(1); point.setY(1);- Parameters:
type- Type of geometry. Must be a value defined inGeometry.TYPESsubType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- A instance of a geometry.
- Throws:
CreateGeometryException- This exception is thrown when the manager can not create the geometry.
-
createNullGeometry
It creates a null geometry with a concrete subtype.- Parameters:
subType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- A NullGeometry
- Throws:
CreateGeometryException- This exception is thrown when the manager can not create the geometry.
-
createPoint
Create a new point with a concrete type and sets the value for the X and the Y.- Parameters:
x- The X coordinatey- The y coordinatesubType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- The Point
- Throws:
CreateGeometryException- This exception is thrown when the manager can not create the geometry.
-
createLine
Create a new line with a concrete type. Use later addVertex to add vertex to te line.- Parameters:
subType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- a line
- Throws:
CreateGeometryException- This exception is thrown when the manager can not create the geometry.
-
createCurve
- Throws:
CreateGeometryException
-
createPolygon
Create a new polygon with a concrete type. Use later addVertex to add vertex to te polygon.- Parameters:
subType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- A polygon
- Throws:
CreateGeometryException- This exception is thrown when the manager can not create the geometry.
-
createSurface
- Throws:
CreateGeometryException
-
createMultiPoint
Create a new multipoint with a concrete subtype. Use addPrimitive to populate the multipoint.- Parameters:
subType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- A multipoint
- Throws:
CreateGeometryException- This exception is thrown when the manager can not create the geometry.
-
createMultiCurve
Create a new multicurve with a concrete subtype. Use addPrimitive to populate the multicurve.- Parameters:
subType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- A multicurve
- Throws:
CreateGeometryException- This exception is thrown when the manager can not create the geometry.
-
createMultiLine
- Throws:
CreateGeometryException
-
createMultiSurface
Create a new multisurface with a concrete subtype. Use later addPrimitive to populate.- Parameters:
subType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- A multisurface
- Throws:
CreateGeometryException- This exception is thrown when the manager can not create the geometry.
-
createMultiPolygon
- Throws:
CreateGeometryException
-
getGeometryOperation
GeometryOperation getGeometryOperation(int opCode, int type, int subType) throws GeometryTypeNotSupportedException, GeometryOperationNotSupportedException, GeometryTypeNotValidException Returns an operation given the Geometry type, the Geometry subtype and and the operation code. If opCode corresponds to a common operation (a common operation is an operation registered for all geometries), then this method returns the common operation. For better performance, if you need to call an operation multiple times, use this method only once and keep the returned object in a local variable over which you can iterate. For instance:// Get the operation you need GeometryManager gm = GeometryLocator.getGeometryManager() GeometryOperation geomOp = null; try { geomOp = gm.getGeometryOperation(Draw2D.CODE, Geometry.TYPES.POINT, Geometry.SUBTYPES.GEOM2D); } catch (GeometryTypeNotSupportedException gtnse) { // treat exception } catch (GeometryOperationNotSupportedException gonse) { // treat exception } // Fill the operation context with required params GeometryOperationContext ctx = new GeometryOperationContext(); // Here is the main loop where you call the operation for (int i=0; i<myGeometries.length; i++) { Object result = geomOp.invoke(myGeometries[i], ctx); }- Parameters:
opCode- The operation codetype- Type of geometry. Must be a value defined inGeometry.TYPESsubType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- Geometry operation
- Throws:
GeometryTypeNotSupportedException- Returns this exception if there is not a registered geometry with these type and subtypeGeometryTypeNotValidException- Returns this exception if the type and subtype are not validGeometryOperationNotSupportedException- Returns this exception if there is not a registered operation with this operation code
-
getGeometryOperation
Returns an common operation with given operation code. A common operation is an operation registered for all geometries. For better performance, if you need to call an operation multiple times, use this method only once and keep the returned object in a local variable over which you can iterate. For instance:// Get the operation you need GeometryManager gm = GeometryLocator.getGeometryManager() GeometryOperation geomOp = null; try { geomOp = gm.getGeometryOperation(FromWKB.CODE); } catch (GeometryOperationNotSupportedException gonse) { // treat exception } // Fill the operation context with required params FromWKBGeometryOperationContext ctx = new FromWKBGeometryOperationContext(); // Here is the main loop where you call the operation for (int i=0; i<myGeometriesWKB.length; i++) { ctx.setData(myGeometriesWKB[i]); Object result = geomOp.invoke(null, ctx); }- Parameters:
opCode- The operation code- Returns:
- Geometry operation
- Throws:
GeometryOperationNotSupportedException- Returns this exception if there is not a registered operation with this operation code
-
invokeOperation
Object invokeOperation(int opCode, Geometry geom, GeometryOperationContext ctx) throws GeometryOperationNotSupportedException, GeometryOperationException Invokes an operation given its code, the geometry and the operation context holding the parameters required for the operation.- Parameters:
opCode- Operation code.geom- Geometry to which apply the operationctx- Context holding the operation parameters- Returns:
- The object returned by an operation, depends on each operation.
- Throws:
GeometryOperationNotSupportedExceptionGeometryOperationException
-
invokeOperation
Object invokeOperation(String geomOpName, Geometry geom, GeometryOperationContext ctx) throws GeometryOperationNotSupportedException, GeometryOperationException Invokes an operation given its code, the geometry and the operation context holding the parameters required for the operation.- Parameters:
geomOpName- Operation name.geom- Geometry to which apply the operationctx- Context holding the operation parameters- Returns:
- The object returned by an operation, depends on each operation.
- Throws:
GeometryOperationNotSupportedExceptionGeometryOperationException
-
invokeOperation
Object invokeOperation(String geomOpName, GeometryOperationContext ctx) throws GeometryOperationNotSupportedException, GeometryOperationException Invokes an operation given its code, and the operation context holding the parameters required for the operation.- Parameters:
geomOpName- Operation name.ctx- Context holding the operation parameters- Returns:
- The object returned by an operation, depends on each operation.
- Throws:
GeometryOperationNotSupportedExceptionGeometryOperationException
-
getGeometryOperationCode
Registers the unique name of one operation. If it already exists then this method does nothing but returning the name's corresponding index. By convention this method is used to set the value of the final and static variable that is located in the classes that implements the operation:
public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }- Parameters:
geomOpName- Name used to register the geometry operation- Returns:
- Index assigned to the operation name passed as parameter
-
getGeometryOperationNames
List getGeometryOperationNames()Returns a list with the name of the operations that have been registered.- Returns:
- A list of the registered operations.
-
getFlatness
double getFlatness()Returns the flatness used to convert a curve is a set of points.- Returns:
- The flatness.
-
setFlatness
void setFlatness(double flatness) Sets the application flatness.- Parameters:
flatness- The flatness to set
-
createDefaultMemorySpatialIndex
Create a memory spatial index with the default implementation.- Returns:
- a new SpatialIndex
- Throws:
org.gvsig.tools.service.ServiceException
-
createSpatialIndex
SpatialIndex createSpatialIndex(String name, org.gvsig.tools.dynobject.DynObject parameters) throws org.gvsig.tools.service.ServiceException Create a spatial index with the implementation specified as name. If the creation of index don't requery parameters can be passed a null.- Parameters:
name- of the type of spatial index to createparameters- used to create the index or null.- Returns:
- the new SpatialIndex or null if not exists the type of index.
- Throws:
GeometryExceptionorg.gvsig.tools.service.ServiceException
-
getSpatialIndexFactory
Return the name of the factory of the spatial index required.- Parameters:
name- of the spatial index factory- Returns:
- the SpatialIndexFactory required or null if not exists
-
createGeneralPath
Create a GeneralPathX to populate a geometry. This method is deprecated, instead use OrientablePrimitive#addVertex(Point) to add vertex to primitive geometries orMultiPrimitive.addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)to add geometries to an aggregate.- Parameters:
rule-pathIterator- , can be null- Returns:
- a GeneralPathX
- See Also:
-
createCurve
Create a new curve with a concrete type and sets the value for the coordinates using a GeneralPathX.- Parameters:
generalPathX- It is used to set the values for the X and Y coordinates.subType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- A curve
- Throws:
CreateGeometryException- This exception is thrown when the manager can not create the geometry.
-
createMultiPoint
Create a new multipoint with a concrete type and sets the value for the coordinates using a GeneralPathX.- Parameters:
generalPathX- It is used to set the values for the X and Y coordinates.subType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- A multipoint
- Throws:
CreateGeometryException- This exception is thrown when the manager can not create the geometry.
-
createMultiCurve
Create a new multicurve with a concrete type and sets the value for the coordinates using a GeneralPathX.- Parameters:
generalPathX- It is used to set the values for the X and Y coordinates.subType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- A multicurve
- Throws:
CreateGeometryException- This exception is thrown when the manager can not create the geometry.
-
createSurface
Create a new surface with a concrete type and sets the value for the coordinates using a GeneralPathX.- Parameters:
generalPathX- It is used to set the values for the X and Y coordinates.subType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- A surface
- Throws:
CreateGeometryException- This exception is thrown when the manager can not create the geometry.
-
createMultiSurface
MultiSurface createMultiSurface(GeneralPathX generalPathX, int subType) throws CreateGeometryException Create a new multisurface with a concrete type and sets the value for the coordinates using a GeneralPathX.- Parameters:
generalPathX- It is used to set the values for the X and Y coordinates.subType- SubType of geometry. Must be a value defined inGeometry.SUBTYPES- Returns:
- A multisurface
- Throws:
CreateGeometryException- This exception is thrown when the manager can not create the geometry.
-
createInformacionBuilder
InformationbuilderWithGeometrySupport createInformacionBuilder() -
isSubtype
boolean isSubtype(int geomTypeParent, int geomTypeChild) Check if geomTypeChild is a geoemtry type deribed of geomTypeParent- Parameters:
geomTypeParent-geomTypeChild-- Returns:
-
canAggregate
boolean canAggregate(int geomTypeParent, int geomTypeChild) Check if geomTypeParent is a Multigeometry and geomTypeChild is compatible- Parameters:
geomTypeParent-geomTypeChild-- Returns:
-
createGeometryCoercionContext
GeometryCoercionContext createGeometryCoercionContext() -
createMultiPrimitive
- Throws:
CreateGeometryException
-