Class FastJGeometry
- java.lang.Object
-
- oracle.spatial.geometry.JGeometry
-
- oracle.spatial.geometry.FastJGeometry
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,RNode
public final class FastJGeometry extends JGeometry
Subclass of JGeometry that is capable of preprocessing the geometry and storing extra information to allow later operations to be performed faster.Currently does not handle arcs or splines.
- Since:
- release specific (what release of product did this appear in)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FastJGeometry.FastOp
Operations can be accelerated by doing preprocessing beforehand.static class
FastJGeometry.PPStatus
Whether a particular operation is PREPROCESSed, should NEVER be preprocessed, or may be AUTOmatcially done at the discretion of the implementation.-
Nested classes/interfaces inherited from class oracle.spatial.geometry.JGeometry
JGeometry.ChainConverter, JGeometry.ElementIterator, JGeometry.GeomParser, JGeometry.Point
-
-
Field Summary
-
Fields inherited from class oracle.spatial.geometry.JGeometry
dim, EITPR_ARC, EITPR_CIRCLE, EITPR_GEODETICMBR, EITPR_LINEAR, EITPR_NURBSCURVE, EITPR_RECTANGLE, EITPR_UNKNOWN, elemInfo, elemInfoDesc, ELEMINFODESCSTR, ETOPO_EXTERIOR, ETOPO_INTERIOR, ETOPO_NA, ETOPO_UNKNOWN, ETYPE_COMPOUNDCURVE, ETYPE_COMPOUNDRING, ETYPE_CURVE, ETYPE_POINT, ETYPE_RING, ETYPE_UNKNOWN, geomDesc, GEOMDESCSTR, gtransH, gtype, GTYPE_COLLECTION, GTYPE_CURVE, GTYPE_MULTICURVE, GTYPE_MULTIPOINT, GTYPE_MULTIPOLYGON, GTYPE_POINT, GTYPE_POLYGON, linfo, lttpH, mbr, mer, ORDINATEDESCSTR, ordinates, ordinatesDesc, pointDesc, POINTDESCSTR, srid, sridCSI, x, y, z
-
-
Constructor Summary
Constructors Constructor Description FastJGeometry(JGeometry geom, double tolerance)
All eligible operations will be preprocessed automatically at the discretion of the implementation.FastJGeometry(JGeometry geom, double tolerance, java.util.EnumSet<FastJGeometry.FastOp> opsSet, boolean defaultAuto)
Creates a shallow copy of the given geometry that will be preprocessed as specified.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
anyInteract(JGeometry B, double tolerance)
This method determines if a 2D/3D Geometry has anyinteraction with another 2D/3D Geometry.double
distance(JGeometry A)
Compute distance to geometry A using the tolerance and isGeodetic values passed at creation.double
distance(JGeometry B, double tolerance)
This method determines the distance between two 2D Geometries.FastJGeometry.PPStatus
getPPStatus(FastJGeometry.FastOp op)
Return the preprocessing status of the specified operation.boolean
isInside(JGeometry B, double tolerance)
Determine whether this geometry is inside B.-
Methods inherited from class oracle.spatial.geometry.JGeometry
affineTransforms, anyInteract, anyInteract, area, buffer, buffer, buffer, byteArrayToHexString, centralLongLatforGNMProjection, circle_polygon, circle_polygon, clone, closeCoords, computeArc, computeArcMBR, concaveHullDig, convexHull, coord, createArc2d, createCircle, createCircle, createDBDescriptors, createDoubleShape, createDoubleShape, createLinearLineString, createLinearMultiLineString, createLinearPolygon, createLinearPolygon, createLRSLinearLineString, createLRSLinearMultiLineString, createLRSLinearPolygon, createLRSLinearPolygon, createLRSPoint, createMultiPoint, createNURBScurve, createPoint, createShape, createShape, createShape, createvoronoiDiag, crossesMeridian, decodePolyline, decodePolyline, defaultTolerance, densifyArcs, densifyArcs, densifyGeodesic, densifyGeodesic, distance, encodePolyline, encodePolyline, equals, expandCircle, expandMBR, expandMBR, expandMBR, expandMBR, fitArc, fitsInHemisphere, geodetic3DLength, geodetic3DLength, getCoordSysInfo, getDimensions, getElementAt, getElements, getElements, getElemInfo, getElemInfoOfElement, getExtendedMBR, getFirstPoint, getGeomDescriptor, getJavaPoint, getJavaPoints, getLabelPoint, getLabelPointXYZ, getLastPoint, getLRMDimension, getMBR, getMer, getNumPoints, getNurbsApprox, getOracleDescriptors, getOracleDescriptorsStr, getOrdinatesArray, getOrdinatesOfElement, getOrdinatesOfElements, getOrientMultiPointOffset, getPoint, getSize, getSRID, getType, hasCircularArcs, isCircle, isCompoundElement, isGeodetic, isGeodeticMBR, isInside, isInside, isLRSGeometry, isMultiPoint, isOptimizedPoint, isOrientedMultiPoint, isOrientedPoint, isPoint, isRectangle, isSimpleElement, jMdcgsphgcu, length, linearizeArc, linearizeArc, linearizeArc, linearizeArc, load, load, loadJS, loadJS, make_2d, make_3d, make_3dgeom, make_3dgeom, makeElementGeometry, monoMeasure, orientation, parseGeometry, projectArrayToGNM, projectFromGNM_longLat, projectFromLTP, projectToGNM_longLat, projectToGNM_longLat, projectToLTP, projectToLTP, reFormulateArc, remove_etype0, reOrientCurves, setLRMDimension, setSRID, setType, simplify, simplify, simplifyVW, simplifyVW, simplifyVW, simplifyVW, store, store, store, store, store, store, store, storeJS, storeJS, storeJS, storeJS, storeJS, tfm_8307_to_PopularMercator, tfm_8307_to_PopularMercator, tfm_PopularMercator_to_8307, tfm_PopularMercator_to_8307, thetaInArc, toGeoJson, toGeoJsonCollection, toString, toStringFull, toStringFull, volume
-
-
-
-
Constructor Detail
-
FastJGeometry
public FastJGeometry(JGeometry geom, double tolerance, java.util.EnumSet<FastJGeometry.FastOp> opsSet, boolean defaultAuto) throws java.lang.Exception
Creates a shallow copy of the given geometry that will be preprocessed as specified. After preprocessing the specified operations will run faster.Preprocessing does not help in all cases:
- Preprocessing takes time and uses some extra storage. Generally preprocessing should be considered only when an operation on a geometry is likely to be repeated at least 50 times.
- Preprocessing may not be useful if the tolerance does not match the value passed at creation.
- Some geometries may not be preprocessable (e.g., a single point; splines).
- Only 2D geometries can be preprocessed.
Preprocessing is intended to be harmless; operations should return their contracted results whether or not preprocessing succeeded, regardless of the values used for preprocessing. However, results do change in some cases due to the different algorithms. If exactly reproducable results are required, especially for results affected by tolerances, preprocessing should be used always or never for that operation. AUTO is particularly discouraged if exactly reproducable results are required.
Preprocessing information is usable both when a method on FastJGeometry is called, and also when a FastJGeometry is passed to a JGeometry method.
This object is not thread-safe.
Example usage:
JGeometry geom = new JGeometry(2003, SRID, new int[] { 1, 2, 1 }, new double[] { 3,3, 6,6 }); FastJGeometry fastGeom = new FastJGeometry(fjg, 0.05, false, EnumSet.of(JGeometry.FastOp.DISTANCE, JGeometry.FastOp.ANYINTERACT)); JGeometry otherGeom = new JGeometry(2003, SRID, new int[] { 1, 2, 1 }, new double[] { 0,0, 9,9 }); double dist1 = fastGeom.distance(otherGeom); // Defaults tolerance and isGeodetic values double dist2 = otherGeom.distance(fastGeom, 0.05, false); // Returns same answer using same preprocessed info in fjg // (parameter order doesn't matter for distance).
AUTO allows the implementation freedom to decide when to preprocess based on usage.
- Parameters:
geom
- must not be modified after this object is created.tolerance
-isGeodetic
-opsSet
- list of operations to preprcoess immediatelydefaultAuto
- true = other operations are AUTO (may also be preprocessed); false = NEVER preprocess other operations- Throws:
java.lang.Exception
-
FastJGeometry
public FastJGeometry(JGeometry geom, double tolerance) throws java.lang.Exception
All eligible operations will be preprocessed automatically at the discretion of the implementation.- Parameters:
geom
-tolerance
-isGeodetic
-- Throws:
java.lang.Exception
-
-
Method Detail
-
getPPStatus
public FastJGeometry.PPStatus getPPStatus(FastJGeometry.FastOp op)
Return the preprocessing status of the specified operation.- PREPROCESS means the operation has been preprocessed.
- AUTO means that preprocessing for the operation hasn't happend yet, but may automatically happen when the operation is used.
- NEVER means that the operation never stores preprocessed information.
- Parameters:
op
-- Returns:
-
anyInteract
public boolean anyInteract(JGeometry B, double tolerance) throws java.lang.Exception
This method determines if a 2D/3D Geometry has anyinteraction with another 2D/3D Geometry. The geometries can be any 2D/3D types supported by Oracle Spatial including geometries with arcs and compund elements.- Overrides:
anyInteract
in classJGeometry
- Parameters:
B
- 2D/3D Geometrytolerance
- at which the given geometry is validisGeodetic
- true if the geometries are geodetic- Returns:
- TRUE if the two geometries interact; FALSE otherwise
- Throws:
java.lang.Exception
-
distance
public double distance(JGeometry B, double tolerance) throws java.lang.Exception
This method determines the distance between two 2D Geometries.- Overrides:
distance
in classJGeometry
- Parameters:
B
- 2D Geometry that is a polygon or multi-polygontolerance
- at which the given geometry is validisGeodetic
- if the geometries are geodetic- Returns:
- distance between the two given geometries. For projected data, the distance is in the same UNIT as the unit of projection. For Geodetic, the distance is in METERS.
- Throws:
java.lang.Exception
-
distance
public double distance(JGeometry A) throws java.lang.Exception
Compute distance to geometry A using the tolerance and isGeodetic values passed at creation.- Parameters:
A
-- Returns:
- Throws:
java.lang.Exception
-
-