Class 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 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:
    Polygon, Polyline, Part
    • 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 LineSegment
        startY - the y-coordinate of the start Point of the new LineSegment
        endX - the x-coordinate of the end Point of the new LineSegment
        endY - 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 LineSegment
        startY - the y-coordinate of the start Point of the new LineSegment
        endX - the x-coordinate of the end Point of the new LineSegment
        endY - the y-coordinate of the end Point of the new LineSegment
        spatialReference - 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 LineSegment
        startY - the y-coordinate of the start Point of the new LineSegment
        startZ - the z-value of the start Point of the new LineSegment
        endX - the x-coordinate of the end Point of the new LineSegment
        endY - the y-coordinate of the end Point of the new LineSegment
        endZ - 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 LineSegment
        startY - the y-coordinate of the start Point of the new LineSegment
        startZ - the z-value of the start Point of the new LineSegment
        endX - the x-coordinate of the end Point of the new LineSegment
        endY - the y-coordinate of the end Point of the new LineSegment
        endZ - the z-value of the end Point of the new LineSegment
        spatialReference - 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 new LineSegment with the given start and end Points. The SpatialReference of the new LineSegment will be null.
        Parameters:
        startPoint - the start Point of the new LineSegment
        endPoint - the end Point of the new LineSegment
        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.
        Parameters:
        startPoint - the start Point of the new LineSegment
        endPoint - the end Point of the new LineSegment
        spatialReference - the SpatialReference of the new LineSegment
        Since:
        100.0.0
    • Method Detail

      • createLineAtAngleFrom

        @Deprecated
        public static LineSegment createLineAtAngleFrom​(Point startPoint,
                                                        double angleDegrees,
                                                        double length)
        Deprecated.
        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 LineSegment
        angleDegrees - 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:
        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 LineSegment
        angleRadians - 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

        public 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 class Object
        Since:
        100.0.0