KiCad PCB EDA Suite
TEST_BOARD_ITEM_FIXTURE Class Reference

Public Member Functions

 TEST_BOARD_ITEM_FIXTURE ()
 
BOARD_ITEMInstantiate (KICAD_T aType)
 

Static Public Member Functions

static void CompareItems (BOARD_ITEM *aItem, BOARD_ITEM *aOriginalItem)
 

Public Attributes

BOARD m_board
 
FOOTPRINT m_footprint
 
std::shared_ptr< DRC_ITEMm_drcItem
 
PCB_TEXT m_text
 

Detailed Description

Definition at line 49 of file test_board_item.cpp.

Constructor & Destructor Documentation

◆ TEST_BOARD_ITEM_FIXTURE()

TEST_BOARD_ITEM_FIXTURE::TEST_BOARD_ITEM_FIXTURE ( )
inline

Definition at line 57 of file test_board_item.cpp.

57 :
58 m_board(),
61 m_text( &m_board )
62 {
63 }
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:324
std::shared_ptr< DRC_ITEM > m_drcItem
@ DRCE_MALFORMED_COURTYARD
Definition: drc_item.h:63

Member Function Documentation

◆ CompareItems()

static void TEST_BOARD_ITEM_FIXTURE::CompareItems ( BOARD_ITEM aItem,
BOARD_ITEM aOriginalItem 
)
inlinestatic

Definition at line 146 of file test_board_item.cpp.

147 {
148 BOOST_CHECK_EQUAL( aItem->GetPosition(), aOriginalItem->GetPosition() );
149 BOOST_CHECK_EQUAL( aItem->GetBoundingBox().GetTop(),
150 aOriginalItem->GetBoundingBox().GetTop() );
151 BOOST_CHECK_EQUAL( aItem->GetBoundingBox().GetLeft(),
152 aOriginalItem->GetBoundingBox().GetLeft() );
153 BOOST_CHECK_EQUAL( aItem->GetBoundingBox().GetBottom(),
154 aOriginalItem->GetBoundingBox().GetBottom() );
155 BOOST_CHECK_EQUAL( aItem->GetBoundingBox().GetRight(),
156 aOriginalItem->GetBoundingBox().GetRight() );
157 }
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:262
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:75
int GetLeft() const
Definition: eda_rect.h:126
int GetTop() const
Definition: eda_rect.h:127
int GetRight() const
Definition: eda_rect.h:125
int GetBottom() const
Definition: eda_rect.h:128

References EDA_RECT::GetBottom(), EDA_ITEM::GetBoundingBox(), EDA_RECT::GetLeft(), EDA_ITEM::GetPosition(), EDA_RECT::GetRight(), and EDA_RECT::GetTop().

◆ Instantiate()

BOARD_ITEM * TEST_BOARD_ITEM_FIXTURE::Instantiate ( KICAD_T  aType)
inline

Definition at line 65 of file test_board_item.cpp.

66 {
67 if( !IsPcbnewType( aType ) )
68 return nullptr;
69
70 if( !IsInstantiableType( aType ) )
71 return nullptr;
72
73 switch( aType )
74 {
75 case PCB_FOOTPRINT_T: return new FOOTPRINT( &m_board );
76 case PCB_PAD_T: return new PAD( &m_footprint );
77 case PCB_SHAPE_T: return new PCB_SHAPE( &m_board );
78 case PCB_TEXT_T: return new PCB_TEXT( &m_board );
79 case PCB_TEXTBOX_T: return new PCB_TEXTBOX( &m_board );
80 case PCB_BITMAP_T: return new PCB_BITMAP( &m_board );
81 case PCB_FP_TEXT_T: return new FP_TEXT( &m_footprint );
82 case PCB_FP_TEXTBOX_T: return new FP_TEXTBOX( &m_footprint );
83 case PCB_FP_SHAPE_T: return new FP_SHAPE( &m_footprint );
85 case PCB_FP_DIM_LEADER_T: return new PCB_DIM_LEADER( &m_footprint, true );
86 case PCB_FP_DIM_CENTER_T: return new PCB_DIM_CENTER( &m_footprint, true );
87 case PCB_FP_DIM_RADIAL_T: return new PCB_DIM_RADIAL( &m_footprint, true );
89 case PCB_FP_ZONE_T:
90 {
91 FP_ZONE* fpZone = new FP_ZONE( &m_footprint );
92
93 fpZone->AppendCorner( wxPoint( Millimeter2iu( -100 ), Millimeter2iu( -50 ) ), -1 );
94 fpZone->AppendCorner( wxPoint( Millimeter2iu( -100 ), Millimeter2iu( 50 ) ), -1 );
95 fpZone->AppendCorner( wxPoint( Millimeter2iu( 100 ), Millimeter2iu( 50 ) ), -1 );
96 fpZone->AppendCorner( wxPoint( Millimeter2iu( 100 ), Millimeter2iu( -50 ) ), -1 );
97
98 return fpZone;
99 }
100
101 case PCB_TRACE_T: return new PCB_TRACK( &m_board );
102 case PCB_VIA_T: return new PCB_VIA( &m_board );
103 case PCB_ARC_T: return new PCB_ARC( &m_board );
104 case PCB_MARKER_T: return new PCB_MARKER( m_drcItem, wxPoint( 0, 0 ) );
106 case PCB_DIM_LEADER_T: return new PCB_DIM_LEADER( &m_board );
107 case PCB_DIM_CENTER_T: return new PCB_DIM_CENTER( &m_board );
108 case PCB_DIM_RADIAL_T: return new PCB_DIM_RADIAL( &m_board );
110 case PCB_TARGET_T: return new PCB_TARGET( &m_board );
111 case PCB_ZONE_T:
112 {
113 ZONE* zone = new ZONE( &m_board );
114
115 zone->AppendCorner( wxPoint( Millimeter2iu( -100 ), Millimeter2iu( -50 ) ), -1 );
116 zone->AppendCorner( wxPoint( Millimeter2iu( -100 ), Millimeter2iu( 50 ) ), -1 );
117 zone->AppendCorner( wxPoint( Millimeter2iu( 100 ), Millimeter2iu( 50 ) ), -1 );
118 zone->AppendCorner( wxPoint( Millimeter2iu( 100 ), Millimeter2iu( -50 ) ), -1 );
119
120 return zone;
121 }
122 case PCB_GROUP_T:
123 {
124 PCB_GROUP* group = new PCB_GROUP( &m_board );
125
126 // Group position only makes sense if there's at least one item in the group.
127 group->AddItem( &m_text );
128
129 return group;
130 }
131
132 case PCB_T:
133 case PCB_ITEM_LIST_T:
134 case PCB_NETINFO_T:
135 return nullptr;
136
137 default:
138 BOOST_FAIL( wxString::Format(
139 "Unhandled type: %d "
140 "(if you created a new type you need to handle it in this switch statement)",
141 aType ) );
142 return nullptr;
143 }
144 }
A specialization of ZONE for use in footprints.
Definition: zone.h:920
Object to handle a bitmap image that can be inserted in a PCB.
Definition: pcb_bitmap.h:42
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).
Definition: pcb_group.h:51
Handle a list of polygons defining a copper zone.
Definition: zone.h:58
bool AppendCorner(VECTOR2I aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
Definition: zone.cpp:705
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
static constexpr int Millimeter2iu(double mm)
@ PCB_FP_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:97
@ PCB_T
Definition: typeinfo.h:84
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:112
@ PCB_FP_SHAPE_T
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:96
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:109
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:104
@ PCB_FP_TEXTBOX_T
class FP_TEXTBOX, wrapped text in a footprint
Definition: typeinfo.h:95
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:110
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:117
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition: typeinfo.h:93
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:114
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition: typeinfo.h:92
@ PCB_FP_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:99
@ PCB_ITEM_LIST_T
class BOARD_ITEM_LIST, a list of board items
Definition: typeinfo.h:115
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
Definition: typeinfo.h:106
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:113
@ PCB_FP_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:101
@ PCB_FP_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:98
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:108
@ PCB_FP_ZONE_T
class ZONE, managed by a footprint
Definition: typeinfo.h:102
@ PCB_BITMAP_T
class PCB_BITMAP, bitmap on a layer
Definition: typeinfo.h:91
@ PCB_FP_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:100
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:89
@ PCB_FP_TEXT_T
class FP_TEXT, text in a footprint
Definition: typeinfo.h:94
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:105
@ PCB_NETINFO_T
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:116
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:103
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:111
constexpr bool IsPcbnewType(const KICAD_T aType)
Definition: typeinfo.h:401
constexpr bool IsInstantiableType(const KICAD_T aType)
Definition: typeinfo.h:295

References ZONE::AppendCorner(), Format(), group, IsInstantiableType(), IsPcbnewType(), m_board, m_drcItem, m_footprint, m_text, Millimeter2iu(), PAD, PCB_ARC_T, PCB_BITMAP_T, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_DIM_RADIAL_T, PCB_FOOTPRINT_T, PCB_FP_DIM_ALIGNED_T, PCB_FP_DIM_CENTER_T, PCB_FP_DIM_LEADER_T, PCB_FP_DIM_ORTHOGONAL_T, PCB_FP_DIM_RADIAL_T, PCB_FP_SHAPE_T, PCB_FP_TEXT_T, PCB_FP_TEXTBOX_T, PCB_FP_ZONE_T, PCB_GROUP_T, PCB_ITEM_LIST_T, PCB_MARKER_T, PCB_NETINFO_T, PCB_PAD_T, PCB_SHAPE_T, PCB_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TEXTBOX_T, PCB_TRACE_T, PCB_VIA_T, and PCB_ZONE_T.

Member Data Documentation

◆ m_board

BOARD TEST_BOARD_ITEM_FIXTURE::m_board

Definition at line 52 of file test_board_item.cpp.

Referenced by Instantiate().

◆ m_drcItem

std::shared_ptr<DRC_ITEM> TEST_BOARD_ITEM_FIXTURE::m_drcItem

Definition at line 54 of file test_board_item.cpp.

Referenced by Instantiate().

◆ m_footprint

FOOTPRINT TEST_BOARD_ITEM_FIXTURE::m_footprint

Definition at line 53 of file test_board_item.cpp.

Referenced by Instantiate().

◆ m_text

PCB_TEXT TEST_BOARD_ITEM_FIXTURE::m_text

Definition at line 55 of file test_board_item.cpp.

Referenced by Instantiate().


The documentation for this class was generated from the following file: