public interface GeometryManager extends Manager, ServiceManager
Modifier and Type | Interface and Description |
---|---|
static interface |
GeometryManager.OPERATIONS |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SPATIALINDEX_DEFAULT_QUADTREE |
static java.lang.String |
SPATIALINDEX_DEFAULT_RTREE |
Modifier and Type | Method and Description |
---|---|
boolean |
canAggregate(int geomTypeParent,
int geomTypeChild)
Check if geomTypeParent is a Multigeometry and geomTypeChild is compatible
|
Geometry |
create(GeometryType geomType)
This method creates a
Geometry with the type specified by this
GeometryType. |
Geometry |
create(int type,
int subType)
This method creates a
Geometry with a concrete type and subtype. |
Geometry |
create(java.lang.String name)
This method creates a
Geometry with the type specified by this
name. |
Curve |
createCurve(GeneralPathX generalPathX,
int subType)
Deprecated.
use
createCurve(int) and OrientablePrimitive#addVertex(Point) |
Curve |
createCurve(int subType)
Deprecated.
use createLine
|
SpatialIndex |
createDefaultMemorySpatialIndex()
Create a memory spatial index with the default implementation.
|
Envelope |
createEnvelope(double minX,
double minY,
double maxX,
double maxY,
int subType)
Creates a Envelope with a concrete subtype.
|
Envelope |
createEnvelope(int subType)
Creates a Envelope with a concrete subtype.
|
Geometry |
createFrom(byte[] wkb)
Create a geometry from a WKB definition.
|
Geometry |
createFrom(byte[] wkb,
IProjection srs) |
Geometry |
createFrom(java.lang.Object data) |
Geometry |
createFrom(java.io.Reader geom,
IProjection srs) |
Geometry |
createFrom(java.lang.String wkt)
Create a geometry from a WKT or HexWKB definition.
|
Geometry |
createFrom(java.lang.String wkt,
IProjection srs) |
Geometry |
createFrom(java.lang.String wkt,
java.lang.String srs)
Create a geometry from a WKT definition.
|
Geometry |
createFromQuietly(java.lang.String wkt) |
IGeneralPathX |
createGeneralPath(int rule,
java.awt.geom.PathIterator pathIterator)
Deprecated.
use method of Geometry to handle this
|
GeometryCoercionContext |
createGeometryCoercionContext() |
InformationbuilderWithGeometrySupport |
createInformacionBuilder() |
Line |
createLine(int subType)
Create a new line with a concrete type.
|
MultiCurve |
createMultiCurve(GeneralPathX generalPathX,
int subType)
|
MultiCurve |
createMultiCurve(int subType)
Create a new multicurve with a concrete subtype.
|
MultiLine |
createMultiLine(int subType) |
MultiPoint |
createMultiPoint(GeneralPathX generalPathX,
int subType)
|
MultiPoint |
createMultiPoint(int subType)
Create a new multipoint with a concrete subtype.
|
MultiPolygon |
createMultiPolygon(int subType) |
MultiPrimitive |
createMultiPrimitive(GeometryType geometryType) |
MultiSurface |
createMultiSurface(GeneralPathX generalPathX,
int subType)
|
MultiSurface |
createMultiSurface(int subType)
Create a new multisurface with a concrete subtype.
|
NullGeometry |
createNullGeometry(int subType)
Deprecated.
use null instead. This method can be removed in next revisions
|
Point |
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.
|
Polygon |
createPolygon(int subType)
Create a new polygon with a concrete type.
|
SpatialIndex |
createSpatialIndex(java.lang.String name,
DynObject parameters)
Create a spatial index with the implementation specified as name.
|
Surface |
createSurface(GeneralPathX generalPathX,
int subType)
Deprecated.
use
createSurface(int) and OrientablePrimitive#addVertex(Point) |
Surface |
createSurface(int subType)
Deprecated.
use createPolygon
|
double |
getFlatness()
Returns the flatness used to convert a curve is a set
of points.
|
GeometryOperation |
getGeometryOperation(int opCode)
Returns an common operation with given operation code.
|
GeometryOperation |
getGeometryOperation(int opCode,
int type,
int subType)
Returns an operation given the Geometry type, the Geometry subtype and
and the operation code.
|
int |
getGeometryOperationCode(java.lang.String geomOpName)
Registers the unique name of one operation.
|
java.util.List |
getGeometryOperationNames()
Returns a list with the name of the operations that have been
registered.
|
GeometryType |
getGeometryType(int type,
int subType)
Returns an instance of GeometryType given the Geometry type and the
subtype.
|
GeometryType |
getGeometryType(java.lang.String typeName) |
SpatialIndexFactory |
getSpatialIndexFactory(java.lang.String name)
Return the name of the factory of the spatial index required.
|
java.lang.Object |
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.
|
java.lang.Object |
invokeOperation(java.lang.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.
|
java.lang.Object |
invokeOperation(java.lang.String geomOpName,
GeometryOperationContext ctx)
Invokes an operation given its code, and the operation context holding
the parameters required for the operation.
|
boolean |
isSubtype(int geomTypeParent,
int geomTypeChild)
Check if geomTypeChild is a geoemtry type deribed of geomTypeParent
|
int |
registerGeometryOperation(java.lang.String geomOpName,
GeometryOperation geomOp)
Registers a GeometryOperation that is common for all GeometryType
(registered yet or not).
|
int |
registerGeometryOperation(java.lang.String geomOpName,
GeometryOperation geomOp,
GeometryType geomType)
Registers a GeometryOperation associated to a GeometryType.
|
int |
registerGeometryOperation(java.lang.String geomOpName,
GeometryOperation geomOp,
int type)
Registers a GeometryOperation associated to all the geometries with a
concrete type.
|
int |
registerGeometryOperation(java.lang.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.
|
int |
registerGeometryOperationBySubtype(java.lang.String geomOpName,
GeometryOperation geomOp,
int subType)
Registers a GeometryOperation associated to all the geometries with a
concrete subtype.
|
int |
registerGeometryOperationBySuperSubType(java.lang.String geomOpName,
GeometryOperation geomOp,
int superSubType)
Registers a GeometryOperation associated to all the geometries which
super subType matches with a concrete subType.
|
int |
registerGeometryOperationBySuperType(java.lang.String geomOpName,
GeometryOperation geomOp,
int superType)
Registers a GeometryOperation associated to all the geometries which
super type matches with a concrete type.
|
GeometryType |
registerGeometryType(java.lang.Class geomClass,
int type,
int subType)
Registers a Geometry implementation class with a predefined geometry type
and returns the associated GeometryType instance.
|
GeometryType |
registerGeometryType(java.lang.Class geomClass,
java.lang.String name,
int type,
int subType)
Registers a Geometry implementation class with a predefined geometry type
and returns the associated GeometryType instance.
|
GeometryType |
registerGeometryType(java.lang.Class geomClass,
java.lang.String name,
int type,
int subType,
int superType)
Registers a Geometry implementation class with a predefined geometry type
and returns the associated GeometryType instance.
|
GeometryType |
registerGeometryType(java.lang.Class geomClass,
java.lang.String name,
int type,
int subType,
int[] superTypes)
Registers a Geometry implementation class with a predefined geometry type
and returns the associated GeometryType instance.
|
GeometryType |
registerGeometryType(java.lang.Class geomClass,
java.lang.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.
|
GeometryType |
registerGeometryType(java.lang.Class geomClass,
java.lang.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.
|
GeometryType |
registerGeometryType(GeometryType geometryType)
Registers a GeometryType instance.
|
void |
setFlatness(double flatness)
Sets the application flatness.
|
createServiceParameters, getService
addServiceFactory, createService, createServiceParameters
static final java.lang.String SPATIALINDEX_DEFAULT_RTREE
static final java.lang.String SPATIALINDEX_DEFAULT_QUADTREE
int registerGeometryOperation(java.lang.String geomOpName, GeometryOperation geomOp, GeometryType geomType)
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 method
getGeometryOperationCode(String)
:
public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }
geomOpName
- Operation's unique namegeomOp
- Specific GeometryOperation's instance implementing this
operationgeomType
- GeometryType instance to which this operation should be
associatedint registerGeometryOperation(java.lang.String geomOpName, GeometryOperation geomOp)
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 method
getGeometryOperationCode(String)
:
public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }
geomOpName
- Operation's unique namegeomOp
- Specific GeometryOperation's instance implementing this
operationint registerGeometryOperation(java.lang.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 method
getGeometryOperationCode(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.
geomOpName
- Operation's unique namegeomOp
- Specific GeometryOperation's instance implementing this
operationtype
- Type of geometry. Must be a value defined in
Geometry.TYPES
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
GeometryTypeNotSupportedException
- Returns this exception if there is not a registered geometry
with
these type and subtypeGeometryTypeNotValidException
- Returns if the type and subtype are not validint registerGeometryOperation(java.lang.String geomOpName, GeometryOperation geomOp, int type)
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 method
getGeometryOperationCode(String)
:
public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }
geomOpName
- Operation's unique namegeomOp
- Specific GeometryOperation's instance implementing this
operationtype
- Type of geometry. Must be a value defined in
Geometry.TYPES
int registerGeometryOperationBySuperType(java.lang.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 method
getGeometryOperationCode(String)
:
public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }
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 in
Geometry.TYPES
int registerGeometryOperationBySuperSubType(java.lang.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 method
getGeometryOperationCode(String)
:
public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }
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 in
Geometry.SUBTYPES
int registerGeometryOperationBySubtype(java.lang.String geomOpName, GeometryOperation geomOp, int subType)
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 method
getGeometryOperationCode(String)
:
public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }
geomOpName
- Operation's unique namegeomOp
- Specific GeometryOperation's instance implementing this
operationsubType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
GeometryType registerGeometryType(GeometryType geometryType)
Registers a GeometryType instance.
geometryType
- A GeometryType
instance to create Geometry
objectsGeometryType registerGeometryType(java.lang.Class geomClass, java.lang.String name, int type, int subType)
Registers a Geometry implementation class with a predefined geometry type
and returns the associated GeometryType instance. Available predefined
types are defined in Geometry.TYPES
and the subtypes are defined
in Geometry.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);
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 in
Geometry.TYPES
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
java.lang.IllegalArgumentException
- If geomClass is null or does not implement GeometryGeometryType registerGeometryType(java.lang.Class geomClass, java.lang.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 in Geometry.TYPES
and the subtypes are defined
in Geometry.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);
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 in
Geometry.TYPES
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
superType
- Super type of a geometry. Must be a value defined in
Geometry.TYPES
superSubType
- Super subType of a geometry. Must be a value defined in
Geometry.SUBTYPES
java.lang.IllegalArgumentException
- If geomClass is null or does not implement GeometryGeometryType registerGeometryType(java.lang.Class geomClass, java.lang.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 in Geometry.TYPES
and the subtypes are defined
in Geometry.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);
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 in
Geometry.TYPES
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
superType
- Super type of a geometry. Must be a value defined in
Geometry.TYPES
java.lang.IllegalArgumentException
- If geomClass is null or does not implement GeometryGeometryType registerGeometryType(java.lang.Class geomClass, java.lang.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 in Geometry.TYPES
and the subtypes are defined
in Geometry.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});
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 in
Geometry.TYPES
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
superTypes
- List of the super types of a geometry. Must be a value defined in
Geometry.TYPES
superSubTypes
- List of the super subType of a geometry. Must be a value defined in
Geometry.SUBTYPES
java.lang.IllegalArgumentException
- If geomClass is null or does not implement GeometryGeometryType registerGeometryType(java.lang.Class geomClass, java.lang.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 in Geometry.TYPES
and the subtypes are defined
in Geometry.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});
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 in
Geometry.TYPES
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
superTypes
- List of the super types of a geometry. Must be a value defined in
Geometry.TYPES
java.lang.IllegalArgumentException
- If geomClass is null or does not implement GeometryGeometryType registerGeometryType(java.lang.Class geomClass, int type, int subType)
Registers a Geometry implementation class with a predefined geometry type
and returns the associated GeometryType instance. Available predefined
types are defined in Geometry.TYPES
and the subtypes are defined
in Geometry.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);
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 in
Geometry.TYPES
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
java.lang.IllegalArgumentException
- If geomClass is null or does not implement GeometryGeometryType getGeometryType(java.lang.String typeName) throws GeometryTypeNotSupportedException, GeometryTypeNotValidException
GeometryType getGeometryType(int type, int subType) throws GeometryTypeNotSupportedException, GeometryTypeNotValidException
Returns an instance of GeometryType given the Geometry type and the subtype.
type
- Type of geometry. Must be a value defined in
Geometry.TYPES
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
GeometryTypeNotSupportedException
- Returns this exception if there is not a registered geometry
with
these type and subtypeGeometryTypeNotValidException
- Returns if the type and subtype are not validGeometry create(GeometryType geomType) throws CreateGeometryException
This method creates a Geometry
with 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);
geomType
- The geometry typeCreateGeometryException
- This exception is thrown when the manager can not create
the geometry.Envelope createEnvelope(int subType) throws CreateEnvelopeException
Creates a Envelope with a concrete subtype. The envelope is empty and it have to be filled with the corners once has been created.
subType
- SubType of envelope. Must be a value defined in
Geometry.SUBTYPES
CreateEnvelopeException
- If it is not possible to create the envelope.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.
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 in
Geometry.SUBTYPES
CreateEnvelopeException
Geometry create(java.lang.String name) throws CreateGeometryException
This method creates a Geometry
with the type specified by this
name. If a geometry with this name doesn't exist, a
IllegalArgumentException
is 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);
name
- The name of the geometry typeCreateGeometryException
- This exception is thrown when the manager can not create
the geometry.Geometry createFrom(java.lang.Object data) throws CreateGeometryException, GeometryException
data
- CreateGeometryException
GeometryException
Geometry createFrom(java.lang.String wkt, java.lang.String srs) throws CreateGeometryException, GeometryException
GeometryManager.OPERATIONS.FROMWKT
.wkt
- geometry in Well-known text formatsrs
- CreateGeometryException
GeometryException
Geometry createFrom(java.lang.String wkt, IProjection srs) throws CreateGeometryException, GeometryException
Geometry createFrom(java.io.Reader geom, IProjection srs) throws GeometryException
GeometryException
Geometry createFrom(java.lang.String wkt) throws CreateGeometryException, GeometryException
wkt
- geometry in WKT or HexWKB text format. If null return null.CreateGeometryException
GeometryException
Geometry createFromQuietly(java.lang.String wkt)
Geometry createFrom(byte[] wkb) throws CreateGeometryException, GeometryException
GeometryManager.OPERATIONS.FROMWKB
.wkb
- geometry in well-known binary formatCreateGeometryException
GeometryException
Geometry createFrom(byte[] wkb, IProjection srs) throws CreateGeometryException, GeometryException
Geometry create(int type, int subType) throws CreateGeometryException
This method creates a Geometry
with 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);
type
- Type of geometry. Must be a value defined in
Geometry.TYPES
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
CreateGeometryException
- This exception is thrown when the manager can not create
the geometry.NullGeometry createNullGeometry(int subType) throws CreateGeometryException
It creates a null geometry with a concrete subtype.
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
CreateGeometryException
- This exception is thrown when the manager can not create
the geometry.Point createPoint(double x, double y, int subType) throws CreateGeometryException
Create a new point with a concrete type and sets the value for the X and the Y.
x
- The X coordinatey
- The y coordinatesubType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
CreateGeometryException
- This exception is thrown when the manager can not create
the geometry.Line createLine(int subType) throws CreateGeometryException
subType
- SubType of geometry. Must be a value defined in Geometry.SUBTYPES
CreateGeometryException
- This exception is thrown when the manager can not create
the geometry.Curve createCurve(int subType) throws CreateGeometryException
CreateGeometryException
Polygon createPolygon(int subType) throws CreateGeometryException
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
CreateGeometryException
- This exception is thrown when the manager can not create
the geometry.Surface createSurface(int subType) throws CreateGeometryException
CreateGeometryException
MultiPoint createMultiPoint(int subType) throws CreateGeometryException
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
CreateGeometryException
- This exception is thrown when the manager can not create the
geometry.MultiCurve createMultiCurve(int subType) throws CreateGeometryException
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
CreateGeometryException
- This exception is thrown when the manager can not create the
geometry.MultiLine createMultiLine(int subType) throws CreateGeometryException
CreateGeometryException
MultiSurface createMultiSurface(int subType) throws CreateGeometryException
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
CreateGeometryException
- This exception is thrown when the manager can not create the
geometry.MultiPolygon createMultiPolygon(int subType) throws CreateGeometryException
CreateGeometryException
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
opCode
- The operation codetype
- Type of geometry. Must be a value defined in
Geometry.TYPES
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
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 codeGeometryOperation getGeometryOperation(int opCode) throws GeometryOperationNotSupportedException
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
opCode
- The operation codeGeometryOperationNotSupportedException
- Returns this exception if there is not a registered operation
with
this operation codejava.lang.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.
opCode
- Operation code.geom
- Geometry to which apply the operationctx
- Context holding the operation parametersGeometryOperationNotSupportedException
GeometryOperationException
java.lang.Object invokeOperation(java.lang.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.
geomOpName
- Operation name.geom
- Geometry to which apply the operationctx
- Context holding the operation parametersGeometryOperationNotSupportedException
GeometryOperationException
java.lang.Object invokeOperation(java.lang.String geomOpName, GeometryOperationContext ctx) throws GeometryOperationNotSupportedException, GeometryOperationException
Invokes an operation given its code, and the operation context holding the parameters required for the operation.
geomOpName
- Operation name.ctx
- Context holding the operation parametersGeometryOperationNotSupportedException
GeometryOperationException
int getGeometryOperationCode(java.lang.String geomOpName)
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"); }
geomOpName
- Name used to register the geometry operationjava.util.List getGeometryOperationNames()
double getFlatness()
void setFlatness(double flatness)
flatness
- The flatness to setSpatialIndex createDefaultMemorySpatialIndex() throws ServiceException
ServiceException
SpatialIndex createSpatialIndex(java.lang.String name, DynObject parameters) throws ServiceException
name
- of the type of spatial index to createparameters
- used to create the index or null.GeometryException
ServiceException
SpatialIndexFactory getSpatialIndexFactory(java.lang.String name)
name
- of the spatial index factoryIGeneralPathX createGeneralPath(int rule, java.awt.geom.PathIterator pathIterator)
MultiPrimitive.addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)
to add geometries to an aggregate.rule
- pathIterator
- , can be nullor {@link MultiPrimitive#addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)}
Curve createCurve(GeneralPathX generalPathX, int subType) throws CreateGeometryException
createCurve(int)
and OrientablePrimitive#addVertex(Point)Create a new curve with a concrete type and sets the value for the coordinates using a GeneralPathX.
generalPathX
- It is used to set the values for the X and Y coordinates.subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
CreateGeometryException
- This exception is thrown when the manager can not create
the geometry.MultiPoint createMultiPoint(GeneralPathX generalPathX, int subType) throws CreateGeometryException
createMultiCurve(int)
and MultiPrimitive.addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)
Create a new multipoint with a concrete type and sets the value for the coordinates using a GeneralPathX.
generalPathX
- It is used to set the values for the X and Y coordinates.subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
CreateGeometryException
- This exception is thrown when the manager can not create the
geometry.MultiCurve createMultiCurve(GeneralPathX generalPathX, int subType) throws CreateGeometryException
createMultiCurve(int)
and MultiPrimitive.addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)
Create a new multicurve with a concrete type and sets the value for the coordinates using a GeneralPathX.
generalPathX
- It is used to set the values for the X and Y coordinates.subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
CreateGeometryException
- This exception is thrown when the manager can not create the
geometry.Surface createSurface(GeneralPathX generalPathX, int subType) throws CreateGeometryException
createSurface(int)
and OrientablePrimitive#addVertex(Point)Create a new surface with a concrete type and sets the value for the coordinates using a GeneralPathX.
generalPathX
- It is used to set the values for the X and Y coordinates.subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
CreateGeometryException
- This exception is thrown when the manager can not create
the geometry.MultiSurface createMultiSurface(GeneralPathX generalPathX, int subType) throws CreateGeometryException
createMultiSurface(int)
and MultiPrimitive.addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)
Create a new multisurface with a concrete type and sets the value for the coordinates using a GeneralPathX.
generalPathX
- It is used to set the values for the X and Y coordinates.subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
CreateGeometryException
- This exception is thrown when the manager can not create the
geometry.InformationbuilderWithGeometrySupport createInformacionBuilder()
boolean isSubtype(int geomTypeParent, int geomTypeChild)
geomTypeParent
- geomTypeChild
- boolean canAggregate(int geomTypeParent, int geomTypeChild)
geomTypeParent
- geomTypeChild
- GeometryCoercionContext createGeometryCoercionContext()
MultiPrimitive createMultiPrimitive(GeometryType geometryType) throws CreateGeometryException
CreateGeometryException