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:
/**
* 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 to all others
* tests area outlines for DRC:
* Tests areas inside other areas.
* Tests areas too close.
*
* @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
* @return errors count
*/
......
......@@ -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
* tests if the given wxPoint is within the bounds of a filled area of this zone.
......
......@@ -140,6 +140,8 @@ public:
*/
EDA_RECT GetBoundingBox() const;
int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const;
/**
* Function Test_For_Copper_Island_And_Remove__Insulated_Islands
* Remove insulated copper islands found in m_FilledPolysList.
......
......@@ -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,
bool aCreate_Markers )
{
wxString str;
long nerrors = 0;
int zone2zoneClearance;
wxString str;
int nerrors = 0;
// iterate through all areas
for( int ia = 0; ia < GetAreaCount(); ia++ )
{
ZONE_CONTAINER* Area_Ref = GetArea( ia );
CPolyLine* refSmoothedPoly = Area_Ref->GetSmoothedPoly();
CPolyLine* refSmoothedPoly = Area_Ref->GetSmoothedPoly();
if( !Area_Ref->IsOnCopperLayer() )
continue;
// If testing only a single area, then skip all others
if( aArea_To_Examine && (aArea_To_Examine != Area_Ref) )
continue;
for( int ia2 = 0; ia2 < GetAreaCount(); 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 )
continue;
......@@ -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 )
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:
zone2zoneClearance = Area_Ref->GetClearance(Area_To_Test);
zone2zoneClearance = MAX( zone2zoneClearance, Area_Ref->m_ZoneClearance );
zone2zoneClearance = MAX( zone2zoneClearance, Area_To_Test->m_ZoneClearance );
// Get clearance used in zone to zone test. The policy used to
// obtain that value is now part of the zone object itself by way of
// ZONE_CONTAINER::GetClearance().
int zone2zoneClearance = Area_Ref->GetClearance( Area_To_Test );
// test for some corners of Area_Ref inside Area_To_Test
for( int ic = 0; ic < refSmoothedPoly->GetNumCorners(); ic++ )
{
int x = refSmoothedPoly->GetX( ic );
int y = refSmoothedPoly->GetY( ic );
if( testSmoothedPoly->TestPointInside( x, y ) )
{
// 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