com.vividsolutions.jts.io.oracle
Class OraReader

java.lang.Object
  extended bycom.vividsolutions.jts.io.oracle.OraReader

public class OraReader
extends java.lang.Object

Reads a Geometry from an Oracle MDSYS.GEOMETRY object. A GeometryFactory may be provided, otherwise a default one will be used. The provided GeometryFactory will be used, with the exception of the SRID field. This will be extracted from the Geometry.

If a PrecisionModel is supplied it is the callers's responsibility to ensure that it matches the precision of the incoming data. If a lower precision for the data is required, a subsequent process must be run on the data to reduce its precision.

To use this class a suitable Oracle JDBC driver JAR must be present.

Version:
9i
Author:
David Zwiers, Vivid Solutions., Martin Davis

Field Summary
static int NULL_DIMENSION
           
 
Constructor Summary
OraReader()
          Creates a new reader, with a default GeometryFactory.
OraReader(GeometryFactory gf)
          Creates a new reader, with the supplied GeometryFactory.
 
Method Summary
 int getDimension()
          Gets the number of coordinate dimensions which will be read.
 Geometry read(oracle.sql.STRUCT struct)
          This method will attempt to create a JTS Geometry for the MDSYS.GEOMETRY provided.
 void setDimension(int dimension)
          Sets the number of coordinate dimensions to read.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_DIMENSION

public static final int NULL_DIMENSION
See Also:
Constant Field Values
Constructor Detail

OraReader

public OraReader()
Creates a new reader, with a default GeometryFactory.

See Also:
OraReader(GeometryFactory)

OraReader

public OraReader(GeometryFactory gf)
Creates a new reader, with the supplied GeometryFactory. It is assumed that the supplied PrecisionModel matches the precision of the incoming data - coordinates are not made precise.

Parameters:
gf - A non-null geometry factory for later use.
Throws:
java.lang.NullPointerException - when the geometry factory is null.
Method Detail

getDimension

public int getDimension()
Gets the number of coordinate dimensions which will be read.

Returns:
the dimension which will be read

setDimension

public void setDimension(int dimension)
Sets the number of coordinate dimensions to read.

Parameters:
dimension - the dimension to read

read

public Geometry read(oracle.sql.STRUCT struct)
              throws java.sql.SQLException
This method will attempt to create a JTS Geometry for the MDSYS.GEOMETRY provided. The Type of gemetry returned will depend on the input datum, where the Geometry type is specified within the STRUCT.

Parameters:
struct - The MDSYS.GEOMETRY Object to decode
Returns:
A JTS Geometry if one could be created, null otherwise
Throws:
java.sql.SQLException - When a read error occured within the struct