KiCad PCB EDA Suite
PCAD2KICAD::PCB_MODULE Class Reference

#include <pcb_module.h>

Inheritance diagram for PCAD2KICAD::PCB_MODULE:
PCAD2KICAD::PCB_COMPONENT PCAD2KICAD::PCB

Public Member Functions

 PCB_MODULE (PCB_CALLBACKS *aCallbacks, BOARD *aBoard)
 
 ~PCB_MODULE ()
 
XNODEFindModulePatternDefName (XNODE *aNode, wxString aName)
 
void DoLayerContentsObjects (XNODE *aNode, PCB_MODULE *aPCBModule, PCB_COMPONENTS_ARRAY *aList, wxStatusBar *aStatusBar, wxString aDefaultMeasurementUnit, wxString aActualConversion)
 
void SetPadName (wxString aPin, wxString aName)
 
virtual void Parse (XNODE *aNode, wxStatusBar *aStatusBar, wxString aDefaultMeasurementUnit, wxString aActualConversion)
 
virtual void Flip () override
 
void AddToBoard () override
 
virtual void SetPosOffset (int aX_offs, int aY_offs)
 
virtual void AddToModule (MODULE *aModule)
 
PCB_LAYER_ID GetKiCadLayer ()
 
int GetNewTimestamp ()
 
int GetNetCode (wxString aNetName)
 

Public Attributes

TTEXTVALUE m_value
 
PCB_COMPONENTS_ARRAY m_moduleObjects
 
int m_mirror
 
VERTICES_ARRAY m_boardOutline
 
int m_tag
 
char m_objType
 
int m_PCadLayer
 
PCB_LAYER_ID m_KiCadLayer
 
int m_timestamp
 
int m_positionX
 
int m_positionY
 
int 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)
 
wxString ModuleLayer (int aMirror)
 

Detailed Description

Definition at line 40 of file pcb_module.h.

Constructor & Destructor Documentation

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

Definition at line 50 of file pcb_module.cpp.

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::Parse().

50  : PCB_COMPONENT( aCallbacks,
51  aBoard )
52 {
54  m_mirror = 0;
55  m_objType = wxT( 'M' ); // MODULE
56  m_KiCadLayer = F_SilkS; // default
57 }
void InitTTextValue(TTEXTVALUE *aTextValue)
PCB_COMPONENT(PCB_CALLBACKS *aCallbacks, BOARD *aBoard)
PCAD2KICAD::PCB_MODULE::~PCB_MODULE ( )

Definition at line 60 of file pcb_module.cpp.

References m_moduleObjects.

61 {
62  int i;
63 
64  for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
65  {
66  delete m_moduleObjects[i];
67  }
68 }
PCB_COMPONENTS_ARRAY m_moduleObjects
Definition: pcb_module.h:44

Member Function Documentation

void PCAD2KICAD::PCB_MODULE::AddToBoard ( )
overridevirtual

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 502 of file pcb_module.cpp.

References BOARD::Add(), ADD_APPEND, PCAD2KICAD::PCB_COMPONENT::AddToModule(), B_Cu, MODULE::CalculateBoundingBox(), PCAD2KICAD::_TTEXTVALUE::correctedPositionX, PCAD2KICAD::_TTEXTVALUE::correctedPositionY, PCAD2KICAD::CorrectTextPosition(), F_Cu, PCAD2KICAD::PCB_COMPONENT::m_board, PCAD2KICAD::PCB_COMPONENT::m_compRef, PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, m_mirror, m_moduleObjects, 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, MOD_CMS, MOD_DEFAULT, MODULE::Reference(), RotatePoint(), MODULE::SetAttributes(), TEXTE_MODULE::SetDrawCoord(), MODULE::SetFPID(), MODULE::SetLastEditTime(), BOARD_ITEM::SetLayer(), EDA_TEXT::SetMirrored(), MODULE::SetOrientation(), TEXTE_MODULE::SetPos0(), MODULE::SetPosition(), EDA_TEXT::SetText(), TEXTE_MODULE::SetTextAngle(), PCAD2KICAD::SetTextSizeFromStrokeFontHeight(), EDA_TEXT::SetThickness(), EDA_ITEM::SetTimeStamp(), TEXTE_MODULE::SetType(), EDA_TEXT::SetVisible(), PCAD2KICAD::_TTEXTVALUE::text, TEXTE_MODULE::TEXT_is_REFERENCE, TEXTE_MODULE::TEXT_is_VALUE, PCAD2KICAD::_TTEXTVALUE::textHeight, PCAD2KICAD::_TTEXTVALUE::textIsVisible, PCAD2KICAD::_TTEXTVALUE::textRotation, PCAD2KICAD::_TTEXTVALUE::textstrokeWidth, and MODULE::Value().

503 {
504  int i;
505  int r;
506 
507  // transform text positions
510  (double) -m_rotation );
511 
514  (double) -m_rotation );
515 
516  MODULE* module = new MODULE( m_board );
517  m_board->Add( module, ADD_APPEND );
518 
520  module->SetLayer( m_mirror ? B_Cu : F_Cu );
521  module->SetOrientation( m_rotation );
522  module->SetTimeStamp( 0 );
523  module->SetLastEditTime( 0 );
524 
525  module->SetFPID( LIB_ID( m_compRef ) );
526 
527  module->SetAttributes( MOD_DEFAULT | MOD_CMS );
528 
529  // reference text
530  TEXTE_MODULE* ref_text = &module->Reference();
531 
532  ref_text->SetText( m_name.text );
534 
537 
539  ref_text->SetTextAngle( r );
540 
541  ref_text->SetThickness( m_name.textstrokeWidth );
542 
543  ref_text->SetMirrored( m_name.mirror );
544  ref_text->SetVisible( m_name.textIsVisible );
545 
546  ref_text->SetLayer( m_KiCadLayer );
547 
548  // Calculate the actual position.
549  ref_text->SetDrawCoord();
550 
551  // value text
552  TEXTE_MODULE* val_text = &module->Value();
553 
554  val_text->SetText( m_value.text );
556 
559 
561  val_text->SetTextAngle( r );
562 
563  val_text->SetThickness( m_value.textstrokeWidth );
564 
565  val_text->SetMirrored( m_value.mirror );
566  val_text->SetVisible( m_value.textIsVisible );
567 
568  val_text->SetLayer( m_KiCadLayer );
569 
570  // Calculate the actual position.
571  val_text->SetDrawCoord();
572 
573  // TEXTS
574  for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
575  {
576  if( m_moduleObjects[i]->m_objType == wxT( 'T' ) )
577  {
578  ( (PCB_TEXT*) m_moduleObjects[i] )->m_tag = i + 2;
579  m_moduleObjects[i]->AddToModule( module );
580  }
581  }
582 
583  // MODULE LINES
584  for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
585  {
586  if( m_moduleObjects[i]->m_objType == wxT( 'L' ) )
587  m_moduleObjects[i]->AddToModule( module );
588  }
589 
590  // MODULE Arcs
591  for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
592  {
593  if( m_moduleObjects[i]->m_objType == wxT( 'A' ) )
594  m_moduleObjects[i]->AddToModule( module );
595  }
596 
597  // PADS
598  for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
599  {
600  if( m_moduleObjects[i]->m_objType == wxT( 'P' ) )
601  ( (PCB_PAD*) m_moduleObjects[i] )->AddToModule( module, m_rotation, false );
602  }
603 
604  // VIAS
605  for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
606  {
607  if( m_moduleObjects[i]->m_objType == wxT( 'V' ) )
608  ( (PCB_VIA*) m_moduleObjects[i] )->AddToModule( module, m_rotation, false );
609  }
610 
611  module->CalculateBoundingBox();
612 }
void SetMirrored(bool isMirrored)
Definition: eda_text.h:178
TEXTE_MODULE & Reference()
Definition: class_module.h:463
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
void SetVisible(bool aVisible)
Definition: eda_text.h:175
Set for modules listed in the automatic insertion list (usually SMD footprints)
Definition: class_module.h:77
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
Class LIB_ID.
Definition: lib_id.h:56
void SetLastEditTime(time_t aTime)
Definition: class_module.h:282
virtual void AddToModule(MODULE *aModule)
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:203
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:462
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
Adds an item to the container.
void SetPosition(const wxPoint &aPos) override
void SetType(TEXT_TYPE aType)
void SetPos0(const wxPoint &aPos)
default
Definition: class_module.h:76
void SetOrientation(double newangle)
void CorrectTextPosition(TTEXTVALUE *aValue)
void SetDrawCoord()
Set absolute coordinates.
PCB_COMPONENTS_ARRAY m_moduleObjects
Definition: pcb_module.h:44
void SetTextSizeFromStrokeFontHeight(EDA_TEXT *aText, int aTextHeight)
void SetTextAngle(double aAngle)
void SetFPID(const LIB_ID &aFPID)
Definition: class_module.h:165
void SetThickness(int aNewThickness)
Function SetThickness sets pen width.
Definition: eda_text.h:148
void SetAttributes(int aAttributes)
Definition: class_module.h:198
virtual void SetText(const wxString &aText)
Definition: eda_text.h:141
void PCAD2KICAD::PCB_COMPONENT::AddToModule ( MODULE aModule)
virtualinherited

Reimplemented in PCAD2KICAD::PCB_POLYGON, PCAD2KICAD::PCB_LINE, PCAD2KICAD::PCB_ARC, and PCAD2KICAD::PCB_TEXT.

Definition at line 64 of file pcb_component.cpp.

Referenced by AddToBoard().

65 {
66 }
void PCAD2KICAD::PCB_MODULE::DoLayerContentsObjects ( XNODE aNode,
PCB_MODULE aPCBModule,
PCB_COMPONENTS_ARRAY *  aList,
wxStatusBar *  aStatusBar,
wxString  aDefaultMeasurementUnit,
wxString  aActualConversion 
)

Definition at line 217 of file pcb_module.cpp.

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_PLANE::Parse(), PCAD2KICAD::PCB_COPPER_POUR::Parse(), PCAD2KICAD::PCB_CUTOUT::Parse(), PCAD2KICAD::PCB_TEXT::Parse(), PCAD2KICAD::PCB_LINE::Parse(), PCAD2KICAD::PCB_ARC::Parse(), PCAD2KICAD::PCB_POLYGON::Parse(), PCAD2KICAD::SetFontProperty(), and PCAD2KICAD::PCB_POLYGON::SetOutline().

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

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

Definition at line 71 of file pcb_module.cpp.

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

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

72 {
73  XNODE* result, * lNode;
74  wxString propValue1, propValue2;
75 
76  result = NULL;
77  lNode = FindNode( aNode, wxT( "patternDef" ) );
78 
79  while( lNode )
80  {
81  if( lNode->GetName() == wxT( "patternDef" ) )
82  {
83  lNode->GetAttribute( wxT( "Name" ), &propValue1 );
84  FindNode( lNode,
85  wxT( "originalName" ) )->GetAttribute( wxT( "Name" ), &propValue2 );
86 
87  if( ValidateName( propValue1 ) == aName
88  || ValidateName( propValue2 ) == aName )
89  {
90  result = lNode;
91  lNode = NULL;
92  }
93  }
94 
95  if( lNode )
96  lNode = lNode->GetNext();
97  }
98 
99  if( result == NULL )
100  {
101  lNode = FindNode( aNode, wxT( "patternDefExtended" ) ); // New file format
102 
103  while( lNode )
104  {
105  if( lNode->GetName() == wxT( "patternDefExtended" ) )
106  {
107  lNode->GetAttribute( wxT( "Name" ), &propValue1 );
108 
109  if( ValidateName( propValue1 ) == aName )
110  {
111  result = lNode;
112  lNode = NULL;
113  }
114  }
115 
116  if( lNode )
117  lNode = lNode->GetNext();
118  }
119  }
120 
121  return result;
122 }
wxString ValidateName(wxString aName)
Class XNODE holds an XML or S-expression element.
Definition: xnode.h:43
XNODE * FindNode(XNODE *aChild, wxString aTag)
XNODE * GetNext() const
Definition: xnode.h:68
XNODE * PCAD2KICAD::PCB_MODULE::FindPatternMultilayerSection ( XNODE aNode,
wxString *  aPatGraphRefName 
)
private

Definition at line 125 of file pcb_module.cpp.

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

Referenced by Parse().

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

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 615 of file pcb_module.cpp.

References FlipLayer(), PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, m_mirror, m_moduleObjects, PCAD2KICAD::PCB_COMPONENT::m_objType, and PCAD2KICAD::PCB_COMPONENT::m_rotation.

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

616 {
617  int i;
618 
619  if( m_mirror == 1 )
620  {
621  // Flipped
624 
625  for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
626  {
627  if( m_moduleObjects[i]->m_objType == wxT( 'L' ) || // lines
628  m_moduleObjects[i]->m_objType == wxT( 'A' ) || // arcs
629  m_moduleObjects[i]->m_objType == wxT( 'P' ) || // pads
630  m_moduleObjects[i]->m_objType == wxT( 'V' ) ) // vias
631  {
632  m_moduleObjects[i]->Flip();
633  }
634  }
635  }
636 }
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:445
PCB_COMPONENTS_ARRAY m_moduleObjects
Definition: pcb_module.h:44
int PCAD2KICAD::PCB_COMPONENT::GetNewTimestamp ( )
inlineinherited
wxString PCAD2KICAD::PCB_MODULE::ModuleLayer ( int  aMirror)
private

Definition at line 485 of file pcb_module.cpp.

486 {
487  wxString result;
488 
489  // ///NOT ! {IntToStr(KiCadLayer)} NOT !
490  // / MODULES ARE HARD PLACED ON COMPONENT OR COPPER LAYER.
491  // / IsFLIPPED--> MIRROR attribute is decision Point!!!
492 
493  if( aMirror == 0 )
494  result = wxT( "15" ); // Components side
495  else
496  result = wxT( "0" ); // Copper side
497 
498  return result;
499 }
void PCAD2KICAD::PCB_MODULE::Parse ( XNODE aNode,
wxStatusBar *  aStatusBar,
wxString  aDefaultMeasurementUnit,
wxString  aActualConversion 
)
virtual

Definition at line 393 of file pcb_module.cpp.

References DoLayerContentsObjects(), PCAD2KICAD::FindNode(), FindPatternMultilayerSection(), PCAD2KICAD::FindPinMap(), XNODE::GetChildren(), XNODE::GetNext(), XNODE::GetParent(), PCAD2KICAD::PCB_COMPONENT::m_board, PCAD2KICAD::PCB_COMPONENT::m_callbacks, m_moduleObjects, PCAD2KICAD::PCB_COMPONENT::m_name, PCAD2KICAD::PCB_COMPONENT::m_patGraphRefName, PCAD2KICAD::PCB_VIA::Parse(), PCAD2KICAD::PCB_PAD::Parse(), SetPadName(), and PCAD2KICAD::_TTEXTVALUE::text.

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

395 {
396  XNODE* lNode, * tNode, * mNode;
397  PCB_PAD* pad;
398  PCB_VIA* via;
399  wxString propValue, str;
400 
401  FindNode( aNode, wxT( "originalName" ) )->GetAttribute( wxT( "Name" ),
402  &propValue );
403  propValue.Trim( false );
404  m_name.text = propValue;
405 
406  // aStatusBar->SetStatusText( wxT( "Creating Component : " ) + m_name.text );
407  lNode = aNode;
409 
410  if( lNode )
411  {
412  tNode = lNode;
413  tNode = tNode->GetChildren();
414 
415  while( tNode )
416  {
417  if( tNode->GetName() == wxT( "pad" ) )
418  {
419  pad = new PCB_PAD( m_callbacks, m_board );
420  pad->Parse( tNode, aDefaultMeasurementUnit, aActualConversion );
421  m_moduleObjects.Add( pad );
422  }
423 
424  if( tNode->GetName() == wxT( "via" ) )
425  {
426  via = new PCB_VIA( m_callbacks, m_board );
427  via->Parse( tNode, aDefaultMeasurementUnit, aActualConversion );
428  m_moduleObjects.Add( via );
429  }
430 
431  tNode = tNode->GetNext();
432  }
433  }
434 
435  if( lNode )
436  lNode = lNode->GetParent();
437 
438  if( lNode )
439  lNode = FindNode( lNode, wxT( "layerContents" ) );
440 
441  while( lNode )
442  {
443  if( lNode->GetName() == wxT( "layerContents" ) )
444  DoLayerContentsObjects( lNode, this, &m_moduleObjects, aStatusBar,
445  aDefaultMeasurementUnit, aActualConversion );
446 
447  lNode = lNode->GetNext();
448  }
449 
450  // map pins
451  lNode = FindPinMap( aNode );
452 
453  if( lNode )
454  {
455  mNode = lNode->GetChildren();
456 
457  while( mNode )
458  {
459  if( mNode->GetName() == wxT( "padNum" ) )
460  {
461  str = mNode->GetNodeContent();
462  mNode = mNode->GetNext();
463 
464  if( !mNode )
465  break;
466 
467  mNode->GetAttribute( wxT( "Name" ), &propValue );
468  SetPadName( str, propValue );
469  mNode = mNode->GetNext();
470  }
471  else
472  {
473  mNode = mNode->GetNext();
474 
475  if( !mNode )
476  break;
477 
478  mNode = mNode->GetNext();
479  }
480  }
481  }
482 }
XNODE * FindPatternMultilayerSection(XNODE *aNode, wxString *aPatGraphRefName)
Definition: pcb_module.cpp:125
XNODE * GetParent() const
Definition: xnode.h:73
XNODE * GetChildren() const
Definition: xnode.h:63
Class XNODE holds an XML or S-expression element.
Definition: xnode.h:43
PCB_COMPONENTS_ARRAY m_moduleObjects
Definition: pcb_module.h:44
XNODE * FindNode(XNODE *aChild, wxString aTag)
PCB_CALLBACKS * m_callbacks
Definition: pcb_component.h:78
void DoLayerContentsObjects(XNODE *aNode, PCB_MODULE *aPCBModule, PCB_COMPONENTS_ARRAY *aList, wxStatusBar *aStatusBar, wxString aDefaultMeasurementUnit, wxString aActualConversion)
Definition: pcb_module.cpp:217
XNODE * GetNext() const
Definition: xnode.h:68
XNODE * FindPinMap(XNODE *aNode)
void SetPadName(wxString aPin, wxString aName)
Definition: pcb_module.cpp:375
void PCAD2KICAD::PCB_MODULE::SetPadName ( wxString  aPin,
wxString  aName 
)

Definition at line 375 of file pcb_module.cpp.

References m_moduleObjects, PCAD2KICAD::PCB_COMPONENT::m_name, PCAD2KICAD::PCB_COMPONENT::m_objType, and PCAD2KICAD::_TTEXTVALUE::text.

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

376 {
377  int i;
378  long num;
379 
380  aPin.ToLong( &num );
381 
382  for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
383  {
384  if( m_moduleObjects[i]->m_objType == wxT( 'P' ) )
385  if( ( (PCB_PAD*) m_moduleObjects[i] )->m_number == num )
386  ( (PCB_PAD*) m_moduleObjects[i] )->m_name.text = aName;
387 
388 
389  }
390 }
PCB_COMPONENTS_ARRAY m_moduleObjects
Definition: pcb_module.h:44
void PCAD2KICAD::PCB_COMPONENT::SetPosOffset ( int  aX_offs,
int  aY_offs 
)
virtualinherited

Member Data Documentation

VERTICES_ARRAY PCAD2KICAD::PCB_MODULE::m_boardOutline

Definition at line 46 of file pcb_module.h.

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

wxString PCAD2KICAD::PCB_COMPONENT::m_compRef
inherited
int PCAD2KICAD::PCB_MODULE::m_mirror

Definition at line 45 of file pcb_module.h.

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

PCB_COMPONENTS_ARRAY PCAD2KICAD::PCB_MODULE::m_moduleObjects
wxString PCAD2KICAD::PCB_COMPONENT::m_patGraphRefName
inherited
int PCAD2KICAD::PCB_COMPONENT::m_tag
inherited

Definition at line 51 of file pcb_component.h.

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

TTEXTVALUE PCAD2KICAD::PCB_MODULE::m_value

Definition at line 43 of file pcb_module.h.

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


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