114 "Unhandled type: %d " 115 "(if you created a new type you need to handle it in this switch statement)",
143 KICAD_T type = static_cast<KICAD_T>( i );
145 auto item = std::unique_ptr<EDA_ITEM>( Instantiate( type ) );
147 if( item ==
nullptr )
152 IterateOverPositionsAndReferences<EDA_ITEM>(
154 [](
EDA_ITEM* aOriginalItem, wxPoint aRef )
156 auto item = std::unique_ptr<EDA_ITEM>( aOriginalItem->
Clone() );
157 wxPoint originalPos = item->GetPosition();
159 SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item.get() );
160 LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( item.get() );
165 if( schItem !=
nullptr )
167 schItem->
Move( aRef );
168 BOOST_CHECK_EQUAL( schItem->
GetPosition(), originalPos + aRef );
170 schItem->
Move( -aRef );
173 if( libItem !=
nullptr )
175 libItem->MoveTo( libItem->GetPosition() + aRef );
176 BOOST_CHECK_EQUAL( libItem->GetPosition(), originalPos + aRef );
178 libItem->MoveTo( libItem->GetPosition() - aRef );
181 CompareItems( item.get(), aOriginalItem );
192 KICAD_T type = static_cast<KICAD_T>( i );
194 auto item = std::unique_ptr<EDA_ITEM>( Instantiate( type ) );
196 if( item ==
nullptr )
203 if( item->GetClass() ==
"SCH_SHEET_PIN" )
205 auto newItem = std::unique_ptr<EDA_ITEM>( item->Clone() );
207 SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( newItem.get() );
208 LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( newItem.get() );
210 if( schItem !=
nullptr )
212 schItem->ClearFieldsAutoplaced();
214 schItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
215 schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
216 schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
217 schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
220 if( libItem !=
nullptr )
222 libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
223 libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
224 libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
225 libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
228 CompareItems( newItem.get(), item.get() );
232 IterateOverPositionsAndReferences<EDA_ITEM>(
234 [](
EDA_ITEM* aOriginalItem, wxPoint aRef )
236 auto item = std::unique_ptr<EDA_ITEM>( aOriginalItem->
Clone() );
238 SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item.get() );
239 LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( item.get() );
241 if( schItem !=
nullptr )
244 schItem->Rotate( aRef );
245 schItem->Rotate( aRef );
246 schItem->Rotate( aRef );
249 if( libItem !=
nullptr )
251 libItem->Rotate( aRef );
252 libItem->Rotate( aRef );
253 libItem->Rotate( aRef );
254 libItem->Rotate( aRef );
257 CompareItems( item.get(), aOriginalItem );
269 KICAD_T type = static_cast<KICAD_T>( i );
271 auto item = std::unique_ptr<EDA_ITEM>( Instantiate( type ) );
273 if( item ==
nullptr )
278 IterateOverPositionsAndReferences<EDA_ITEM>(
280 [](
EDA_ITEM* aOriginalItem, wxPoint aRef )
282 auto item = std::unique_ptr<EDA_ITEM>( aOriginalItem->
Clone() );
284 SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item.get() );
285 LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( item.get() );
289 if( schItem !=
nullptr )
291 schItem->ClearFieldsAutoplaced();
292 schItem->MirrorHorizontally( aRef.x );
293 schItem->MirrorHorizontally( aRef.x );
296 if( libItem !=
nullptr )
299 libItem->MirrorHorizontal( aRef );
302 CompareItems( item.get(), aOriginalItem );
313 KICAD_T type = static_cast<KICAD_T>( i );
315 auto item = std::unique_ptr<EDA_ITEM>( Instantiate( type ) );
317 if( item ==
nullptr )
322 IterateOverPositionsAndReferences<EDA_ITEM>(
324 [](
EDA_ITEM* aOriginalItem, wxPoint aRef )
326 auto item = std::unique_ptr<EDA_ITEM>( aOriginalItem->
Clone() );
328 SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item.get() );
329 LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( item.get() );
333 if( schItem !=
nullptr )
335 schItem->ClearFieldsAutoplaced();
336 schItem->MirrorVertically( aRef.y );
337 schItem->MirrorVertically( aRef.y );
340 if( libItem !=
nullptr )
343 libItem->MirrorVertical( aRef );
346 CompareItems( item.get(), aOriginalItem );
352 BOOST_AUTO_TEST_SUITE_END()
Class for a bus to bus entry.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
constexpr bool IsEeschemaType(const KICAD_T aType)
EDA_ITEM * Instantiate(KICAD_T aType)
BOOST_AUTO_TEST_CASE(Move)
Define a symbol library graphical text item.
Field object used in symbol libraries.
virtual void MirrorHorizontal(const wxPoint &aCenter)=0
Mirror the draw object along the horizontal (X) axis about aCenter point.
virtual wxPoint GetPosition() const
Define a library symbol object.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
The base class for drawable items used by schematic library symbols.
std::shared_ptr< ERC_ITEM > m_ercItem
virtual void Rotate(const wxPoint &aCenter, bool aRotateCCW=true)=0
Rotate the object about aCenter point.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
virtual void MirrorVertical(const wxPoint &aCenter)=0
Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.
#define BOOST_TEST_CONTEXT(A)
wxPoint GetPosition() const override
Object to handle a bitmap image that can be inserted in a schematic.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void SetSize(const wxSize &aSize)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Segment description base class to describe items which have 2 end points (track, wire,...
void SetPosition(const wxPoint &aPosition) override
A base class for most all the KiCad significant classes used in schematics and boards.
constexpr bool IsInstantiableType(const KICAD_T aType)
Class for a wire to bus entry.
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Conflicting drivers (labels, etc) on a subgraph.
static constexpr int Millimeter2iu(double mm)
Base class for any item which can be embedded within the SCHEMATIC container class,...
static void CompareItems(EDA_ITEM *aItem, EDA_ITEM *aOriginalItem)
virtual void Move(const wxPoint &aMoveVector)=0
Move the item by aMoveVector to a new position.