Package org.geotools.data.oracle.sdo
Class GeometryConverter
Object
GeometryConverter
Sample use of SDO class for simple JTS Geometry.
If needed I can make a LRSGeometryConverter that allows JTS Geometries with additional ordinates beyond xyz.
- Author:
- jgarnett, Mark Prins, B3Partners
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGeometryConverter(OracleConnection connection) GeometryConverter(OracleConnection connection, GeometryFactory geometryFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected doubleasDouble(Datum datum, double DEFAULT) Presents datum as a doubleprotected double[]asDoubleArray(OracleArray array, double DEFAULT) Presents array as a double[]protected double[]asDoubleArray(OracleStruct struct, double DEFAULT) Presents struct as a double[]protected double[]asDoubleArray(Datum[] data, double DEFAULT) Presents Datum[] as a double[]protected OracleStructRepresentation ofnullas an EmptySDO_GEOMETRY.asGeometry(OracleStruct sdoGeometry) Convert provided SDO_GEOMETRY to JTS Geometry.protected int[]asIntArray(OracleArray array, int DEFAULT) protected int[]asIntArray(Datum[] data, int DEFAULT) Presents Datum[] as a int[]protected intasInteger(Datum datum, int DEFAULT) Presents datum as an intUsed to handle MDSYS.SDO_GEOMETRY.booleanEnsure that obj is a JTS Geometry (2D or 3D) with no LRS measures.protected final OracleArrayConvenience method for OracleArray construction.protected final OracleArrayConvenience method for OracleArray construction.protected final OracleArraytoATTRIBUTE(double[] ords, String desc) protected final CHARConvenience method for CHAR constructionprotected final NUMBERtoNUMBER(double number) Convenience method for NUMBER construction.protected final NUMBERtoNUMBER(int number) Convenience method for NUMBER constructionprotected final OracleArraytoORDINATE(double[] ords) protected final OracleArraytoORDINATE(CoordinateList list, double[][] measures, int D) Convenience method for OracleArray construction.OracleStructUsed to convert double[] to SDO_ODINATE_ARRAY.OracleStructUsed to convert double[] to SDO_ODINATE_ARRAY.protected final OracleStructConvenience method for OracleStruct construction.
-
Field Details
-
connection
protected OracleConnection connection -
DATATYPE
- See Also:
-
-
Constructor Details
-
GeometryConverter
public GeometryConverter(OracleConnection connection) -
GeometryConverter
-
-
Method Details
-
getDataTypeName
Used to handle MDSYS.SDO_GEOMETRY.- Returns:
MDSYS.SDO_GEOMETRY- See Also:
-
isCapable
Ensure that obj is a JTS Geometry (2D or 3D) with no LRS measures.This Converter does not support SpatialCoordinates
- Parameters:
geom- the Geometry to be converted- Returns:
trueifobjis a JTS Geometry
-
asGeometry
Convert provided SDO_GEOMETRY to JTS Geometry.Will return
nullasnull.- Parameters:
sdoGeometry- datum STRUCT to be converted to a geometry- Returns:
- JTS
Geometryrepresenting the provideddatum - Throws:
SQLException
-
toSDO
Used to convert double[] to SDO_ODINATE_ARRAY.Will return
nullas an emptySDO_GEOMETRY- Parameters:
geom- Map to be represented as a STRUCT- Returns:
- Struct representing provided Map
- Throws:
SQLException
-
toSDO
Used to convert double[] to SDO_ODINATE_ARRAY.Will return
nullas an emptySDO_GEOMETRY- Parameters:
geom- Map to be represented as a STRUCT- Returns:
- STRUCT representing provided Map
- Throws:
SQLException
-
asEmptyDataType
Representation ofnullas an EmptySDO_GEOMETRY.- Returns:
nullas a SDO_GEOMETRY- Throws:
SQLException
-
toSTRUCT
Convenience method for OracleStruct construction.- Throws:
SQLException
-
toARRAY
Convenience method for OracleArray construction.Compare and contrast with toORDINATE - which treats
Double.NaNasNULL- Throws:
SQLException
-
toORDINATE
protected final OracleArray toORDINATE(CoordinateList list, double[][] measures, int D) throws SQLException Convenience method for OracleArray construction.Forced to burn memory here - only way to actually place
NULLnumbers in the ordinate stream.- JTS: records lack of data as
Double.NaN - SDO: records lack of data as
NULL
The alternative is to construct the array from a array of doubles, which does not record
NULLNUMBERs.The results is an "MDSYS.SDO_ORDINATE_ARRAY"
{@code list = c1(1,2,0), c2(3,4,Double.NaN) measures = {{5,6},{7,8} toORDINATE( list, measures, 2 ) = (1,2,5,7, 3,4,6,8) toORDINATE( list, measures, 3 ) = (1,2,0,5,7, 3,4,NULL,6,8) toORDINATE( list, null, 2 ) = (1,2, 3,4) } </pre> @param list CoordinateList to be represented @param measures Per Coordinate Measures, {@code null} if not required @param D Dimension of Coordinates (limited to 2d, 3d)- Throws:
SQLException
- JTS: records lack of data as
-
toORDINATE
- Throws:
SQLException
-
toATTRIBUTE
- Throws:
SQLException
-
toNUMBER
Convenience method for NUMBER construction.Double.NaN is represented as
NULLto agree with JTS use.- Throws:
SQLException
-
toARRAY
Convenience method for OracleArray construction.- Throws:
SQLException
-
toNUMBER
protected final NUMBER toNUMBER(int number) Convenience method for NUMBER construction -
toCHAR
Convenience method for CHAR construction -
asInteger
Presents datum as an int- Throws:
SQLException
-
asDouble
Presents datum as a double- Throws:
SQLException
-
asDoubleArray
Presents struct as a double[]- Throws:
SQLException
-
asDoubleArray
Presents array as a double[]- Throws:
SQLException
-
asDoubleArray
Presents Datum[] as a double[]- Throws:
SQLException
-
asIntArray
- Throws:
SQLException
-
asIntArray
Presents Datum[] as a int[]- Throws:
SQLException
-