com.mizar.oracle.spatial
Class JGeometry2

java.lang.Object
  extended by oracle.spatial.geometry.JGeometry
      extended by com.mizar.oracle.spatial.JGeometry2
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class JGeometry2
extends oracle.spatial.geometry.JGeometry

An implementation of Oracle's JGeometry with some added functionality provided by the com.mizar.geometry package. We also added some functionality from oracle.spatial.util package.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class oracle.spatial.geometry.JGeometry
oracle.spatial.geometry.JGeometry.ElementIterator, oracle.spatial.geometry.JGeometry.Point
 
Field Summary
protected  org.apache.commons.logging.Log _Logger
           
static int GEOMETRY_DIFFERENT_PATH
           
static int GEOMETRY_DIFFERENT_TYPE
           
static int GEOMETRY_ENDPOINTS_DIFFER
           
static int GEOMETRY_FEWER_DIMENSIONS
           
static int GEOMETRY_FEWER_VERTICES
           
static int GEOMETRY_IDENTICAL
           
static int GEOMETRY_LONGER
           
static int GEOMETRY_MORE_DIMENSIONS
           
static int GEOMETRY_MORE_VERTICES
           
static int GEOMETRY_NULL_GEOM
           
static int GEOMETRY_SHORTER
           
static int GEOMETRY_SIMILAR
           
 
Fields inherited from class oracle.spatial.geometry.JGeometry
dim, EITPR_ARC, EITPR_CIRCLE, EITPR_GEODETICMBR, EITPR_LINEAR, EITPR_RECTANGLE, EITPR_UNKNOWN, elemInfo, elemInfoDesc, ETOPO_EXTERIOR, ETOPO_INTERIOR, ETOPO_NA, ETOPO_UNKNOWN, ETYPE_COMPOUNDCURVE, ETYPE_COMPOUNDRING, ETYPE_CURVE, ETYPE_POINT, ETYPE_RING, ETYPE_UNKNOWN, geomDesc, gtransH, gtype, GTYPE_COLLECTION, GTYPE_CURVE, GTYPE_MULTICURVE, GTYPE_MULTIPOINT, GTYPE_MULTIPOLYGON, GTYPE_POINT, GTYPE_POLYGON, linfo, lttpH, mbr, ordinates, ordinatesDesc, pointDesc, srid, x, y, z
 
Constructor Summary
JGeometry2(double minX, double minY, double maxX, double maxY, int srid)
           
JGeometry2(double x, double y, int srid)
           
JGeometry2(int gtype, int srid, int[] elemInfo, double[] ordinates)
           
JGeometry2(oracle.spatial.geometry.JGeometry geom)
           
 
Method Summary
 int compare(oracle.spatial.geometry.JGeometry geometry, double tolerance)
           
static java.lang.String describeGeometryDifferences(int differences)
           
static double[] get2DOrdinateArray(oracle.spatial.geometry.JGeometry geom)
           
 double getAngle()
           
static Point getAPoint(oracle.spatial.geometry.JGeometry geom)
          NOTE: THIS METHOD IS NOT COMPLETE.
 double getLength()
           
 double getLengthAlong(double[] point)
           
static double[] getOrdinatesArray(oracle.spatial.geometry.JGeometry geom)
          Note, if you are going to mutate the ordinates you should clone the returned array
static double[] getOrdinatesArray(oracle.spatial.geometry.JGeometry geom, int returnDimensions)
          NOTE: the method has been tested for returnDimensions =< geom.getDimensions but not greater than.
static double[] getOrdinatesArray(oracle.spatial.geometry.JGeometry geom, int returnDimensions, double fill)
          NOTE: the method has been tested for returnDimensions =< geom.getDimensions but not greater than.
static Point getPoint(oracle.spatial.geometry.JGeometry geom)
          Constructs a Point from a JGeometry
static oracle.spatial.geometry.JGeometry getPoint(Point pt, int SRID)
          constructs a JGeometry from a Point
 double[] getPointAlong(double[] point)
           
static Polygon getPolygon(oracle.spatial.geometry.JGeometry geom)
          constructs a Polygon from a JGeometry
static oracle.spatial.geometry.JGeometry getPolygon(Polygon pg, int SRID)
          constructs a JGeometry from a Polygon
static Polyline getPolyline(oracle.spatial.geometry.JGeometry geom)
          Constructs a Polyline from a JGeometry
static oracle.spatial.geometry.JGeometry getPolyline(Polyline pl, int SRID)
          constructs a JGeometry from a Polyline
 double getPrecision()
           
 Geometry.Results getResults()
           
static boolean isGeometryCircular(oracle.spatial.geometry.JGeometry geom)
          Returns true if a geometry defines a circular/closed line.
static oracle.spatial.geometry.JGeometry reverse(oracle.spatial.geometry.JGeometry geom)
           
 void setPrecision(double precision)
           
 void setResults(Geometry.Results results)
           
 boolean snap(oracle.spatial.geometry.JGeometry curve, double tolerance, int method)
          Snaps two polylines so that if one of their sets of endpoints is coincident it makes them exactly the same.
static boolean snap(oracle.spatial.geometry.JGeometry curve1, oracle.spatial.geometry.JGeometry curve2, double tolerance, int method)
          Snaps two polylines so that if one of their sets of endpoints is coincident it makes them exactly the same.
 java.lang.String toWKT()
           
static java.util.ArrayList<Point> uniquePoints(java.util.ArrayList<oracle.spatial.geometry.JGeometry> linearGeometries, double tolerance)
           
 
Methods inherited from class oracle.spatial.geometry.JGeometry
affineTransforms, buffer, buffer, byteArrayToHexString, clone, closeCoords, computeArc, computeArcMBR, createArc2d, createCircle, createCircle, createDBDescriptors, createDoubleShape, createDoubleShape, createLinearLineString, createLinearMultiLineString, createLinearPolygon, createLinearPolygon, createLRSLinearLineString, createLRSLinearMultiLineString, createLRSLinearPolygon, createLRSLinearPolygon, createLRSPoint, createMultiPoint, createPoint, createShape, createShape, createShape, densifyArcs, densifyArcs, equals, expandCircle, expandMBR, expandMBR, expandMBR, expandMBR, finalize, getDimensions, getElementAt, getElements, getElements, getElemInfo, getElemInfoOfElement, getFirstPoint, getGeomDescriptor, getJavaPoint, getJavaPoints, getLabelPoint, getLabelPointXYZ, getLastPoint, getLRMDimension, getMBR, getNumPoints, getOracleDescriptors, getOrdinatesArray, getOrdinatesOfElement, getOrdinatesOfElements, getOrientMultiPointOffset, getPoint, getSize, getSRID, getType, hasCircularArcs, isCircle, isCompoundElement, isGeodeticMBR, isLRSGeometry, isMultiPoint, isOptimizedPoint, isOrientedMultiPoint, isOrientedPoint, isPoint, isRectangle, isSimpleElement, linearizeArc, linearizeArc, load, load, makeElementGeometry, monoMeasure, orientation, projectFromGNM_longLat, projectFromLTP, projectToGNM_longLat, projectToGNM_longLat, projectToLTP, reFormulateArc, remove_etype0, reOrientCurves, setLRMDimension, setSRID, setType, simplify, simplify, store, store, store, store, store, store, store, tfm_8307_to_PopularMercator, tfm_8307_to_PopularMercator, tfm_PopularMercator_to_8307, tfm_PopularMercator_to_8307, thetaInArc, toString, toStringFull, toStringFull
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_Logger

protected org.apache.commons.logging.Log _Logger

GEOMETRY_IDENTICAL

public static final int GEOMETRY_IDENTICAL
See Also:
Constant Field Values

GEOMETRY_SIMILAR

public static final int GEOMETRY_SIMILAR
See Also:
Constant Field Values

GEOMETRY_DIFFERENT_TYPE

public static final int GEOMETRY_DIFFERENT_TYPE
See Also:
Constant Field Values

GEOMETRY_SHORTER

public static final int GEOMETRY_SHORTER
See Also:
Constant Field Values

GEOMETRY_LONGER

public static final int GEOMETRY_LONGER
See Also:
Constant Field Values

GEOMETRY_FEWER_VERTICES

public static final int GEOMETRY_FEWER_VERTICES
See Also:
Constant Field Values

GEOMETRY_MORE_VERTICES

public static final int GEOMETRY_MORE_VERTICES
See Also:
Constant Field Values

GEOMETRY_FEWER_DIMENSIONS

public static final int GEOMETRY_FEWER_DIMENSIONS
See Also:
Constant Field Values

GEOMETRY_MORE_DIMENSIONS

public static final int GEOMETRY_MORE_DIMENSIONS
See Also:
Constant Field Values

GEOMETRY_ENDPOINTS_DIFFER

public static final int GEOMETRY_ENDPOINTS_DIFFER
See Also:
Constant Field Values

GEOMETRY_DIFFERENT_PATH

public static final int GEOMETRY_DIFFERENT_PATH
See Also:
Constant Field Values

GEOMETRY_NULL_GEOM

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

JGeometry2

public JGeometry2(oracle.spatial.geometry.JGeometry geom)
           throws GeometryException
Parameters:
geom -
Throws:
GeometryException

JGeometry2

public JGeometry2(double minX,
                  double minY,
                  double maxX,
                  double maxY,
                  int srid)
           throws GeometryException
Parameters:
minX -
minY -
maxX -
maxY -
srid -
Throws:
GeometryException
See Also:
JGeometry

JGeometry2

public JGeometry2(double x,
                  double y,
                  int srid)
           throws GeometryException
Parameters:
x -
y -
srid -
Throws:
GeometryException
See Also:
JGeometry

JGeometry2

public JGeometry2(int gtype,
                  int srid,
                  int[] elemInfo,
                  double[] ordinates)
           throws GeometryException
Parameters:
gtype -
srid -
elemInfo -
ordinates -
Throws:
GeometryException
See Also:
JGeometry
Method Detail

toWKT

public java.lang.String toWKT()
                       throws oracle.spatial.util.GeometryExceptionWithContext
Returns:
Throws:
oracle.spatial.util.GeometryExceptionWithContext
See Also:
WKT

getAngle

public double getAngle()
                throws GeometryException
Throws:
GeometryException

getLength

public double getLength()
                 throws GeometryException
Throws:
GeometryException

getLengthAlong

public double getLengthAlong(double[] point)
                      throws GeometryException
Throws:
GeometryException

getPointAlong

public double[] getPointAlong(double[] point)
                       throws GeometryException
Throws:
GeometryException

setPrecision

public void setPrecision(double precision)

getPrecision

public double getPrecision()

setResults

public void setResults(Geometry.Results results)

getResults

public Geometry.Results getResults()

describeGeometryDifferences

public static java.lang.String describeGeometryDifferences(int differences)

compare

public int compare(oracle.spatial.geometry.JGeometry geometry,
                   double tolerance)
            throws GeometryException
Throws:
GeometryException

snap

public boolean snap(oracle.spatial.geometry.JGeometry curve,
                    double tolerance,
                    int method)
             throws GeometryException
Snaps two polylines so that if one of their sets of endpoints is coincident it makes them exactly the same. Four tests are made comparing the first points, first and last repectively of each polyline and then the last points. If all four points fall within the tolerance all four endpoints will be set to the same "snap" point: garbage in compacted garbage out!

Parameters:
curve - must be of type JGeometry.ETYPE_CURVE or JGeometry.ETYPE.COMPOUND_CURVE
tolerance - if endpoints of this or curve are within tolerance move something to co-locate them.
method - 0=move both points to average, 1=snap to this, 2=snap to curve
Returns:
Throws:
GeometryException
See Also:
Polyline.snap(com.mizar.geometry.Point, com.mizar.geometry.OneCell, double)

snap

public static boolean snap(oracle.spatial.geometry.JGeometry curve1,
                           oracle.spatial.geometry.JGeometry curve2,
                           double tolerance,
                           int method)
                    throws GeometryException
Snaps two polylines so that if one of their sets of endpoints is coincident it makes them exactly the same. Four tests are made comparing the first points, first and last repectively of each polyline and then the last points. If all four points fall within the tolerance all four endpoints will be set to the same "snap" point: garbage in compacted garbage out!

Parameters:
curve1 - must be of type JGeometry.ETYPE_CURVE or JGeometry.ETYPE.COMPOUND_CURVE
curve2 - must be of type JGeometry.ETYPE_CURVE or JGeometry.ETYPE.COMPOUND_CURVE
tolerance - if endpoints of curve1 or curve2 are within tolerance move something to co-locate them.
method - 0=move both points to average, 1=snap to curve1, 2=snap to curve2
Returns:
Throws:
GeometryException
See Also:
Polyline.snap(com.mizar.geometry.Point, com.mizar.geometry.OneCell, double)

uniquePoints

public static java.util.ArrayList<Point> uniquePoints(java.util.ArrayList<oracle.spatial.geometry.JGeometry> linearGeometries,
                                                      double tolerance)
                                               throws GeometryException
Throws:
GeometryException

getAPoint

public static Point getAPoint(oracle.spatial.geometry.JGeometry geom)
                       throws GeometryException
NOTE: THIS METHOD IS NOT COMPLETE. CURRENTLY IT JUST RETURNS THE FIRST POINT. The method returns a point that is

Parameters:
geom -
Returns:
a point
Throws:
GeometryException

getPoint

public static Point getPoint(oracle.spatial.geometry.JGeometry geom)
                      throws GeometryException
Constructs a Point from a JGeometry

Parameters:
geom -
Returns:
Throws:
GeometryException - if geom is not a point or number of ordinates equal to dimensions

getOrdinatesArray

public static double[] getOrdinatesArray(oracle.spatial.geometry.JGeometry geom)
Note, if you are going to mutate the ordinates you should clone the returned array

Parameters:
geom -
Returns:
a reference to the geom.ordinatesArray

get2DOrdinateArray

public static double[] get2DOrdinateArray(oracle.spatial.geometry.JGeometry geom)
Parameters:
geom -
Returns:

getOrdinatesArray

public static double[] getOrdinatesArray(oracle.spatial.geometry.JGeometry geom,
                                         int returnDimensions)
NOTE: the method has been tested for returnDimensions =< geom.getDimensions but not greater than. Returns the contents of the input JGeometry with more or fewer dimensions.

Parameters:
geom -
returnDimensions -
Returns:
an array of doubles dimensioned to returnDimensions

getOrdinatesArray

public static double[] getOrdinatesArray(oracle.spatial.geometry.JGeometry geom,
                                         int returnDimensions,
                                         double fill)
NOTE: the method has been tested for returnDimensions =< geom.getDimensions but not greater than. Returns the contents of the input JGeometry with more or fewer dimensions.

Parameters:
geom -
returnDimensions -
fill - if returnDimensions is greater than geom.getDimensions() then this fill value will be applied to additional dimensions.
Returns:
an array of doubles dimensioned to returnDimensions

getPolyline

public static Polyline getPolyline(oracle.spatial.geometry.JGeometry geom)
                            throws GeometryException
Constructs a Polyline from a JGeometry

Parameters:
geom -
Returns:
Throws:
GeometryException - if geom is not a curve

getPolygon

public static Polygon getPolygon(oracle.spatial.geometry.JGeometry geom)
                          throws GeometryException
constructs a Polygon from a JGeometry

Parameters:
geom -
Returns:
Throws:
GeometryException - if geomn is not a polygon

getPoint

public static oracle.spatial.geometry.JGeometry getPoint(Point pt,
                                                         int SRID)
constructs a JGeometry from a Point

Parameters:
pt -
SRID -
Returns:

getPolyline

public static oracle.spatial.geometry.JGeometry getPolyline(Polyline pl,
                                                            int SRID)
constructs a JGeometry from a Polyline

Parameters:
pl -
SRID -
Returns:

getPolygon

public static oracle.spatial.geometry.JGeometry getPolygon(Polygon pg,
                                                           int SRID)
constructs a JGeometry from a Polygon

Parameters:
pg -
SRID -
Returns:

reverse

public static oracle.spatial.geometry.JGeometry reverse(oracle.spatial.geometry.JGeometry geom)
                                                 throws GeometryException
Throws:
GeometryException

isGeometryCircular

public static boolean isGeometryCircular(oracle.spatial.geometry.JGeometry geom)
Returns true if a geometry defines a circular/closed line. Returns false if the geometry is a point or an un-closed line

Parameters:
geom -
Returns: