LineSegment.fromXYZ constructor

LineSegment.fromXYZ(
  1. {required double xStart,
  2. required double yStart,
  3. required double zStart,
  4. required double xEnd,
  5. required double yEnd,
  6. required double zEnd,
  7. SpatialReference? spatialReference}
)

Creates a line segment based on 3D coordinates and a spatial reference.

Use this method to create a line segment representing a straight line between two points.

Parameters:

  • xStart — The X coordinate of start point.
  • yStart — The Y coordinate of start point.
  • zStart — The Z coordinate of start point.
  • xEnd — The X coordinate of end point.
  • yEnd — The Y coordinate of end point.
  • zEnd — The Z coordinate of end point.
  • spatialReference — A spatial reference.

Implementation

factory LineSegment.fromXYZ(
    {required double xStart,
    required double yStart,
    required double zStart,
    required double xEnd,
    required double yEnd,
    required double zEnd,
    SpatialReference? spatialReference}) {
  _initializeArcGISEnvironmentIfNeeded();
  final handle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_LineSegment_createWithXYZSpatialReference(
        xStart,
        yStart,
        zStart,
        xEnd,
        yEnd,
        zEnd,
        spatialReference?._handle ?? ffi.nullptr,
        errorHandler);
  });
  final LineSegment object = LineSegment._withHandle(handle);
  object._spatialReference.cache(spatialReference);
  return object;
}