addPointXY method

int addPointXY({
  1. required double x,
  2. required double y,
})

Add a new point to the end of the part by specifying the points x,y coordinates. A new line segment is added to connect the new point to the previous.

The points in the part are the start and end points of segments. A new line segment is added to connect the new point to the previous point. If this is the first point in an empty segment, a single closed segment is added using the same start and end point. Adding a second point updates this line segment to gain a distinct end point. Adding subsequent points adds new line segments.

Parameters:

  • x — The x-coordinate of the new point.
  • y — The y-coordinate of the new point.

Return Value: the point index where the point was added. If an error occurred, then -1 is returned.

Implementation

int addPointXY({
  required double x,
  required double y,
}) {
  return _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_MutablePart_addPointXY(
      _handle,
      x,
      y,
      errorHandler,
    );
  });
}