117 BOOST_FAIL( wxString::Format(
118 "Unhandled type: %d "
119 "(if you created a new type you need to handle it in this switch statement)",
149 auto item = std::unique_ptr<EDA_ITEM>( Instantiate( type ) );
151 if( item ==
nullptr )
156 IterateOverPositionsAndReferences<EDA_ITEM>(
160 auto item = std::unique_ptr<EDA_ITEM>( aOriginalItem->Clone() );
161 VECTOR2I originalPos = item->GetPosition();
163 SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item.get() );
164 LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( item.get() );
169 if( schItem != nullptr )
171 schItem->Move( aRef );
172 BOOST_CHECK_EQUAL( schItem->GetPosition(), originalPos + aRef );
174 schItem->Move( -aRef );
177 if( libItem !=
nullptr )
179 libItem->MoveTo( libItem->GetPosition() + aRef );
180 BOOST_CHECK_EQUAL( libItem->GetPosition(), originalPos + aRef );
182 libItem->MoveTo( libItem->GetPosition() - aRef );
185 CompareItems( item.get(), aOriginalItem );
198 auto item = std::unique_ptr<EDA_ITEM>( Instantiate( type ) );
200 if( item ==
nullptr )
208 if( item->GetClass() ==
"SCH_SHEET_PIN" )
210 auto newItem = std::unique_ptr<EDA_ITEM>( item->Clone() );
215 if( schItem !=
nullptr )
219 schItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
220 schItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
221 schItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
222 schItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
225 if( libItem !=
nullptr )
227 libItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
228 libItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
229 libItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
230 libItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
233 CompareItems( newItem.get(), item.get() );
237 IterateOverPositionsAndReferences<EDA_ITEM>(
241 auto item = std::unique_ptr<EDA_ITEM>( aOriginalItem->Clone() );
243 SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item.get() );
244 LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( item.get() );
246 if( schItem != nullptr )
248 schItem->ClearFieldsAutoplaced();
249 schItem->Rotate( aRef );
250 schItem->Rotate( aRef );
251 schItem->Rotate( aRef );
252 schItem->Rotate( aRef );
255 if( libItem !=
nullptr )
257 libItem->Rotate( aRef );
258 libItem->Rotate( aRef );
259 libItem->Rotate( aRef );
260 libItem->Rotate( aRef );
263 CompareItems( item.get(), aOriginalItem );
277 auto item = std::unique_ptr<EDA_ITEM>( Instantiate( type ) );
279 if( item ==
nullptr )
284 IterateOverPositionsAndReferences<EDA_ITEM>(
288 auto item = std::unique_ptr<EDA_ITEM>( aOriginalItem->Clone() );
290 SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item.get() );
291 LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( item.get() );
295 if( schItem != nullptr )
297 schItem->ClearFieldsAutoplaced();
298 schItem->MirrorHorizontally( aRef.x );
299 schItem->MirrorHorizontally( aRef.x );
302 if( libItem !=
nullptr )
304 libItem->MirrorHorizontal( aRef );
305 libItem->MirrorHorizontal( aRef );
308 CompareItems( item.get(), aOriginalItem );
321 auto item = std::unique_ptr<EDA_ITEM>( Instantiate( type ) );
323 if( item ==
nullptr )
328 IterateOverPositionsAndReferences<EDA_ITEM>(
332 auto item = std::unique_ptr<EDA_ITEM>( aOriginalItem->Clone() );
334 SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item.get() );
335 LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( item.get() );
340 if( schItem != nullptr )
342 schItem->ClearFieldsAutoplaced();
343 schItem->MirrorVertically( aRef.y );
344 schItem->MirrorVertically( aRef.y );
347 if( libItem !=
nullptr )
349 libItem->MirrorVertical( aRef );
350 libItem->MirrorVertical( aRef );
353 CompareItems( item.get(), aOriginalItem );
359BOOST_AUTO_TEST_SUITE_END()
constexpr EDA_IU_SCALE schIUScale
coord_type GetTop() const
coord_type GetRight() const
coord_type GetLeft() const
coord_type GetBottom() const
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Field object used in symbol libraries.
The base class for drawable items used by schematic library symbols.
virtual void Rotate(const VECTOR2I &aCenter, bool aRotateCCW=true)=0
Rotate the object about aCenter point.
Define a library symbol object.
Define a symbol library graphical text item.
Object to handle a bitmap image that can be inserted in a schematic.
Class for a bus to bus entry.
Class for a wire to bus entry.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Base class for any item which can be embedded within the SCHEMATIC container class,...
void ClearFieldsAutoplaced()
virtual void Rotate(const VECTOR2I &aCenter)=0
Rotate the item around aCenter 90 degrees in the clockwise direction.
Segment description base class to describe items which have 2 end points (track, wire,...
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void SetSize(const VECTOR2I &aSize)
void SetPosition(const VECTOR2I &aPosition) override
VECTOR2I GetPosition() const override
EDA_ITEM * Instantiate(KICAD_T aType)
static void CompareItems(EDA_ITEM *aItem, EDA_ITEM *aOriginalItem)
std::shared_ptr< ERC_ITEM > m_ercItem
@ ERCE_DRIVER_CONFLICT
Conflicting drivers (labels, etc) on a subgraph.
constexpr int mmToIU(double mm) const
BOOST_AUTO_TEST_CASE(Move)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
constexpr bool IsInstantiableType(const KICAD_T aType)
constexpr bool IsEeschemaType(const KICAD_T aType)
#define BOOST_TEST_CONTEXT(A)