java.lang.Object
com.esri.arcgisruntime.geometry.Segment
com.esri.arcgisruntime.geometry.LineSegment
Represents a straight line between a start and end Point.
LineSegments are used to represent the edges of Polygons
and Polylines
.
The SpatialReference of a LineSegment will be null if one is not set in its constructor. If subsequently added to a
Part
, it will take on the SpatialReference of that part.
LineSegment is immutable. Create new instances by using the constructors and factory methods, instead of changing the properties of an existing LineSegment.
- Since:
- 100.0.0
- See Also:
-
Constructor Summary
ConstructorDescriptionLineSegment
(double startX, double startY, double endX, double endY) Creates a new LineSegment with start and end points at the given x,y coordinates.LineSegment
(double startX, double startY, double startZ, double endX, double endY, double endZ) Creates a new LineSegment with start and end points at the given x,y coordinates and z value.LineSegment
(double startX, double startY, double startZ, double endX, double endY, double endZ, SpatialReference spatialReference) Creates a new LineSegment with start and end points at the given x,y coordinates, z value, and the given SpatialReference.LineSegment
(double startX, double startY, double endX, double endY, SpatialReference spatialReference) Creates a new LineSegment with start and end points at the given x,y coordinates, and the given SpatialReference.LineSegment
(Point startPoint, Point endPoint) Creates a newLineSegment
with the given start and endPoint
s.LineSegment
(Point startPoint, Point endPoint, SpatialReference spatialReference) Creates a new line segment with the given start and end Points, and SpatialReference. -
Method Summary
Modifier and TypeMethodDescriptionstatic LineSegment
createLineAtAngleFromPoint
(Point startPoint, double angleRadians, double length) Creates a new LineSegment with the given start Point, and the given length and angle from the start Point.toString()
Returns a string representation of this LineSegment instance.Methods inherited from class com.esri.arcgisruntime.geometry.Segment
getEndPoint, getSpatialReference, getStartPoint, isClosed, isCurve
-
Constructor Details
-
LineSegment
public LineSegment(double startX, double startY, double endX, double endY) Creates a new LineSegment with start and end points at the given x,y coordinates. The SpatialReference of the new LineSegment will be null.- Parameters:
startX
- the x coordinate of the start Point of the new LineSegmentstartY
- the y coordinate of the start Point of the new LineSegmentendX
- the x coordinate of the end Point of the new LineSegmentendY
- the y coordinate of the end Point of the new LineSegment- Since:
- 100.0.0
-
LineSegment
public LineSegment(double startX, double startY, double endX, double endY, SpatialReference spatialReference) Creates a new LineSegment with start and end points at the given x,y coordinates, and the given SpatialReference.- Parameters:
startX
- the x coordinate of the start Point of the new LineSegmentstartY
- the y coordinate of the start Point of the new LineSegmentendX
- the x coordinate of the end Point of the new LineSegmentendY
- the y coordinate of the end Point of the new LineSegmentspatialReference
- the SpatialReference of the new LineSegment, and of the x,y coordinates- Since:
- 100.0.0
-
LineSegment
public LineSegment(double startX, double startY, double startZ, double endX, double endY, double endZ) Creates a new LineSegment with start and end points at the given x,y coordinates and z value.- Parameters:
startX
- the x coordinate of the start Point of the new LineSegmentstartY
- the y coordinate of the start Point of the new LineSegmentstartZ
- the z value of the start Point of the new LineSegmentendX
- the x coordinate of the end Point of the new LineSegmentendY
- the y coordinate of the end Point of the new LineSegmentendZ
- the z value of the end Point of the new LineSegment- Since:
- 100.1.0
-
LineSegment
public LineSegment(double startX, double startY, double startZ, double endX, double endY, double endZ, SpatialReference spatialReference) Creates a new LineSegment with start and end points at the given x,y coordinates, z value, and the given SpatialReference.- Parameters:
startX
- the x coordinate of the start Point of the new LineSegmentstartY
- the y coordinate of the start Point of the new LineSegmentstartZ
- the z value of the start Point of the new LineSegmentendX
- the x coordinate of the end Point of the new LineSegmentendY
- the y coordinate of the end Point of the new LineSegmentendZ
- the z value of the end Point of the new LineSegmentspatialReference
- the SpatialReference of the new LineSegment, and of the x,y coordinates- Since:
- 100.1.0
-
LineSegment
Creates a newLineSegment
with the given start and endPoint
s. TheSpatialReference
of the new LineSegment will be null.- Parameters:
startPoint
- the start Point of the new LineSegmentendPoint
- the end Point of the new LineSegment- Throws:
ArcGISRuntimeException
- if theSpatialReference
of both thePoint
s supplied are non-null and differ.- Since:
- 100.0.0
-
LineSegment
Creates a new line segment with the given start and end Points, and SpatialReference.The spatial reference parameter is used if the points have a null spatial reference. If more than one spatial reference is supplied (as a parameter or as a property of a
Point
parameter), they must all be equal.- Parameters:
startPoint
- the start Point of the new LineSegmentendPoint
- the end Point of the new LineSegmentspatialReference
- the SpatialReference of the new LineSegment- Throws:
ArcGISRuntimeException
- if theSpatialReference
of thePoint
s and theSpatialReference
parameters are non-null and differ.- Since:
- 100.0.0
-
-
Method Details
-
createLineAtAngleFromPoint
public static LineSegment createLineAtAngleFromPoint(Point startPoint, double angleRadians, double length) Creates a new LineSegment with the given start Point, and the given length and angle from the start Point. The spatial reference of the point is used to determine the segment's spatial reference. The angle is specified in radians relative to the x-axis. The length is in the units of the spatial reference.- Parameters:
startPoint
- the start Point of the new LineSegmentangleRadians
- the angle, in radians, at which the new LineSegment will be created.length
- the length of the new LineSegment- Returns:
- a new LineSegment with the given properties
- Throws:
IllegalArgumentException
- if startPoint is null- Since:
- 100.3.0
-
toString
Returns a string representation of this LineSegment instance. The format and content of this string is subject to change without notice.This value may be useful for debugging purposes, but cannot be relied upon for persistence purposes.
-