KiCad PCB EDA Suite
PCAD2KICAD::PCB_KEEPOUT Class Reference

#include <pcb_keepout.h>

Inheritance diagram for PCAD2KICAD::PCB_KEEPOUT:
PCAD2KICAD::PCB_POLYGON PCAD2KICAD::PCB_COMPONENT

Public Member Functions

 PCB_KEEPOUT (PCB_CALLBACKS *aCallbacks, BOARD *aBoard, int aPCadLayer)
 
 ~PCB_KEEPOUT ()
 
virtual bool Parse (XNODE *aNode, wxString aDefaultMeasurementUnit, wxString aActualConversion)
 
virtual bool Parse (XNODE *aNode, wxString aDefaultMeasurementUnit, wxString aActualConversion, wxStatusBar *aStatusBar)
 
virtual void SetPosOffset (int aX_offs, int aY_offs) override
 
void AddToModule (MODULE *aModule) override
 
void AddToBoard () override
 
void AssignNet (wxString aNetName)
 
void SetOutline (VERTICES_ARRAY *aOutline)
 
void FormPolygon (XNODE *aNode, VERTICES_ARRAY *aPolygon, wxString aDefaultMeasurementUnit, wxString actualConversion)
 
virtual void Flip ()
 
LAYER_ID GetKiCadLayer ()
 
int GetNewTimestamp ()
 
int GetNetCode (wxString aNetName)
 

Public Attributes

int m_width
 
int m_priority
 
VERTICES_ARRAY m_outline
 
ISLANDS_ARRAY m_islands
 
ISLANDS_ARRAY m_cutouts
 
int m_tag
 
char m_objType
 
int m_PCadLayer
 
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

bool m_filled
 
PCB_CALLBACKSm_callbacks
 
BOARDm_board
 

Detailed Description

Definition at line 38 of file pcb_keepout.h.

Constructor & Destructor Documentation

PCAD2KICAD::PCB_KEEPOUT::PCB_KEEPOUT ( PCB_CALLBACKS aCallbacks,
BOARD aBoard,
int  aPCadLayer 
)

Definition at line 38 of file pcb_keepout.cpp.

References PCAD2KICAD::PCB_COMPONENT::m_objType.

40  :
41  PCB_POLYGON( aCallbacks, aBoard, aPCadLayer )
42 {
43  m_objType = wxT( 'K' );
44 }
PCB_POLYGON(PCB_CALLBACKS *aCallbacks, BOARD *aBoard, int aPCadLayer)
Definition: pcb_polygon.cpp:39
PCAD2KICAD::PCB_KEEPOUT::~PCB_KEEPOUT ( )

Definition at line 47 of file pcb_keepout.cpp.

48 {
49 }

Member Function Documentation

void PCAD2KICAD::PCB_POLYGON::AddToBoard ( )
overridevirtualinherited

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 166 of file pcb_polygon.cpp.

References BOARD::Add(), ADD_APPEND, ZONE_CONTAINER::AppendCorner(), ZONE_CONTAINER::DIAGONAL_EDGE, ZONE_CONTAINER::GetDefaultHatchPitchMils(), KiROUND(), PCAD2KICAD::PCB_COMPONENT::m_board, PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, PCAD2KICAD::PCB_COMPONENT::m_netCode, PCAD2KICAD::PCB_COMPONENT::m_objType, PCAD2KICAD::PCB_POLYGON::m_outline, PCAD2KICAD::PCB_POLYGON::m_priority, PCAD2KICAD::PCB_COMPONENT::m_timestamp, PCAD2KICAD::PCB_POLYGON::m_width, ZONE_CONTAINER::SetDoNotAllowCopperPour(), ZONE_CONTAINER::SetDoNotAllowTracks(), ZONE_CONTAINER::SetDoNotAllowVias(), ZONE_CONTAINER::SetHatch(), ZONE_CONTAINER::SetIsKeepout(), BOARD_ITEM::SetLayer(), BOARD_CONNECTED_ITEM::SetNetCode(), ZONE_CONTAINER::SetPriority(), EDA_ITEM::SetTimeStamp(), and ZONE_CONTAINER::SetZoneClearance().

167 {
168  int i = 0;
169 
170  if( m_outline.GetCount() > 0 )
171  {
172  ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board );
173  m_board->Add( zone, ADD_APPEND );
174 
175  zone->SetTimeStamp( m_timestamp );
176  zone->SetLayer( m_KiCadLayer );
177  zone->SetNetCode( m_netCode );
178 
179  // add outline
180  int outline_hatch = ZONE_CONTAINER::DIAGONAL_EDGE;
181 
182  for( i = 0; i < (int) m_outline.GetCount(); i++ )
183  {
184  zone->AppendCorner( wxPoint( KiROUND( m_outline[i]->x ),
185  KiROUND( m_outline[i]->y ) ) );
186  }
187 
188  zone->SetZoneClearance( m_width );
189 
190  zone->SetPriority( m_priority );
191 
192  zone->SetHatch( outline_hatch, Mils2iu( zone->GetDefaultHatchPitchMils() ), true );
193 
194  if ( m_objType == wxT( 'K' ) )
195  {
196  zone->SetIsKeepout( true );
197  zone->SetDoNotAllowTracks( true );
198  zone->SetDoNotAllowVias( true );
199  zone->SetDoNotAllowCopperPour( true );
200  }
201  else if( m_objType == wxT( 'C' ) )
202  {
203  // convert cutouts to keepouts because standalone cutouts are not supported in KiCad
204  zone->SetIsKeepout( true );
205  zone->SetDoNotAllowCopperPour( true );
206  }
207 
208  //if( m_filled )
209  // cvpcb is not linked
210  // zone->BuildFilledPolysListData( m_board );
211  }
212 }
void SetDoNotAllowTracks(bool aEnable)
Definition: class_zone.h:652
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
virtual void SetLayer(LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
void SetHatch(int aHatchStyle, int aHatchPitch, bool aRebuildHatch)
Function SetHatch sets all hatch parameters for the zone.
Definition: class_zone.cpp:881
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:203
void SetDoNotAllowVias(bool aEnable)
Definition: class_zone.h:651
void SetPriority(unsigned aPriority)
Function SetPriority.
Definition: class_zone.h:113
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:47
void AppendCorner(wxPoint position, bool aAllowDuplication=false)
Function AppendCorner.
Definition: class_zone.h:546
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
>
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
void SetZoneClearance(int aZoneClearance)
Definition: class_zone.h:204
void SetDoNotAllowCopperPour(bool aEnable)
Definition: class_zone.h:650
static int GetDefaultHatchPitchMils()
Function GetDefaultHatchPitchMils.
Definition: class_zone.h:670
void SetIsKeepout(bool aEnable)
Definition: class_zone.h:649
void PCAD2KICAD::PCB_POLYGON::AddToModule ( MODULE aModule)
overridevirtualinherited

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 161 of file pcb_polygon.cpp.

162 {
163 }
void PCAD2KICAD::PCB_POLYGON::AssignNet ( wxString  aNetName)
inherited
void PCAD2KICAD::PCB_COMPONENT::Flip ( )
virtualinherited
void PCAD2KICAD::PCB_POLYGON::FormPolygon ( XNODE aNode,
VERTICES_ARRAY *  aPolygon,
wxString  aDefaultMeasurementUnit,
wxString  actualConversion 
)
inherited

Definition at line 104 of file pcb_polygon.cpp.

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

Referenced by PCAD2KICAD::PCB_MODULE::DoLayerContentsObjects(), Parse(), PCAD2KICAD::PCB_PLANE::Parse(), PCAD2KICAD::PCB_CUTOUT::Parse(), PCAD2KICAD::PCB_COPPER_POUR::Parse(), and PCAD2KICAD::PCB_POLYGON::Parse().

106 {
107  XNODE* lNode;
108  double x, y;
109 
110  lNode = FindNode( aNode, wxT( "pt" ) );
111 
112  while( lNode )
113  {
114  if( lNode->GetName() == wxT( "pt" ) )
115  {
117  lNode->GetNodeContent(), aDefaultMeasurementUnit, &x, &y, aActualConversion );
118  aPolygon->Add( new wxRealPoint( x, y ) );
119  }
120 
121  lNode = lNode->GetNext();
122  }
123 }
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 SetDoublePrecisionPosition(wxString aStr, wxString aDefaultMeasurementUnit, double *aX, double *aY, wxString aActualConversion)
int PCAD2KICAD::PCB_COMPONENT::GetNewTimestamp ( )
inlineinherited
bool PCAD2KICAD::PCB_KEEPOUT::Parse ( XNODE aNode,
wxString  aDefaultMeasurementUnit,
wxString  aActualConversion 
)
virtual

Definition at line 52 of file pcb_keepout.cpp.

References PCAD2KICAD::FindNode(), PCAD2KICAD::PCB_POLYGON::FormPolygon(), PCAD2KICAD::PCB_POLYGON::m_outline, PCAD2KICAD::PCB_COMPONENT::m_positionX, and PCAD2KICAD::PCB_COMPONENT::m_positionY.

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

55 {
56  XNODE* lNode;
57 
58  lNode = FindNode( aNode, wxT( "pcbPoly" ) );
59 
60  if( lNode )
61  {
62  // retrieve keepOut outline
63  FormPolygon( lNode, &m_outline, aDefaultMeasurementUnit, aActualConversion );
64 
65  m_positionX = m_outline[0]->x;
66  m_positionY = m_outline[0]->y;
67  }
68  else
69  {
70  return false;
71  }
72 
73  return true;
74 }
void FormPolygon(XNODE *aNode, VERTICES_ARRAY *aPolygon, wxString aDefaultMeasurementUnit, wxString actualConversion)
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:47
Class XNODE holds an XML or S-expression element.
Definition: xnode.h:43
XNODE * FindNode(XNODE *aChild, wxString aTag)
bool PCAD2KICAD::PCB_POLYGON::Parse ( XNODE aNode,
wxString  aDefaultMeasurementUnit,
wxString  aActualConversion,
wxStatusBar *  aStatusBar 
)
virtualinherited

Reimplemented in PCAD2KICAD::PCB_COPPER_POUR, and PCAD2KICAD::PCB_PLANE.

Definition at line 126 of file pcb_polygon.cpp.

References PCAD2KICAD::FindNode(), PCAD2KICAD::PCB_POLYGON::FormPolygon(), PCAD2KICAD::PCB_COMPONENT::GetNetCode(), PCAD2KICAD::PCB_POLYGON::m_islands, PCAD2KICAD::PCB_COMPONENT::m_net, PCAD2KICAD::PCB_COMPONENT::m_netCode, PCAD2KICAD::PCB_POLYGON::m_outline, PCAD2KICAD::PCB_COMPONENT::m_positionX, and PCAD2KICAD::PCB_COMPONENT::m_positionY.

Referenced by PCAD2KICAD::PCB_MODULE::DoLayerContentsObjects().

130 {
131  XNODE* lNode;
132  wxString propValue;
133 
134  // aStatusBar->SetStatusText( aStatusBar->GetStatusText() + wxT( " Polygon..." ) );
135 
136  lNode = FindNode( aNode, wxT( "netNameRef" ) );
137 
138  if( lNode )
139  {
140  lNode->GetAttribute( wxT( "Name" ), &propValue );
141  propValue.Trim( false );
142  propValue.Trim( true );
143  m_net = propValue;
145  }
146 
147  // retrieve polygon outline
148  FormPolygon( aNode, &m_outline, aDefaultMeasurementUnit, aActualConversion );
149 
150  m_positionX = m_outline[0]->x;
151  m_positionY = m_outline[0]->y;
152 
153  // fill the polygon with the same contour as its outline is
154  m_islands.Add( new VERTICES_ARRAY );
155  FormPolygon( aNode, m_islands[0], aDefaultMeasurementUnit, aActualConversion );
156 
157  return true;
158 }
void FormPolygon(XNODE *aNode, VERTICES_ARRAY *aPolygon, wxString aDefaultMeasurementUnit, wxString actualConversion)
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:47
Class XNODE holds an XML or S-expression element.
Definition: xnode.h:43
ISLANDS_ARRAY m_islands
Definition: pcb_polygon.h:48
XNODE * FindNode(XNODE *aChild, wxString aTag)
int GetNetCode(wxString aNetName)
Definition: pcb_component.h:75
void PCAD2KICAD::PCB_POLYGON::SetOutline ( VERTICES_ARRAY *  aOutline)
inherited

Definition at line 88 of file pcb_polygon.cpp.

References PCAD2KICAD::PCB_POLYGON::m_outline, PCAD2KICAD::PCB_COMPONENT::m_positionX, and PCAD2KICAD::PCB_COMPONENT::m_positionY.

Referenced by PCAD2KICAD::PCB_MODULE::DoLayerContentsObjects().

89 {
90  int i;
91 
92  m_outline.Empty();
93 
94  for( i = 0; i < (int) aOutline->GetCount(); i++ )
95  m_outline.Add( new wxRealPoint( (*aOutline)[i]->x, (*aOutline)[i]->y ) );
96 
97  if( m_outline.Count() > 0 )
98  {
99  m_positionX = m_outline[0]->x;
100  m_positionY = m_outline[0]->y;
101  }
102 }
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:47
void PCAD2KICAD::PCB_POLYGON::SetPosOffset ( int  aX_offs,
int  aY_offs 
)
overridevirtualinherited

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 215 of file pcb_polygon.cpp.

References PCAD2KICAD::PCB_POLYGON::m_cutouts, PCAD2KICAD::PCB_POLYGON::m_islands, PCAD2KICAD::PCB_POLYGON::m_outline, and PCAD2KICAD::PCB_COMPONENT::SetPosOffset().

216 {
217  int i, island;
218 
219  PCB_COMPONENT::SetPosOffset( aX_offs, aY_offs );
220 
221  for( i = 0; i < (int) m_outline.GetCount(); i++ )
222  {
223  m_outline[i]->x += aX_offs;
224  m_outline[i]->y += aY_offs;
225  }
226 
227  for( island = 0; island < (int) m_islands.GetCount(); island++ )
228  {
229  for( i = 0; i < (int) m_islands[island]->GetCount(); i++ )
230  {
231  (*m_islands[island])[i]->x += aX_offs;
232  (*m_islands[island])[i]->y += aY_offs;
233  }
234  }
235 
236  for( island = 0; island < (int) m_cutouts.GetCount(); island++ )
237  {
238  for( i = 0; i < (int) m_cutouts[island]->GetCount(); i++ )
239  {
240  (*m_cutouts[island])[i]->x += aX_offs;
241  (*m_cutouts[island])[i]->y += aY_offs;
242  }
243  }
244 }
ISLANDS_ARRAY m_cutouts
Definition: pcb_polygon.h:49
virtual void SetPosOffset(int aX_offs, int aY_offs)
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:47
ISLANDS_ARRAY m_islands
Definition: pcb_polygon.h:48

Member Data Documentation

wxString PCAD2KICAD::PCB_COMPONENT::m_compRef
inherited
ISLANDS_ARRAY PCAD2KICAD::PCB_POLYGON::m_cutouts
inherited
bool PCAD2KICAD::PCB_POLYGON::m_filled
protectedinherited
ISLANDS_ARRAY PCAD2KICAD::PCB_POLYGON::m_islands
inherited
wxString PCAD2KICAD::PCB_COMPONENT::m_patGraphRefName
inherited
int PCAD2KICAD::PCB_POLYGON::m_priority
inherited
int PCAD2KICAD::PCB_COMPONENT::m_tag
inherited

Definition at line 51 of file pcb_component.h.

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

int PCAD2KICAD::PCB_POLYGON::m_width
inherited

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