Performance: get rid of rawPolys / finalPolys distinction.
(The final fractured polys are required, and we don't really ever use the raw polys anyway, so they were removed.)
This commit is contained in:
parent
08383e923c
commit
327ddad79f
|
@ -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<ALTIUM_VERTICE>& 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 );
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,7 +156,6 @@ void ZONE::InitDataFromSrcInCopyCtor( const ZONE& aZone )
|
|||
else
|
||||
m_FilledPolysList[layer] = std::make_shared<SHAPE_POLY_SET>();
|
||||
|
||||
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<SHAPE_POLY_SET>();
|
||||
m_RawPolysList[layer] = {};
|
||||
m_filledPolysHash[layer] = {};
|
||||
m_insulatedIslands[layer] = {};
|
||||
}
|
||||
|
|
|
@ -665,14 +665,6 @@ public:
|
|||
m_FilledPolysList[aLayer] = std::make_shared<SHAPE_POLY_SET>( 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<PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>> m_FilledPolysList;
|
||||
std::map<PCB_LAYER_ID, SHAPE_POLY_SET> m_RawPolysList;
|
||||
|
||||
/// Temp variables used while filling
|
||||
EDA_RECT m_bboxCache;
|
||||
|
|
|
@ -238,13 +238,12 @@ bool ZONE_FILLER::Fill( std::vector<ZONE*>& 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<std::mutex> 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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue