KiCad PCB EDA Suite
DRC_KEEPOUT_TESTER Class Reference

#include <drc_keepout_tester.h>

Inheritance diagram for DRC_KEEPOUT_TESTER:
DRC_TEST_PROVIDER

Public Types

using MARKER_HANDLER = std::function< void(MARKER_PCB *)>
 A callable that can handle a single generated PCB_MARKER. More...
 

Public Member Functions

 DRC_KEEPOUT_TESTER (MARKER_HANDLER aMarkerHandler)
 
virtual ~DRC_KEEPOUT_TESTER ()
 
bool RunDRC (EDA_UNITS aUnits, BOARD &aBoard) override
 Runs this provider against the given PCB with configured options (if any). More...
 

Protected Member Functions

void HandleMarker (MARKER_PCB *aMarker) const
 Pass a given marker to the marker handler. More...
 

Private Member Functions

bool checkTracksAndVias ()
 
bool checkFootprints ()
 
bool checkPads (MODULE *aModule)
 
bool checkDrawings ()
 

Private Attributes

EDA_UNITS m_units
 
BOARDm_board
 
ZONE_CONTAINERm_zone
 
EDA_RECT m_zoneBBox
 
int m_keepoutFlags
 
std::map< int, wxString > m_sources
 
wxString m_msg
 

Detailed Description

Definition at line 34 of file drc_keepout_tester.h.

Member Typedef Documentation

◆ MARKER_HANDLER

using DRC_TEST_PROVIDER::MARKER_HANDLER = std::function<void( MARKER_PCB* )>
inherited

A callable that can handle a single generated PCB_MARKER.

Definition at line 47 of file drc_provider.h.

Constructor & Destructor Documentation

◆ DRC_KEEPOUT_TESTER()

DRC_KEEPOUT_TESTER::DRC_KEEPOUT_TESTER ( MARKER_HANDLER  aMarkerHandler)

Definition at line 31 of file drc_keepout_tester.cpp.

31  :
32  DRC_TEST_PROVIDER( std::move( aMarkerHandler ) ),
34  m_board( nullptr ),
35  m_zone( nullptr ),
36  m_keepoutFlags( 0 )
37 {
38 }
DRC_TEST_PROVIDER(MARKER_HANDLER aMarkerHandler)
Definition: drc_provider.h:60
ZONE_CONTAINER * m_zone

◆ ~DRC_KEEPOUT_TESTER()

virtual DRC_KEEPOUT_TESTER::~DRC_KEEPOUT_TESTER ( )
inlinevirtual

Definition at line 39 of file drc_keepout_tester.h.

39 {};

Member Function Documentation

◆ checkDrawings()

bool DRC_KEEPOUT_TESTER::checkDrawings ( )
private

Definition at line 292 of file drc_keepout_tester.cpp.

293 {
294  constexpr int CHECK_DRAWINGS_MASK = DISALLOW_TEXTS | DISALLOW_GRAPHICS;
295  constexpr KICAD_T graphicTypes[] = { PCB_LINE_T, PCB_DIMENSION_T, PCB_TARGET_T, EOT };
296 
297  if(( m_keepoutFlags & CHECK_DRAWINGS_MASK ) == 0 )
298  return true;
299 
300  bool success = true;
301 
302  for( BOARD_ITEM* drawing : m_board->Drawings() )
303  {
304  if( !m_zoneBBox.Intersects( drawing->GetBoundingBox() ) )
305  continue;
306 
307  int sourceId = 0;
308 
309  if( drawing->IsType( graphicTypes ) && ( m_keepoutFlags & DISALLOW_GRAPHICS ) > 0 )
310  sourceId = DISALLOW_GRAPHICS;
311  else if( drawing->Type() == PCB_TEXT_T && ( m_keepoutFlags & DISALLOW_TEXTS ) > 0 )
312  sourceId = DISALLOW_TEXTS;
313  else
314  continue;
315 
316  SHAPE_POLY_SET poly;
317  drawing->TransformShapeWithClearanceToPolygon( poly, 0 );
318 
319  // Build the common area between footprint and the keepout area:
321 
322  // If it's not empty then we have a violation
323  if( poly.OutlineCount() )
324  {
325  const VECTOR2I& pt = poly.CVertex( 0, 0, -1 );
326  DRC_ITEM* drcItem = DRC_ITEM::Create( DRCE_KEEPOUT );
327  m_msg.Printf( drcItem->GetErrorText() + _( " (%s)" ), m_sources.at( sourceId ) );
328  drcItem->SetErrorMessage( m_msg );
329  drcItem->SetItems( drawing, m_zone );
330 
331  HandleMarker( new MARKER_PCB( drcItem, (wxPoint) pt ) );
332  success = false;
333  }
334  }
335 
336  return success;
337 }
#define DISALLOW_TEXTS
Definition: drc_rule.h:47
int OutlineCount() const
Returns the number of outlines in the set
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
void SetItems(EDA_ITEM *aItem, EDA_ITEM *bItem=nullptr, EDA_ITEM *cItem=nullptr, EDA_ITEM *dItem=nullptr)
Definition: rc_item.h:119
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:271
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
wxString GetErrorText() const
Definition: rc_item.h:169
std::map< int, wxString > m_sources
#define DISALLOW_GRAPHICS
Definition: drc_rule.h:48
SHAPE_POLY_SET.
void HandleMarker(MARKER_PCB *aMarker) const
Pass a given marker to the marker handler.
Definition: drc_provider.h:68
static DRC_ITEM * Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:197
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset intersection For aFastMode meaning, see function booleanOp
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:100
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:101
#define _(s)
Definition: 3d_actions.cpp:33
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
void SetErrorMessage(const wxString &aMessage)
Definition: rc_item.h:117
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
ZONE_CONTAINER * m_zone
DRAWINGS & Drawings()
Definition: class_board.h:275
A disallowed object is inside a keepout.
Definition: drc.h:60

References _, SHAPE_POLY_SET::BooleanIntersection(), DRC_ITEM::Create(), SHAPE_POLY_SET::CVertex(), DISALLOW_GRAPHICS, DISALLOW_TEXTS, BOARD::Drawings(), DRCE_KEEPOUT, EOT, RC_ITEM::GetErrorText(), DRC_TEST_PROVIDER::HandleMarker(), EDA_RECT::Intersects(), m_board, m_keepoutFlags, m_msg, m_sources, m_zone, m_zoneBBox, ZONE_CONTAINER::Outline(), SHAPE_POLY_SET::OutlineCount(), PCB_DIMENSION_T, PCB_LINE_T, PCB_TARGET_T, PCB_TEXT_T, SHAPE_POLY_SET::PM_FAST, RC_ITEM::SetErrorMessage(), and RC_ITEM::SetItems().

Referenced by RunDRC().

◆ checkFootprints()

bool DRC_KEEPOUT_TESTER::checkFootprints ( )
private

Definition at line 162 of file drc_keepout_tester.cpp.

163 {
164  constexpr int CHECK_PADS_MASK = DISALLOW_PADS | DISALLOW_HOLES;
165  constexpr int CHECK_FOOTPRINTS_MASK = CHECK_PADS_MASK | DISALLOW_FOOTPRINTS;
166 
167  if(( m_keepoutFlags & CHECK_FOOTPRINTS_MASK ) == 0 )
168  return true;
169 
170  bool success = true;
171 
172  for( MODULE* fp : m_board->Modules() )
173  {
174  if( !m_zoneBBox.Intersects( fp->GetBoundingBox() ) )
175  continue;
176 
177  if( ( m_keepoutFlags & DISALLOW_FOOTPRINTS ) > 0
178  && ( fp->IsFlipped() ? m_zone->CommonLayerExists( LSET::BackMask() )
180  {
181  SHAPE_POLY_SET poly;
182 
183  if( fp->BuildPolyCourtyard() )
184  poly = fp->IsFlipped() ? fp->GetPolyCourtyardBack() : fp->GetPolyCourtyardFront();
185 
186  if( poly.OutlineCount() == 0 )
187  poly = fp->GetBoundingPoly();
188 
189  // Build the common area between footprint and the keepout area:
191 
192  // If it's not empty then we have a violation
193  if( poly.OutlineCount() )
194  {
195  const VECTOR2I& pt = poly.CVertex( 0, 0, -1 );
196  DRC_ITEM* drcItem = DRC_ITEM::Create( DRCE_KEEPOUT );
197 
198  m_msg.Printf( drcItem->GetErrorText() + _( " (%s)" ),
200 
201  drcItem->SetErrorMessage( m_msg );
202  drcItem->SetItems( fp, m_zone );
203 
204  HandleMarker( new MARKER_PCB( drcItem, (wxPoint) pt ) );
205  success = false;
206  }
207  }
208 
209  if( ( m_keepoutFlags & CHECK_PADS_MASK ) > 0 )
210  {
211  success &= checkPads( fp );
212  }
213  }
214 
215  return success;
216 }
int OutlineCount() const
Returns the number of outlines in the set
bool CommonLayerExists(const LSET aLayerSet) const
Function CommonLayerExist Test if this zone shares a common layer with the given layer set.
Definition: class_zone.cpp:248
void SetItems(EDA_ITEM *aItem, EDA_ITEM *bItem=nullptr, EDA_ITEM *cItem=nullptr, EDA_ITEM *dItem=nullptr)
Definition: rc_item.h:119
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
bool checkPads(MODULE *aModule)
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:271
#define DISALLOW_HOLES
Definition: drc_rule.h:49
#define DISALLOW_PADS
Definition: drc_rule.h:45
static LSET FrontMask()
Function FrontMask returns a mask holding all technical layers and the external CU layer on front sid...
Definition: lset.cpp:811
wxString GetErrorText() const
Definition: rc_item.h:169
std::map< int, wxString > m_sources
MODULES & Modules()
Definition: class_board.h:266
SHAPE_POLY_SET.
void HandleMarker(MARKER_PCB *aMarker) const
Pass a given marker to the marker handler.
Definition: drc_provider.h:68
#define DISALLOW_FOOTPRINTS
Definition: drc_rule.h:50
static DRC_ITEM * Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:197
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset intersection For aFastMode meaning, see function booleanOp
#define _(s)
Definition: 3d_actions.cpp:33
static LSET BackMask()
Function BackMask returns a mask holding all technical layers and the external CU layer on back side.
Definition: lset.cpp:818
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
void SetErrorMessage(const wxString &aMessage)
Definition: rc_item.h:117
ZONE_CONTAINER * m_zone
A disallowed object is inside a keepout.
Definition: drc.h:60

References _, LSET::BackMask(), SHAPE_POLY_SET::BooleanIntersection(), checkPads(), ZONE_CONTAINER::CommonLayerExists(), DRC_ITEM::Create(), SHAPE_POLY_SET::CVertex(), DISALLOW_FOOTPRINTS, DISALLOW_HOLES, DISALLOW_PADS, DRCE_KEEPOUT, LSET::FrontMask(), RC_ITEM::GetErrorText(), DRC_TEST_PROVIDER::HandleMarker(), EDA_RECT::Intersects(), m_board, m_keepoutFlags, m_msg, m_sources, m_zone, m_zoneBBox, BOARD::Modules(), ZONE_CONTAINER::Outline(), SHAPE_POLY_SET::OutlineCount(), SHAPE_POLY_SET::PM_FAST, RC_ITEM::SetErrorMessage(), and RC_ITEM::SetItems().

Referenced by RunDRC().

◆ checkPads()

bool DRC_KEEPOUT_TESTER::checkPads ( MODULE aModule)
private

Definition at line 219 of file drc_keepout_tester.cpp.

220 {
221  bool success = true;
222 
223  for( D_PAD* pad : aModule->Pads() )
224  {
225  if( !m_zone->CommonLayerExists( pad->GetLayerSet() ) )
226  continue;
227 
228  // Fast test to detect a pad inside the keepout area bounding box.
229  EDA_RECT padBBox( pad->GetPosition(), wxSize() );
230  padBBox.Inflate( pad->GetBoundingRadius() );
231 
232  if( !m_zoneBBox.Intersects( padBBox ) )
233  continue;
234 
235  if( ( m_keepoutFlags & DISALLOW_PADS ) > 0 )
236  {
237  SHAPE_POLY_SET outline;
238  pad->TransformShapeWithClearanceToPolygon( outline, 0 );
239 
240  // Build the common area between pad and the keepout area:
242 
243  // If it's not empty then we have a violation
244  if( outline.OutlineCount() )
245  {
246  const VECTOR2I& pt = outline.CVertex( 0, 0, -1 );
247  DRC_ITEM* drcItem = DRC_ITEM::Create( DRCE_KEEPOUT );
248 
249  m_msg.Printf( drcItem->GetErrorText() + _( " (%s)" ),
250  m_sources.at( DISALLOW_PADS ) );
251 
252  drcItem->SetErrorMessage( m_msg );
253  drcItem->SetItems( pad, m_zone );
254 
255  HandleMarker( new MARKER_PCB( drcItem, (wxPoint) pt ) );
256  success = false;
257  }
258  }
259  else if( ( m_keepoutFlags & DISALLOW_HOLES ) > 0 )
260  {
261  wxPoint slotStart, slotEnd;
262  int slotWidth;
263 
264  pad->GetOblongGeometry( pad->GetDrillSize(), &slotStart, &slotEnd, &slotWidth );
265  slotStart += pad->GetPosition();
266  slotEnd += pad->GetPosition();
267 
268  SEG slotSeg( slotStart, slotEnd );
269  SHAPE_POLY_SET* outline = m_zone->Outline();
270  SEG::ecoord center2center_sq = outline->SquaredDistance( slotSeg );
271 
272  if( center2center_sq <= SEG::Square( slotWidth) )
273  {
274  DRC_ITEM* drcItem = DRC_ITEM::Create( DRCE_KEEPOUT );
275 
276  m_msg.Printf( drcItem->GetErrorText() + _( " (%s)" ),
277  m_sources.at( DISALLOW_HOLES ) );
278 
279  drcItem->SetErrorMessage( m_msg );
280  drcItem->SetItems( pad, m_zone );
281 
282  HandleMarker( new MARKER_PCB( drcItem, pad->GetPosition() ) );
283  success = false;
284  }
285  }
286  }
287 
288  return success;
289 }
int OutlineCount() const
Returns the number of outlines in the set
bool CommonLayerExists(const LSET aLayerSet) const
Function CommonLayerExist Test if this zone shares a common layer with the given layer set.
Definition: class_zone.cpp:248
void SetItems(EDA_ITEM *aItem, EDA_ITEM *bItem=nullptr, EDA_ITEM *cItem=nullptr, EDA_ITEM *dItem=nullptr)
Definition: rc_item.h:119
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
VECTOR2I::extended_type ecoord
Definition: seg.h:42
PADS & Pads()
Definition: class_module.h:169
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:271
SEG::ecoord SquaredDistance(VECTOR2I aPoint) const
Function SquaredDistance computes the minimum distance squared between aPoint and all the polygons in...
#define DISALLOW_HOLES
Definition: drc_rule.h:49
#define DISALLOW_PADS
Definition: drc_rule.h:45
static SEG::ecoord Square(int a)
Definition: seg.h:116
wxString GetErrorText() const
Definition: rc_item.h:169
std::map< int, wxString > m_sources
SHAPE_POLY_SET.
void HandleMarker(MARKER_PCB *aMarker) const
Pass a given marker to the marker handler.
Definition: drc_provider.h:68
static DRC_ITEM * Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:197
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset intersection For aFastMode meaning, see function booleanOp
Definition: seg.h:39
#define _(s)
Definition: 3d_actions.cpp:33
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
void SetErrorMessage(const wxString &aMessage)
Definition: rc_item.h:117
ZONE_CONTAINER * m_zone
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
A disallowed object is inside a keepout.
Definition: drc.h:60

References _, SHAPE_POLY_SET::BooleanIntersection(), ZONE_CONTAINER::CommonLayerExists(), DRC_ITEM::Create(), SHAPE_POLY_SET::CVertex(), DISALLOW_HOLES, DISALLOW_PADS, DRCE_KEEPOUT, RC_ITEM::GetErrorText(), DRC_TEST_PROVIDER::HandleMarker(), EDA_RECT::Inflate(), EDA_RECT::Intersects(), m_keepoutFlags, m_msg, m_sources, m_zone, m_zoneBBox, ZONE_CONTAINER::Outline(), SHAPE_POLY_SET::OutlineCount(), MODULE::Pads(), SHAPE_POLY_SET::PM_FAST, RC_ITEM::SetErrorMessage(), RC_ITEM::SetItems(), SEG::Square(), and SHAPE_POLY_SET::SquaredDistance().

Referenced by checkFootprints().

◆ checkTracksAndVias()

bool DRC_KEEPOUT_TESTER::checkTracksAndVias ( )
private

Definition at line 71 of file drc_keepout_tester.cpp.

72 {
74  constexpr int CHECK_VIAS_MASK = VIA_MASK | DISALLOW_HOLES;
75  constexpr int CHECK_TRACKS_AND_VIAS_MASK = CHECK_VIAS_MASK | DISALLOW_TRACKS;
76 
77  if(( m_keepoutFlags & CHECK_TRACKS_AND_VIAS_MASK ) == 0 )
78  return true;
79 
80  bool success = true;
81 
82  for( TRACK* segm : m_board->Tracks() )
83  {
84  if( !m_zoneBBox.Intersects( segm->GetBoundingBox() ) )
85  continue;
86 
87  if( segm->Type() == PCB_TRACE_T && ( m_keepoutFlags & DISALLOW_TRACKS ) != 0 )
88  {
89  // Ignore if the keepout zone is not on the same layer
90  if( !m_zone->IsOnLayer( segm->GetLayer() ) )
91  continue;
92 
93  int widths = segm->GetWidth() / 2;
94  SEG trackSeg( segm->GetStart(), segm->GetEnd() );
95  SEG::ecoord center2center_squared = m_zone->Outline()->SquaredDistance( trackSeg );
96 
97  if( center2center_squared <= SEG::Square( widths) )
98  {
100 
101  m_msg.Printf( drcItem->GetErrorText() + _( " (%s)" ),
102  m_sources.at( DISALLOW_TRACKS ) );
103 
104  drcItem->SetErrorMessage( m_msg );
105  drcItem->SetItems( segm, m_zone );
106 
107  HandleMarker( new MARKER_PCB( drcItem, DRC::GetLocation( segm, m_zone ) ) );
108  success = false;
109  }
110  }
111  else if( segm->Type() == PCB_VIA_T && ( m_keepoutFlags & CHECK_VIAS_MASK ) != 0 )
112  {
113  VIA* via = static_cast<VIA*>( segm );
114  int sourceId = 0;
115 
116  if( ( m_keepoutFlags & DISALLOW_VIAS ) > 0 )
117  {
118  sourceId = DISALLOW_VIAS;
119  }
120  else if( via->GetViaType() == VIATYPE::MICROVIA
121  && ( m_keepoutFlags & DISALLOW_MICRO_VIAS ) > 0 )
122  {
123  sourceId = DISALLOW_MICRO_VIAS;
124  }
125  else if( via->GetViaType() == VIATYPE::BLIND_BURIED
126  && ( m_keepoutFlags & DISALLOW_BB_VIAS ) > 0 )
127  {
128  sourceId = DISALLOW_BB_VIAS;
129  }
130  else if( ( m_keepoutFlags & DISALLOW_HOLES ) > 0 )
131  {
132  sourceId = DISALLOW_HOLES;
133  }
134  else
135  continue;
136 
137  int widths = via->GetWidth() / 2;
138  wxPoint viaPos = via->GetPosition();
139 
140  if( sourceId == DISALLOW_HOLES )
141  widths = via->GetDrillValue() / 2;
142 
143  SEG::ecoord center2center_squared = m_zone->Outline()->SquaredDistance( viaPos );
144 
145  if( center2center_squared <= SEG::Square( widths ) )
146  {
147  DRC_ITEM* drcItem = DRC_ITEM::Create( DRCE_KEEPOUT );
148  m_msg.Printf( drcItem->GetErrorText() + _( " (%s)" ), m_sources.at( sourceId ) );
149  drcItem->SetErrorMessage( m_msg );
150  drcItem->SetItems( segm, m_zone );
151 
152  HandleMarker( new MARKER_PCB( drcItem, DRC::GetLocation( segm, m_zone ) ) );
153  success = false;
154  }
155  }
156  }
157 
158  return success;
159 }
#define DISALLOW_TRACKS
Definition: drc_rule.h:44
void SetItems(EDA_ITEM *aItem, EDA_ITEM *bItem=nullptr, EDA_ITEM *cItem=nullptr, EDA_ITEM *dItem=nullptr)
Definition: rc_item.h:119
virtual bool IsOnLayer(PCB_LAYER_ID) const override
Function IsOnLayer tests to see if this object is on the given layer.
Definition: class_zone.cpp:329
VECTOR2I::extended_type ecoord
Definition: seg.h:42
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:271
#define DISALLOW_MICRO_VIAS
Definition: drc_rule.h:42
SEG::ecoord SquaredDistance(VECTOR2I aPoint) const
Function SquaredDistance computes the minimum distance squared between aPoint and all the polygons in...
#define DISALLOW_HOLES
Definition: drc_rule.h:49
static SEG::ecoord Square(int a)
Definition: seg.h:116
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
wxString GetErrorText() const
Definition: rc_item.h:169
std::map< int, wxString > m_sources
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
void HandleMarker(MARKER_PCB *aMarker) const
Pass a given marker to the marker handler.
Definition: drc_provider.h:68
static DRC_ITEM * Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:197
const wxPoint GetPosition() const override
Definition: class_track.h:406
#define DISALLOW_VIAS
Definition: drc_rule.h:41
Definition: seg.h:39
int GetWidth() const
Definition: class_track.h:112
#define _(s)
Definition: 3d_actions.cpp:33
VIATYPE GetViaType() const
Definition: class_track.h:368
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
void SetErrorMessage(const wxString &aMessage)
Definition: rc_item.h:117
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
#define DISALLOW_BB_VIAS
Definition: drc_rule.h:43
static wxPoint GetLocation(TRACK *aTrack, ZONE_CONTAINER *aConflictZone)
Fetches a reasonable point for marking a violoation between two non-point objects.
ZONE_CONTAINER * m_zone
TRACKS & Tracks()
Definition: class_board.h:257
A disallowed object is inside a keepout.
Definition: drc.h:60

References _, BLIND_BURIED, DRC_ITEM::Create(), DISALLOW_BB_VIAS, DISALLOW_HOLES, DISALLOW_MICRO_VIAS, DISALLOW_TRACKS, DISALLOW_VIAS, DRCE_KEEPOUT, VIA::GetDrillValue(), RC_ITEM::GetErrorText(), DRC::GetLocation(), VIA::GetPosition(), VIA::GetViaType(), TRACK::GetWidth(), DRC_TEST_PROVIDER::HandleMarker(), EDA_RECT::Intersects(), ZONE_CONTAINER::IsOnLayer(), m_board, m_keepoutFlags, m_msg, m_sources, m_zone, m_zoneBBox, MICROVIA, ZONE_CONTAINER::Outline(), PCB_TRACE_T, PCB_VIA_T, RC_ITEM::SetErrorMessage(), RC_ITEM::SetItems(), SEG::Square(), SHAPE_POLY_SET::SquaredDistance(), BOARD::Tracks(), and VIA_MASK.

Referenced by RunDRC().

◆ HandleMarker()

void DRC_TEST_PROVIDER::HandleMarker ( MARKER_PCB aMarker) const
inlineprotectedinherited

◆ RunDRC()

bool DRC_KEEPOUT_TESTER::RunDRC ( EDA_UNITS  aUnits,
BOARD aBoard 
)
overridevirtual

Runs this provider against the given PCB with configured options (if any).

Note: Board is non-const, as some DRC functions modify the board (e.g. zone fill or polygon coalescing)

Implements DRC_TEST_PROVIDER.

Definition at line 41 of file drc_keepout_tester.cpp.

42 {
43  bool success = true;
44 
45  m_units = aUnits;
46  m_board = &aBoard;
47 
48  // Get a list of all zones to inspect, from both board and footprints
49  std::list<ZONE_CONTAINER*> areasToInspect = m_board->GetZoneList( true );
50 
51  // Test keepout areas for vias, tracks and pads inside keepout areas
52  for( ZONE_CONTAINER* area : areasToInspect )
53  {
54  m_keepoutFlags = area->GetKeepouts( &m_sources );
55 
56  if( m_keepoutFlags > 0 )
57  {
58  m_zone = area;
59  m_zoneBBox = area->GetBoundingBox();
60 
61  success &= checkTracksAndVias();
62  success &= checkFootprints();
63  success &= checkDrawings();
64  }
65  }
66 
67  return success;
68 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
std::map< int, wxString > m_sources
ZONE_CONTAINER * m_zone
std::list< ZONE_CONTAINER * > GetZoneList(bool aIncludeZonesInFootprints=false)
Function GetZoneList.

References checkDrawings(), checkFootprints(), checkTracksAndVias(), BOARD::GetZoneList(), m_board, m_keepoutFlags, m_sources, m_units, m_zone, and m_zoneBBox.

Referenced by DRC::RunTests().

Member Data Documentation

◆ m_board

BOARD* DRC_KEEPOUT_TESTER::m_board
private

Definition at line 51 of file drc_keepout_tester.h.

Referenced by checkDrawings(), checkFootprints(), checkTracksAndVias(), and RunDRC().

◆ m_keepoutFlags

int DRC_KEEPOUT_TESTER::m_keepoutFlags
private

◆ m_msg

wxString DRC_KEEPOUT_TESTER::m_msg
private

Definition at line 58 of file drc_keepout_tester.h.

Referenced by checkDrawings(), checkFootprints(), checkPads(), and checkTracksAndVias().

◆ m_sources

std::map<int, wxString> DRC_KEEPOUT_TESTER::m_sources
private

◆ m_units

EDA_UNITS DRC_KEEPOUT_TESTER::m_units
private

Definition at line 50 of file drc_keepout_tester.h.

Referenced by RunDRC().

◆ m_zone

ZONE_CONTAINER* DRC_KEEPOUT_TESTER::m_zone
private

◆ m_zoneBBox

EDA_RECT DRC_KEEPOUT_TESTER::m_zoneBBox
private

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