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 )

This commit is contained in:
jean-pierre charras 2014-12-19 20:09:53 +01:00
parent 1a748e6b9b
commit bb7a74f58f
4 changed files with 24 additions and 19 deletions

View File

@ -342,13 +342,15 @@ public:
* Used in filling zones calculations
* Circles (vias) and arcs (ends of tracks) are approximated by segments
* @param aCornerBuffer = a buffer to store the polygon
* @param aClearanceValue = the clearance around the pad
* @param aAddClearance = true to add a clearance area to the polygon
* false to create the outline polygon.
* @param aMinClearanceValue = the min clearance around outlines
* @param aUseNetClearance = true to use a clearance which is the max value between
* 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,
int aClearanceValue,
bool aAddClearance );
int aMinClearanceValue,
bool aUseNetClearance );
/**
* Function HitTestForCorner
* tests if the given wxPoint near a corner

View File

@ -376,7 +376,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
if( zone->GetIsKeepout() && ! zone->GetDoNotAllowCopperPour() )
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();
if( !item_boundingbox.Intersects( zone_boundingbox ) )
continue;
@ -386,18 +386,21 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// do not add clearance.
// the zone will be connected to the current zone, but filled areas
// will use different parameters (clearance, thermal shapes )
bool addclearance = GetNetCode() != zone->GetNetCode();
int clearance = zone_clearance;
bool same_net = GetNetCode() == zone->GetNetCode();
int min_clearance = zone_clearance;
bool use_net_clearance = true;
if( zone->GetIsKeepout() )
if( zone->GetIsKeepout() || same_net )
{
addclearance = true;
clearance = m_ZoneMinThickness / 2;
// Just take in account the fact the outline has a thickness, so
// the actual area to substract is inflated to take in account this fact
min_clearance = m_ZoneMinThickness / 2;
use_net_clearance = false;
}
zone->TransformOutlinesShapeWithClearanceToPolygon(
cornerBufferPolysToSubstract,
clearance, addclearance );
min_clearance, use_net_clearance );
}
// Remove thermal symbols

View File

@ -48,22 +48,22 @@
* false to create the outline polygon.
*/
void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(
CPOLYGONS_LIST& aCornerBuffer,
int aClearanceValue, bool aAddClearance )
CPOLYGONS_LIST& aCornerBuffer, int aMinClearanceValue, bool aUseNetClearance )
{
// Creates the zone outline polygon (with linked holes if any)
CPOLYGONS_LIST zoneOutline;
BuildFilledSolidAreasPolygons( NULL, &zoneOutline );
// add clearance to outline
int clearance = 0;
int clearance = aMinClearanceValue;
if( aAddClearance )
if( aUseNetClearance )
{
clearance = GetClearance();
if( aClearanceValue > clearance )
clearance = aClearanceValue;
if( aMinClearanceValue > clearance )
clearance = aMinClearanceValue;
}
// Calculate the polygon with clearance
// holes are linked to the main outline, so only one polygon is created.
if( clearance )

View File

@ -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 )
{
aOnePolyList = aPolysListWithHoles;
aOnePolyList.Append( aPolysListWithHoles );
return;
}