KiCad PCB EDA Suite
PCAD2KICAD::PCB_PLANE Class Reference

#include <pcb_plane.h>

Inheritance diagram for PCAD2KICAD::PCB_PLANE:
PCAD2KICAD::PCB_POLYGON PCAD2KICAD::PCB_COMPONENT

Public Member Functions

 PCB_PLANE (PCB_CALLBACKS *aCallbacks, BOARD *aBoard, int aPCadLayer)
 
 ~PCB_PLANE ()
 
virtual bool Parse (XNODE *aNode, const wxString &aDefaultUnits, const wxString &aActualConversion) override
 
virtual void SetPosOffset (int aX_offs, int aY_offs) override
 
virtual void Flip () override
 
void AddToFootprint (FOOTPRINT *aFootprint) override
 
void AddToBoard () override
 
void AssignNet (const wxString &aNetName)
 
void SetOutline (VERTICES_ARRAY *aOutline)
 
void FormPolygon (XNODE *aNode, VERTICES_ARRAY *aPolygon, const wxString &aDefaultUnits, const wxString &actualConversion)
 
PCB_LAYER_ID GetKiCadLayer () const
 
int GetNetCode (const wxString &aNetName) const
 

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
 
PCB_LAYER_ID m_KiCadLayer
 
KIID m_uuid
 
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 36 of file pcb_plane.h.

Constructor & Destructor Documentation

◆ PCB_PLANE()

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

Definition at line 35 of file pcb_plane.cpp.

37  :
38  PCB_POLYGON( aCallbacks, aBoard, aPCadLayer )
39 {
40  m_priority = 1;
41 }
PCB_POLYGON(PCB_CALLBACKS *aCallbacks, BOARD *aBoard, int aPCadLayer)
Definition: pcb_polygon.cpp:40

References PCAD2KICAD::PCB_POLYGON::m_priority.

◆ ~PCB_PLANE()

PCAD2KICAD::PCB_PLANE::~PCB_PLANE ( )

Definition at line 44 of file pcb_plane.cpp.

45 {
46 }

Member Function Documentation

◆ AddToBoard()

void PCAD2KICAD::PCB_POLYGON::AddToBoard ( )
overridevirtualinherited

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 186 of file pcb_polygon.cpp.

187 {
188  int i = 0;
189 
190  if( m_outline.GetCount() > 0 )
191  {
192  ZONE* zone = new ZONE( m_board );
193  m_board->Add( zone, ADD_MODE::APPEND );
194 
195  zone->SetLayer( m_KiCadLayer );
196  zone->SetNetCode( m_netCode );
197 
198  // add outline
199  for( i = 0; i < (int) m_outline.GetCount(); i++ )
200  {
201  zone->AppendCorner( wxPoint( KiROUND( m_outline[i]->x ),
202  KiROUND( m_outline[i]->y ) ), -1 );
203  }
204 
205  zone->SetLocalClearance( m_width );
206 
207  zone->SetPriority( m_priority );
208 
210  zone->GetDefaultHatchPitch(), true );
211 
212  if ( m_objType == wxT( 'K' ) )
213  {
214  zone->SetIsRuleArea( true );
215  zone->SetDoNotAllowTracks( true );
216  zone->SetDoNotAllowVias( true );
217  zone->SetDoNotAllowPads( true );
218  zone->SetDoNotAllowCopperPour( true );
219  zone->SetDoNotAllowFootprints( false );
220  }
221  else if( m_objType == wxT( 'C' ) )
222  {
223  // convert cutouts to keepouts because standalone cutouts are not supported in KiCad
224  zone->SetIsRuleArea( true );
225  zone->SetDoNotAllowCopperPour( true );
226  zone->SetDoNotAllowTracks( false );
227  zone->SetDoNotAllowVias( false );
228  zone->SetDoNotAllowPads( false );
229  zone->SetDoNotAllowFootprints( false );
230  }
231 
232  //if( m_filled )
233  // zone->BuildFilledPolysListData( m_board );
234  }
235 }
void SetDoNotAllowTracks(bool aEnable)
Definition: zone.h:745
void SetBorderDisplayStyle(ZONE_BORDER_DISPLAY_STYLE aHatchStyle, int aHatchPitch, bool aRebuildHatch)
Set all hatch parameters for the zone.
Definition: zone.cpp:896
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
void SetPriority(unsigned aPriority)
Definition: zone.h:117
void SetIsRuleArea(bool aEnable)
Definition: zone.h:742
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
Definition: board.cpp:606
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:66
static int GetDefaultHatchPitch()
Definition: zone.cpp:1088
void SetDoNotAllowPads(bool aEnable)
Definition: zone.h:746
void SetDoNotAllowVias(bool aEnable)
Definition: zone.h:744
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
bool AppendCorner(wxPoint aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
Definition: zone.cpp:836
void SetDoNotAllowCopperPour(bool aEnable)
Definition: zone.h:743
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: zone.cpp:238
void SetLocalClearance(int aClearance)
Definition: zone.h:158
void SetDoNotAllowFootprints(bool aEnable)
Definition: zone.h:747

References BOARD::Add(), APPEND, ZONE::AppendCorner(), DIAGONAL_EDGE, ZONE::GetDefaultHatchPitch(), 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_POLYGON::m_width, ZONE::SetBorderDisplayStyle(), ZONE::SetDoNotAllowCopperPour(), ZONE::SetDoNotAllowFootprints(), ZONE::SetDoNotAllowPads(), ZONE::SetDoNotAllowTracks(), ZONE::SetDoNotAllowVias(), ZONE::SetIsRuleArea(), ZONE::SetLayer(), ZONE::SetLocalClearance(), BOARD_CONNECTED_ITEM::SetNetCode(), and ZONE::SetPriority().

◆ AddToFootprint()

void PCAD2KICAD::PCB_POLYGON::AddToFootprint ( FOOTPRINT aFootprint)
overridevirtualinherited

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 162 of file pcb_polygon.cpp.

163 {
165  {
166  FP_SHAPE* dwg = new FP_SHAPE( aFootprint, SHAPE_T::POLY );
167  aFootprint->Add( dwg );
168 
169  dwg->SetWidth( 0 );
170  dwg->SetLayer( m_KiCadLayer );
171 
172  auto outline = new std::vector<wxPoint>;
173  for( auto point : m_outline )
174  outline->push_back( wxPoint( point->x, point->y ) );
175 
176  dwg->SetPolyPoints( *outline );
177  dwg->SetStart0( *outline->begin() );
178  dwg->SetEnd0( outline->back() );
179  dwg->SetDrawCoord();
180 
181  delete( outline );
182  }
183 }
void SetEnd0(const wxPoint &aPoint)
Definition: fp_shape.h:114
polygon (not yet used for tracks, but could be in microwave apps)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:192
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:66
bool IsNonCopperLayer(LAYER_NUM aLayerId)
Test whether a layer is a non copper layer.
Definition: layer_ids.h:798
void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
Definition: fp_shape.cpp:82
void SetStart0(const wxPoint &aPoint)
Definition: fp_shape.h:111
void SetWidth(int aWidth)
Definition: pcb_shape.h:96
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Removes an item from the container.
Definition: footprint.cpp:510
void SetPolyPoints(const std::vector< wxPoint > &aPoints)
Definition: pcb_shape.cpp:1153

References FOOTPRINT::Add(), IsNonCopperLayer(), PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, PCAD2KICAD::PCB_POLYGON::m_outline, POLY, FP_SHAPE::SetDrawCoord(), FP_SHAPE::SetEnd0(), BOARD_ITEM::SetLayer(), PCB_SHAPE::SetPolyPoints(), FP_SHAPE::SetStart0(), and PCB_SHAPE::SetWidth().

◆ AssignNet()

void PCAD2KICAD::PCB_POLYGON::AssignNet ( const wxString &  aNetName)
inherited

◆ Flip()

void PCAD2KICAD::PCB_POLYGON::Flip ( )
overridevirtualinherited

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 238 of file pcb_polygon.cpp.

239 {
241 
243 }
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition: lset.cpp:521

References PCAD2KICAD::PCB_COMPONENT::Flip(), FlipLayer(), and PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer.

◆ FormPolygon()

void PCAD2KICAD::PCB_POLYGON::FormPolygon ( XNODE aNode,
VERTICES_ARRAY *  aPolygon,
const wxString &  aDefaultUnits,
const wxString &  actualConversion 
)
inherited

Definition at line 109 of file pcb_polygon.cpp.

111 {
112  XNODE* lNode;
113  double x, y;
114 
115  lNode = FindNode( aNode, wxT( "pt" ) );
116 
117  while( lNode )
118  {
119  if( lNode->GetName() == wxT( "pt" ) )
120  {
121  SetDoublePrecisionPosition( lNode->GetNodeContent(), aDefaultUnits, &x, &y,
122  aActualConversion );
123  aPolygon->Add( new wxRealPoint( x, y ) );
124  }
125 
126  lNode = lNode->GetNext();
127  }
128 }
Hold an XML or S-expression element.
Definition: xnode.h:43
XNODE * GetNext() const
Definition: xnode.h:67
XNODE * FindNode(XNODE *aChild, const wxString &aTag)
void SetDoublePrecisionPosition(const wxString &aStr, const wxString &aDefaultMeasurementUnit, double *aX, double *aY, const wxString &aActualConversion)

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

Referenced by PCAD2KICAD::PCB_FOOTPRINT::DoLayerContentsObjects(), PCAD2KICAD::PCB_KEEPOUT::Parse(), Parse(), PCAD2KICAD::PCB_CUTOUT::Parse(), PCAD2KICAD::PCB_COPPER_POUR::Parse(), and PCAD2KICAD::PCB_POLYGON::Parse().

◆ GetKiCadLayer()

◆ GetNetCode()

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

◆ Parse()

bool PCAD2KICAD::PCB_PLANE::Parse ( XNODE aNode,
const wxString &  aDefaultUnits,
const wxString &  aActualConversion 
)
overridevirtual

Reimplemented from PCAD2KICAD::PCB_POLYGON.

Definition at line 49 of file pcb_plane.cpp.

51 {
52  XNODE* lNode;
53  wxString pourType, str, propValue;
54 
55  lNode = FindNode( aNode, wxT( "netNameRef" ) );
56 
57  if( lNode )
58  {
59  lNode->GetAttribute( wxT( "Name" ), &propValue );
60  propValue.Trim( false );
61  propValue.Trim( true );
62  m_net = propValue;
64  }
65 
66  if( FindNode( aNode, wxT( "width" ) ) )
67  {
68  SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(), aDefaultUnits, &m_width,
69  aActualConversion );
70  }
71 
72  lNode = FindNode( aNode, wxT( "pcbPoly" ) );
73 
74  if( lNode )
75  {
76  // retrieve plane outline
77  FormPolygon( lNode, &m_outline, aDefaultUnits, aActualConversion );
78 
79  m_positionX = m_outline[0]->x;
80  m_positionY = m_outline[0]->y;
81  }
82  else
83  {
84  return false;
85  }
86 
87  return true;
88 }
void SetWidth(const wxString &aStr, const wxString &aDefaultMeasurementUnit, int *aWidth, const wxString &aActualConversion)
int GetNetCode(const wxString &aNetName) const
Definition: pcb_component.h:58
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:66
void FormPolygon(XNODE *aNode, VERTICES_ARRAY *aPolygon, const wxString &aDefaultUnits, const wxString &actualConversion)
Hold an XML or S-expression element.
Definition: xnode.h:43
XNODE * FindNode(XNODE *aChild, const wxString &aTag)

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

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

◆ SetOutline()

void PCAD2KICAD::PCB_POLYGON::SetOutline ( VERTICES_ARRAY *  aOutline)
inherited

Definition at line 93 of file pcb_polygon.cpp.

94 {
95  int i;
96 
97  m_outline.Empty();
98 
99  for( i = 0; i < (int) aOutline->GetCount(); i++ )
100  m_outline.Add( new wxRealPoint( (*aOutline)[i]->x, (*aOutline)[i]->y ) );
101 
102  if( m_outline.Count() > 0 )
103  {
104  m_positionX = m_outline[0]->x;
105  m_positionY = m_outline[0]->y;
106  }
107 }
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:66

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

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

◆ SetPosOffset()

void PCAD2KICAD::PCB_POLYGON::SetPosOffset ( int  aX_offs,
int  aY_offs 
)
overridevirtualinherited

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 246 of file pcb_polygon.cpp.

247 {
248  int i, island;
249 
250  PCB_COMPONENT::SetPosOffset( aX_offs, aY_offs );
251 
252  for( i = 0; i < (int) m_outline.GetCount(); i++ )
253  {
254  m_outline[i]->x += aX_offs;
255  m_outline[i]->y += aY_offs;
256  }
257 
258  for( island = 0; island < (int) m_islands.GetCount(); island++ )
259  {
260  for( i = 0; i < (int) m_islands[island]->GetCount(); i++ )
261  {
262  (*m_islands[island])[i]->x += aX_offs;
263  (*m_islands[island])[i]->y += aY_offs;
264  }
265  }
266 
267  for( island = 0; island < (int) m_cutouts.GetCount(); island++ )
268  {
269  for( i = 0; i < (int) m_cutouts[island]->GetCount(); i++ )
270  {
271  (*m_cutouts[island])[i]->x += aX_offs;
272  (*m_cutouts[island])[i]->y += aY_offs;
273  }
274  }
275 }
ISLANDS_ARRAY m_cutouts
Definition: pcb_polygon.h:68
virtual void SetPosOffset(int aX_offs, int aY_offs)
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:66
ISLANDS_ARRAY m_islands
Definition: pcb_polygon.h:67

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

Member Data Documentation

◆ m_board

◆ m_callbacks

◆ m_compRef

wxString PCAD2KICAD::PCB_COMPONENT::m_compRef
inherited

◆ m_cutouts

ISLANDS_ARRAY PCAD2KICAD::PCB_POLYGON::m_cutouts
inherited

◆ m_filled

bool PCAD2KICAD::PCB_POLYGON::m_filled
protectedinherited

◆ m_islands

ISLANDS_ARRAY PCAD2KICAD::PCB_POLYGON::m_islands
inherited

◆ m_KiCadLayer

◆ m_name

◆ m_net

◆ m_netCode

◆ m_objType

◆ m_outline

◆ m_patGraphRefName

wxString PCAD2KICAD::PCB_COMPONENT::m_patGraphRefName
inherited

◆ m_PCadLayer

◆ m_positionX

◆ m_positionY

◆ m_priority

int PCAD2KICAD::PCB_POLYGON::m_priority
inherited

◆ 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_width

int PCAD2KICAD::PCB_POLYGON::m_width
inherited

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