KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcad_footprint.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2007, 2008 Lubo Racko <[email protected]>
5 * Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <[email protected]>
6 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#include <pcad/pcad_arc.h>
24#include <pcad/pcad_cutout.h>
25#include <pcad/pcad_plane.h>
26#include <pcad/pcad_line.h>
27#include <pcad/pcad_footprint.h>
28#include <pcad/pcad_pad.h>
29#include <pcad/pcad_polygon.h>
30#include <pcad/pcad_text.h>
31#include <pcad/pcad_via.h>
32
33#include <board.h>
34#include <footprint.h>
35#include <pcb_text.h>
36#include <trigo.h>
37#include <xnode.h>
38
39#include <wx/string.h>
40
41namespace PCAD2KICAD {
42
43
45 PCAD_PCB_COMPONENT( aCallbacks, aBoard )
46{
48 m_Mirror = 0;
49 m_ObjType = wxT( 'M' ); // FOOTPRINT
50 m_KiCadLayer = F_SilkS; // default
51}
52
53
55{
56 for( int i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
57 delete m_FootprintItems[i];
58}
59
60
61XNODE* PCAD_FOOTPRINT::FindModulePatternDefName( XNODE* aNode, const wxString& aName )
62{
63 XNODE* result, * lNode;
64 wxString propValue1, propValue2;
65
66 result = nullptr;
67 lNode = FindNode( aNode, wxT( "patternDef" ) );
68
69 while( lNode )
70 {
71 if( lNode->GetName() == wxT( "patternDef" ) )
72 {
73 lNode->GetAttribute( wxT( "Name" ), &propValue1 );
74 if( XNODE* originalNameNode = FindNode( lNode, wxT( "originalName" ) ) )
75 originalNameNode->GetAttribute( wxT( "Name" ), &propValue2 );
76
77 if( ValidateName( propValue1 ) == aName || ValidateName( propValue2 ) == aName )
78 {
79 result = lNode;
80 lNode = nullptr;
81 }
82 }
83
84 if( lNode )
85 lNode = lNode->GetNext();
86 }
87
88 if( result == nullptr )
89 {
90 lNode = FindNode( aNode, wxT( "patternDefExtended" ) ); // New file format
91
92 while( lNode )
93 {
94 if( lNode->GetName() == wxT( "patternDefExtended" ) )
95 {
96 lNode->GetAttribute( wxT( "Name" ), &propValue1 );
97
98 if( ValidateName( propValue1 ) == aName )
99 {
100 result = lNode;
101 lNode = nullptr;
102 }
103 }
104
105 if( lNode )
106 lNode = lNode->GetNext();
107 }
108 }
109
110 return result;
111}
112
113
114XNODE* PCAD_FOOTPRINT::FindPatternMultilayerSection( XNODE* aNode, wxString* aPatGraphRefName )
115{
116 XNODE* result, * pNode, * lNode;
117 wxString propValue, patName;
118
119 result = nullptr;
120 pNode = aNode; // pattern;
121 lNode = aNode;
122
123 // calling from library conversion we need to find pattern
124 if( lNode->GetName() == wxT( "compDef" ) )
125 {
126 lNode->GetAttribute( wxT( "Name" ), &propValue );
127 propValue.Trim( false );
128 patName = ValidateName( propValue );
129
130 if( XNODE* patternNode = FindNode( lNode, wxT( "attachedPattern" ) ) )
131 {
132 if( XNODE* patternNameNode = FindNode( patternNode, wxT( "patternName" ) ) )
133 patternNameNode->GetAttribute( wxT( "Name" ), &propValue );
134
135 propValue.Trim( false );
136 propValue.Trim( true );
137 patName = ValidateName( propValue );
138 }
139
140 lNode = FindModulePatternDefName( lNode->GetParent(), patName );
141 pNode = lNode; // pattern;
142 }
143
144 lNode = nullptr;
145
146 if( pNode )
147 lNode = FindNode( pNode, wxT( "multiLayer" ) ); // Old file format
148
149 if( lNode )
150 {
151 *aPatGraphRefName = wxEmptyString; // default
152 result = lNode;
153 }
154 else
155 {
156 // New file format
157
158 if( *aPatGraphRefName == wxEmptyString ) // default
159 {
160 if( XNODE* nameRefNode = FindNode( aNode, wxT( "patternGraphicsNameRef" ) ) )
161 nameRefNode->GetAttribute( wxT( "Name" ), aPatGraphRefName );
162 }
163
164 if( FindNode( aNode, wxT( "patternGraphicsDef" ) ) )
165 lNode = FindNode( aNode, wxT( "patternGraphicsDef" ) );
166 else if( pNode )
167 lNode = FindNode( pNode, wxT( "patternGraphicsDef" ) );
168
169 if( *aPatGraphRefName == wxEmptyString ) // no pattern detection, the first is actual...
170 {
171 if( lNode )
172 {
173 result = FindNode( lNode, wxT( "multiLayer" ) );
174 lNode = nullptr;
175 }
176 }
177
178 while( lNode ) // selected by name
179 {
180 if( lNode->GetName() == wxT( "patternGraphicsDef" ) )
181 {
182 if( XNODE* nameDefNode = FindNode( lNode, wxT( "patternGraphicsNameDef" ) ) )
183 nameDefNode->GetAttribute( wxT( "Name" ), &propValue );
184
185 if( propValue == *aPatGraphRefName )
186 {
187 result = FindNode( lNode, wxT( "multiLayer" ) );
188 lNode = nullptr;
189 }
190 else
191 {
192 lNode = lNode->GetNext();
193 }
194 }
195 else
196 {
197 lNode = lNode->GetNext();
198 }
199 }
200 }
201
202 return result;
203}
204
205static bool HasLine( std::vector<PCAD_LINE*>& vector, PCAD_LINE* line )
206{
207 auto it = std::find_if( vector.begin(), vector.end(),
208 [line]( PCAD_LINE* l2 )
209 {
210 return line->m_PositionX == l2->m_PositionX && line->m_PositionY == l2->m_PositionY
211 && line->m_ToX == l2->m_ToX && line->m_ToY == l2->m_ToY;
212 } );
213 return it != vector.end();
214}
215
217 PCAD_COMPONENTS_ARRAY* aList, wxStatusBar* aStatusBar,
218 const wxString& aDefaultMeasurementUnit,
219 const wxString& aActualConversion )
220{
221 PCAD_ARC* arc = nullptr;
222 PCAD_POLYGON* polygon = nullptr;
223 PCAD_POLYGON* plane_layer = nullptr;
224 PCAD_COPPER_POUR* copperPour = nullptr;
225 PCAD_CUTOUT* cutout = nullptr;
226 PCAD_PLANE* plane = nullptr;
227 VERTICES_ARRAY* plane_layer_polygon = nullptr;
228 PCAD_LINE* line = nullptr;
229 PCAD_TEXT* text = nullptr;
230 XNODE* lNode = nullptr;
231 XNODE* tNode = nullptr;
232 XNODE* pNode = nullptr;
233 wxString propValue;
234 int PCadLayer = 0;
235 long num = 0;
236 int width = 0;
237 int x = 0, y = 0;
238 int LastX = 0, LastY = 0;
239 int FirstX = 0, FirstY = 0;
240 bool IsFirstPoint = false;
241 bool IsBoardLayer = false;
242 std::vector<PCAD_LINE*> lines;
243
244 // aStatusBar->SetStatusText( wxT( "Processing LAYER CONTENT OBJECTS " ) );
245 if( FindNode( aNode, wxT( "layerNumRef" ) ) )
246 FindNode( aNode, wxT( "layerNumRef" ) )->GetNodeContent().ToLong( &num );
247
248 PCadLayer = (int) num;
249 IsBoardLayer = ( PCadLayer == 3 );
250
251 if( m_callbacks->GetLayerType( PCadLayer ) == LAYER_TYPE_PLANE )
252 {
253 plane_layer = new PCAD_POLYGON( m_callbacks, m_board, PCadLayer );
254 plane_layer->AssignNet( m_callbacks->GetLayerNetNameRef( PCadLayer ) );
255 plane_layer->SetOutline( &m_BoardOutline );
256 aList->Add( plane_layer );
257
258 // fill the polygon with the same contour as its outline is
259 //plane_layer->AddIsland( &m_boardOutline );
260 }
261
262 lNode = aNode->GetChildren();
263
264 while( lNode )
265 {
266 if( lNode->GetName() == wxT( "line" ) )
267 {
268 line = new PCAD_LINE( m_callbacks, m_board );
269 line->Parse( lNode, PCadLayer, aDefaultMeasurementUnit, aActualConversion );
270 if( IsBoardLayer )
271 {
272 if( !HasLine( lines, line ) )
273 {
274 lines.push_back( line );
275 aList->Add( line );
276 }
277 }
278 else
279 {
280 aList->Add( line );
281 }
282 }
283
284 if( lNode->GetName() == wxT( "text" ) )
285 {
287 text->Parse( lNode, PCadLayer, aDefaultMeasurementUnit, aActualConversion );
288 aList->Add( text );
289 }
290
291 // added as Sergeys request 02/2008
292 if( lNode->GetName() == wxT( "attr" ) )
293 {
294 // assign fonts to Module Name,Value,Type,....s
295 lNode->GetAttribute( wxT( "Name" ), &propValue );
296 propValue.Trim( false );
297 propValue.Trim( true );
298
299 if( propValue == wxT( "RefDes" ) )
300 {
301 tNode = FindNode( lNode, wxT( "textStyleRef" ) );
302
303 if( tNode && aFootprint )
304 {
305 // TODO: to understand and may be repair
306 // Alexander Lunev: originally in Delphi version of the project there was
307 // a strange access to pcbModule->m_Name (it was global variable). This access
308 // is necessary when the function DoLayerContentsObjects() is called from
309 // function CreatePCBModule(). However it is not clear whether the access is
310 // required when the function DoLayerContentsObjects() is called from
311 // function ProcessXMLtoPCBLib().
312 SetFontProperty( tNode, &aFootprint->m_Name, aDefaultMeasurementUnit,
313 aActualConversion );
314 }
315 }
316 }
317
318 // added as Sergeys request 02/2008
319 if( lNode->GetName() == wxT( "arc" ) || lNode->GetName() == wxT( "triplePointArc" ) )
320 {
321 arc = new PCAD_ARC( m_callbacks, m_board );
322 arc->Parse( lNode, PCadLayer, aDefaultMeasurementUnit, aActualConversion );
323 aList->Add( arc );
324 }
325
326 if( lNode->GetName() == wxT( "pcbPoly" ) )
327 {
328 if( m_callbacks->GetLayerType( PCadLayer ) == LAYER_TYPE_PLANE )
329 {
330 if( plane_layer )
331 {
332 plane_layer_polygon = new VERTICES_ARRAY;
333 plane_layer->FormPolygon( lNode, plane_layer_polygon, aDefaultMeasurementUnit,
334 aActualConversion );
335 plane_layer->m_Cutouts.Add( plane_layer_polygon );
336 }
337 }
338 else
339 {
340 polygon = new PCAD_POLYGON( m_callbacks, m_board, PCadLayer );
341
342 if( polygon->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
343 aList->Add( polygon );
344 else
345 delete polygon;
346 }
347 }
348
349 if( lNode->GetName() == wxT( "copperPour95" ) )
350 {
351 copperPour = new PCAD_COPPER_POUR( m_callbacks, m_board, PCadLayer );
352
353 if( copperPour->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
354 aList->Add( copperPour );
355 else
356 delete copperPour;
357 }
358
359 if( lNode->GetName() == wxT( "polyCutOut" ) )
360 {
361 cutout = new PCAD_CUTOUT( m_callbacks, m_board, PCadLayer );
362
363 if( cutout->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
364 aList->Add( cutout );
365 else
366 delete cutout;
367 }
368
369 if( lNode->GetName() == wxT( "planeObj" ) )
370 {
371 plane = new PCAD_PLANE( m_callbacks, m_board, PCadLayer );
372
373 if( plane->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
374 aList->Add( plane );
375 else
376 delete plane;
377 }
378
379 if( lNode->GetName() == wxT( "boardOutlineObj" ) && IsBoardLayer )
380 {
381 LastX = 0;
382 LastY = 0;
383 FirstX = 0;
384 FirstY = 0;
385 IsFirstPoint = true;
386
387 pNode = FindNode( lNode, wxT( "width" ) );
388
389 if( pNode )
390 {
391 SetWidth( pNode->GetNodeContent(), aDefaultMeasurementUnit, &width, aActualConversion );
392
393 pNode = FindNode( lNode, wxT( "enhancedPolygon" ) );
394
395 if( pNode )
396 {
397 pNode = pNode->GetChildren();
398
399 while( pNode )
400 {
401 if( pNode->GetName() == wxT( "polyPoint" ) )
402 {
403 SetPosition( pNode->GetNodeContent(), aDefaultMeasurementUnit, &x, &y, aActualConversion );
404 if( IsFirstPoint )
405 {
406 IsFirstPoint = false;
407 FirstX = x;
408 FirstY = y;
409 }
410 else
411 {
412 line = new PCAD_LINE( m_callbacks, m_board );
413 line->m_PositionX = LastX;
414 line->m_PositionY = LastY;
415 line->m_ToX = x;
416 line->m_ToY = y;
417 line->m_Width = width;
418 line->m_PCadLayer = PCadLayer;
419 line->m_KiCadLayer = line->GetKiCadLayer();
420 if( !HasLine( lines, line ) )
421 {
422 lines.push_back( line );
423 aList->Add( line );
424 }
425 }
426 LastX = x;
427 LastY = y;
428 }
429
430 pNode = pNode->GetNext();
431 }
432
433 if( LastX != FirstX || LastY != FirstY )
434 {
435 line = new PCAD_LINE( m_callbacks, m_board );
436 line->m_PositionX = LastX;
437 line->m_PositionY = LastY;
438 line->m_ToX = FirstX;
439 line->m_ToY = FirstY;
440 line->m_Width = width;
441 line->m_PCadLayer = PCadLayer;
442 line->m_KiCadLayer = line->GetKiCadLayer();
443 if( !HasLine( lines, line ) )
444 {
445 lines.push_back( line );
446 aList->Add( line );
447 }
448 }
449 }
450 }
451 }
452
453 lNode = lNode->GetNext();
454 }
455}
456
457
458void PCAD_FOOTPRINT::SetName( const wxString& aPin, const wxString& aName )
459{
460 long num;
461 aPin.ToLong( &num );
462
463 for( int i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
464 {
465 if( m_FootprintItems[i]->m_ObjType == wxT( 'P' ) )
466 {
467 if( ( (PCAD_PAD*) m_FootprintItems[i] )->m_Number == num )
468 ( (PCAD_PAD*) m_FootprintItems[i] )->m_Name.text = aName;
469 }
470 }
471}
472
473
474void PCAD_FOOTPRINT::Parse( XNODE* aNode, wxStatusBar* aStatusBar,
475 const wxString& aDefaultMeasurementUnit,
476 const wxString& aActualConversion )
477{
478 XNODE* lNode = nullptr;
479 XNODE* tNode = nullptr;;
480 XNODE* mNode = nullptr;
481 PCAD_PAD* pad = nullptr;
482 PCAD_VIA* via = nullptr;
483 wxString propValue, str;
484
485 FindNode( aNode, wxT( "originalName" ) )->GetAttribute( wxT( "Name" ), &propValue );
486 propValue.Trim( false );
487 m_Name.text = propValue;
488
489 // aStatusBar->SetStatusText( wxT( "Creating Component : " ) + m_Name.text );
490 lNode = aNode;
492
493 if( lNode )
494 {
495 tNode = lNode;
496 tNode = tNode->GetChildren();
497
498 while( tNode )
499 {
500 if( tNode->GetName() == wxT( "pad" ) )
501 {
503 pad->Parse( tNode, aDefaultMeasurementUnit, aActualConversion );
504 m_FootprintItems.Add( pad );
505 }
506
507 if( tNode->GetName() == wxT( "via" ) )
508 {
510 via->Parse( tNode, aDefaultMeasurementUnit, aActualConversion );
511 m_FootprintItems.Add( via );
512 }
513
514 tNode = tNode->GetNext();
515 }
516
517 lNode = lNode->GetParent();
518 }
519
520 if( lNode )
521 lNode = FindNode( lNode, wxT( "layerContents" ) );
522
523 while( lNode )
524 {
525 if( lNode->GetName() == wxT( "layerContents" ) )
526 {
527 DoLayerContentsObjects( lNode, this, &m_FootprintItems, aStatusBar,
528 aDefaultMeasurementUnit, aActualConversion );
529 }
530
531 lNode = lNode->GetNext();
532 }
533
534 // map pins
535 lNode = FindPinMap( aNode );
536
537 if( lNode )
538 {
539 mNode = lNode->GetChildren();
540
541 while( mNode )
542 {
543 if( mNode->GetName() == wxT( "padNum" ) )
544 {
545 str = mNode->GetNodeContent();
546 mNode = mNode->GetNext();
547
548 if( !mNode )
549 break;
550
551 mNode->GetAttribute( wxT( "Name" ), &propValue );
552 SetName( str, propValue );
553 mNode = mNode->GetNext();
554 }
555 else
556 {
557 mNode = mNode->GetNext();
558
559 if( !mNode )
560 break;
561
562 mNode = mNode->GetNext();
563 }
564 }
565 }
566}
567
568
570{
571 // No nested footprints....
572 wxCHECK( aFootprint == nullptr, /* void */ );
573
574 EDA_ANGLE r;
575
576 // transform text positions
578 RotatePoint( &m_Name.correctedPositionX, &m_Name.correctedPositionY, -m_Rotation );
579
581 RotatePoint( &m_Value.correctedPositionX, &m_Value.correctedPositionY, -m_Rotation );
582
583 FOOTPRINT* footprint = new FOOTPRINT( m_board );
584 m_board->Add( footprint, ADD_MODE::APPEND );
585
587 footprint->SetLayer( m_Mirror ? B_Cu : F_Cu );
588 footprint->SetOrientation( m_Rotation );
589
590 LIB_ID fpID;
591 fpID.Parse( m_CompRef, true );
592 footprint->SetFPID( fpID );
593
594 // reference text
595 PCB_FIELD* ref_text = &footprint->Reference();
596
597 ref_text->SetText( ValidateReference( m_Name.text ) );
598
599 ref_text->SetFPRelativePosition( VECTOR2I( m_Name.correctedPositionX,
600 m_Name.correctedPositionY ) );
601
602 if( m_Name.isTrueType )
603 SetTextSizeFromTrueTypeFontHeight( ref_text, m_Name.textHeight );
604 else
605 SetTextSizeFromStrokeFontHeight( ref_text, m_Name.textHeight );
606
607 r = m_Name.textRotation - m_Rotation;
608 ref_text->SetTextAngle( r );
609 ref_text->SetKeepUpright( false );
610
611 ref_text->SetItalic( m_Name.isItalic );
612 ref_text->SetTextThickness( m_Name.textstrokeWidth );
613
614 ref_text->SetMirrored( m_Name.mirror );
615 ref_text->SetVisible( m_Name.textIsVisible );
616
617 ref_text->SetLayer( m_Mirror ? m_board->FlipLayer( m_KiCadLayer ) : m_KiCadLayer );
618
619 // value text
620 PCB_FIELD* val_text = &footprint->Value();
621
622 val_text->SetText( m_Value.text );
623
624 val_text->SetFPRelativePosition( VECTOR2I( m_Value.correctedPositionX,
625 m_Value.correctedPositionY ) );
626
627 if( m_Value.isTrueType )
628 SetTextSizeFromTrueTypeFontHeight( val_text, m_Value.textHeight );
629 else
630 SetTextSizeFromStrokeFontHeight( val_text, m_Value.textHeight );
631
632 r = m_Value.textRotation - m_Rotation;
633 val_text->SetTextAngle( r );
634 val_text->SetKeepUpright( false );
635
636 val_text->SetItalic( m_Value.isItalic );
637 val_text->SetTextThickness( m_Value.textstrokeWidth );
638
639 val_text->SetMirrored( m_Value.mirror );
640 val_text->SetVisible( m_Value.textIsVisible );
641
642 val_text->SetLayer( m_Value.mirror ? m_board->FlipLayer( m_KiCadLayer ) : m_KiCadLayer );
643
644 // TEXTS
645 for( int i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
646 {
647 if( m_FootprintItems[i]->m_ObjType == wxT( 'T' ) )
648 m_FootprintItems[ i ]->AddToBoard( footprint );
649 }
650
651 // FOOTPRINT LINES
652 for( int i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
653 {
654 if( m_FootprintItems[i]->m_ObjType == wxT( 'L' ) )
655 m_FootprintItems[ i ]->AddToBoard( footprint );
656 }
657
658 // FOOTPRINT ARCS
659 for( int i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
660 {
661 if( m_FootprintItems[i]->m_ObjType == wxT( 'A' ) )
662 m_FootprintItems[ i ]->AddToBoard( footprint );
663 }
664
665 // FOOTPRINT POLYGONS
666 for( int i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
667 {
668 if( m_FootprintItems[i]->m_ObjType == wxT( 'Z' ) )
669 m_FootprintItems[ i ]->AddToBoard( footprint );
670 }
671
672 // PADS
673 for( int i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
674 {
675 if( m_FootprintItems[i]->m_ObjType == wxT( 'P' ) )
676 ((PCAD_PAD*) m_FootprintItems[ i ] )->AddToFootprint( footprint, m_Rotation, false );
677 }
678
679 // VIAS
680 for( int i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
681 {
682 if( m_FootprintItems[i]->m_ObjType == wxT( 'V' ) )
683 ((PCAD_VIA*) m_FootprintItems[ i ] )->AddToFootprint( footprint, m_Rotation, false );
684 }
685}
686
687
689{
690 if( m_Mirror == 1 )
691 {
693
694 for( int i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
695 {
696 if( m_FootprintItems[i]->m_ObjType == wxT( 'L' ) || // lines
697 m_FootprintItems[i]->m_ObjType == wxT( 'A' ) || // arcs
698 m_FootprintItems[i]->m_ObjType == wxT( 'Z' ) || // polygons
699 m_FootprintItems[i]->m_ObjType == wxT( 'P' ) || // pads
700 m_FootprintItems[i]->m_ObjType == wxT( 'V' ) ) // vias
701 {
702 m_FootprintItems[i]->Flip();
703 }
704 }
705 }
706}
707
708} // namespace PCAD2KICAD
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition board_item.h:313
void SetFPRelativePosition(const VECTOR2I &aPos)
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
void SetMirrored(bool isMirrored)
Definition eda_text.cpp:388
virtual void SetVisible(bool aVisible)
Definition eda_text.cpp:381
void SetKeepUpright(bool aKeepUpright)
Definition eda_text.cpp:420
virtual void SetText(const wxString &aText)
Definition eda_text.cpp:265
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
Definition eda_text.cpp:302
void SetPosition(const VECTOR2I &aPos) override
void SetFPID(const LIB_ID &aFPID)
Definition footprint.h:442
void SetOrientation(const EDA_ANGLE &aNewAngle)
PCB_FIELD & Value()
read/write accessors:
Definition footprint.h:877
PCB_FIELD & Reference()
Definition footprint.h:878
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition lib_id.cpp:48
virtual void Parse(XNODE *aNode, int aLayer, const wxString &aDefaultUnits, const wxString &aActualConversion)
Definition pcad_arc.cpp:51
virtual bool Parse(XNODE *aNode, const wxString &aDefaultUnits, const wxString &aActualConversion) override
virtual bool Parse(XNODE *aNode, const wxString &aDefaultMeasurementUnit, const wxString &actualConversion) override
PCAD_FOOTPRINT(PCAD_CALLBACKS *aCallbacks, BOARD *aBoard)
void DoLayerContentsObjects(XNODE *aNode, PCAD_FOOTPRINT *aFootprint, PCAD_COMPONENTS_ARRAY *aList, wxStatusBar *aStatusBar, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
PCAD_COMPONENTS_ARRAY m_FootprintItems
XNODE * FindPatternMultilayerSection(XNODE *aNode, wxString *aPatGraphRefName)
virtual void Flip() override
void AddToBoard(FOOTPRINT *aFootprint=nullptr) override
XNODE * FindModulePatternDefName(XNODE *aNode, const wxString &aName)
void SetName(const wxString &aPin, const wxString &aName)
virtual void Parse(XNODE *aNode, wxStatusBar *aStatusBar, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
virtual void Parse(XNODE *aNode, int aLayer, const wxString &aDefaultUnits, const wxString &aActualConversion)
Definition pcad_line.cpp:50
PCAD_PCB_COMPONENT(PCAD_CALLBACKS *aCallbacks, BOARD *aBoard)
virtual bool Parse(XNODE *aNode, const wxString &aDefaultUnits, const wxString &aActualConversion) override
void SetOutline(VERTICES_ARRAY *aOutline)
virtual bool Parse(XNODE *aNode, const wxString &aDefaultUnits, const wxString &aActualConversion)
void FormPolygon(XNODE *aNode, VERTICES_ARRAY *aPolygon, const wxString &aDefaultUnits, const wxString &actualConversion)
void AssignNet(const wxString &aNetName)
void SetTextThickness(int aWidth) override
The TextThickness is that set by the user.
Definition pcb_text.cpp:495
void SetTextAngle(const EDA_ANGLE &aAngle) override
Definition pcb_text.cpp:552
An extension of wxXmlNode that can format its contents as KiCad-style s-expressions.
Definition xnode.h:67
XNODE * GetParent() const
Definition xnode.h:107
XNODE * GetChildren() const
Definition xnode.h:97
XNODE * GetNext() const
Definition xnode.h:102
@ B_Cu
Definition layer_ids.h:61
@ F_SilkS
Definition layer_ids.h:96
@ F_Cu
Definition layer_ids.h:60
wxString ValidateName(const wxString &aName)
void SetWidth(const wxString &aStr, const wxString &aDefaultMeasurementUnit, int *aWidth, const wxString &aActualConversion)
static bool HasLine(std::vector< PCAD_LINE * > &vector, PCAD_LINE *line)
XNODE * FindNode(XNODE *aChild, const wxString &aTag)
wxString ValidateReference(const wxString &aRef)
void SetTextSizeFromStrokeFontHeight(EDA_TEXT *aText, int aTextHeight)
void SetPosition(const wxString &aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)
XNODE * FindPinMap(XNODE *aNode)
void CorrectTextPosition(TTEXTVALUE *aValue)
void SetFontProperty(XNODE *aNode, TTEXTVALUE *aTextValue, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
void InitTTextValue(TTEXTVALUE *aTextValue)
void SetTextSizeFromTrueTypeFontHeight(EDA_TEXT *aText, int aTextHeight)
@ LAYER_TYPE_PLANE
wxString result
Test unit parsing edge cases and error handling.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
Definition trigo.cpp:225
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683