103 for( iterator = common.holeyPolySet.IterateWithHoles(); iterator; iterator++ )
105 BOOST_CHECK_EQUAL( common.holeyPoints[vertexIndex], *iterator );
116 int segmentIndex = 0;
118 for( iterator = common.holeyPolySet.IterateSegmentsWithHoles(); iterator; iterator++ )
120 SEG segment = *iterator;
122 BOOST_CHECK_EQUAL( common.holeySegments[segmentIndex].A, segment.
A );
123 BOOST_CHECK_EQUAL( common.holeySegments[segmentIndex].B, segment.
B );
136 for( iterator = common.emptyPolySet.IterateSegmentsWithHoles(); iterator; iterator++ )
138 BOOST_FAIL(
"Empty set is being iterated!" );
148 iterator = common.uniqueVertexPolySet.IterateSegmentsWithHoles();
150 SEG segment = *iterator;
151 BOOST_CHECK_EQUAL( segment.
A, common.uniquePoints[0] );
152 BOOST_CHECK_EQUAL( segment.
B, common.uniquePoints[0] );
156 BOOST_CHECK( !iterator );
164 BOOST_CHECK_EQUAL( common.emptyPolySet.TotalVertices(), 0 );
165 BOOST_CHECK_EQUAL( common.uniqueVertexPolySet.TotalVertices(), 1 );
166 BOOST_CHECK_EQUAL( common.solidPolySet.TotalVertices(), 0 );
167 BOOST_CHECK_EQUAL( common.holeyPolySet.TotalVertices(), 12 );
175 SHAPE_POLY_SET polygonSets[3] = { lastNullSegmentPolySet, firstNullSegmentPolySet,
176 insideNullSegmentPolySet };
180 BOOST_CHECK_EQUAL( polygonSet.TotalVertices(), 4 );
181 BOOST_CHECK_EQUAL( polygonSet.RemoveNullSegments(), 1 );
182 BOOST_CHECK_EQUAL( polygonSet.TotalVertices(), 3 );
184 BOOST_CHECK_EQUAL( polygonSet.CVertex( 0 ), nullPoints[0] );
185 BOOST_CHECK_EQUAL( polygonSet.CVertex( 1 ), nullPoints[1] );
186 BOOST_CHECK_EQUAL( polygonSet.CVertex( 2 ), nullPoints[2] );
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
void Clear()
Remove all points from the line chain.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
Base class for iterating over all vertices in a given SHAPE_POLY_SET.
Base class for iterating over all segments in a given SHAPE_POLY_SET.
Represent a set of closed polygons.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index.
Fixture for the Iterator test suite.
SHAPE_POLY_SET insideNullSegmentPolySet
std::vector< VECTOR2I > nullPoints
SHAPE_POLY_SET lastNullSegmentPolySet
SHAPE_POLY_SET firstNullSegmentPolySet
struct KI_TEST::CommonTestData common
Common data for some of the SHAPE_POLY_SET tests:
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(VertexIterator)
Declares the IteratorFixture as the boost test suite fixture.