67 m_text.SetParentGroup(
nullptr );
101 table->SetColCount( 2 );
103 for(
int ii = 0; ii < 4; ++ii )
108 table->InsertCell( ii, cell );
158 BOOST_FAIL( wxString::Format(
"Unhandled type: %d (if you created a new type you need to handle it in "
159 "this switch statement)",
185 auto item = std::unique_ptr<BOARD_ITEM>( Instantiate( type ) );
187 if( item ==
nullptr )
204 auto item = std::unique_ptr<BOARD_ITEM>( Instantiate( type ) );
206 if( item ==
nullptr )
216 if( PCB_DIMENSION_BASE* dimension = dynamic_cast<PCB_DIMENSION_BASE*>( aOriginalItem ) )
219 auto item = std::unique_ptr<BOARD_ITEM>( aOriginalItem->Duplicate( IGNORE_PARENT_GROUP ) );
220 VECTOR2I originalPos = item->GetPosition();
226 BOOST_CHECK_EQUAL( item->GetPosition(), originalPos + aRef );
229 CompareItems( item.get(), aOriginalItem );
242 auto item = std::unique_ptr<BOARD_ITEM>( Instantiate( type ) );
244 if( item ==
nullptr )
256 if( PCB_DIMENSION_BASE* dimension = dynamic_cast<PCB_DIMENSION_BASE*>( aOriginalItem ) )
258 else if( PCB_BARCODE* barcode = dynamic_cast<PCB_BARCODE*>( aOriginalItem ) )
259 barcode->AssembleBarcode();
261 auto item = std::unique_ptr<BOARD_ITEM>( aOriginalItem->Duplicate( IGNORE_PARENT_GROUP ) );
265 item->Rotate( aRef, EDA_ANGLE( 90.0, DEGREES_T ) );
266 item->Rotate( aRef, EDA_ANGLE( 90.0, DEGREES_T ) );
267 item->Rotate( aRef, EDA_ANGLE( 90.0, DEGREES_T ) );
268 item->Rotate( aRef, EDA_ANGLE( 90.0, DEGREES_T ) );
270 CompareItems( item.get(), aOriginalItem );
283 auto item = std::unique_ptr<BOARD_ITEM>( Instantiate( type ) );
285 if( item ==
nullptr )
295 if( PCB_DIMENSION_BASE* dimension = dynamic_cast<PCB_DIMENSION_BASE*>( aOriginalItem ) )
298 auto item = std::unique_ptr<BOARD_ITEM>( aOriginalItem->Duplicate( IGNORE_PARENT_GROUP ) );
302 item->Flip( aRef, FLIP_DIRECTION::LEFT_RIGHT );
303 item->Flip( aRef, FLIP_DIRECTION::LEFT_RIGHT );
305 CompareItems( item.get(), aOriginalItem );
318 auto item = std::unique_ptr<BOARD_ITEM>( Instantiate( type ) );
320 if( item ==
nullptr )
330 if( PCB_DIMENSION_BASE* dimension = dynamic_cast<PCB_DIMENSION_BASE*>( aOriginalItem ) )
333 auto item = std::unique_ptr<BOARD_ITEM>( aOriginalItem->Duplicate( IGNORE_PARENT_GROUP ) );
337 item->Flip( aRef, FLIP_DIRECTION::TOP_BOTTOM );
338 item->Flip( aRef, FLIP_DIRECTION::TOP_BOTTOM );
340 CompareItems( item.get(), aOriginalItem );
366 pad.SetLayerSet( smd_layers );
394 ZONE live( &m_board );
405 BOOST_CHECK(
image.GetParentGroup() == &
group );
407 image.SetParentGroup(
nullptr );
435 board.
Add( footprint );
438 footprint->
Pads().push_back(
pad );
441 const KIID padId =
pad->m_Uuid;
450 std::deque<PAD*>& pads = footprint->
Pads();
451 pads.erase( std::find( pads.begin(), pads.end(),
pad ) );
454 BOOST_CHECK( board.
ResolveItem( padId,
true ) ==
nullptr );
464 board.
Add( footprint );
467 footprint->
Pads().push_back(
pad );
469 BOOST_CHECK( !
pad->IsIndexedInBoard() );
472 BOOST_CHECK(
pad->IsIndexedInBoard() );
478 BOOST_CHECK( !
copy.IsIndexedInBoard() );
482 BOOST_CHECK( !
pad->IsIndexedInBoard() );
486 BOOST_CHECK(
pad->IsIndexedInBoard() );
489 BOOST_CHECK( !
pad->IsIndexedInBoard() );
495 BOOST_CHECK( !
pad->IsIndexedInBoard() );
512 BOOST_CHECK_NO_THROW(
delete track );
527 BOOST_CHECK_NO_THROW(
delete dummy );
constexpr EDA_IU_SCALE pcbIUScale
BASE_SET & set(size_t pos)
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
std::set< wxString > m_DrcExclusions
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SwapItemData(BOARD_ITEM *aImage)
Swap data between aItem and aImage.
bool IsIndexedInBoard() const
Information pertinent to a Pcbnew printed circuit board.
void CacheItemById(BOARD_ITEM *aItem) const
Add an item to the item-by-id cache.
void UncacheItemById(const KIID &aId) const
Remove an item from the item-by-id cache.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
void ClearItemByIdCache()
void RecordDRCExclusions()
Scan existing markers and record data from any that are Excluded.
void UncacheItemByPtr(const BOARD_ITEM *aItem)
Remove every cache entry that still points to aItem.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
BOARD_ITEM * CacheAndReturnItemById(const KIID &aId, BOARD_ITEM *aItem) const
bool IsItemIndexedById(const BOARD_ITEM *aItem) const
BOARD_ITEM * ResolveItem(const KIID &aID, bool aAllowNullptrReturn=false) const
constexpr coord_type GetLeft() const
constexpr coord_type GetRight() const
constexpr coord_type GetTop() const
constexpr coord_type GetBottom() const
virtual VECTOR2I GetPosition() const
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
virtual EDA_GROUP * GetParentGroup() const
virtual void SetParentGroup(EDA_GROUP *aGroup)
void SetRectangleHeight(const int &aHeight)
void SetRectangleWidth(const int &aWidth)
static ENUM_MAP< T > & Instance()
LSET is a set of PCB_LAYER_IDs.
void SetExcluded(bool aExcluded, const wxString &aComment=wxEmptyString)
@ CUSTOM
Shapes can be defined on arbitrary layers.
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
void AssembleBarcode() const
Assemble the barcode polygon and text polygons into a single polygonal representation.
void SetText(const wxString &aText)
Set the barcode content text to encode.
For better understanding of the points that make a dimension:
Mark the center of a circle or arc with a cross shape.
A leader is a dimension-like object pointing to a specific point.
An orthogonal dimension is like an aligned dimension, but the extension lines are locked to the X or ...
A radial dimension indicates either the radius or diameter of an arc or circle.
A set of BOARD_ITEMs (i.e., without duplicates).
A PCB_POINT is a 0-dimensional point that is used to mark a position on a PCB, or more usually a foot...
Object to handle a bitmap image that can be inserted in a PCB.
BOARD_ITEM * Instantiate(KICAD_T aType)
static void CompareItems(BOARD_ITEM *aItem, BOARD_ITEM *aOriginalItem)
TEST_BOARD_ITEM_FIXTURE()
~TEST_BOARD_ITEM_FIXTURE()
std::shared_ptr< DRC_ITEM > m_drcItem
Handle a list of polygons defining a copper zone.
bool AppendCorner(VECTOR2I aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
@ DRCE_MALFORMED_COURTYARD
static void IterateOverPositionsAndReferences(T *aItem, void(*aCallback)(T *, VECTOR2I))
@ TOP_BOTTOM
Flip top to bottom (around the X axis)
@ SMD
Smd pad, appears on the solder paste layer (default)
BARCODE class definition.
Class to handle a set of BOARD_ITEMs.
std::vector< FAB_LAYER_COLOR > dummy
@ USER
The field ID hasn't been set yet; field is invalid.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_CASE(Type)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST_CONTEXT("Test Clearance")
BOOST_CHECK_EQUAL(result, "25.4")
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_CONSTRAINT_T
class PCB_CONSTRAINT, a geometric constraint between board items
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
@ PCB_ITEM_LIST_T
class BOARD_ITEM_LIST, a list of board items
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
@ PCB_BARCODE_T
class PCB_BARCODE, a barcode (graphic item)
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_BOARD_OUTLINE_T
class PCB_BOARD_OUTLINE_T, a pcb board outline item
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
@ PCB_NETINFO_T
class NETINFO_ITEM, a description of a net
@ PCB_POINT_T
class PCB_POINT, a 0-dimensional point
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
constexpr bool IsPcbnewType(const KICAD_T aType)
constexpr bool IsInstantiableType(const KICAD_T aType)
#define CHECK_WX_ASSERT(STATEMENT)
A test macro to check a wxASSERT is thrown.
VECTOR2< int32_t > VECTOR2I