Class Segment
java.lang.Object
com.esri.core.geometry.Geometry
com.esri.core.geometry.Segment
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Line
A base class for segments. Presently only Line segments are supported.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Geometry
Geometry.GeometryAccelerationDegree, Geometry.GeometryType, Geometry.Type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void_assignVertexDescriptionImpl(VertexDescription newDescription) doubleCalculates the area of the geometry.voidCopies this geometry to another geometry of the same type.abstract Segmentcut(double t1, double t2) Returns subsegment between parameters t1 and t2.doubleabstract doublegetAttributeAsDbl(double t, int semantics, int ordinate) Returns the attribute on the segment for the given parameter value.Returns boundary of this geometry.abstract doublegetClosestCoordinate(Point2D inputPoint, boolean bExtrapolate) Finds a closest coordinate on this segment.getCoord2D(double t) Returns the coordinate of the point on this segment for the given parameter value.abstract voidgetCoord2D(double t, Point2D dst) Returns the coordinate of the point on this segment for the given parameter value (segments are parametric curves).final intReturns the topological dimension of the geometry object based on the geometry's type.doublegetEndAttributeAsDbl(int semantics, int ordinate) Returns value of the end vertex attribute's ordinate.intgetEndAttributeAsInt(int semantics, int ordinate) Returns the value of the end vertex attribute's ordinate.doublegetEndX()Returns the X coordinate of ending point.getEndXY()Returns XY coordinates of the end point.voidReturns XYZ coordinates of the end point.doublegetEndY()Returns the Y coordinate of ending point.doublegetStartAttributeAsDbl(int semantics, int ordinate) Returns value of the start vertex attribute's ordinate.intgetStartAttributeAsInt(int semantics, int ordinate) Returns the value of the start vertex attribute's ordinate.doubleReturns the X coordinate of starting point.Returns XY coordinates of the start point.voidgetStartXY(Point2D pt) Returns XYZ coordinates of the start point.doubleReturns the Y coordinate of starting point.inthashCode()abstract intintersectionWithAxis2D(boolean bAxisX, double ordinate, double[] resultOrdinates, double[] parameters) Calculates intersection points of this segment with an infinite line, parallel to one of the axes.final booleanisEmpty()IsEmpty returns TRUE when the Geometry object does not contain geometric information beyond its original initialization state.booleanNon public abstract version of the function.booleanisIntersecting(Point2D pt, double tolerance) Returns TRUE if the point and segment intersect (not disjoint) for the given tolerance.booleanisIntersecting(Segment other, double tolerance) Returns TRUE if this segment intersects with the other segment with the given tolerance.voidReturns coordinates of the end point in this segment.queryInterval(int semantics, int ordinate) Returns the min and max attribute values at the ordinate of the Geometry.voidqueryStart(Point dstPoint) Returns coordinates of the start point in a Point class.final voidsetEmpty()Returns the geometry to its original initialization state by releasing all data referenced by the geometry.voidSets the coordinates of the end point in a Point class.voidsetEndAttribute(int semantics, int ordinate, double value) Sets the value of end vertex attribute.voidsetEndAttribute(int semantics, int ordinate, int value) voidsetEndXY(double x, double y) voidSets the XY coordinates of the end point.voidsetEndXYZ(double x, double y, double z) voidSets the XYZ coordinates of the end point.voidSets the coordinates of the start point in this segment.voidsetStartAttribute(int semantics, int ordinate, double value) Sets the value of the start vertex attribute.voidsetStartAttribute(int semantics, int ordinate, int value) voidsetStartXY(double x, double y) voidsetStartXY(Point2D pt) Sets the XY coordinates of the start point.voidsetStartXYZ(double x, double y, double z) voidsetStartXYZ(Point3D pt) Sets the XYZ coordinates of the start point.Methods inherited from class Geometry
_getImpl, addAttribute, addID, addM, applyTransformation, assignVertexDescription, calculateLength2D, copy, createInstance, dropAllAttributes, dropAttribute, estimateMemorySize, estimateMemorySize, getDescription, getDimensionFromType, getStateFlag, getType, hasAttribute, hasID, hasM, hasZ, isArea, isLinear, isMultiPath, isMultiVertex, isPoint, isSegment, mergeVertexDescription, queryEnvelope, queryEnvelope2D, queryLooseEnvelope2D, replaceNaNs, toString, vertex_count
-
Constructor Details
-
Segment
public Segment()Creates a segment with start and end points (0,0).
-
-
Method Details
-
getStartXY
Returns XY coordinates of the start point. -
getStartXY
-
setStartXY
Sets the XY coordinates of the start point. -
setStartXY
public void setStartXY(double x, double y) -
getStartXYZ
Returns XYZ coordinates of the start point. Z if 0 if Z is missing. -
setStartXYZ
Sets the XYZ coordinates of the start point. -
setStartXYZ
public void setStartXYZ(double x, double y, double z) -
queryStart
Returns coordinates of the start point in a Point class. -
setStart
Sets the coordinates of the start point in this segment.- Parameters:
srcPoint- The new start point of this segment.
-
getStartAttributeAsDbl
public double getStartAttributeAsDbl(int semantics, int ordinate) Returns value of the start vertex attribute's ordinate. Throws if the Point is empty.- Parameters:
semantics- The attribute semantics.ordinate- The attribute's ordinate. For example, the y coordinate of the NORMAL has ordinate of 1.- Returns:
- Ordinate value as double.
-
getStartAttributeAsInt
public int getStartAttributeAsInt(int semantics, int ordinate) Returns the value of the start vertex attribute's ordinate. The ordinate is always 0 because integer attributes always have one component.- Parameters:
semantics- The attribute semantics.ordinate- The attribute's ordinate. For example, the y coordinate of the NORMAL has ordinate of 1.- Returns:
- Ordinate value truncated to 32 bit integer.
-
setStartAttribute
public void setStartAttribute(int semantics, int ordinate, double value) Sets the value of the start vertex attribute.- Parameters:
semantics- The attribute semantics.value- is the array to write values to. The attribute type and the number of elements must match the persistence type, as well as the number of components of the attribute.
-
setStartAttribute
public void setStartAttribute(int semantics, int ordinate, int value) -
getStartX
public double getStartX()Returns the X coordinate of starting point.- Returns:
- The X coordinate of starting point.
-
getStartY
public double getStartY()Returns the Y coordinate of starting point.- Returns:
- The Y coordinate of starting point.
-
getEndX
public double getEndX()Returns the X coordinate of ending point.- Returns:
- The X coordinate of ending point.
-
getEndY
public double getEndY()Returns the Y coordinate of ending point.- Returns:
- The Y coordinate of ending point.
-
getEndXY
Returns XY coordinates of the end point.- Returns:
- The XY coordinates of the end point.
-
getEndXY
-
setEndXY
Sets the XY coordinates of the end point.- Parameters:
pt- The end point of the segment.
-
setEndXY
public void setEndXY(double x, double y) -
getEndXYZ
Returns XYZ coordinates of the end point. Z if 0 if Z is missing.- Returns:
- The XYZ coordinates of the end point.
-
setEndXYZ
Sets the XYZ coordinates of the end point. -
setEndXYZ
public void setEndXYZ(double x, double y, double z) -
queryEnd
Returns coordinates of the end point in this segment.- Parameters:
dstPoint- The end point of this segment.
-
setEnd
Sets the coordinates of the end point in a Point class.- Parameters:
srcPoint- The new end point of this segment.
-
getEndAttributeAsDbl
public double getEndAttributeAsDbl(int semantics, int ordinate) Returns value of the end vertex attribute's ordinate. Throws if the Point is empty.- Parameters:
semantics- The attribute semantics.ordinate- The attribute's ordinate. For example, the y coordinate of the NORMAL has ordinate of 1.- Returns:
- Ordinate value as double.
-
getEndAttributeAsInt
public int getEndAttributeAsInt(int semantics, int ordinate) Returns the value of the end vertex attribute's ordinate. The ordinate is always 0 because integer attributes always have one component.- Parameters:
semantics- The attribute semantics.ordinate- The attribute's ordinate. For example, the y coordinate of the NORMAL has ordinate of 1.- Returns:
- The ordinate value truncated to 32 bit integer.
-
setEndAttribute
public void setEndAttribute(int semantics, int ordinate, double value) Sets the value of end vertex attribute.- Parameters:
semantics- The attribute semantics.ordinate- The attribute's ordinate.value- Is the array to write values to. The attribute type and the number of elements must match the persistence type, as well as the number of components of the attribute.
-
setEndAttribute
public void setEndAttribute(int semantics, int ordinate, int value) -
getDimension
public final int getDimension()Description copied from class:GeometryReturns the topological dimension of the geometry object based on the geometry's type.Returns 0 for point and multipoint.
Returns 1 for lines and polylines.
Returns 2 for polygons and envelopes
Returns 3 for objects with volume
- Specified by:
getDimensionin classGeometry- Returns:
- Returns the integer value of the dimension of geometry.
-
isEmpty
-
setEmpty
-
calculateArea2D
public double calculateArea2D()Description copied from class:GeometryCalculates the area of the geometry. If the spatial reference is a Geographic Coordinate System (WGS84) then the 2D area calculation is defined in angular units.- Overrides:
calculateArea2Din classGeometry- Returns:
- A double value representing the 2D area of the geometry.
-
isIntersecting
Returns TRUE if this segment intersects with the other segment with the given tolerance. -
isIntersecting
Returns TRUE if the point and segment intersect (not disjoint) for the given tolerance. -
isEmptyImpl
public boolean isEmptyImpl()Non public abstract version of the function. -
_assignVertexDescriptionImpl
- Specified by:
_assignVertexDescriptionImplin classGeometry
-
copyTo
-
queryInterval
Description copied from class:GeometryReturns the min and max attribute values at the ordinate of the Geometry.- Specified by:
queryIntervalin classGeometry- Parameters:
semantics- The semantics of the interval.ordinate- The ordinate of the interval.- Returns:
- The interval.
-
hashCode
-
getCoord2D
Returns the coordinate of the point on this segment for the given parameter value. -
getCoord2D
Returns the coordinate of the point on this segment for the given parameter value (segments are parametric curves).- Parameters:
t- the parameter coordinate along the segment from 0.0 to 1.0. Value of 0 returns the start point, 1 returns end point.dst- the coordinate where result will be placed.
-
getClosestCoordinate
Finds a closest coordinate on this segment.- Parameters:
inputPoint- The 2D point to find the closest coordinate on this segment.bExtrapolate- TRUE if the segment is extrapolated at the end points along the end point tangents. Otherwise the result is limited to values between 0 and 1.- Returns:
- The parametric coordinate t on the segment (0 corresponds to the start point, 1 corresponds to the end point). Use getCoord2D to obtain the 2D coordinate on the segment from t. To find the distance, call (inputPoint.sub(seg.getCoord2D(t))).length();
-
intersectionWithAxis2D
public abstract int intersectionWithAxis2D(boolean bAxisX, double ordinate, double[] resultOrdinates, double[] parameters) Calculates intersection points of this segment with an infinite line, parallel to one of the axes.- Parameters:
bAxisX- TRUE if the function works with the line parallel to the axis X.ordinate- The ordinate value of the line (x for axis Y, y for axis X).resultOrdinates- The value of ordinate in the intersection points One ordinate is equal to the ordinate parameter. This parameter can be NULL.parameters- The value of the parameter in the intersection points (between 0 and 1). This parameter can be NULL.- Returns:
- The number of intersection points, 0 when no intersection points exist, -1 when the segment coincides with the line (infinite number of intersection points).
-
cut
Returns subsegment between parameters t1 and t2. The attributes are interpolated along the length of the curve. -
getAttributeAsDbl
public abstract double getAttributeAsDbl(double t, int semantics, int ordinate) Returns the attribute on the segment for the given parameter value. The interpolation of attribute is given by the attribute interpolation type. -
distance
-
getBoundary
Description copied from class:GeometryReturns boundary of this geometry. Polygon and Envelope boundary is a Polyline. For Polyline and Line, the boundary is a Multi_point consisting of path end points. For Multi_point and Point null is returned.- Specified by:
getBoundaryin classGeometry- Returns:
- The boundary geometry.
-