Commit 40664a55 authored by Dick Hollenbeck's avatar Dick Hollenbeck

zone to zone DRC 'clearance' policy/setting now comes from...

zone to zone DRC 'clearance' policy/setting now comes from ZONE_CONTAINER::GetClearance(), a virtual override, and is currently ignoring the netclass setting and using only the m_ZoneClearance settting, see ZONE_CONTAINER::GetClearance() to adjust policy.
parent 1247401e
...@@ -1024,10 +1024,12 @@ public: ...@@ -1024,10 +1024,12 @@ public:
/** /**
* Function Test_Drc_Areas_Outlines_To_Areas_Outlines * Function Test_Drc_Areas_Outlines_To_Areas_Outlines
* Test Areas outlines for DRC: * tests area outlines for DRC:
* Test areas inside other areas * Tests areas inside other areas.
* Test areas too close * Tests areas too close.
* @param aArea_To_Examine: area to compare with other areas. if NULL: all areas are compared to all others *
* @param aArea_To_Examine: area to compare with other areas, or if NULL then
* all areas are compared to all others.
* @param aCreate_Markers: if true create DRC markers. False: do not creates anything * @param aCreate_Markers: if true create DRC markers. False: do not creates anything
* @return errors count * @return errors count
*/ */
......
...@@ -941,6 +941,27 @@ bool ZONE_CONTAINER::HitTest( EDA_RECT& refArea ) ...@@ -941,6 +941,27 @@ bool ZONE_CONTAINER::HitTest( EDA_RECT& refArea )
} }
int ZONE_CONTAINER::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const
{
NETCLASS* myclass = GetNetClass();
int myClearance = m_ZoneClearance;
#if 0 // maybe the netclass clearance should not come into play for a zone?
if( myclass )
myClearance = max( myClearance, myclass->GetClearance() );
#endif
if( aItem )
{
int hisClearance = aItem->GetClearance( NULL );
myClearance = max( hisClearance, myClearance );
}
return myClearance;
}
/** /**
* Function HitTestFilledArea * Function HitTestFilledArea
* tests if the given wxPoint is within the bounds of a filled area of this zone. * tests if the given wxPoint is within the bounds of a filled area of this zone.
......
...@@ -140,6 +140,8 @@ public: ...@@ -140,6 +140,8 @@ public:
*/ */
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const;
/** /**
* Function Test_For_Copper_Island_And_Remove__Insulated_Islands * Function Test_For_Copper_Island_And_Remove__Insulated_Islands
* Remove insulated copper islands found in m_FilledPolysList. * Remove insulated copper islands found in m_FilledPolysList.
......
...@@ -833,39 +833,29 @@ int BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_r ...@@ -833,39 +833,29 @@ int BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_r
} }
/**
* Function Test_Drc_Areas_Outlines_To_Areas_Outlines
* Test Areas outlines for DRC:
* Test areas inside other areas
* Test areas too close
* @param aArea_To_Examine: area to compare with other areas. if NULL: all areas are compared tp all others
* @param aCreate_Markers: if true create DRC markers. False: do not creates anything
* @return errors count
*/
int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_Examine, int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_Examine,
bool aCreate_Markers ) bool aCreate_Markers )
{ {
wxString str; wxString str;
long nerrors = 0; int nerrors = 0;
int zone2zoneClearance;
// iterate through all areas // iterate through all areas
for( int ia = 0; ia < GetAreaCount(); ia++ ) for( int ia = 0; ia < GetAreaCount(); ia++ )
{ {
ZONE_CONTAINER* Area_Ref = GetArea( ia ); ZONE_CONTAINER* Area_Ref = GetArea( ia );
CPolyLine* refSmoothedPoly = Area_Ref->GetSmoothedPoly(); CPolyLine* refSmoothedPoly = Area_Ref->GetSmoothedPoly();
if( !Area_Ref->IsOnCopperLayer() ) if( !Area_Ref->IsOnCopperLayer() )
continue; continue;
// If testing only a single area, then skip all others
if( aArea_To_Examine && (aArea_To_Examine != Area_Ref) ) if( aArea_To_Examine && (aArea_To_Examine != Area_Ref) )
continue; continue;
for( int ia2 = 0; ia2 < GetAreaCount(); ia2++ ) for( int ia2 = 0; ia2 < GetAreaCount(); ia2++ )
{ {
ZONE_CONTAINER* Area_To_Test = GetArea( ia2 ); ZONE_CONTAINER* Area_To_Test = GetArea( ia2 );
CPolyLine* testSmoothedPoly = Area_To_Test->GetSmoothedPoly(); CPolyLine* testSmoothedPoly = Area_To_Test->GetSmoothedPoly();
if( Area_Ref == Area_To_Test ) if( Area_Ref == Area_To_Test )
continue; continue;
...@@ -878,19 +868,19 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E ...@@ -878,19 +868,19 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
if( Area_Ref->GetNet() == Area_To_Test->GetNet() && Area_Ref->GetNet() >= 0 ) if( Area_Ref->GetNet() == Area_To_Test->GetNet() && Area_Ref->GetNet() >= 0 )
continue; continue;
/* Examine a candidate zone: compare Area_To_Test to Area_Ref // Examine a candidate zone: compare Area_To_Test to Area_Ref
*/
// Calculate the clearance used in zone to zone test: // Get clearance used in zone to zone test. The policy used to
zone2zoneClearance = Area_Ref->GetClearance(Area_To_Test); // obtain that value is now part of the zone object itself by way of
zone2zoneClearance = MAX( zone2zoneClearance, Area_Ref->m_ZoneClearance ); // ZONE_CONTAINER::GetClearance().
zone2zoneClearance = MAX( zone2zoneClearance, Area_To_Test->m_ZoneClearance ); int zone2zoneClearance = Area_Ref->GetClearance( Area_To_Test );
// test for some corners of Area_Ref inside Area_To_Test // test for some corners of Area_Ref inside Area_To_Test
for( int ic = 0; ic < refSmoothedPoly->GetNumCorners(); ic++ ) for( int ic = 0; ic < refSmoothedPoly->GetNumCorners(); ic++ )
{ {
int x = refSmoothedPoly->GetX( ic ); int x = refSmoothedPoly->GetX( ic );
int y = refSmoothedPoly->GetY( ic ); int y = refSmoothedPoly->GetY( ic );
if( testSmoothedPoly->TestPointInside( x, y ) ) if( testSmoothedPoly->TestPointInside( x, y ) )
{ {
// COPPERAREA_COPPERAREA error: copper area ref corner inside copper area // COPPERAREA_COPPERAREA error: copper area ref corner inside copper area
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment