Remove broken call to normalize outlines

We should never be editing the user's outlines for them.  This creates
broken zones that are hard to repair.  In this case, there was also a
secondary zone with no outline that would crash the system

Fixes https://gitlab.com/kicad/code/kicad/issues/10904

(cherry picked from commit f0d7a09af9)
This commit is contained in:
Seth Hillbrand 2022-02-18 09:29:00 -08:00
parent c27ec5cae1
commit f0e4448a9d
3 changed files with 0 additions and 97 deletions

View File

@ -1922,54 +1922,6 @@ ZONE* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_
}
bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE* aCurrArea )
{
// mark all areas as unmodified except this one, if modified
for( ZONE* zone : m_zones )
zone->SetLocalFlags( 0 );
aCurrArea->SetLocalFlags( 1 );
if( aCurrArea->Outline()->IsSelfIntersecting() )
{
aCurrArea->UnHatchBorder();
// Normalize copied area and store resulting number of polygons
int n_poly = aCurrArea->Outline()->NormalizeAreaOutlines();
// If clipping has created some polygons, we must add these new copper areas.
if( n_poly > 1 )
{
ZONE* NewArea;
// Move the newly created polygons to new areas, removing them from the current area
for( int ip = 1; ip < n_poly; ip++ )
{
// Create new copper area and copy poly into it
SHAPE_POLY_SET* new_p = new SHAPE_POLY_SET( aCurrArea->Outline()->UnitSet( ip ) );
NewArea = AddArea( aNewZonesList, aCurrArea->GetNetCode(), aCurrArea->GetLayer(),
VECTOR2I( 0, 0 ), aCurrArea->GetHatchStyle() );
// remove the poly that was automatically created for the new area
// and replace it with a poly from NormalizeAreaOutlines
delete NewArea->Outline();
NewArea->SetOutline( new_p );
NewArea->HatchBorder();
NewArea->SetLocalFlags( 1 );
}
SHAPE_POLY_SET* new_p = new SHAPE_POLY_SET( aCurrArea->Outline()->UnitSet( 0 ) );
delete aCurrArea->Outline();
aCurrArea->SetOutline( new_p );
}
}
aCurrArea->HatchBorder();
return true;
}
bool BOARD::GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines,
OUTLINE_ERROR_HANDLER* aErrorHandler )
{

View File

@ -874,31 +874,6 @@ public:
ZONE* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer,
VECTOR2I aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch );
/**
* Process an area that has been modified, by normalizing its polygon against itself.
* i.e. convert a self-intersecting polygon to one (or more) non self-intersecting polygon(s)
*
* This may change the number and order of copper areas in the net.
*
* @param aNewZonesList is a PICKED_ITEMS_LIST where to store new created areas pickers.
* @param aCurrArea is the zone to process.
* @return true if changes are made.
*/
bool NormalizeAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList, ZONE* aCurrArea );
/**
* Process an area that has been modified, by normalizing its polygon
* and merging the intersecting polygons for any other areas on the same net.
*
* This may change the number and order of copper areas in the net.
*
* @param aModifiedZonesList is a #PICKED_ITEMS_LIST where to store deleted or added areas
* (useful in undo commands can be NULL).
* @param modified_area is the area to test.
* @return true if some areas modified.
*/
bool OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, ZONE* modified_area );
/**
* Test for intersection of 2 copper areas.
*

View File

@ -101,9 +101,6 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE* aZone )
if( net ) // net == NULL should not occur
aZone->SetNetCode( net->GetNetCode() );
// Combine zones if possible
GetBoard()->OnAreaPolygonModified( &deletedList, aZone );
UpdateCopyOfZonesList( pickedList, deletedList, GetBoard() );
// refill zones with the new properties applied
@ -150,27 +147,6 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE* aZone )
}
bool BOARD::OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, ZONE* modified_area )
{
// clip polygon against itself
bool modified = NormalizeAreaPolygon( aModifiedZonesList, modified_area );
// Test for bad areas: all zones must have more than 2 corners:
// Note: should not happen, but just in case.
for( ZONE* zone : m_zones )
{
if( zone->GetNumCorners() < 3 )
{
ITEM_PICKER picker( nullptr, zone, UNDO_REDO::DELETED );
aModifiedZonesList->PushItem( picker );
zone->SetFlags( STRUCT_DELETED );
}
}
return modified;
}
bool BOARD::TestZoneIntersection( ZONE* aZone1, ZONE* aZone2 )
{
// see if areas are on same layer