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 478 of file pcb_footprint.cpp.

479{
480 int i;
481 EDA_ANGLE r;
482
483 // transform text positions
486
489
490 FOOTPRINT* footprint = new FOOTPRINT( m_board );
491 m_board->Add( footprint, ADD_MODE::APPEND );
492
494 footprint->SetLayer( m_Mirror ? B_Cu : F_Cu );
495 footprint->SetOrientation( m_rotation );
496
497 LIB_ID fpID;
498 fpID.Parse( m_compRef, true );
499 footprint->SetFPID( fpID );
500
501 // reference text
502 FP_TEXT* ref_text = &footprint->Reference();
503
504 ref_text->SetText( ValidateReference( m_name.text ) );
506
508
509 if( m_name.isTrueType )
511 else
513
515 ref_text->SetTextAngle( r );
516 ref_text->SetKeepUpright( false );
517
518 ref_text->SetItalic( m_name.isItalic );
520
521 ref_text->SetMirrored( m_name.mirror );
522 ref_text->SetVisible( m_name.textIsVisible );
523
525
526 // Calculate the actual position.
527 ref_text->SetDrawCoord();
528
529 // value text
530 FP_TEXT* val_text = &footprint->Value();
531
532 val_text->SetText( m_Value.text );
533 val_text->SetType( FP_TEXT::TEXT_is_VALUE );
534
536
537 if( m_Value.isTrueType )
539 else
541
543 val_text->SetTextAngle( r );
544 val_text->SetKeepUpright( false );
545
546 val_text->SetItalic( m_Value.isItalic );
548
549 val_text->SetMirrored( m_Value.mirror );
550 val_text->SetVisible( m_Value.textIsVisible );
551
553
554 // Calculate the actual position.
555 val_text->SetDrawCoord();
556
557 // TEXTS
558 for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
559 {
560 if( m_FootprintItems[i]->m_objType == wxT( 'T' ) )
561 {
562 ( (PCB_TEXT*) m_FootprintItems[i] )->m_tag = i + 2;
563 m_FootprintItems[ i ]->AddToFootprint( footprint );
564 }
565 }
566
567 // FOOTPRINT LINES
568 for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
569 {
570 if( m_FootprintItems[i]->m_objType == wxT( 'L' ) )
571 m_FootprintItems[ i ]->AddToFootprint( footprint );
572 }
573
574 // FOOTPRINT ARCS
575 for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
576 {
577 if( m_FootprintItems[i]->m_objType == wxT( 'A' ) )
578 m_FootprintItems[ i ]->AddToFootprint( footprint );
579 }
580
581 // FOOTPRINT POLYGONS
582 for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
583 {
584 if( m_FootprintItems[i]->m_objType == wxT( 'Z' ) )
585 m_FootprintItems[ i ]->AddToFootprint( footprint );
586 }
587
588 // PADS
589 for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
590 {
591 if( m_FootprintItems[i]->m_objType == wxT( 'P' ) )
592 ((PCB_PAD*) m_FootprintItems[ i ] )->AddToFootprint( footprint, m_rotation, false );
593 }
594
595 // VIAS
596 for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
597 {
598 if( m_FootprintItems[i]->m_objType == wxT( 'V' ) )
599 ((PCB_VIA*) m_FootprintItems[ i ] )->AddToFootprint( footprint, m_rotation, false );
600 }
601}
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:214
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:696
void SetMirrored(bool isMirrored)
Definition: eda_text.cpp:224
virtual void SetVisible(bool aVisible)
Definition: eda_text.cpp:217
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.cpp:185
void SetKeepUpright(bool aKeepUpright)
Definition: eda_text.cpp:256
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:163
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:193
void SetItalic(bool aItalic)
Definition: eda_text.cpp:201
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:1645
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:204
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:1775
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:558
FP_TEXT & Reference()
Definition: footprint.h:559
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)
E_SERIE r
Definition: eserie.cpp:41
@ 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:618

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(), r, 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 wxASSERT( plane_layer );
319 plane_layer->FormPolygon( lNode, plane_layer_polygon, aDefaultMeasurementUnit,
320 aActualConversion );
321 plane_layer->m_cutouts.Add( plane_layer_polygon );
322 }
323 else
324 {
325 polygon = new PCB_POLYGON( m_callbacks, m_board, PCadLayer );
326
327 if( polygon->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
328 aList->Add( polygon );
329 else
330 delete polygon;
331 }
332 }
333
334 if( lNode->GetName() == wxT( "copperPour95" ) )
335 {
336 copperPour = new PCB_COPPER_POUR( m_callbacks, m_board, PCadLayer );
337
338 if( copperPour->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
339 aList->Add( copperPour );
340 else
341 delete copperPour;
342 }
343
344 if( lNode->GetName() == wxT( "polyCutOut" ) )
345 {
346 cutout = new PCB_CUTOUT( m_callbacks, m_board, PCadLayer );
347
348 if( cutout->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
349 aList->Add( cutout );
350 else
351 delete cutout;
352 }
353
354 if( lNode->GetName() == wxT( "planeObj" ) )
355 {
356 plane = new PCB_PLANE( m_callbacks, m_board, PCadLayer );
357
358 if( plane->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
359 aList->Add( plane );
360 else
361 delete plane;
362 }
363
364 lNode = lNode->GetNext();
365 }
366}
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 604 of file pcb_footprint.cpp.

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

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 387 of file pcb_footprint.cpp.

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

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

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: