diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index ef54404968..8b3306d392 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -2103,8 +2103,8 @@ void ALTIUM_PCB::ParseRegions6Data( const ALTIUM_COMPOUND_FILE& aAltiumPcbFi linechain.Append( elem.outline.at( 0 ).position ); linechain.SetClosed( true ); - SHAPE_POLY_SET rawPolys; - rawPolys.AddOutline( linechain ); + SHAPE_POLY_SET fill; + fill.AddOutline( linechain ); for( const std::vector& hole : elem.holes ) { @@ -2115,20 +2115,15 @@ void ALTIUM_PCB::ParseRegions6Data( const ALTIUM_COMPOUND_FILE& aAltiumPcbFi hole_linechain.Append( hole.at( 0 ).position ); hole_linechain.SetClosed( true ); - rawPolys.AddHole( hole_linechain ); + fill.AddHole( hole_linechain ); } if( zone->HasFilledPolysForLayer( klayer ) ) - { - rawPolys.BooleanAdd( zone->RawPolysList( klayer ), - SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); - } + fill.BooleanAdd( *zone->GetFill( klayer ), SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); - SHAPE_POLY_SET finalPolys = rawPolys; - finalPolys.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); + fill.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); - zone->SetRawPolysList( klayer, rawPolys ); - zone->SetFilledPolysList( klayer, finalPolys ); + zone->SetFilledPolysList( klayer, fill ); zone->SetIsFilled( true ); zone->SetNeedRefill( false ); } diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp index 6bbe0a15fc..21c3b9ed9a 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp @@ -2028,7 +2028,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers() if( !csCopper.PouredTemplateID.IsEmpty() ) { ZONE* pouredZone = m_zonesMap.at( csCopper.PouredTemplateID ); - SHAPE_POLY_SET rawPolys; + SHAPE_POLY_SET fill; int copperWidth = getKiCadLength( getCopperCode( csCopper.CopperCodeID ).CopperWidth ); @@ -2058,28 +2058,26 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers() } poly.ClearArcs(); - rawPolys.BooleanAdd( poly, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); + fill.BooleanAdd( poly, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); } } else { - rawPolys = getPolySetFromCadstarShape( csCopper.Shape, -1 ); - rawPolys.ClearArcs(); - rawPolys.Inflate( copperWidth / 2, 32 ); + fill = getPolySetFromCadstarShape( csCopper.Shape, -1 ); + fill.ClearArcs(); + fill.Inflate( copperWidth / 2, 32 ); } if( pouredZone->HasFilledPolysForLayer( getKiCadLayer( csCopper.LayerID ) ) ) { - rawPolys.BooleanAdd( pouredZone->RawPolysList( getKiCadLayer( csCopper.LayerID )), - SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); + fill.BooleanAdd( *pouredZone->GetFill( getKiCadLayer( csCopper.LayerID ) ), + SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); } - SHAPE_POLY_SET finalPolys = rawPolys; - finalPolys.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); + fill.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); - pouredZone->SetRawPolysList( getKiCadLayer( csCopper.LayerID ), rawPolys ); - pouredZone->SetFilledPolysList( getKiCadLayer( csCopper.LayerID ), finalPolys ); + pouredZone->SetFilledPolysList( getKiCadLayer( csCopper.LayerID ), fill ); pouredZone->SetIsFilled( true ); pouredZone->SetNeedRefill( false ); continue; @@ -2155,12 +2153,11 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers() zone->SetPadConnection( ZONE_CONNECTION::FULL ); zone->SetNet( getKiCadNet( csCopper.NetRef.NetID ) ); zone->SetPriority( m_zonesMap.size() + 1 ); // Highest priority (always fill first) - zone->SetRawPolysList( getKiCadLayer( csCopper.LayerID ), *zone->Outline() ); - SHAPE_POLY_SET fillePolys( *zone->Outline() ); - fillePolys.Fracture( SHAPE_POLY_SET::POLYGON_MODE::PM_STRICTLY_SIMPLE ); + SHAPE_POLY_SET fill( *zone->Outline() ); + fill.Fracture( SHAPE_POLY_SET::POLYGON_MODE::PM_STRICTLY_SIMPLE ); - zone->SetFilledPolysList( getKiCadLayer( csCopper.LayerID ), fillePolys ); + zone->SetFilledPolysList( getKiCadLayer( csCopper.LayerID ), fill ); } } } diff --git a/pcbnew/zone.cpp b/pcbnew/zone.cpp index 94982a5d09..5ad5448672 100644 --- a/pcbnew/zone.cpp +++ b/pcbnew/zone.cpp @@ -156,7 +156,6 @@ void ZONE::InitDataFromSrcInCopyCtor( const ZONE& aZone ) else m_FilledPolysList[layer] = std::make_shared(); - m_RawPolysList[layer] = aZone.m_RawPolysList.at( layer ); m_filledPolysHash[layer] = aZone.m_filledPolysHash.at( layer ); m_insulatedIslands[layer] = aZone.m_insulatedIslands.at( layer ); } @@ -250,14 +249,12 @@ void ZONE::SetLayerSet( LSET aLayerSet ) UnFill(); m_FilledPolysList.clear(); - m_RawPolysList.clear(); m_filledPolysHash.clear(); m_insulatedIslands.clear(); for( PCB_LAYER_ID layer : aLayerSet.Seq() ) { m_FilledPolysList[layer] = std::make_shared(); - m_RawPolysList[layer] = {}; m_filledPolysHash[layer] = {}; m_insulatedIslands[layer] = {}; } diff --git a/pcbnew/zone.h b/pcbnew/zone.h index b7338bc6bc..59823030eb 100644 --- a/pcbnew/zone.h +++ b/pcbnew/zone.h @@ -665,14 +665,6 @@ public: m_FilledPolysList[aLayer] = std::make_shared( aPolysList ); } - /** - * Set the list of filled polygons. - */ - void SetRawPolysList( PCB_LAYER_ID aLayer, const SHAPE_POLY_SET& aPolysList ) - { - m_RawPolysList[aLayer] = aPolysList; - } - /** * Check if a given filled polygon is an insulated island. * @@ -717,12 +709,6 @@ public: void AddPolygon( const SHAPE_LINE_CHAIN& aPolygon ); - SHAPE_POLY_SET& RawPolysList( PCB_LAYER_ID aLayer ) - { - wxASSERT( m_RawPolysList.count( aLayer ) ); - return m_RawPolysList.at( aLayer ); - } - wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAPS GetMenuImage() const override; @@ -932,7 +918,6 @@ protected: * described by m_Poly can have many filled areas */ std::map> m_FilledPolysList; - std::map m_RawPolysList; /// Temp variables used while filling EDA_RECT m_bboxCache; diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index b5203517ec..873afa3e28 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -238,13 +238,12 @@ bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWindow* aPare continue; // Now we're ready to fill. - SHAPE_POLY_SET rawPolys, finalPolys; - fillSingleZone( zone, layer, rawPolys, finalPolys ); + SHAPE_POLY_SET fillPolys; + fillSingleZone( zone, layer, fillPolys ); std::unique_lock zoneLock( zone->GetLock() ); - zone->SetRawPolysList( layer, rawPolys ); - zone->SetFilledPolysList( layer, finalPolys ); + zone->SetFilledPolysList( layer, fillPolys ); zone->SetFillFlag( layer, true ); if( m_progressReporter ) @@ -987,11 +986,11 @@ void ZONE_FILLER::subtractHigherPriorityZones( const ZONE* aZone, PCB_LAYER_ID a * 5 - Removes unconnected copper islands, deleting any affected spokes * 6 - Adds in the remaining spokes */ -bool ZONE_FILLER::computeRawFilledArea( const ZONE* aZone, - PCB_LAYER_ID aLayer, PCB_LAYER_ID aDebugLayer, - const SHAPE_POLY_SET& aSmoothedOutline, - const SHAPE_POLY_SET& aMaxExtents, - SHAPE_POLY_SET& aRawPolys ) +bool ZONE_FILLER::fillCopperZone( const ZONE* aZone, + PCB_LAYER_ID aLayer, PCB_LAYER_ID aDebugLayer, + const SHAPE_POLY_SET& aSmoothedOutline, + const SHAPE_POLY_SET& aMaxExtents, + SHAPE_POLY_SET& aRawPolys ) { m_maxError = m_board->GetDesignSettings().m_MaxError; @@ -1160,8 +1159,7 @@ bool ZONE_FILLER::computeRawFilledArea( const ZONE* aZone, * The solid areas can be more than one on copper layers, and do not have holes * ( holes are linked by overlapping segments to the main outline) */ -bool ZONE_FILLER::fillSingleZone( ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aRawPolys, - SHAPE_POLY_SET& aFinalPolys ) +bool ZONE_FILLER::fillSingleZone( ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aFillPolys ) { SHAPE_POLY_SET* boardOutline = m_brdOutlinesValid ? &m_boardOutline : nullptr; SHAPE_POLY_SET maxExtents; @@ -1182,10 +1180,8 @@ bool ZONE_FILLER::fillSingleZone( ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_S if( aZone->IsOnCopperLayer() ) { - if( computeRawFilledArea( aZone, aLayer, debugLayer, smoothedPoly, maxExtents, aRawPolys ) ) + if( fillCopperZone( aZone, aLayer, debugLayer, smoothedPoly, maxExtents, aFillPolys ) ) aZone->SetNeedRefill( false ); - - aFinalPolys = aRawPolys; } else { @@ -1206,10 +1202,9 @@ bool ZONE_FILLER::fillSingleZone( ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_S if( half_min_width - epsilon > epsilon ) smoothedPoly.Inflate( half_min_width - epsilon, numSegs ); - aRawPolys = smoothedPoly; - aFinalPolys = smoothedPoly; + aFillPolys = smoothedPoly; - aFinalPolys.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); + aFillPolys.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); aZone->SetNeedRefill( false ); } diff --git a/pcbnew/zone_filler.h b/pcbnew/zone_filler.h index 81b0071637..f6ddadf2f5 100644 --- a/pcbnew/zone_filler.h +++ b/pcbnew/zone_filler.h @@ -75,7 +75,7 @@ private: SHAPE_POLY_SET& aRawFill ); /** - * Function computeRawFilledArea + * Function fillCopperZone * Add non copper areas polygons (pads and tracks with clearance) * to a filled copper area * used in BuildFilledSolidAreasPolygons when calculating filled areas in a zone @@ -85,9 +85,9 @@ private: * filled copper area polygon (without clearance areas * @param aPcb: the current board */ - bool computeRawFilledArea( const ZONE* aZone, PCB_LAYER_ID aLayer, PCB_LAYER_ID aDebugLayer, - const SHAPE_POLY_SET& aSmoothedOutline, - const SHAPE_POLY_SET& aMaxExtents, SHAPE_POLY_SET& aRawPolys ); + bool fillCopperZone( const ZONE* aZone, PCB_LAYER_ID aLayer, PCB_LAYER_ID aDebugLayer, + const SHAPE_POLY_SET& aSmoothedOutline, + const SHAPE_POLY_SET& aMaxExtents, SHAPE_POLY_SET& aRawPolys ); /** * Function buildThermalSpokes @@ -104,15 +104,12 @@ private: * in order to have drawable (and plottable) filled polygons. * @return true if OK, false if the solid polygons cannot be built * @param aZone is the zone to fill - * @param aRawPolys: A reference to a SHAPE_POLY_SET buffer to store - * filled solid areas polygons (with holes) - * @param aFinalPolys: A reference to a SHAPE_POLY_SET buffer to store polygons with no holes + * @param aFillPolys: A reference to a SHAPE_POLY_SET buffer to store polygons with no holes * (holes are linked to main outline by overlapping segments, and these polygons are shrunk * by aZone->GetMinThickness() / 2 to be drawn with a outline thickness = aZone->GetMinThickness() * aFinalPolys are polygons that will be drawn on screen and plotted */ - bool fillSingleZone( ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aRawPolys, - SHAPE_POLY_SET& aFinalPolys ); + bool fillSingleZone( ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aFillPolys ); /** * for zones having the ZONE_FILL_MODE::ZONE_FILL_MODE::HATCH_PATTERN, create a grid pattern