119 "Unhandled type: %d "
120 "(if you created a new type you need to handle it in this switch statement)",
150 auto item = std::unique_ptr<EDA_ITEM>( Instantiate( type ) );
152 if( item ==
nullptr )
157 IterateOverPositionsAndReferences<EDA_ITEM>(
161 auto item = std::unique_ptr<EDA_ITEM>( aOriginalItem->Clone() );
162 VECTOR2I originalPos = item->GetPosition();
164 SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item.get() );
165 LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( item.get() );
170 if( schItem != nullptr )
172 schItem->Move( aRef );
173 BOOST_CHECK_EQUAL( schItem->GetPosition(), originalPos + aRef );
175 schItem->Move( -aRef );
178 if( libItem !=
nullptr )
180 libItem->MoveTo( libItem->GetPosition() + aRef );
181 BOOST_CHECK_EQUAL( libItem->GetPosition(), originalPos + aRef );
183 libItem->MoveTo( libItem->GetPosition() - aRef );
186 CompareItems( item.get(), aOriginalItem );
199 auto item = std::unique_ptr<EDA_ITEM>( Instantiate( type ) );
201 if( item ==
nullptr )
209 if( item->GetClass() ==
"SCH_SHEET_PIN" )
211 auto newItem = std::unique_ptr<EDA_ITEM>( item->Clone() );
216 if( schItem !=
nullptr )
220 schItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
221 schItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
222 schItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
223 schItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
226 if( libItem !=
nullptr )
228 libItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
229 libItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
230 libItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
231 libItem->
Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
234 CompareItems( newItem.get(), item.get() );
238 IterateOverPositionsAndReferences<EDA_ITEM>(
242 auto item = std::unique_ptr<EDA_ITEM>( aOriginalItem->Clone() );
244 SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item.get() );
245 LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( item.get() );
247 if( schItem != nullptr )
249 schItem->ClearFieldsAutoplaced();
250 schItem->Rotate( aRef );
251 schItem->Rotate( aRef );
252 schItem->Rotate( aRef );
253 schItem->Rotate( aRef );
256 if( libItem !=
nullptr )
258 libItem->Rotate( aRef );
259 libItem->Rotate( aRef );
260 libItem->Rotate( aRef );
261 libItem->Rotate( aRef );
264 CompareItems( item.get(), aOriginalItem );
278 auto item = std::unique_ptr<EDA_ITEM>( Instantiate( type ) );
280 if( item ==
nullptr )
285 IterateOverPositionsAndReferences<EDA_ITEM>(
289 auto item = std::unique_ptr<EDA_ITEM>( aOriginalItem->Clone() );
291 SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item.get() );
292 LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( item.get() );
296 if( schItem != nullptr )
298 schItem->ClearFieldsAutoplaced();
299 schItem->MirrorHorizontally( aRef.x );
300 schItem->MirrorHorizontally( aRef.x );
303 if( libItem !=
nullptr )
305 libItem->MirrorHorizontal( aRef );
306 libItem->MirrorHorizontal( aRef );
309 CompareItems( item.get(), aOriginalItem );
322 auto item = std::unique_ptr<EDA_ITEM>( Instantiate( type ) );
324 if( item ==
nullptr )
329 IterateOverPositionsAndReferences<EDA_ITEM>(
333 auto item = std::unique_ptr<EDA_ITEM>( aOriginalItem->Clone() );
335 SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item.get() );
336 LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( item.get() );
341 if( schItem != nullptr )
343 schItem->ClearFieldsAutoplaced();
344 schItem->MirrorVertically( aRef.y );
345 schItem->MirrorVertically( aRef.y );
348 if( libItem !=
nullptr )
350 libItem->MirrorVertical( aRef );
351 libItem->MirrorVertical( aRef );
354 CompareItems( item.get(), aOriginalItem );
360BOOST_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.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
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)