LineSegment constructor

LineSegment(
  1. {required ArcGISPoint startPoint,
  2. required ArcGISPoint endPoint,
  3. SpatialReference? spatialReference}
)

Creates a line segment based on two points and a spatial reference.

Use this method to create a line segment representing a straight line between two points. 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 an ArcGISPoint parameter), they must all be equal.

Parameters:

  • startPoint — The start point.
  • endPoint — The end point.
  • spatialReference — A spatial reference.

Implementation

factory LineSegment(
    {required ArcGISPoint startPoint,
    required ArcGISPoint endPoint,
    SpatialReference? spatialReference}) {
  _initializeArcGISEnvironmentIfNeeded();
  final handle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_LineSegment_createWithSpatialReference(
        startPoint._handle,
        endPoint._handle,
        spatialReference?._handle ?? ffi.nullptr,
        errorHandler);
  });
  final LineSegment object = LineSegment._withHandle(handle);
  object._spatialReference.cache(spatialReference);
  return object;
}