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, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion) override
 
virtual void SetPosOffset (int aX_offs, int aY_offs) override
 
virtual void Flip () override
 
void AddToModule (MODULE *aModule) override
 
void AddToBoard () override
 
void AssignNet (const wxString &aNetName)
 
void SetOutline (VERTICES_ARRAY *aOutline)
 
void FormPolygon (XNODE *aNode, VERTICES_ARRAY *aPolygon, const wxString &aDefaultMeasurementUnit, const wxString &actualConversion)
 
PCB_LAYER_ID GetKiCadLayer ()
 
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
 
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 38 of file pcb_keepout.h.

Constructor & Destructor Documentation

◆ PCB_KEEPOUT()

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

Definition at line 37 of file pcb_keepout.cpp.

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

References PCAD2KICAD::PCB_COMPONENT::m_objType.

◆ ~PCB_KEEPOUT()

PCAD2KICAD::PCB_KEEPOUT::~PCB_KEEPOUT ( )

Definition at line 46 of file pcb_keepout.cpp.

47 {
48 }

Member Function Documentation

◆ AddToBoard()

void PCAD2KICAD::PCB_POLYGON::AddToBoard ( )
overridevirtualinherited

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 182 of file pcb_polygon.cpp.

183 {
184  int i = 0;
185 
186  if( m_outline.GetCount() > 0 )
187  {
188  ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board );
189  m_board->Add( zone, ADD_MODE::APPEND );
190 
191  zone->SetLayer( m_KiCadLayer );
192  zone->SetNetCode( m_netCode );
193 
194  // add outline
195  for( i = 0; i < (int) m_outline.GetCount(); i++ )
196  {
197  zone->AppendCorner( wxPoint( KiROUND( m_outline[i]->x ),
198  KiROUND( m_outline[i]->y ) ), -1 );
199  }
200 
201  zone->SetZoneClearance( m_width );
202 
203  zone->SetPriority( m_priority );
204 
206 
207  if ( m_objType == wxT( 'K' ) )
208  {
209  zone->SetIsKeepout( true );
210  zone->SetDoNotAllowTracks( true );
211  zone->SetDoNotAllowVias( true );
212  zone->SetDoNotAllowPads( true );
213  zone->SetDoNotAllowCopperPour( true );
214  zone->SetDoNotAllowFootprints( false );
215  }
216  else if( m_objType == wxT( 'C' ) )
217  {
218  // convert cutouts to keepouts because standalone cutouts are not supported in KiCad
219  zone->SetIsKeepout( true );
220  zone->SetDoNotAllowCopperPour( true );
221  zone->SetDoNotAllowTracks( false );
222  zone->SetDoNotAllowVias( false );
223  zone->SetDoNotAllowPads( false );
224  zone->SetDoNotAllowFootprints( false );
225  }
226 
227  //if( m_filled )
228  // zone->BuildFilledPolysListData( m_board );
229  }
230 }
void SetDoNotAllowTracks(bool aEnable)
Definition: class_zone.h:673
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
void SetHatch(ZONE_HATCH_STYLE aHatchStyle, int aHatchPitch, bool aRebuildHatch)
Function SetHatch sets all hatch parameters for the zone.
Definition: class_zone.cpp:927
void SetDoNotAllowFootprints(bool aEnable)
Definition: class_zone.h:675
static int GetDefaultHatchPitch()
Function GetDefaultHatchPitchMils.
void SetDoNotAllowVias(bool aEnable)
Definition: class_zone.h:672
void SetPriority(unsigned aPriority)
Function SetPriority.
Definition: class_zone.h:94
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:47
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
Definition: class_zone.cpp:246
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Sets net using a net code.
void SetZoneClearance(int aZoneClearance)
Definition: class_zone.h:175
void SetDoNotAllowPads(bool aEnable)
Definition: class_zone.h:674
void SetDoNotAllowCopperPour(bool aEnable)
Definition: class_zone.h:671
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:61
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: class_zone.cpp:884
void SetIsKeepout(bool aEnable)
Definition: class_zone.h:670

References BOARD::Add(), APPEND, ZONE_CONTAINER::AppendCorner(), DIAGONAL_EDGE, ZONE_CONTAINER::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_CONTAINER::SetDoNotAllowCopperPour(), ZONE_CONTAINER::SetDoNotAllowFootprints(), ZONE_CONTAINER::SetDoNotAllowPads(), ZONE_CONTAINER::SetDoNotAllowTracks(), ZONE_CONTAINER::SetDoNotAllowVias(), ZONE_CONTAINER::SetHatch(), ZONE_CONTAINER::SetIsKeepout(), ZONE_CONTAINER::SetLayer(), BOARD_CONNECTED_ITEM::SetNetCode(), ZONE_CONTAINER::SetPriority(), and ZONE_CONTAINER::SetZoneClearance().

◆ AddToModule()

void PCAD2KICAD::PCB_POLYGON::AddToModule ( MODULE aModule)
overridevirtualinherited

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 158 of file pcb_polygon.cpp.

159 {
161  {
162  EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON );
163  aModule->Add( dwg );
164 
165  dwg->SetWidth( 0 );
166  dwg->SetLayer( m_KiCadLayer );
167 
168  auto outline = new std::vector<wxPoint>;
169  for( auto point : m_outline )
170  outline->push_back( wxPoint( point->x, point->y ) );
171 
172  dwg->SetPolyPoints( *outline );
173  dwg->SetStart0( *outline->begin() );
174  dwg->SetEnd0( outline->back() );
175  dwg->SetDrawCoord();
176 
177  delete( outline );
178  }
179 }
void SetEnd0(const wxPoint &aPoint)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
polygon (not yet used for tracks, but could be in microwave apps)
bool IsNonCopperLayer(LAYER_NUM aLayerId)
Function IsNonCopperLayer tests whether a layer is a non copper layer.
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:47
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
void SetPolyPoints(const std::vector< wxPoint > &aPoints)
void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
void SetStart0(const wxPoint &aPoint)
void SetWidth(int aWidth)

References MODULE::Add(), IsNonCopperLayer(), PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, PCAD2KICAD::PCB_POLYGON::m_outline, S_POLYGON, EDGE_MODULE::SetDrawCoord(), EDGE_MODULE::SetEnd0(), BOARD_ITEM::SetLayer(), DRAWSEGMENT::SetPolyPoints(), EDGE_MODULE::SetStart0(), and DRAWSEGMENT::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 233 of file pcb_polygon.cpp.

234 {
236 
238 }
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:485

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 &  aDefaultMeasurementUnit,
const wxString &  actualConversion 
)
inherited

Definition at line 103 of file pcb_polygon.cpp.

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 }
void SetDoublePrecisionPosition(wxString aStr, const wxString &aDefaultMeasurementUnit, double *aX, double *aY, const wxString &aActualConversion)
XNODE holds an XML or S-expression element.
Definition: xnode.h:43
XNODE * GetNext() const
Definition: xnode.h:68
XNODE * FindNode(XNODE *aChild, const wxString &aTag)

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

◆ GetKiCadLayer()

◆ GetNetCode()

◆ Parse()

bool PCAD2KICAD::PCB_KEEPOUT::Parse ( XNODE aNode,
const wxString &  aDefaultMeasurementUnit,
const wxString &  aActualConversion 
)
overridevirtual

Reimplemented from PCAD2KICAD::PCB_POLYGON.

Definition at line 51 of file pcb_keepout.cpp.

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

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

◆ SetOutline()

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

Definition at line 87 of file pcb_polygon.cpp.

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

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

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

◆ SetPosOffset()

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

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 241 of file pcb_polygon.cpp.

242 {
243  int i, island;
244 
245  PCB_COMPONENT::SetPosOffset( aX_offs, aY_offs );
246 
247  for( i = 0; i < (int) m_outline.GetCount(); i++ )
248  {
249  m_outline[i]->x += aX_offs;
250  m_outline[i]->y += aY_offs;
251  }
252 
253  for( island = 0; island < (int) m_islands.GetCount(); island++ )
254  {
255  for( i = 0; i < (int) m_islands[island]->GetCount(); i++ )
256  {
257  (*m_islands[island])[i]->x += aX_offs;
258  (*m_islands[island])[i]->y += aY_offs;
259  }
260  }
261 
262  for( island = 0; island < (int) m_cutouts.GetCount(); island++ )
263  {
264  for( i = 0; i < (int) m_cutouts[island]->GetCount(); i++ )
265  {
266  (*m_cutouts[island])[i]->x += aX_offs;
267  (*m_cutouts[island])[i]->y += aY_offs;
268  }
269  }
270 }
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

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 51 of file pcb_component.h.

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

◆ m_uuid

KIID PCAD2KICAD::PCB_COMPONENT::m_uuid
inherited

Definition at line 55 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: