63 BOOST_CHECK_EQUAL( m_tree.empty(), true );
66 for(
auto item : m_tree )
68 static_cast<void>( item );
72 BOOST_CHECK_EQUAL( count, 0 );
77 for(
auto item : m_tree.OfType(
KICAD_T( type ) ) )
79 static_cast<void>( item );
83 BOOST_CHECK_EQUAL( count, 0 );
93 static_cast<void>( item );
97 BOOST_CHECK_EQUAL( count, 0 );
103 for(
int i = 0; i < 100; i++ )
106 new SCH_JUNCTION( wxPoint( Mils2iu( 100 ) * i, Mils2iu( 100 ) * i ) );
107 m_tree.insert( junction );
114 static_cast<void>( item );
118 BOOST_CHECK_EQUAL( count, 100 );
123 static_cast<void>( item );
127 BOOST_CHECK_EQUAL( count, 0 );
129 EDA_RECT small_bbox( wxPoint( -1, -1 ), wxSize( Mils2iu( 2 ), Mils2iu( 2 ) ) );
130 EDA_RECT med_bbox( wxPoint( 0, 0 ), wxSize( Mils2iu( 100 ), Mils2iu( 100 ) ) );
131 EDA_RECT big_bbox( wxPoint( 0, 0 ), wxSize( Mils2iu( 5000 ), Mils2iu( 5000 ) ) );
134 for(
auto item : m_tree.Overlapping( small_bbox ) )
140 BOOST_CHECK_EQUAL( count, 1 );
143 for(
auto item : m_tree.Overlapping(
SCH_JUNCTION_T, small_bbox ) )
149 BOOST_CHECK_EQUAL( count, 1 );
158 BOOST_CHECK_EQUAL( count, 0 );
161 for(
auto item : m_tree.Overlapping( med_bbox ) )
167 BOOST_CHECK_EQUAL( count, 2 );
170 for(
auto item : m_tree.Overlapping( big_bbox ) )
176 BOOST_CHECK_EQUAL( count, 51 );
184 for(
int i = 0; i < 100; i++ )
186 int x_sign = ( i % 2 == 0 ) ? -1 : 1;
187 int y_sign = ( i % 3 == 0 ) ? -1 : 1;
190 wxPoint( Mils2iu( 100 ) * i * x_sign, Mils2iu( 100 ) * i * y_sign ) );
191 m_tree.insert( junction );
194 wxPoint( Mils2iu( 150 ) * i * y_sign, Mils2iu( 150 ) * i * x_sign ) );
202 static_cast<void>( item );
206 BOOST_CHECK_EQUAL( count, 100 );
211 static_cast<void>( item );
215 BOOST_CHECK_EQUAL( count, 100 );
217 EDA_RECT small_bbox( wxPoint( -1, -1 ), wxSize( Mils2iu( 2 ), Mils2iu( 2 ) ) );
220 for(
auto item : m_tree.Overlapping( small_bbox ) )
226 BOOST_CHECK_EQUAL( count, 2 );
229 for(
auto item : m_tree.Overlapping(
SCH_JUNCTION_T, small_bbox ) )
235 BOOST_CHECK_EQUAL( count, 1 );
244 BOOST_CHECK_EQUAL( count, 1 );
255 m_tree.insert( junction );
264 static_cast<void>( item );
268 BOOST_CHECK_EQUAL( count, 1 );
273 static_cast<void>( item );
277 BOOST_CHECK_EQUAL( count, 1 );
283 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(Default)
Declare the test suite.
EE_RTREE - Implements an R-tree for fast spatial and type indexing of schematic items.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
BOOST_CHECK(v2.Cross(v1)==1)
Handle the component boundary box.
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Test utilities for timestamps.