public class DefaultGeometryManager extends Object implements GeometryManager
GeometryManager
. When the
application starts, this class is registered in the GeometryLocator
using the DefaultGeometryLibrary
.Modifier and Type | Class and Description |
---|---|
class |
DefaultGeometryManager.CantExistsService |
GeometryManager.OPERATIONS
SPATIALINDEX_DEFAULT_QUADTREE, SPATIALINDEX_DEFAULT_RTREE
Constructor and Description |
---|
DefaultGeometryManager() |
DefaultGeometryManager(int initialTypesSize,
int initialSubtypesSize) |
Modifier and Type | Method and Description |
---|---|
void |
addServiceFactory(ServiceFactory serviceFactory)
Adds a new
ServiceFactory to the registry. |
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(String name)
This method creates a
Geometry with the type specified by this
name. |
Curve |
createCurve(GeneralPathX generalPathX,
int subType)
Create a new curve with a concrete type and sets the value for the
coordinates using a GeneralPathX.
|
Curve |
createCurve(int subType) |
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,
IProjection srs) |
Geometry |
createFrom(com.vividsolutions.jts.geom.Geometry geom) |
Geometry |
createFrom(String wkt,
IProjection srs) |
Geometry |
createFrom(String wkt,
String srs)
Create a geometry from a WKT definition.
|
IGeneralPathX |
createGeneralPath(int rule,
PathIterator pathIterator)
Create a GeneralPathX to populate a geometry.
|
InformationbuilderWithGeometrySupport |
createInformacionBuilder() |
Line |
createLine(int subType)
Create a new line with a concrete type.
|
MultiCurve |
createMultiCurve(GeneralPathX generalPathX,
int subType)
Create a new multicurve with a concrete type and sets the value for the
coordinates using a GeneralPathX.
|
MultiCurve |
createMultiCurve(int subType)
Create a new multicurve with a concrete subtype.
|
MultiLine |
createMultiLine(int subType) |
MultiPoint |
createMultiPoint(GeneralPathX generalPathX,
int subType)
Create a new multipoint with a concrete type and sets the value for the
coordinates using a GeneralPathX.
|
MultiPoint |
createMultiPoint(int subType)
Create a new multipoint with a concrete subtype.
|
MultiPolygon |
createMultiPolygon(int subType) |
MultiSurface |
createMultiSurface(GeneralPathX generalPathX,
int subType)
Create a new multisurface with a concrete type and sets the value for the
coordinates using a GeneralPathX.
|
MultiSurface |
createMultiSurface(int subType)
Create a new multisurface with a concrete subtype.
|
NullGeometry |
createNullGeometry(int subType)
It creates a null geometry with a concrete subtype.
|
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.
|
Service |
createService(DynObject serviceParameters)
Creates a new
Service . |
DynObject |
createServiceParameters(String serviceName)
Creates a new object to contain service parameters values.
|
SpatialIndex |
createSpatialIndex(String name,
DynObject parameters)
Create a spatial index with the implementation specified as name.
|
Surface |
createSurface(GeneralPathX generalPathX,
int subType)
Create a new surface with a concrete type and sets the value for the
coordinates using a GeneralPathX.
|
Surface |
createSurface(int subType) |
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(String geomOpName)
Registers the unique name of one operation.
|
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.
|
Service |
getService(DynObject parameters)
Creates a new
Service based on the given parameters. |
SpatialIndexFactory |
getSpatialIndexFactory(String name)
Return the name of the factory of the spatial index required.
|
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.
|
Object |
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.
|
Object |
invokeOperation(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(String geomOpName,
GeometryOperation geomOp)
Registers a GeometryOperation that is common for all GeometryType
(registered yet or not).
|
int |
registerGeometryOperation(String geomOpName,
GeometryOperation geomOp,
GeometryType geomType)
Registers a GeometryOperation associated to a GeometryType.
|
int |
registerGeometryOperation(String geomOpName,
GeometryOperation geomOp,
int type)
Registers a GeometryOperation associated to all the geometries with a
concrete type.
|
int |
registerGeometryOperation(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(String geomOpName,
GeometryOperation geomOp,
int subType)
Registers a GeometryOperation associated to all the geometries with a
concrete subtype.
|
int |
registerGeometryOperationBySuperSubType(String geomOpName,
GeometryOperation geomOp,
int superSubType)
Registers a GeometryOperation associated to all the geometries which
super subType matches with a concrete subType.
|
int |
registerGeometryOperationBySuperType(String geomOpName,
GeometryOperation geomOp,
int superType)
Registers a GeometryOperation associated to all the geometries which
super type matches with a concrete type.
|
GeometryType |
registerGeometryType(Class geomClass,
int type,
int subType)
Registers a Geometry implementation class with a predefined geometry type
and returns the associated GeometryType instance.
|
GeometryType |
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.
|
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.
|
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.
|
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.
|
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.
|
void |
registerGeometryType(GeometryType geometryType)
Registers a GeometryType instance.
|
void |
setFlatness(double flatness)
Sets the application flatness.
|
public DefaultGeometryManager() throws GeometryException
GeometryException
public DefaultGeometryManager(int initialTypesSize, int initialSubtypesSize) throws GeometryException
GeometryException
public int registerGeometryOperation(String geomOpName, GeometryOperation geomOp, GeometryType geomType)
GeometryManager
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
GeometryManager.getGeometryOperationCode(String)
:
public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }
registerGeometryOperation
in interface GeometryManager
geomOpName
- Operation's unique namegeomOp
- Specific GeometryOperation's instance implementing this
operationgeomType
- GeometryType instance to which this operation should be
associatedpublic int registerGeometryOperation(String geomOpName, GeometryOperation geomOp)
GeometryManager
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
GeometryManager.getGeometryOperationCode(String)
:
public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }
registerGeometryOperation
in interface GeometryManager
geomOpName
- Operation's unique namegeomOp
- Specific GeometryOperation's instance implementing this
operationpublic int registerGeometryOperation(String geomOpName, GeometryOperation geomOp, int type, int subType) throws GeometryTypeNotSupportedException, GeometryTypeNotValidException
GeometryManager
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
GeometryManager.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.
registerGeometryOperation
in interface GeometryManager
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 validpublic int registerGeometryOperation(String geomOpName, GeometryOperation geomOp, int type)
GeometryManager
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
GeometryManager.getGeometryOperationCode(String)
:
public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }
registerGeometryOperation
in interface GeometryManager
geomOpName
- Operation's unique namegeomOp
- Specific GeometryOperation's instance implementing this
operationtype
- Type of geometry. Must be a value defined in
Geometry.TYPES
public int registerGeometryOperationBySubtype(String geomOpName, GeometryOperation geomOp, int subType)
GeometryManager
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
GeometryManager.getGeometryOperationCode(String)
:
public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }
registerGeometryOperationBySubtype
in interface GeometryManager
geomOpName
- Operation's unique namegeomOp
- Specific GeometryOperation's instance implementing this
operationsubType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
public int registerGeometryOperationBySuperType(String geomOpName, GeometryOperation geomOp, int superType)
GeometryManager
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
GeometryManager.getGeometryOperationCode(String)
:
public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }
registerGeometryOperationBySuperType
in interface GeometryManager
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
public int registerGeometryOperationBySuperSubType(String geomOpName, GeometryOperation geomOp, int superSubType)
GeometryManager
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
GeometryManager.getGeometryOperationCode(String)
:
public class MyOperation extends GeometryOperation { public static final int CODE = GeometryLocator.getGeometryManager() .getGeometryOperationCode("MyOperation"); }
registerGeometryOperationBySuperSubType
in interface GeometryManager
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
public GeometryType registerGeometryType(Class geomClass, String name, int type, int subType)
GeometryManager
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);
registerGeometryType
in interface GeometryManager
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
public GeometryType registerGeometryType(Class geomClass, String name, int type, int subType, int superType, int superSubType)
GeometryManager
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);
registerGeometryType
in interface GeometryManager
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
public GeometryType registerGeometryType(Class geomClass, String name, int type, int subType, int superType)
GeometryManager
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);
registerGeometryType
in interface GeometryManager
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
public GeometryType registerGeometryType(Class geomClass, String name, int type, int subType, int[] superTypes)
GeometryManager
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});
registerGeometryType
in interface GeometryManager
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
public GeometryType registerGeometryType(Class geomClass, String name, int type, int subType, int[] superTypes, int[] superSubTypes)
Geometry.TYPES
If the class is already registered then this
method throws an IllegalArgumentException.public class Point2D implements Point { private static final GeometryType geomType = GeometryManager.getInstance() .registerBasicGeometryType(Point2D.class, "Point2D", Geometry.TYPES.POINT); ... public int getType() { return geomType.getType(); } }
registerGeometryType
in interface GeometryManager
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.id
- Geometry identifier.type
- Type of geometry. Must be a value defined in
Geometry.TYPES
subType
- SubType of geometry. Must be a value defined in
Geometry.SUBTYPES
IllegalArgumentException
- If geomClass is null or does not implement Geometrypublic void registerGeometryType(GeometryType geometryType)
GeometryManager
Registers a GeometryType instance.
registerGeometryType
in interface GeometryManager
geometryType
- A GeometryType
instance to create Geometry
objectspublic GeometryType registerGeometryType(Class geomClass, int type, int subType)
GeometryManager
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);
registerGeometryType
in interface GeometryManager
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
public GeometryType getGeometryType(int type, int subType) throws GeometryTypeNotSupportedException, GeometryTypeNotValidException
GeometryManager
Returns an instance of GeometryType given the Geometry type and the subtype.
getGeometryType
in interface GeometryManager
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 validpublic Geometry create(GeometryType geomType) throws CreateGeometryException
GeometryManager
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);
create
in interface GeometryManager
geomType
- The geometry typeCreateGeometryException
- This exception is thrown when the manager can not create
the geometry.public Geometry create(String name) throws CreateGeometryException
GeometryManager
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);
create
in interface GeometryManager
name
- The name of the geometry typeCreateGeometryException
- This exception is thrown when the manager can not create
the geometry.public Geometry create(int type, int subType) throws CreateGeometryException
GeometryManager
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);
create
in interface GeometryManager
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.public Curve createCurve(GeneralPathX generalPathX, int subType) throws CreateGeometryException
GeometryManager
Create a new curve with a concrete type and sets the value for the coordinates using a GeneralPathX.
createCurve
in interface GeometryManager
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.public NullGeometry createNullGeometry(int subType) throws CreateGeometryException
GeometryManager
It creates a null geometry with a concrete subtype.
createNullGeometry
in interface GeometryManager
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.public Point createPoint(double x, double y, int subType) throws CreateGeometryException
GeometryManager
Create a new point with a concrete type and sets the value for the X and the Y.
createPoint
in interface GeometryManager
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.public Surface createSurface(GeneralPathX generalPathX, int subType) throws CreateGeometryException
GeometryManager
Create a new surface with a concrete type and sets the value for the coordinates using a GeneralPathX.
createSurface
in interface GeometryManager
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.public GeometryOperation getGeometryOperation(int opCode, int type, int subType) throws GeometryTypeNotSupportedException, GeometryOperationNotSupportedException, GeometryTypeNotValidException
GeometryManager
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
getGeometryOperation
in interface GeometryManager
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 subtypeGeometryOperationNotSupportedException
- Returns this exception if there is not a registered operation
with
this operation codeGeometryTypeNotValidException
- Returns this exception if the type and subtype are not validpublic GeometryOperation getGeometryOperation(int opCode) throws GeometryOperationNotSupportedException
GeometryManager
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
getGeometryOperation
in interface GeometryManager
opCode
- The operation codeGeometryOperationNotSupportedException
- Returns this exception if there is not a registered operation
with
this operation codepublic Object invokeOperation(int opCode, Geometry geom, GeometryOperationContext ctx) throws GeometryOperationNotSupportedException, GeometryOperationException
GeometryManager
Invokes an operation given its code, the geometry and the operation context holding the parameters required for the operation.
invokeOperation
in interface GeometryManager
opCode
- Operation code.geom
- Geometry to which apply the operationctx
- Context holding the operation parametersGeometryOperationNotSupportedException
GeometryOperationException
public Object invokeOperation(String geomOpName, Geometry geom, GeometryOperationContext ctx) throws GeometryOperationNotSupportedException, GeometryOperationException
GeometryManager
Invokes an operation given its code, the geometry and the operation context holding the parameters required for the operation.
invokeOperation
in interface GeometryManager
geomOpName
- Operation name.geom
- Geometry to which apply the operationctx
- Context holding the operation parametersGeometryOperationNotSupportedException
GeometryOperationException
public Object invokeOperation(String geomOpName, GeometryOperationContext ctx) throws GeometryOperationNotSupportedException, GeometryOperationException
GeometryManager
Invokes an operation given its code, and the operation context holding the parameters required for the operation.
invokeOperation
in interface GeometryManager
geomOpName
- Operation name.ctx
- Context holding the operation parametersGeometryOperationNotSupportedException
GeometryOperationException
public Envelope createEnvelope(int subType)
GeometryManager
Creates a Envelope with a concrete subtype. The envelope is empty and it have to be filled with the corners once has been created.
createEnvelope
in interface GeometryManager
subType
- SubType of envelope. Must be a value defined in
Geometry.SUBTYPES
public Envelope createEnvelope(double minX, double minY, double maxX, double maxY, int subType) throws CreateEnvelopeException
GeometryManager
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.
createEnvelope
in interface GeometryManager
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
public MultiCurve createMultiCurve(GeneralPathX generalPathX, int subType) throws CreateGeometryException
GeometryManager
Create a new multicurve with a concrete type and sets the value for the coordinates using a GeneralPathX.
createMultiCurve
in interface GeometryManager
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.public MultiSurface createMultiSurface(GeneralPathX generalPathX, int subType) throws CreateGeometryException
GeometryManager
Create a new multisurface with a concrete type and sets the value for the coordinates using a GeneralPathX.
createMultiSurface
in interface GeometryManager
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.public MultiPoint createMultiPoint(GeneralPathX generalPathX, int subType) throws CreateGeometryException
GeometryManager
Create a new multipoint with a concrete type and sets the value for the coordinates using a GeneralPathX.
createMultiPoint
in interface GeometryManager
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.public int getGeometryOperationCode(String geomOpName)
GeometryManager
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"); }
getGeometryOperationCode
in interface GeometryManager
geomOpName
- Name used to register the geometry operationpublic List getGeometryOperationNames()
GeometryManager
getGeometryOperationNames
in interface GeometryManager
public double getFlatness()
GeometryManager
getFlatness
in interface GeometryManager
public void setFlatness(double flatness)
GeometryManager
setFlatness
in interface GeometryManager
flatness
- The flatness to setpublic Geometry createFrom(String wkt, String srs) throws GeometryException
GeometryManager
GeometryManager.OPERATIONS.FROMWKT
.createFrom
in interface GeometryManager
wkt
- geometry in Well-known text formatCreateGeometryException
GeometryException
public Geometry createFrom(String wkt, IProjection srs) throws GeometryException
createFrom
in interface GeometryManager
GeometryException
public Geometry createFrom(com.vividsolutions.jts.geom.Geometry geom) throws GeometryException
createFrom
in interface GeometryManager
GeometryException
public Geometry createFrom(byte[] wkb, IProjection srs) throws GeometryException
createFrom
in interface GeometryManager
GeometryException
public IGeneralPathX createGeneralPath(int rule, PathIterator pathIterator)
GeometryManager
MultiPrimitive.addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)
to add geometries to an aggregate.createGeneralPath
in interface GeometryManager
pathIterator
- , can be nullor {@link MultiPrimitive#addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)}
public MultiPoint createMultiPoint(int subType) throws CreateGeometryException
GeometryManager
createMultiPoint
in interface GeometryManager
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.public Line createLine(int subType) throws CreateGeometryException
GeometryManager
createLine
in interface GeometryManager
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.public Curve createCurve(int subType) throws CreateGeometryException
createCurve
in interface GeometryManager
CreateGeometryException
public MultiCurve createMultiCurve(int subType) throws CreateGeometryException
GeometryManager
createMultiCurve
in interface GeometryManager
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.public MultiLine createMultiLine(int subType) throws CreateGeometryException
createMultiLine
in interface GeometryManager
CreateGeometryException
public MultiSurface createMultiSurface(int subType) throws CreateGeometryException
GeometryManager
createMultiSurface
in interface GeometryManager
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.public MultiPolygon createMultiPolygon(int subType) throws CreateGeometryException
createMultiPolygon
in interface GeometryManager
CreateGeometryException
public Polygon createPolygon(int subType) throws CreateGeometryException
GeometryManager
createPolygon
in interface GeometryManager
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.public Surface createSurface(int subType) throws CreateGeometryException
createSurface
in interface GeometryManager
CreateGeometryException
public SpatialIndex createDefaultMemorySpatialIndex() throws ServiceException
GeometryManager
createDefaultMemorySpatialIndex
in interface GeometryManager
ServiceException
public SpatialIndex createSpatialIndex(String name, DynObject parameters) throws ServiceException
GeometryManager
createSpatialIndex
in interface GeometryManager
name
- of the type of spatial index to createparameters
- used to create the index or null.ServiceException
public SpatialIndexFactory getSpatialIndexFactory(String name)
GeometryManager
getSpatialIndexFactory
in interface GeometryManager
name
- of the spatial index factorypublic void addServiceFactory(ServiceFactory serviceFactory)
ServiceManager
ServiceFactory
to the registry.addServiceFactory
in interface ServiceManager
serviceFactory
- to addpublic Service createService(DynObject serviceParameters) throws ServiceException
ServiceManager
Service
.createService
in interface ServiceManager
serviceParameters
- for the Service
Service
ServiceException
- if the parameters are not valid or there is an error creating
the Provider
public DynObject createServiceParameters(String serviceName) throws ServiceException
Manager
createServiceParameters
in interface Manager
createServiceParameters
in interface ServiceManager
serviceName
- the name of the service whose parameters have to be createdServiceException
- if there is not any service registered with the given namepublic Service getService(DynObject parameters) throws ServiceException
Manager
Service
based on the given parameters.getService
in interface Manager
parameters
- of the Service
to createService
ServiceException
- if there is an error creating the Service, or the parameters
are not validpublic InformationbuilderWithGeometrySupport createInformacionBuilder()
createInformacionBuilder
in interface GeometryManager
public boolean isSubtype(int geomTypeParent, int geomTypeChild)
GeometryManager
isSubtype
in interface GeometryManager