public class GeometryConverter extends Object
If needed I can make a LRSGeometryConverter that allows JTS Geometries with additional ordinates beyond xyz.
| Modifier and Type | Field and Description |
|---|---|
protected OracleConnection |
connection |
static String |
DATATYPE |
| Constructor and Description |
|---|
GeometryConverter(OracleConnection connection) |
GeometryConverter(OracleConnection connection,
GeometryFactory geometryFactory) |
| Modifier and Type | Method and Description |
|---|---|
protected double |
asDouble(Datum datum,
double DEFAULT)
Presents datum as a double
|
protected double[] |
asDoubleArray(Datum[] data,
double DEFAULT)
Presents Datum[] as a double[]
|
protected double[] |
asDoubleArray(OracleArray array,
double DEFAULT)
Presents array as a double[]
|
protected double[] |
asDoubleArray(OracleStruct struct,
double DEFAULT)
Presents struct as a double[]
|
protected OracleStruct |
asEmptyDataType()
Representation of
null as an Empty SDO_GEOMETRY. |
Geometry |
asGeometry(OracleStruct sdoGeometry)
Convert provided SDO_GEOMETRY to JTS Geometry.
|
protected int[] |
asIntArray(Datum[] data,
int DEFAULT)
Presents Datum[] as a int[]
|
protected int[] |
asIntArray(OracleArray array,
int DEFAULT) |
protected int |
asInteger(Datum datum,
int DEFAULT)
Presents datum as an int
|
String |
getDataTypeName()
Used to handle MDSYS.SDO_GEOMETRY.
|
boolean |
isCapable(Geometry geom)
Ensure that obj is a JTS Geometry (2D or 3D) with no LRS measures.
|
protected OracleArray |
toARRAY(double[] doubles,
String dataType)
Convenience method for OracleArray construction.
|
protected OracleArray |
toARRAY(int[] ints,
String dataType)
Convenience method for OracleArray construction.
|
protected OracleArray |
toATTRIBUTE(double[] ords,
String desc) |
protected CHAR |
toCHAR(String s)
Convenience method for CHAR construction
|
protected NUMBER |
toNUMBER(double number)
Convenience method for NUMBER construction.
|
protected NUMBER |
toNUMBER(int number)
Convenience method for NUMBER construction
|
protected OracleArray |
toORDINATE(CoordinateList list,
double[][] measures,
int D)
Convenience method for OracleArray construction.
|
protected OracleArray |
toORDINATE(double[] ords) |
OracleStruct |
toSDO(Geometry geom)
Used to convert double[] to SDO_ODINATE_ARRAY.
|
OracleStruct |
toSDO(Geometry geom,
int srid)
Used to convert double[] to SDO_ODINATE_ARRAY.
|
protected OracleStruct |
toSTRUCT(Datum[] attributes,
String dataType)
Convenience method for OracleStruct construction.
|
protected OracleConnection connection
public static final String DATATYPE
public GeometryConverter(OracleConnection connection)
public GeometryConverter(OracleConnection connection,
GeometryFactory geometryFactory)
public String getDataTypeName()
MDSYS.SDO_GEOMETRYDATATYPEpublic boolean isCapable(Geometry geom)
This Converter does not support SpatialCoordinates
geom - the Geometry to be convertedtrue if obj is a JTS Geometrypublic Geometry asGeometry(OracleStruct sdoGeometry)
throws SQLException
Will return null as null.
sdoGeometry - datum STRUCT to be converted to a geometryGeometry representing the provided datumSQLExceptionpublic OracleStruct toSDO(Geometry geom)
throws SQLException
Will return null as an empty SDO_GEOMETRY
geom - Map to be represented as a STRUCTSQLExceptionpublic OracleStruct toSDO(Geometry geom,
int srid)
throws SQLException
Will return null as an empty SDO_GEOMETRY
geom - Map to be represented as a STRUCTSQLExceptionprotected OracleStruct asEmptyDataType()
throws SQLException
null as an Empty SDO_GEOMETRY.null as a SDO_GEOMETRYSQLExceptionprotected final OracleStruct toSTRUCT(Datum[] attributes,
String dataType)
throws SQLException
SQLExceptionprotected final OracleArray toARRAY(double[] doubles,
String dataType)
throws SQLException
Compare and contrast with toORDINATE - which treats Double.NaN as NULL
SQLExceptionprotected final OracleArray toORDINATE(CoordinateList list,
double[][] measures,
int D)
throws SQLException
Forced to burn memory here - only way to actually place NULL numbers in the
ordinate stream.
Double.NaN
NULL
The alternative is to construct the array from a array of doubles, which does not record
NULL NUMBERs.
The results is an "MDSYS.SDO_ORDINATE_ARRAY"
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)
}
list - CoordinateList to be representedmeasures - Per Coordinate Measures, null if not requiredD - Dimension of Coordinates (limited to 2d, 3d)SQLExceptionprotected final OracleArray toORDINATE(double[] ords)
throws SQLException
SQLExceptionprotected final OracleArray toATTRIBUTE(double[] ords,
String desc)
throws SQLException
SQLExceptionprotected final NUMBER toNUMBER(double number)
throws SQLException
Double.NaN is represented as NULL to agree with JTS use.
SQLExceptionprotected final OracleArray toARRAY(int[] ints,
String dataType)
throws SQLException
SQLExceptionprotected final NUMBER toNUMBER(int number)
protected final CHAR toCHAR(String s)
protected int asInteger(Datum datum,
int DEFAULT)
throws SQLException
SQLExceptionprotected double asDouble(Datum datum,
double DEFAULT)
throws SQLException
SQLExceptionprotected double[] asDoubleArray(OracleStruct struct,
double DEFAULT)
throws SQLException
SQLExceptionprotected double[] asDoubleArray(OracleArray array,
double DEFAULT)
throws SQLException
SQLExceptionprotected double[] asDoubleArray(Datum[] data,
double DEFAULT)
throws SQLException
SQLExceptionprotected int[] asIntArray(OracleArray array,
int DEFAULT)
throws SQLException
SQLExceptionprotected int[] asIntArray(Datum[] data,
int DEFAULT)
throws SQLException
SQLExceptionCopyright © 1996–2021 Geotools. All rights reserved.