Commit bb7a74f5 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: fix Bug #1404191 (Zone filling fails when a zone inside having the...

Pcbnew: fix Bug #1404191 (Zone filling fails when a zone inside having the same net and a highter priority exists, which is allowed to manage different fill parameters )
parent 1a748e6b
...@@ -342,13 +342,15 @@ public: ...@@ -342,13 +342,15 @@ public:
* Used in filling zones calculations * Used in filling zones calculations
* Circles (vias) and arcs (ends of tracks) are approximated by segments * Circles (vias) and arcs (ends of tracks) are approximated by segments
* @param aCornerBuffer = a buffer to store the polygon * @param aCornerBuffer = a buffer to store the polygon
* @param aClearanceValue = the clearance around the pad * @param aMinClearanceValue = the min clearance around outlines
* @param aAddClearance = true to add a clearance area to the polygon * @param aUseNetClearance = true to use a clearance which is the max value between
* false to create the outline polygon. * aMinClearanceValue and the net clearance
* false to use aMinClearanceValue only
* if both aMinClearanceValue = 0 and aUseNetClearance = false: create the zone outline polygon.
*/ */
void TransformOutlinesShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer, void TransformOutlinesShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer,
int aClearanceValue, int aMinClearanceValue,
bool aAddClearance ); bool aUseNetClearance );
/** /**
* Function HitTestForCorner * Function HitTestForCorner
* tests if the given wxPoint near a corner * tests if the given wxPoint near a corner
......
...@@ -376,7 +376,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -376,7 +376,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
if( zone->GetIsKeepout() && ! zone->GetDoNotAllowCopperPour() ) if( zone->GetIsKeepout() && ! zone->GetDoNotAllowCopperPour() )
continue; continue;
// A highter priority zone or keepout area is found: remove its area // A highter priority zone or keepout area is found: remove this area
item_boundingbox = zone->GetBoundingBox(); item_boundingbox = zone->GetBoundingBox();
if( !item_boundingbox.Intersects( zone_boundingbox ) ) if( !item_boundingbox.Intersects( zone_boundingbox ) )
continue; continue;
...@@ -386,18 +386,21 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -386,18 +386,21 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// do not add clearance. // do not add clearance.
// the zone will be connected to the current zone, but filled areas // the zone will be connected to the current zone, but filled areas
// will use different parameters (clearance, thermal shapes ) // will use different parameters (clearance, thermal shapes )
bool addclearance = GetNetCode() != zone->GetNetCode(); bool same_net = GetNetCode() == zone->GetNetCode();
int clearance = zone_clearance; int min_clearance = zone_clearance;
bool use_net_clearance = true;
if( zone->GetIsKeepout() ) if( zone->GetIsKeepout() || same_net )
{ {
addclearance = true; // Just take in account the fact the outline has a thickness, so
clearance = m_ZoneMinThickness / 2; // the actual area to substract is inflated to take in account this fact
min_clearance = m_ZoneMinThickness / 2;
use_net_clearance = false;
} }
zone->TransformOutlinesShapeWithClearanceToPolygon( zone->TransformOutlinesShapeWithClearanceToPolygon(
cornerBufferPolysToSubstract, cornerBufferPolysToSubstract,
clearance, addclearance ); min_clearance, use_net_clearance );
} }
// Remove thermal symbols // Remove thermal symbols
......
...@@ -48,22 +48,22 @@ ...@@ -48,22 +48,22 @@
* false to create the outline polygon. * false to create the outline polygon.
*/ */
void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon( void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(
CPOLYGONS_LIST& aCornerBuffer, CPOLYGONS_LIST& aCornerBuffer, int aMinClearanceValue, bool aUseNetClearance )
int aClearanceValue, bool aAddClearance )
{ {
// Creates the zone outline polygon (with linked holes if any) // Creates the zone outline polygon (with linked holes if any)
CPOLYGONS_LIST zoneOutline; CPOLYGONS_LIST zoneOutline;
BuildFilledSolidAreasPolygons( NULL, &zoneOutline ); BuildFilledSolidAreasPolygons( NULL, &zoneOutline );
// add clearance to outline // add clearance to outline
int clearance = 0; int clearance = aMinClearanceValue;
if( aAddClearance ) if( aUseNetClearance )
{ {
clearance = GetClearance(); clearance = GetClearance();
if( aClearanceValue > clearance ) if( aMinClearanceValue > clearance )
clearance = aClearanceValue; clearance = aMinClearanceValue;
} }
// Calculate the polygon with clearance // Calculate the polygon with clearance
// holes are linked to the main outline, so only one polygon is created. // holes are linked to the main outline, so only one polygon is created.
if( clearance ) if( clearance )
......
...@@ -1501,7 +1501,7 @@ void ConvertPolysListWithHolesToOnePolygon( const CPOLYGONS_LIST& aPolysListWith ...@@ -1501,7 +1501,7 @@ void ConvertPolysListWithHolesToOnePolygon( const CPOLYGONS_LIST& aPolysListWith
// If polycount<= 1, there is no holes found, and therefore just copy the polygon. // If polycount<= 1, there is no holes found, and therefore just copy the polygon.
if( polycount <= 1 ) if( polycount <= 1 )
{ {
aOnePolyList = aPolysListWithHoles; aOnePolyList.Append( aPolysListWithHoles );
return; return;
} }
......
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