addSegment method

int addSegment(
  1. Segment segment
)

Add segment to the end of the part.

A new segment is added to the end. If the start point of the segment matches the previous end point, the segment shares this point. The count of points increases by 1 if the segment connects, or 2 points if it is disconnected. A more efficient way to add a LineSegment to a part is to use one of the point addition methods. For example MutablePart.addPointXY.

Parameters:

  • segment — The segment.

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

Implementation

int addSegment(
  Segment segment,
) {
  return _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_MutablePart_addSegment(
      _handle,
      segment._handle,
      errorHandler,
    );
  });
}