KiCad PCB EDA Suite
PCAD2KICAD::PCB_FOOTPRINT Class Reference

#include <pcb_footprint.h>

Inheritance diagram for PCAD2KICAD::PCB_FOOTPRINT:
PCAD2KICAD::PCB_COMPONENT PCAD2KICAD::PCB

Public Member Functions

 PCB_FOOTPRINT (PCB_CALLBACKS *aCallbacks, BOARD *aBoard)
 
 ~PCB_FOOTPRINT ()
 
XNODEFindModulePatternDefName (XNODE *aNode, const wxString &aName)
 
void DoLayerContentsObjects (XNODE *aNode, PCB_FOOTPRINT *aFootprint, PCB_COMPONENTS_ARRAY *aList, wxStatusBar *aStatusBar, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
 
void SetName (const wxString &aPin, const wxString &aName)
 
virtual void Parse (XNODE *aNode, wxStatusBar *aStatusBar, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
 
virtual void Flip () override
 
void AddToBoard () override
 
virtual void SetPosOffset (int aX_offs, int aY_offs)
 
virtual void AddToFootprint (FOOTPRINT *aFootprint)
 
PCB_LAYER_ID GetKiCadLayer () const
 
int GetNetCode (const wxString &aNetName) const
 

Public Attributes

TTEXTVALUE m_Value
 
PCB_COMPONENTS_ARRAY m_FootprintItems
 
int m_Mirror
 
VERTICES_ARRAY m_BoardOutline
 
int m_tag
 
char m_objType
 
int m_PCadLayer
 
PCB_LAYER_ID m_KiCadLayer
 
KIID m_uuid
 
int m_positionX
 
int m_positionY
 
EDA_ANGLE m_rotation
 
TTEXTVALUE m_name
 
wxString m_net
 
int m_netCode
 
wxString m_compRef
 
wxString m_patGraphRefName
 

Protected Attributes

PCB_CALLBACKSm_callbacks
 
BOARDm_board
 

Private Member Functions

XNODEFindPatternMultilayerSection (XNODE *aNode, wxString *aPatGraphRefName)
 

Detailed Description

Definition at line 41 of file pcb_footprint.h.

Constructor & Destructor Documentation

◆ PCB_FOOTPRINT()

PCAD2KICAD::PCB_FOOTPRINT::PCB_FOOTPRINT ( PCB_CALLBACKS aCallbacks,
BOARD aBoard 
)

Definition at line 47 of file pcb_footprint.cpp.

47 :
48 PCB_COMPONENT( aCallbacks, aBoard )
49{
51 m_Mirror = 0;
52 m_objType = wxT( 'M' ); // FOOTPRINT
53 m_KiCadLayer = F_SilkS; // default
54}
PCB_COMPONENT(PCB_CALLBACKS *aCallbacks, BOARD *aBoard)
@ F_SilkS
Definition: layer_ids.h:104
void InitTTextValue(TTEXTVALUE *aTextValue)

References F_SilkS, PCAD2KICAD::InitTTextValue(), PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, m_Mirror, PCAD2KICAD::PCB_COMPONENT::m_objType, and m_Value.

Referenced by PCAD2KICAD::PCB::DoPCBComponents(), and PCAD2KICAD::PCB::ParseBoard().

◆ ~PCB_FOOTPRINT()

PCAD2KICAD::PCB_FOOTPRINT::~PCB_FOOTPRINT ( )

Definition at line 57 of file pcb_footprint.cpp.

58{
59 int i;
60
61 for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
62 {
63 delete m_FootprintItems[i];
64 }
65}
PCB_COMPONENTS_ARRAY m_FootprintItems
Definition: pcb_footprint.h:64

References m_FootprintItems.

Member Function Documentation

◆ AddToBoard()

void PCAD2KICAD::PCB_FOOTPRINT::AddToBoard ( )
overridevirtual

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 477 of file pcb_footprint.cpp.

478{
479 int i;
480 EDA_ANGLE r;
481
482 // transform text positions
485
488
489 FOOTPRINT* footprint = new FOOTPRINT( m_board );
490 m_board->Add( footprint, ADD_MODE::APPEND );
491
493 footprint->SetLayer( m_Mirror ? B_Cu : F_Cu );
494 footprint->SetOrientation( m_rotation );
495
496 LIB_ID fpID;
497 fpID.Parse( m_compRef, true );
498 footprint->SetFPID( fpID );
499
500 // reference text
501 FP_TEXT* ref_text = &footprint->Reference();
502
503 ref_text->SetText( ValidateReference( m_name.text ) );
505
507
508 if( m_name.isTrueType )
510 else
512
514 ref_text->SetTextAngle( r );
515 ref_text->SetKeepUpright( false );
516
517 ref_text->SetItalic( m_name.isItalic );
519
520 ref_text->SetMirrored( m_name.mirror );
521 ref_text->SetVisible( m_name.textIsVisible );
522
524
525 // Calculate the actual position.
526 ref_text->SetDrawCoord();
527
528 // value text
529 FP_TEXT* val_text = &footprint->Value();
530
531 val_text->SetText( m_Value.text );
532 val_text->SetType( FP_TEXT::TEXT_is_VALUE );
533
535
536 if( m_Value.isTrueType )
538 else
540
542 val_text->SetTextAngle( r );
543 val_text->SetKeepUpright( false );
544
545 val_text->SetItalic( m_Value.isItalic );
547
548 val_text->SetMirrored( m_Value.mirror );
549 val_text->SetVisible( m_Value.textIsVisible );
550
552
553 // Calculate the actual position.
554 val_text->SetDrawCoord();
555
556 // TEXTS
557 for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
558 {
559 if( m_FootprintItems[i]->m_objType == wxT( 'T' ) )
560 {
561 ( (PCB_TEXT*) m_FootprintItems[i] )->m_tag = i + 2;
562 m_FootprintItems[ i ]->AddToFootprint( footprint );
563 }
564 }
565
566 // FOOTPRINT LINES
567 for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
568 {
569 if( m_FootprintItems[i]->m_objType == wxT( 'L' ) )
570 m_FootprintItems[ i ]->AddToFootprint( footprint );
571 }
572
573 // FOOTPRINT ARCS
574 for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
575 {
576 if( m_FootprintItems[i]->m_objType == wxT( 'A' ) )
577 m_FootprintItems[ i ]->AddToFootprint( footprint );
578 }
579
580 // FOOTPRINT POLYGONS
581 for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
582 {
583 if( m_FootprintItems[i]->m_objType == wxT( 'Z' ) )
584 m_FootprintItems[ i ]->AddToFootprint( footprint );
585 }
586
587 // PADS
588 for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
589 {
590 if( m_FootprintItems[i]->m_objType == wxT( 'P' ) )
591 ((PCB_PAD*) m_FootprintItems[ i ] )->AddToFootprint( footprint, m_rotation, false );
592 }
593
594 // VIAS
595 for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
596 {
597 if( m_FootprintItems[i]->m_objType == wxT( 'V' ) )
598 ((PCB_VIA*) m_FootprintItems[ i ] )->AddToFootprint( footprint, m_rotation, false );
599 }
600}
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:226
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:772
void SetMirrored(bool isMirrored)
Definition: eda_text.cpp:226
virtual void SetVisible(bool aVisible)
Definition: eda_text.cpp:219
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.cpp:187
void SetKeepUpright(bool aKeepUpright)
Definition: eda_text.cpp:258
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:165
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:195
void SetItalic(bool aItalic)
Definition: eda_text.cpp:203
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:1688
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:213
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:1820
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:567
FP_TEXT & Reference()
Definition: footprint.h:568
void SetType(TEXT_TYPE aType)
Definition: fp_text.h:119
void SetDrawCoord()
Set relative coordinates.
Definition: fp_text.cpp:203
@ TEXT_is_REFERENCE
Definition: fp_text.h:49
@ TEXT_is_VALUE
Definition: fp_text.h:50
void SetPos0(const VECTOR2I &aPos)
Definition: fp_text.h:123
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:50
virtual void AddToFootprint(FOOTPRINT *aFootprint)
@ B_Cu
Definition: layer_ids.h:95
@ F_Cu
Definition: layer_ids.h:64
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition: lset.cpp:544
wxString ValidateReference(const wxString &aRef)
void SetTextSizeFromStrokeFontHeight(EDA_TEXT *aText, int aTextHeight)
void CorrectTextPosition(TTEXTVALUE *aValue)
void SetTextSizeFromTrueTypeFontHeight(EDA_TEXT *aText, int aTextHeight)
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590

References BOARD::Add(), PCAD2KICAD::PCB_COMPONENT::AddToFootprint(), APPEND, B_Cu, PCAD2KICAD::TTEXTVALUE::correctedPositionX, PCAD2KICAD::TTEXTVALUE::correctedPositionY, PCAD2KICAD::CorrectTextPosition(), F_Cu, FlipLayer(), PCAD2KICAD::TTEXTVALUE::isItalic, PCAD2KICAD::TTEXTVALUE::isTrueType, PCAD2KICAD::PCB_COMPONENT::m_board, PCAD2KICAD::PCB_COMPONENT::m_compRef, m_FootprintItems, PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, m_Mirror, PCAD2KICAD::PCB_COMPONENT::m_name, PCAD2KICAD::PCB_COMPONENT::m_objType, PCAD2KICAD::PCB_COMPONENT::m_positionX, PCAD2KICAD::PCB_COMPONENT::m_positionY, PCAD2KICAD::PCB_COMPONENT::m_rotation, m_Value, PCAD2KICAD::TTEXTVALUE::mirror, LIB_ID::Parse(), FOOTPRINT::Reference(), RotatePoint(), FP_TEXT::SetDrawCoord(), FOOTPRINT::SetFPID(), EDA_TEXT::SetItalic(), EDA_TEXT::SetKeepUpright(), BOARD_ITEM::SetLayer(), EDA_TEXT::SetMirrored(), FOOTPRINT::SetOrientation(), FP_TEXT::SetPos0(), FOOTPRINT::SetPosition(), EDA_TEXT::SetText(), EDA_TEXT::SetTextAngle(), PCAD2KICAD::SetTextSizeFromStrokeFontHeight(), PCAD2KICAD::SetTextSizeFromTrueTypeFontHeight(), EDA_TEXT::SetTextThickness(), FP_TEXT::SetType(), EDA_TEXT::SetVisible(), PCAD2KICAD::TTEXTVALUE::text, FP_TEXT::TEXT_is_REFERENCE, FP_TEXT::TEXT_is_VALUE, PCAD2KICAD::TTEXTVALUE::textHeight, PCAD2KICAD::TTEXTVALUE::textIsVisible, PCAD2KICAD::TTEXTVALUE::textRotation, PCAD2KICAD::TTEXTVALUE::textstrokeWidth, PCAD2KICAD::ValidateReference(), and FOOTPRINT::Value().

◆ AddToFootprint()

void PCAD2KICAD::PCB_COMPONENT::AddToFootprint ( FOOTPRINT aFootprint)
virtualinherited

◆ DoLayerContentsObjects()

void PCAD2KICAD::PCB_FOOTPRINT::DoLayerContentsObjects ( XNODE aNode,
PCB_FOOTPRINT aFootprint,
PCB_COMPONENTS_ARRAY *  aList,
wxStatusBar *  aStatusBar,
const wxString &  aDefaultMeasurementUnit,
const wxString &  aActualConversion 
)

Definition at line 217 of file pcb_footprint.cpp.

221{
222 PCB_ARC* arc;
223 PCB_POLYGON* polygon;
224 PCB_POLYGON *plane_layer = nullptr;
225 PCB_COPPER_POUR* copperPour;
226 PCB_CUTOUT* cutout;
227 PCB_PLANE* plane;
228 VERTICES_ARRAY* plane_layer_polygon;
229 PCB_LINE* line;
230 PCB_TEXT* text;
231 XNODE* lNode, * tNode;
232 wxString propValue;
233 long long i;
234 int PCadLayer;
235 long num = 0;
236
237 i = 0;
238
239 // aStatusBar->SetStatusText( wxT( "Processing LAYER CONTENT OBJECTS " ) );
240 if( FindNode( aNode, wxT( "layerNumRef" ) ) )
241 FindNode( aNode, wxT( "layerNumRef" ) )->GetNodeContent().ToLong( &num );
242
243 PCadLayer = (int) num;
244
245 if( m_callbacks->GetLayerType( PCadLayer ) == LAYER_TYPE_PLANE )
246 {
247 plane_layer = new PCB_POLYGON( m_callbacks, m_board, PCadLayer );
248 plane_layer->AssignNet( m_callbacks->GetLayerNetNameRef( PCadLayer ) );
249 plane_layer->SetOutline( &m_BoardOutline );
250 aList->Add( plane_layer );
251
252 // fill the polygon with the same contour as its outline is
253 //plane_layer->AddIsland( &m_boardOutline );
254 }
255
256 lNode = aNode->GetChildren();
257
258 while( lNode )
259 {
260 i++;
261 // aStatusBar->SetStatusText( wxString::Format( "Processing LAYER CONTENT OBJECTS :%lld",
262 // i ) );
263
264 if( lNode->GetName() == wxT( "line" ) )
265 {
266 line = new PCB_LINE( m_callbacks, m_board );
267 line->Parse( lNode, PCadLayer, aDefaultMeasurementUnit, aActualConversion );
268 aList->Add( line );
269 }
270
271 if( lNode->GetName() == wxT( "text" ) )
272 {
274 text->Parse( lNode, PCadLayer, aDefaultMeasurementUnit, aActualConversion );
275 aList->Add( text );
276 }
277
278 // added as Sergeys request 02/2008
279 if( lNode->GetName() == wxT( "attr" ) )
280 {
281 // assign fonts to Module Name,Value,Type,....s
282 lNode->GetAttribute( wxT( "Name" ), &propValue );
283 propValue.Trim( false );
284 propValue.Trim( true );
285
286 if( propValue == wxT( "RefDes" ) )
287 {
288 tNode = FindNode( lNode, wxT( "textStyleRef" ) );
289
290 if( tNode && aFootprint )
291 {
292 // TODO: to understand and may be repair
293 // Alexander Lunev: originally in Delphi version of the project there was
294 // a strange access to pcbModule->m_name (it was global variable). This access
295 // is necessary when the function DoLayerContentsObjects() is called from
296 // function CreatePCBModule(). However it is not clear whether the access is
297 // required when the function DoLayerContentsObjects() is called from
298 // function ProcessXMLtoPCBLib().
299 SetFontProperty( tNode, &aFootprint->m_name, aDefaultMeasurementUnit,
300 aActualConversion );
301 }
302 }
303 }
304
305 // added as Sergeys request 02/2008
306 if( lNode->GetName() == wxT( "arc" ) || lNode->GetName() == wxT( "triplePointArc" ) )
307 {
308 arc = new PCB_ARC( m_callbacks, m_board );
309 arc->Parse( lNode, PCadLayer, aDefaultMeasurementUnit, aActualConversion );
310 aList->Add( arc );
311 }
312
313 if( lNode->GetName() == wxT( "pcbPoly" ) )
314 {
315 if( m_callbacks->GetLayerType( PCadLayer ) == LAYER_TYPE_PLANE )
316 {
317 plane_layer_polygon = new VERTICES_ARRAY;
318 plane_layer->FormPolygon( lNode, plane_layer_polygon, aDefaultMeasurementUnit,
319 aActualConversion );
320 plane_layer->m_cutouts.Add( plane_layer_polygon );
321 }
322 else
323 {
324 polygon = new PCB_POLYGON( m_callbacks, m_board, PCadLayer );
325
326 if( polygon->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
327 aList->Add( polygon );
328 else
329 delete polygon;
330 }
331 }
332
333 if( lNode->GetName() == wxT( "copperPour95" ) )
334 {
335 copperPour = new PCB_COPPER_POUR( m_callbacks, m_board, PCadLayer );
336
337 if( copperPour->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
338 aList->Add( copperPour );
339 else
340 delete copperPour;
341 }
342
343 if( lNode->GetName() == wxT( "polyCutOut" ) )
344 {
345 cutout = new PCB_CUTOUT( m_callbacks, m_board, PCadLayer );
346
347 if( cutout->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
348 aList->Add( cutout );
349 else
350 delete cutout;
351 }
352
353 if( lNode->GetName() == wxT( "planeObj" ) )
354 {
355 plane = new PCB_PLANE( m_callbacks, m_board, PCadLayer );
356
357 if( plane->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
358 aList->Add( plane );
359 else
360 delete plane;
361 }
362
363 lNode = lNode->GetNext();
364 }
365}
virtual LAYER_TYPE_T GetLayerType(int aPCadLayer) const =0
virtual wxString GetLayerNetNameRef(int aPCadLayer) const =0
PCB_CALLBACKS * m_callbacks
Definition: pcb_component.h:78
VERTICES_ARRAY m_BoardOutline
Definition: pcb_footprint.h:66
Hold an XML or S-expression element.
Definition: xnode.h:44
XNODE * GetChildren() const
Definition: xnode.h:62
XNODE * GetNext() const
Definition: xnode.h:67
XNODE * FindNode(XNODE *aChild, const wxString &aTag)
void SetFontProperty(XNODE *aNode, TTEXTVALUE *aTextValue, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
@ LAYER_TYPE_PLANE
Definition: pcb_callbacks.h:41

References PCAD2KICAD::PCB_POLYGON::AssignNet(), PCAD2KICAD::FindNode(), PCAD2KICAD::PCB_POLYGON::FormPolygon(), XNODE::GetChildren(), PCAD2KICAD::PCB_CALLBACKS::GetLayerNetNameRef(), PCAD2KICAD::PCB_CALLBACKS::GetLayerType(), XNODE::GetNext(), LAYER_TYPE_PLANE, PCAD2KICAD::PCB_COMPONENT::m_board, m_BoardOutline, PCAD2KICAD::PCB_COMPONENT::m_callbacks, PCAD2KICAD::PCB_POLYGON::m_cutouts, PCAD2KICAD::PCB_COMPONENT::m_name, PCAD2KICAD::PCB_CUTOUT::Parse(), PCAD2KICAD::PCB_POLYGON::Parse(), PCAD2KICAD::PCB_COPPER_POUR::Parse(), PCAD2KICAD::PCB_PLANE::Parse(), PCAD2KICAD::PCB_ARC::Parse(), PCAD2KICAD::PCB_LINE::Parse(), PCAD2KICAD::SetFontProperty(), PCAD2KICAD::PCB_POLYGON::SetOutline(), and text.

Referenced by Parse(), and PCAD2KICAD::PCB::ParseBoard().

◆ FindModulePatternDefName()

XNODE * PCAD2KICAD::PCB_FOOTPRINT::FindModulePatternDefName ( XNODE aNode,
const wxString &  aName 
)

Definition at line 68 of file pcb_footprint.cpp.

69{
70 XNODE* result, * lNode;
71 wxString propValue1, propValue2;
72
73 result = nullptr;
74 lNode = FindNode( aNode, wxT( "patternDef" ) );
75
76 while( lNode )
77 {
78 if( lNode->GetName() == wxT( "patternDef" ) )
79 {
80 lNode->GetAttribute( wxT( "Name" ), &propValue1 );
81 FindNode( lNode,
82 wxT( "originalName" ) )->GetAttribute( wxT( "Name" ), &propValue2 );
83
84 if( ValidateName( propValue1 ) == aName || ValidateName( propValue2 ) == aName )
85 {
86 result = lNode;
87 lNode = nullptr;
88 }
89 }
90
91 if( lNode )
92 lNode = lNode->GetNext();
93 }
94
95 if( result == nullptr )
96 {
97 lNode = FindNode( aNode, wxT( "patternDefExtended" ) ); // New file format
98
99 while( lNode )
100 {
101 if( lNode->GetName() == wxT( "patternDefExtended" ) )
102 {
103 lNode->GetAttribute( wxT( "Name" ), &propValue1 );
104
105 if( ValidateName( propValue1 ) == aName )
106 {
107 result = lNode;
108 lNode = nullptr;
109 }
110 }
111
112 if( lNode )
113 lNode = lNode->GetNext();
114 }
115 }
116
117 return result;
118}
wxString ValidateName(const wxString &aName)

References PCAD2KICAD::FindNode(), XNODE::GetNext(), and PCAD2KICAD::ValidateName().

Referenced by PCAD2KICAD::PCB::DoPCBComponents(), and FindPatternMultilayerSection().

◆ FindPatternMultilayerSection()

XNODE * PCAD2KICAD::PCB_FOOTPRINT::FindPatternMultilayerSection ( XNODE aNode,
wxString *  aPatGraphRefName 
)
private

Definition at line 121 of file pcb_footprint.cpp.

122{
123 XNODE* result, * pNode, * lNode;
124 wxString propValue, patName;
125
126 result = nullptr;
127 pNode = aNode; // pattern;
128 lNode = aNode;
129
130 // calling from library conversion we need to find pattern
131 if( lNode->GetName() == wxT( "compDef" ) )
132 {
133 lNode->GetAttribute( wxT( "Name" ), &propValue );
134 propValue.Trim( false );
135 patName = ValidateName( propValue );
136
137 if( FindNode( lNode, wxT( "attachedPattern" ) ) )
138 {
139 FindNode( FindNode( lNode, wxT( "attachedPattern" ) ),
140 wxT( "patternName" ) )->GetAttribute( wxT( "Name" ), &propValue );
141 propValue.Trim( false );
142 propValue.Trim( true );
143 patName = ValidateName( propValue );
144 }
145
146 lNode = FindModulePatternDefName( lNode->GetParent(), patName );
147 pNode = lNode; // pattern;
148 }
149
150 lNode = nullptr;
151
152 if( pNode )
153 lNode = FindNode( pNode, wxT( "multiLayer" ) ); // Old file format
154
155 if( lNode )
156 {
157 *aPatGraphRefName = wxEmptyString; // default
158 result = lNode;
159 }
160 else
161 {
162 // New file format
163
164 if( *aPatGraphRefName == wxEmptyString ) // default
165 {
166 if( FindNode( aNode, wxT( "patternGraphicsNameRef" ) ) )
167 {
168 FindNode( aNode,
169 wxT( "patternGraphicsNameRef" ) )->GetAttribute( wxT( "Name" ),
170 aPatGraphRefName );
171 }
172 }
173
174 if( FindNode( aNode, wxT( "patternGraphicsDef" ) ) )
175 lNode = FindNode( aNode, wxT( "patternGraphicsDef" ) );
176 else if( pNode )
177 lNode = FindNode( pNode, wxT( "patternGraphicsDef" ) );
178
179 if( *aPatGraphRefName == wxEmptyString ) // no pattern detection, the first is actual...
180 {
181 if( lNode )
182 {
183 result = FindNode( lNode, wxT( "multiLayer" ) );
184 lNode = nullptr;
185 }
186 }
187
188 while( lNode ) // selected by name
189 {
190 if( lNode->GetName() == wxT( "patternGraphicsDef" ) )
191 {
192 FindNode( lNode,
193 wxT( "patternGraphicsNameDef" ) )->GetAttribute( wxT( "Name" ),
194 &propValue );
195
196 if( propValue == *aPatGraphRefName )
197 {
198 result = FindNode( lNode, wxT( "multiLayer" ) );
199 lNode = nullptr;
200 }
201 else
202 {
203 lNode = lNode->GetNext();
204 }
205 }
206 else
207 {
208 lNode = lNode->GetNext();
209 }
210 }
211 }
212
213 return result;
214}
XNODE * FindModulePatternDefName(XNODE *aNode, const wxString &aName)
XNODE * GetParent() const
Definition: xnode.h:72

References FindModulePatternDefName(), PCAD2KICAD::FindNode(), XNODE::GetNext(), XNODE::GetParent(), and PCAD2KICAD::ValidateName().

Referenced by Parse().

◆ Flip()

void PCAD2KICAD::PCB_FOOTPRINT::Flip ( )
overridevirtual

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 603 of file pcb_footprint.cpp.

604{
605 int i;
606
607 if( m_Mirror == 1 )
608 {
610
611 for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
612 {
613 if( m_FootprintItems[i]->m_objType == wxT( 'L' ) || // lines
614 m_FootprintItems[i]->m_objType == wxT( 'A' ) || // arcs
615 m_FootprintItems[i]->m_objType == wxT( 'Z' ) || // polygons
616 m_FootprintItems[i]->m_objType == wxT( 'P' ) || // pads
617 m_FootprintItems[i]->m_objType == wxT( 'V' ) ) // vias
618 {
619 m_FootprintItems[i]->Flip();
620 }
621 }
622 }
623}

References m_FootprintItems, m_Mirror, PCAD2KICAD::PCB_COMPONENT::m_objType, and PCAD2KICAD::PCB_COMPONENT::m_rotation.

Referenced by PCAD2KICAD::PCB::ParseBoard().

◆ GetKiCadLayer()

◆ GetNetCode()

int PCAD2KICAD::PCB_COMPONENT::GetNetCode ( const wxString &  aNetName) const
inlineinherited

◆ Parse()

void PCAD2KICAD::PCB_FOOTPRINT::Parse ( XNODE aNode,
wxStatusBar *  aStatusBar,
const wxString &  aDefaultMeasurementUnit,
const wxString &  aActualConversion 
)
virtual

Definition at line 386 of file pcb_footprint.cpp.

389{
390 XNODE* lNode, * tNode, * mNode;
391 PCB_PAD* pad;
392 PCB_VIA* via;
393 wxString propValue, str;
394
395 FindNode( aNode, wxT( "originalName" ) )->GetAttribute( wxT( "Name" ), &propValue );
396 propValue.Trim( false );
397 m_name.text = propValue;
398
399 // aStatusBar->SetStatusText( wxT( "Creating Component : " ) + m_name.text );
400 lNode = aNode;
402
403 if( lNode )
404 {
405 tNode = lNode;
406 tNode = tNode->GetChildren();
407
408 while( tNode )
409 {
410 if( tNode->GetName() == wxT( "pad" ) )
411 {
412 pad = new PCB_PAD( m_callbacks, m_board );
413 pad->Parse( tNode, aDefaultMeasurementUnit, aActualConversion );
414 m_FootprintItems.Add( pad );
415 }
416
417 if( tNode->GetName() == wxT( "via" ) )
418 {
419 via = new PCB_VIA( m_callbacks, m_board );
420 via->Parse( tNode, aDefaultMeasurementUnit, aActualConversion );
421 m_FootprintItems.Add( via );
422 }
423
424 tNode = tNode->GetNext();
425 }
426
427 lNode = lNode->GetParent();
428 }
429
430 if( lNode )
431 lNode = FindNode( lNode, wxT( "layerContents" ) );
432
433 while( lNode )
434 {
435 if( lNode->GetName() == wxT( "layerContents" ) )
436 DoLayerContentsObjects( lNode, this, &m_FootprintItems, aStatusBar,
437 aDefaultMeasurementUnit, aActualConversion );
438
439 lNode = lNode->GetNext();
440 }
441
442 // map pins
443 lNode = FindPinMap( aNode );
444
445 if( lNode )
446 {
447 mNode = lNode->GetChildren();
448
449 while( mNode )
450 {
451 if( mNode->GetName() == wxT( "padNum" ) )
452 {
453 str = mNode->GetNodeContent();
454 mNode = mNode->GetNext();
455
456 if( !mNode )
457 break;
458
459 mNode->GetAttribute( wxT( "Name" ), &propValue );
460 SetName( str, propValue );
461 mNode = mNode->GetNext();
462 }
463 else
464 {
465 mNode = mNode->GetNext();
466
467 if( !mNode )
468 break;
469
470 mNode = mNode->GetNext();
471 }
472 }
473 }
474}
void SetName(const wxString &aPin, const wxString &aName)
XNODE * FindPatternMultilayerSection(XNODE *aNode, wxString *aPatGraphRefName)
void DoLayerContentsObjects(XNODE *aNode, PCB_FOOTPRINT *aFootprint, PCB_COMPONENTS_ARRAY *aList, wxStatusBar *aStatusBar, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
XNODE * FindPinMap(XNODE *aNode)

References DoLayerContentsObjects(), PCAD2KICAD::FindNode(), FindPatternMultilayerSection(), PCAD2KICAD::FindPinMap(), XNODE::GetChildren(), XNODE::GetNext(), XNODE::GetParent(), PCAD2KICAD::PCB_COMPONENT::m_board, PCAD2KICAD::PCB_COMPONENT::m_callbacks, m_FootprintItems, PCAD2KICAD::PCB_COMPONENT::m_name, PCAD2KICAD::PCB_COMPONENT::m_patGraphRefName, pad, SetName(), PCAD2KICAD::TTEXTVALUE::text, and via.

Referenced by PCAD2KICAD::PCB::DoPCBComponents(), and PCAD2KICAD::PCB::ParseBoard().

◆ SetName()

void PCAD2KICAD::PCB_FOOTPRINT::SetName ( const wxString &  aPin,
const wxString &  aName 
)

Definition at line 368 of file pcb_footprint.cpp.

369{
370 int i;
371 long num;
372
373 aPin.ToLong( &num );
374
375 for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
376 {
377 if( m_FootprintItems[i]->m_objType == wxT( 'P' ) )
378 {
379 if( ( (PCB_PAD*) m_FootprintItems[i] )->m_Number == num )
380 ( (PCB_PAD*) m_FootprintItems[i] )->m_name.text = aName;
381 }
382 }
383}

References m_FootprintItems, PCAD2KICAD::PCB_COMPONENT::m_name, PCAD2KICAD::PCB_COMPONENT::m_objType, and PCAD2KICAD::TTEXTVALUE::text.

Referenced by PCAD2KICAD::PCB::DoPCBComponents(), and Parse().

◆ SetPosOffset()

void PCAD2KICAD::PCB_COMPONENT::SetPosOffset ( int  aX_offs,
int  aY_offs 
)
virtualinherited

Member Data Documentation

◆ m_board

◆ m_BoardOutline

VERTICES_ARRAY PCAD2KICAD::PCB_FOOTPRINT::m_BoardOutline

Definition at line 66 of file pcb_footprint.h.

Referenced by DoLayerContentsObjects(), and PCAD2KICAD::PCB::GetBoardOutline().

◆ m_callbacks

◆ m_compRef

wxString PCAD2KICAD::PCB_COMPONENT::m_compRef
inherited

◆ m_FootprintItems

PCB_COMPONENTS_ARRAY PCAD2KICAD::PCB_FOOTPRINT::m_FootprintItems

◆ m_KiCadLayer

◆ m_Mirror

int PCAD2KICAD::PCB_FOOTPRINT::m_Mirror

Definition at line 65 of file pcb_footprint.h.

Referenced by AddToBoard(), PCAD2KICAD::PCB::DoPCBComponents(), Flip(), and PCB_FOOTPRINT().

◆ m_name

◆ m_net

◆ m_netCode

◆ m_objType

◆ m_patGraphRefName

wxString PCAD2KICAD::PCB_COMPONENT::m_patGraphRefName
inherited

◆ m_PCadLayer

◆ m_positionX

◆ m_positionY

◆ m_rotation

◆ m_tag

int PCAD2KICAD::PCB_COMPONENT::m_tag
inherited

Definition at line 63 of file pcb_component.h.

Referenced by PCAD2KICAD::PCB_COMPONENT::PCB_COMPONENT().

◆ m_uuid

KIID PCAD2KICAD::PCB_COMPONENT::m_uuid
inherited

Definition at line 67 of file pcb_component.h.

◆ m_Value

TTEXTVALUE PCAD2KICAD::PCB_FOOTPRINT::m_Value

Definition at line 63 of file pcb_footprint.h.

Referenced by AddToBoard(), PCAD2KICAD::PCB::DoPCBComponents(), and PCB_FOOTPRINT().


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