Assembly: Cognex.VisionPro.Core (in Cognex.VisionPro.Core.dll) Version: 75.0.0.0
Parameters
- nextSegment
- Type: Cognex.VisionPro CogGeneralContourSegmentIterator
The segment that follows the new segment. If this value is Nothing, the new segment is added at the end of the contour shape.
- startFlags
- Type: Cognex.VisionPro CogGeneralContourVertexConstants
Flags that specify how the start point is treated with respect to the other segments in the contour shape.
- startX
- Type: System Double
X-coordinate of the start point of the segment. Ignored if startFlags includes Connected.
- startY
- Type: System Double
Y-coordinate of the start point of the segment. Ignored if startFlags includes Connected.
- endFlags
- Type: Cognex.VisionPro CogGeneralContourVertexConstants
Flags that specify how the end point is treated with respect to the other segments in the contour shape.
- endX
- Type: System Double
X-coordinate of the end point of the segment. Ignored if endFlags includes Connected.
- endY
- Type: System Double
Y-coordinate of the end point of the segment. Ignored if endFlags includes Connected.
| Event Type | Reason |
|---|---|
| ICogChangedEvent Changed | Fires when the segment is added. The following state flags may be affected: |
| Exception | Condition |
|---|---|
| CogShapeAddWontBreakContourException | nextSegment is already connected at Start or nextSegment is closed at Start and endFlags indicates that the new segment should be connected there. |
| CogShapeBadContourSegConnException | nextSegment is the first segment and startFlags includes Connected or nextSegment is the end segment (or Nothing) and endFlags includes Connected. |
| ArgumentException | startFlags or endFlags include bits that are not defined in CogGeneralContourVertexConstants. |
| CogShapeCoordinatesMustDifferException | Points in the new segment are coincident. |
| CogIteratorInvalidIteratorException | nextSegment is not Nothing, not a valid iterator, and is not the end iterator. |
| CogShapeBadContourChainClosureException | endFlags include Closed but startFlags do not include Connected ; or startFlags include Closed but endFlags do not include Connected. This error may also occur if the startFlags and endFlags are set properly but closing the chain would create a contour that consists of two line segments. |
Adds a new line segment with the specified start and end points before nextSegment. The startFlags and endFlags specify how the end points of the line segment are connected to the rest of the contour shape. After adding the new line segment, all CogGeneralContourSegmentIterator positioned at or after nextSegment are updated so that they continue to refer to the same segment as before calling AddLineSegment(CogGeneralContourSegmentIterator, CogGeneralContourVertexConstants, Double, Double, CogGeneralContourVertexConstants, Double, Double).
If nextSegment is Nothing, the new segment is added at the end of the contour, so endFlags cannot include Connected. If nextSegment is the first segment, the new segment is added at the beginning of the contour, so startFlags cannot include Connected
If startFlags includes Connected, then startX and startY are ignored. Similarly, if endFlags includes Connected, then endX and endY are ignored.
Note: AddLineSegment(CogGeneralContourSegmentIterator, CogGeneralContourVertexConstants, Double, Double, CogGeneralContourVertexConstants, Double, Double) never breaks connections or closure, and it never modifies the coordinates of segments that exist before the call. In particular, this means that new segments cannot be added between two segments that are already connected.