Class Line
java.lang.Object
com.esri.core.geometry.Geometry
com.esri.core.geometry.Segment
com.esri.core.geometry.Line
- All Implemented Interfaces:
Serializable
A straight line between a pair of points.
- 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 TypeMethodDescriptionvoidapplyTransformation(Transformation2D transform) Applies 2D affine transformation in XY plane.doubleCalculates the length of the geometry.Creates an instance of an empty geometry of the same type.cut(double t1, double t2) Returns subsegment between parameters t1 and t2.booleanlongReturns an estimate of this object size in bytes.doublegetAttributeAsDbl(double t, int semantics, int ordinate) Returns the attribute on the segment for the given parameter value.doublegetClosestCoordinate(Point2D inputPt, boolean bExtrapolate) Finds a closest coordinate on this segment.voidgetCoord2D(double t, Point2D pt) Returns the coordinate of the point on this segment for the given parameter value (segments are parametric curves).getType()Returns the geometry type.inthashCode()intintersectionWithAxis2D(boolean b_axis_x, double ordinate, double[] result_ordinates, double[] parameters) Calculates intersection points of this segment with an infinite line, parallel to one of the axes.booleanisCurve()Indicates if the line segment is a curve.booleanisIntersecting(Point2D pt, double tolerance) Returns True if point and the segment intersect (not disjoint) for the given tolerance.voidqueryEnvelope(Envelope env) Returns the axis aligned bounding box of the geometry.voidReturns tight bbox of the Geometry in X, Y plane.voidreplaceNaNs(int semantics, double value) Replaces NaNs in the attribute with the given value.toString()The output of this method can be only used for debugging.Methods inherited from class Segment
_assignVertexDescriptionImpl, calculateArea2D, copyTo, distance, getBoundary, getCoord2D, getDimension, getEndAttributeAsDbl, getEndAttributeAsInt, getEndX, getEndXY, getEndXY, getEndXYZ, getEndY, getStartAttributeAsDbl, getStartAttributeAsInt, getStartX, getStartXY, getStartXY, getStartXYZ, getStartY, isEmpty, isEmptyImpl, isIntersecting, queryEnd, queryInterval, queryStart, setEmpty, setEnd, setEndAttribute, setEndAttribute, setEndXY, setEndXY, setEndXYZ, setEndXYZ, setStart, setStartAttribute, setStartAttribute, setStartXY, setStartXY, setStartXYZ, setStartXYZMethods inherited from class Geometry
_getImpl, addAttribute, addID, addM, assignVertexDescription, copy, dropAllAttributes, dropAttribute, estimateMemorySize, getDescription, getDimensionFromType, getStateFlag, hasAttribute, hasID, hasM, hasZ, isArea, isLinear, isMultiPath, isMultiVertex, isPoint, isSegment, mergeVertexDescription, queryLooseEnvelope2D, vertex_count
-
Constructor Details
-
Line
public Line()Creates a line segment. -
Line
public Line(double x1, double y1, double x2, double y2)
-
-
Method Details
-
getType
Description copied from class:GeometryReturns the geometry type. -
estimateMemorySize
public long estimateMemorySize()Description copied from class:GeometryReturns an estimate of this object size in bytes.This estimate doesn't include the size of the
VertexDescriptionobject because instances ofVertexDescriptionare shared among geometry objects.- Specified by:
estimateMemorySizein classGeometry- Returns:
- Returns an estimate of this object size in bytes.
-
calculateLength2D
public double calculateLength2D()Description copied from class:GeometryCalculates the length of the geometry. If the spatial reference is a Geographic Coordinate System (a system where coordinates are defined using angular units such as longitude and latitude) then the 2D distance calculation is returned in angular units. In cases where length must be calculated on a Geographic Coordinate System consider the using the geodeticLength method on theGeometryEngine- Overrides:
calculateLength2Din classGeometry- Returns:
- A double value representing the 2D length of the geometry.
-
isCurve
public boolean isCurve()Indicates if the line segment is a curve. -
queryEnvelope
Description copied from class:GeometryReturns the axis aligned bounding box of the geometry.- Specified by:
queryEnvelopein classGeometry- Parameters:
env- The envelope to return the result in.
-
queryEnvelope2D
Description copied from class:GeometryReturns tight bbox of the Geometry in X, Y plane.- Specified by:
queryEnvelope2Din classGeometry- Parameters:
env- The envelope to return the result in.
-
applyTransformation
Description copied from class:GeometryApplies 2D affine transformation in XY plane.- Specified by:
applyTransformationin classGeometry- Parameters:
transform- The affine transformation to be applied to this geometry.
-
createInstance
Description copied from class:GeometryCreates an instance of an empty geometry of the same type.- Specified by:
createInstancein classGeometry- Returns:
- The new instance.
-
getCoord2D
Description copied from class:SegmentReturns the coordinate of the point on this segment for the given parameter value (segments are parametric curves).- Specified by:
getCoord2Din classSegment- 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.pt- the coordinate where result will be placed.
-
cut
-
getAttributeAsDbl
public double getAttributeAsDbl(double t, int semantics, int ordinate) Description copied from class:SegmentReturns the attribute on the segment for the given parameter value. The interpolation of attribute is given by the attribute interpolation type.- Specified by:
getAttributeAsDblin classSegment
-
getClosestCoordinate
Description copied from class:SegmentFinds a closest coordinate on this segment.- Specified by:
getClosestCoordinatein classSegment- Parameters:
inputPt- 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 int intersectionWithAxis2D(boolean b_axis_x, double ordinate, double[] result_ordinates, double[] parameters) Description copied from class:SegmentCalculates intersection points of this segment with an infinite line, parallel to one of the axes.- Specified by:
intersectionWithAxis2Din classSegment- Parameters:
b_axis_x- 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).result_ordinates- 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).
-
isIntersecting
Returns True if point and the segment intersect (not disjoint) for the given tolerance.- Overrides:
isIntersectingin classSegment
-
equals
-
hashCode
-
replaceNaNs
public void replaceNaNs(int semantics, double value) Description copied from class:GeometryReplaces 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:
replaceNaNsin classGeometry- Parameters:
semantics- The semantics for which to replace the NaNs.value- The value to replace NaNs with.
-
toString
-