Package com.esri.arcgisruntime.geometry
Class LineSegment
- java.lang.Object
-
- com.esri.arcgisruntime.geometry.Segment
-
- com.esri.arcgisruntime.geometry.LineSegment
-
public final class LineSegment extends Segment
Represents a straight line between a start and end Point.LineSegments are used to represent the edges of
Polygons
andPolylines
. The SpatialReference of a LineSegment will be null if one is not set in its constructor. If subsequently added to aPart
, 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.
-
-
Constructor Summary
Constructors Constructor Description LineSegment(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
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static LineSegment
createLineAtAngleFrom(Point startPoint, double angleDegrees, double length)
Deprecated.As of 100.3.0, replaced bycreateLineAtAngleFromPoint(Point, double, double)
.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.java.lang.String
toString()
Returns a string representation of this LineSegment instance.-
Methods inherited from class com.esri.arcgisruntime.geometry.Segment
getEndPoint, getSpatialReference, getStartPoint, isClosed, isCurve
-
-
-
-
Constructor Detail
-
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
public LineSegment(Point startPoint, Point endPoint)
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
public LineSegment(Point startPoint, Point endPoint, SpatialReference spatialReference)
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 Detail
-
createLineAtAngleFrom
@Deprecated public static LineSegment createLineAtAngleFrom(Point startPoint, double angleDegrees, double length)
Deprecated.As of 100.3.0, replaced bycreateLineAtAngleFromPoint(Point, double, double)
.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 degrees relative to the x-axis. The length is in the units of the spatial reference.- Parameters:
startPoint
- the start Point of the new LineSegmentangleDegrees
- the angle, in degrees, at which the new LineSegment will be created.length
- the length of the new LineSegment- Returns:
- a new LineSegment with the given properties
- Throws:
java.lang.NullPointerException
- if startPoint is null- Since:
- 100.0.0
-
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:
java.lang.IllegalArgumentException
- if startPoint is null- Since:
- 100.3.0
-
toString
public java.lang.String 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.
- Overrides:
toString
in classjava.lang.Object
- Returns:
- a String representation of this segment with useful information for debugging.
- Since:
- 100.0.0
-
-