Package com.esri.core.geometry
Class MultiVertexGeometryImpl
- java.lang.Object
-
- com.esri.core.geometry.Geometry
-
- com.esri.core.geometry.MultiVertexGeometry
-
- com.esri.core.geometry.MultiVertexGeometryImpl
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
MultiPathImpl
,MultiPointImpl
abstract class MultiVertexGeometryImpl extends MultiVertexGeometry
This class is a base for geometries with many vertices. The vertex attributes are stored in separate arrays of corresponding type. There are as many arrays as there are attributes in the vertex. It uses lazy allocation for the vertex attributes. This means, the actual AttributeStream is allocated only when the users asks for it, or sets a non-default value.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
MultiVertexGeometryImpl.DirtyFlags
static interface
MultiVertexGeometryImpl.GeometryXSimple
-
Nested classes/interfaces inherited from class com.esri.core.geometry.Geometry
Geometry.GeometryAccelerationDegree, Geometry.GeometryType, Geometry.Type
-
-
Field Summary
Fields Modifier and Type Field Description (package private) GeometryAccelerators
m_accelerators
(package private) Envelope
m_envelope
protected int
m_flagsMask
protected int
m_pointCount
protected int
m_reservedPointCount
protected double
m_simpleTolerance
(package private) AttributeStreamBase[]
m_vertexAttributes
private static long
serialVersionUID
-
Fields inherited from class com.esri.core.geometry.Geometry
m_description, m_touchFlag
-
-
Constructor Summary
Constructors Constructor Description MultiVertexGeometryImpl()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
_assignVertexDescriptionImpl(VertexDescription newDescription)
boolean
_attributeStreamIsAllocated(int semantics)
abstract boolean
_buildQuadTreeAccelerator(Geometry.GeometryAccelerationDegree d)
abstract boolean
_buildRasterizedGeometryAccelerator(double toleranceXY, Geometry.GeometryAccelerationDegree accelDegree)
(package private) void
_clearAccelerators()
(package private) abstract void
_copyToImpl(MultiVertexGeometryImpl mvg)
\internal CHildren implement this method to copy additional information(package private) void
_copyToUnsafe(MultiVertexGeometryImpl dst)
GeometryAccelerators
_getAccelerators()
(package private) double
_getShortestDistance(int vertex1, int vertex2)
(package private) double
_getSimpleTolerance()
protected boolean
_hasDirtyFlag(int flag)
(package private) void
_interpolateTwoVertices(int vertex1, int vertex2, double f, Point outPoint)
protected abstract void
_notifyModifiedAllImpl()
(package private) void
_resizeImpl(int pointCount)
protected void
_setDirtyFlag(int flag, boolean bYesNo)
(package private) void
_setEmptyImpl()
protected void
_updateAllDirtyIntervals(boolean bExact)
protected void
_updateEnvelope(Envelope2D env)
protected void
_updateEnvelope(Envelope3D env)
protected void
_updateLooseEnvelope(Envelope2D env)
protected void
_updateLooseEnvelope(Envelope3D env)
\internal Calculates loose envelope.void
_updateXYImpl(boolean bExact)
\internal Updates x, y intervals.protected void
_verifyAllStreams()
protected void
_verifyAllStreamsImpl()
\internal Verifies all streams (calls _VerifyStream for every attribute).protected abstract void
_verifyStreamsImpl()
\internal Called inside of the VerifyAllStreams to get a child class a chance to do additional verify.(package private) void
calculateEnvelope2D(Envelope2D env, boolean bExact)
void
copyTo(Geometry dstGeom)
Copies this geometry to another geometry of the same type.boolean
equals(java.lang.Object other)
double
getAttributeAsDbl(int semantics, int offset, int ordinate)
Returns value of the given vertex attribute as double.int
getAttributeAsInt(int semantics, int offset, int ordinate)
Returns value of the given vertex attribute as int.AttributeStreamBase
getAttributeStreamRef(int semantics)
VertexDescription
getDescriptionImpl()
int
getIsSimple(double tolerance)
Point
getPoint(int index)
Returns given vertex of the Geometry.void
getPointByVal(int index, Point dst)
Returns given vertex of the Geometry.int
getPointCount()
Returns the total vertex count in this Geometry.Point2D
getXY(int index)
Returns XY coordinates of the given vertex of the Geometry.void
getXY(int index, Point2D pt)
Point3D
getXYZ(int index)
Returns XYZ coordinates of the given vertex of the Geometry.int
hashCode()
boolean
isEmpty()
IsEmpty returns TRUE when the Geometry object does not contain geometric information beyond its original initialization state.(package private) boolean
isEmptyImpl()
void
notifyModified(int flags)
Notifies the Geometry of changes made to the vertices so that it could reset cached structures.void
queryCoordinates(Point[] dst)
void
queryCoordinates(Point2D[] dst)
Queries XY coordinates as an array.(package private) int
queryCoordinates(Point2D[] dst, int dstSize, int beginIndex, int endIndex)
void
queryCoordinates(Point3D[] dst)
Queries XYZ coordinates as an array.(package private) int
QueryCoordinates(Point3D[] dst, int dstSize, int beginIndex, int endIndex)
void
queryEnvelope(Envelope env)
Returns the axis aligned bounding box of the geometry.void
queryEnvelope2D(Envelope2D env)
Returns tight bbox of the Geometry in X, Y plane.void
queryEnvelope3D(Envelope3D env)
Returns tight bbox of the Geometry in 3D.Envelope1D
queryInterval(int semantics, int ordinate)
Returns the min and max attribute values at the ordinate of the Geometry.void
queryLooseEnvelope2D(Envelope2D env)
Returns the conservative bbox of the Geometry in X, Y plane.void
queryLooseEnvelope3D(Envelope3D env)
Returns tight conservative box of the Geometry in 3D.void
replaceNaNs(int semantics, double value)
Replaces NaNs in the attribute with the given value.void
setAttribute(int semantics, int offset, int ordinate, double value)
Sets the value of given attribute at given posisiotnsis.void
setAttribute(int semantics, int offset, int ordinate, int value)
Same as above, but works with ints.void
setAttributeStreamRef(int semantics, AttributeStreamBase stream)
Sets a reference to the given AttributeStream of the Geometry.void
setEnvelope(Envelope env)
Sets the envelope of the Geometry.(package private) void
setIsSimple(int isSimpleRes, double tolerance, boolean ogc_known)
void
setPoint(int index, Point src)
Sets the vertex at given index of the Geometry.void
setPointByVal(int index, Point src)
Sets the vertex at given index of the Geometry.void
setXY(int index, double x, double y)
void
setXY(int index, Point2D pt)
Sets XY coordinates of the given vertex of the Geometry.void
setXYZ(int index, Point3D pt)
Sets XYZ coordinates of the given vertex of the Geometry.protected void
throwIfEmpty()
java.lang.String
toString()
The output of this method can be only used for debugging.-
Methods inherited from class com.esri.core.geometry.MultiVertexGeometry
getCoordinates2D, getCoordinates3D, getPoint
-
Methods inherited from class com.esri.core.geometry.Geometry
_clone, _getImpl, _touch, addAttribute, addID, addM, addZ, applyTransformation, applyTransformation, assignVertexDescription, calculateArea2D, calculateLength2D, copy, createInstance, dropAllAttributes, dropAttribute, estimateMemorySize, estimateMemorySize, getBoundary, getDescription, getDimension, getDimensionFromType, getStateFlag, getType, hasAttribute, hasID, hasM, hasZ, isArea, isLinear, isMultiPath, isMultiVertex, isPoint, isSegment, mergeVertexDescription, setEmpty, vertex_count, writeReplace
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
m_vertexAttributes
AttributeStreamBase[] m_vertexAttributes
-
m_accelerators
GeometryAccelerators m_accelerators
-
m_envelope
Envelope m_envelope
-
m_pointCount
protected int m_pointCount
-
m_reservedPointCount
protected int m_reservedPointCount
-
m_flagsMask
protected int m_flagsMask
-
m_simpleTolerance
protected double m_simpleTolerance
-
-
Method Detail
-
_copyToImpl
abstract void _copyToImpl(MultiVertexGeometryImpl mvg)
\internal CHildren implement this method to copy additional information
-
_notifyModifiedAllImpl
protected abstract void _notifyModifiedAllImpl()
-
_verifyStreamsImpl
protected abstract void _verifyStreamsImpl()
\internal Called inside of the VerifyAllStreams to get a child class a chance to do additional verify.
-
getPointCount
public int getPointCount()
Returns the total vertex count in this Geometry.- Specified by:
getPointCount
in classMultiVertexGeometry
- Returns:
- total vertex count in this Geometry.
-
isEmpty
public boolean isEmpty()
Description copied from class:Geometry
IsEmpty returns TRUE when the Geometry object does not contain geometric information beyond its original initialization state.
-
getDescriptionImpl
public VertexDescription getDescriptionImpl()
-
isEmptyImpl
boolean isEmptyImpl()
-
_hasDirtyFlag
protected boolean _hasDirtyFlag(int flag)
-
_setDirtyFlag
protected void _setDirtyFlag(int flag, boolean bYesNo)
-
_verifyAllStreams
protected void _verifyAllStreams()
-
throwIfEmpty
protected void throwIfEmpty()
-
getPointByVal
public void getPointByVal(int index, Point dst)
Description copied from class:MultiVertexGeometry
Returns given vertex of the Geometry. The outPoint will have same VertexDescription as this Geometry.- Specified by:
getPointByVal
in classMultiVertexGeometry
-
setPointByVal
public void setPointByVal(int index, Point src)
Description copied from class:MultiVertexGeometry
Sets the vertex at given index of the Geometry.- Specified by:
setPointByVal
in classMultiVertexGeometry
- Parameters:
index
- The index of the vertex being changed.src
- The Point instance to set given vertex attributes from. The pointSrc can not be empty.
The method throws if the pointSrc is not of the Point type.
The attributes, that are present in the pointSrc and missing in this Geometry, will be added to the Geometry.
The vertex attributes missing in the pointSrc but present in the Geometry will be set to the default values (see VertexDescription::GetDefaultValue).
-
getXY
public Point2D getXY(int index)
Description copied from class:MultiVertexGeometry
Returns XY coordinates of the given vertex of the Geometry.- Specified by:
getXY
in classMultiVertexGeometry
-
getXY
public void getXY(int index, Point2D pt)
- Specified by:
getXY
in classMultiVertexGeometry
-
setXY
public void setXY(int index, Point2D pt)
Description copied from class:MultiVertexGeometry
Sets XY coordinates of the given vertex of the Geometry. All other attributes are unchanged.- Specified by:
setXY
in classMultiVertexGeometry
-
setXY
public void setXY(int index, double x, double y)
-
getXYZ
public Point3D getXYZ(int index)
Description copied from class:MultiVertexGeometry
Returns XYZ coordinates of the given vertex of the Geometry. If the Geometry has no Z's, the default value for Z is returned (0).- Specified by:
getXYZ
in classMultiVertexGeometry
-
setXYZ
public void setXYZ(int index, Point3D pt)
Description copied from class:MultiVertexGeometry
Sets XYZ coordinates of the given vertex of the Geometry. If Z attribute is not present in this Geometry, it is added. All other attributes are unchanged.- Specified by:
setXYZ
in classMultiVertexGeometry
-
getAttributeAsDbl
public double getAttributeAsDbl(int semantics, int offset, int ordinate)
Description copied from class:MultiVertexGeometry
Returns value of the given vertex attribute as double.- Specified by:
getAttributeAsDbl
in classMultiVertexGeometry
- Parameters:
semantics
- The atribute semantics.offset
- is the vertex index in the Geometry.ordinate
- is the ordinate of a vertex attribute (for example, y has ordinate of 1, because it is second ordinate of POSITION) If attribute is not present, the default value is returned. See VertexDescription::GetDefaultValue() method.
-
getAttributeAsInt
public int getAttributeAsInt(int semantics, int offset, int ordinate)
Description copied from class:MultiVertexGeometry
Returns value of the given vertex attribute as int.- Specified by:
getAttributeAsInt
in classMultiVertexGeometry
- Parameters:
semantics
- The atribute semantics.offset
- is the vertex index in the Geometry.ordinate
- is the ordinate of a vertex attribute (for example, y has ordinate of 1, because it is second ordinate of POSITION) If attribute is not present, the default value is returned. See VertexDescription::GetDefaultValue() method. Avoid using this method on non-integer atributes.
-
setAttribute
public void setAttribute(int semantics, int offset, int ordinate, double value)
Description copied from class:MultiVertexGeometry
Sets the value of given attribute at given posisiotnsis.- Specified by:
setAttribute
in classMultiVertexGeometry
- Parameters:
semantics
- The atribute semantics.offset
- is the vertex index in the Geometry.ordinate
- is the ordinate of a vertex attribute (for example, y has ordinate of 1, because it is seond ordinate of POSITION)value
- is the value to set. as well as the number of components of the attribute. If the attribute is not present in this Geometry, it is added.
-
setAttribute
public void setAttribute(int semantics, int offset, int ordinate, int value)
Description copied from class:MultiVertexGeometry
Same as above, but works with ints. Avoid using this method on non-integer atributes because some double attributes may have NaN default values (e.g. Ms)- Specified by:
setAttribute
in classMultiVertexGeometry
-
getAttributeStreamRef
public AttributeStreamBase getAttributeStreamRef(int semantics)
-
setAttributeStreamRef
public void setAttributeStreamRef(int semantics, AttributeStreamBase stream)
Sets a reference to the given AttributeStream of the Geometry. Once the buffer has been obtained, the vertices of the Geometry can be manipulated directly. The AttributeStream parameters are not checked for the size.
If the attribute is missing, it will be added.
Note, that this method does not change the vertex count in the Geometry.
The stream can have more elements, than the Geometry point count, but only necessary part will be saved when exporting to a ESRI shape or other format. @param semantics Semantics of the attribute to assign the stream to. @param stream The input AttributeStream that will be assigned by reference. If one changes the stream later through the reference, one has to call NotifyStreamChanged. \exception Throws invalid_argument exception if the input stream type does not match that of the semantics persistence.
-
_assignVertexDescriptionImpl
protected void _assignVertexDescriptionImpl(VertexDescription newDescription)
- Overrides:
_assignVertexDescriptionImpl
in classMultiVertexGeometry
-
_updateEnvelope
protected void _updateEnvelope(Envelope2D env)
-
_updateEnvelope
protected void _updateEnvelope(Envelope3D env)
-
_updateLooseEnvelope
protected void _updateLooseEnvelope(Envelope2D env)
-
_updateLooseEnvelope
protected void _updateLooseEnvelope(Envelope3D env)
\internal Calculates loose envelope. Returns True if the calculation renders exact envelope.
-
queryEnvelope
public void queryEnvelope(Envelope env)
Description copied from class:Geometry
Returns the axis aligned bounding box of the geometry.- Specified by:
queryEnvelope
in classGeometry
- Parameters:
env
- The envelope to return the result in.
-
queryEnvelope2D
public void queryEnvelope2D(Envelope2D env)
Description copied from class:Geometry
Returns tight bbox of the Geometry in X, Y plane.- Specified by:
queryEnvelope2D
in classGeometry
- Parameters:
env
- The envelope to return the result in.
-
queryEnvelope3D
public void queryEnvelope3D(Envelope3D env)
Description copied from class:Geometry
Returns tight bbox of the Geometry in 3D.- Specified by:
queryEnvelope3D
in classGeometry
- Parameters:
env
- The envelope to return the result in.
-
queryLooseEnvelope2D
public void queryLooseEnvelope2D(Envelope2D env)
Description copied from class:Geometry
Returns the conservative bbox of the Geometry in X, Y plane. This is a faster method than QueryEnvelope2D. However, the bbox could be larger than the tight box.- Overrides:
queryLooseEnvelope2D
in classGeometry
- Parameters:
env
- The envelope to return the result in.
-
queryLooseEnvelope3D
public void queryLooseEnvelope3D(Envelope3D env)
Description copied from class:Geometry
Returns tight conservative box of the Geometry in 3D. This is a faster method than the QueryEnvelope3D. However, the box could be larger than the tight box.- Overrides:
queryLooseEnvelope3D
in classGeometry
- Parameters:
env
- The envelope to return the result in.
-
queryInterval
public Envelope1D queryInterval(int semantics, int ordinate)
Description copied from class:Geometry
Returns the min and max attribute values at the ordinate of the Geometry.- Specified by:
queryInterval
in classGeometry
- Parameters:
semantics
- The semantics of the interval.ordinate
- The ordinate of the interval.- Returns:
- The interval.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
setEnvelope
public void setEnvelope(Envelope env)
Sets the envelope of the Geometry. The Envelope description must match that of the Geometry.
-
copyTo
public void copyTo(Geometry dstGeom)
Description copied from class:Geometry
Copies this geometry to another geometry of the same type. The result geometry is an exact copy.
-
_copyToUnsafe
void _copyToUnsafe(MultiVertexGeometryImpl dst)
-
_attributeStreamIsAllocated
public boolean _attributeStreamIsAllocated(int semantics)
-
_setEmptyImpl
void _setEmptyImpl()
-
notifyModified
public void notifyModified(int flags)
Notifies the Geometry of changes made to the vertices so that it could reset cached structures.
-
_updateAllDirtyIntervals
protected void _updateAllDirtyIntervals(boolean bExact)
- Parameters:
bExact
- True, when the exact envelope need to be calculated and false for the loose one.
-
_updateXYImpl
public void _updateXYImpl(boolean bExact)
\internal Updates x, y intervals.
-
calculateEnvelope2D
void calculateEnvelope2D(Envelope2D env, boolean bExact)
-
_verifyAllStreamsImpl
protected void _verifyAllStreamsImpl()
\internal Verifies all streams (calls _VerifyStream for every attribute).
-
_resizeImpl
void _resizeImpl(int pointCount)
-
queryCoordinates
int queryCoordinates(Point2D[] dst, int dstSize, int beginIndex, int endIndex)
-
QueryCoordinates
int QueryCoordinates(Point3D[] dst, int dstSize, int beginIndex, int endIndex)
-
getIsSimple
public int getIsSimple(double tolerance)
-
setIsSimple
void setIsSimple(int isSimpleRes, double tolerance, boolean ogc_known)
-
_getSimpleTolerance
double _getSimpleTolerance()
-
_getAccelerators
public GeometryAccelerators _getAccelerators()
-
_clearAccelerators
void _clearAccelerators()
-
_interpolateTwoVertices
void _interpolateTwoVertices(int vertex1, int vertex2, double f, Point outPoint)
-
_getShortestDistance
double _getShortestDistance(int vertex1, int vertex2)
-
getPoint
public Point getPoint(int index)
Description copied from class:MultiVertexGeometry
Returns given vertex of the Geometry.- Specified by:
getPoint
in classMultiVertexGeometry
-
setPoint
public void setPoint(int index, Point src)
Description copied from class:MultiVertexGeometry
Sets the vertex at given index of the Geometry.- Specified by:
setPoint
in classMultiVertexGeometry
- Parameters:
index
- The index of the vertex being changed.src
- The Point instance to set given vertex attributes from. The pointSrc can not be empty.
The method throws if the pointSrc is not of the Point type.
The attributes, that are present in the pointSrc and missing in this Geometry, will be added to the Geometry.
The vertex attributes missing in the pointSrc but present in the Geometry will be set to the default values (see VertexDescription::GetDefaultValue).
-
queryCoordinates
public void queryCoordinates(Point[] dst)
- Specified by:
queryCoordinates
in classMultiVertexGeometry
-
queryCoordinates
public void queryCoordinates(Point2D[] dst)
Description copied from class:MultiVertexGeometry
Queries XY coordinates as an array. The array must be larg enough (See GetPointCount()).- Specified by:
queryCoordinates
in classMultiVertexGeometry
-
queryCoordinates
public void queryCoordinates(Point3D[] dst)
Description copied from class:MultiVertexGeometry
Queries XYZ coordinates as an array. The array must be larg enough (See GetPointCount()).- Specified by:
queryCoordinates
in classMultiVertexGeometry
-
replaceNaNs
public void replaceNaNs(int semantics, double value)
Description copied from class:Geometry
Replaces NaNs in the attribute with the given value. If the geometry is not empty, it adds the attribute if geometry does not have it yet, and replaces the values. If the geometry is empty, it adds the attribute and does not set any values.- Specified by:
replaceNaNs
in classGeometry
- Parameters:
semantics
- The semantics for which to replace the NaNs.value
- The value to replace NaNs with.
-
_buildRasterizedGeometryAccelerator
public abstract boolean _buildRasterizedGeometryAccelerator(double toleranceXY, Geometry.GeometryAccelerationDegree accelDegree)
-
_buildQuadTreeAccelerator
public abstract boolean _buildQuadTreeAccelerator(Geometry.GeometryAccelerationDegree d)
-
-