LineSegment.fromXY constructor
- {required double xStart,
- required double yStart,
- required double xEnd,
- required double yEnd,
- SpatialReference? spatialReference}
Creates a line segment based on coordinates.
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.xEnd
— The X coordinate of end point.yEnd
— The Y coordinate of end point.spatialReference
— A spatial reference.
Implementation
factory LineSegment.fromXY(
{required double xStart,
required double yStart,
required double xEnd,
required double yEnd,
SpatialReference? spatialReference}) {
_initializeArcGISEnvironmentIfNeeded();
final handle = _withThrowingErrorHandler((errorHandler) {
return runtimecore.RT_LineSegment_createWithXYSpatialReference(
xStart,
yStart,
xEnd,
yEnd,
spatialReference?._handle ?? ffi.nullptr,
errorHandler);
});
final LineSegment object = LineSegment._withHandle(handle);
object._spatialReference.cache(spatialReference);
return object;
}