|
|
|
@ -149,7 +149,13 @@ void ZONE::InitDataFromSrcInCopyCtor( const ZONE& aZone ) |
|
|
|
|
|
|
|
for( PCB_LAYER_ID layer : aZone.GetLayerSet().Seq() ) |
|
|
|
{ |
|
|
|
m_FilledPolysList[layer] = aZone.m_FilledPolysList.at( layer ); |
|
|
|
std::shared_ptr<SHAPE_POLY_SET> fill = aZone.m_FilledPolysList.at( layer ); |
|
|
|
|
|
|
|
if( fill ) |
|
|
|
m_FilledPolysList[layer] = std::make_shared<SHAPE_POLY_SET>( *fill ); |
|
|
|
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 ); |
|
|
|
@ -178,11 +184,11 @@ bool ZONE::UnFill() |
|
|
|
{ |
|
|
|
bool change = false; |
|
|
|
|
|
|
|
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList ) |
|
|
|
for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList ) |
|
|
|
{ |
|
|
|
change |= !pair.second.IsEmpty(); |
|
|
|
change |= !pair.second->IsEmpty(); |
|
|
|
m_insulatedIslands[pair.first].clear(); |
|
|
|
pair.second.RemoveAllContours(); |
|
|
|
pair.second->RemoveAllContours(); |
|
|
|
} |
|
|
|
|
|
|
|
m_isFilled = false; |
|
|
|
@ -250,7 +256,7 @@ void ZONE::SetLayerSet( LSET aLayerSet ) |
|
|
|
|
|
|
|
for( PCB_LAYER_ID layer : aLayerSet.Seq() ) |
|
|
|
{ |
|
|
|
m_FilledPolysList[layer] = {}; |
|
|
|
m_FilledPolysList[layer] = std::make_shared<SHAPE_POLY_SET>(); |
|
|
|
m_RawPolysList[layer] = {}; |
|
|
|
m_filledPolysHash[layer] = {}; |
|
|
|
m_insulatedIslands[layer] = {}; |
|
|
|
@ -351,7 +357,7 @@ void ZONE::BuildHashValue( PCB_LAYER_ID aLayer ) |
|
|
|
if( !m_FilledPolysList.count( aLayer ) ) |
|
|
|
m_filledPolysHash[aLayer] = g_nullPoly.GetHash(); |
|
|
|
else |
|
|
|
m_filledPolysHash[aLayer] = m_FilledPolysList.at( aLayer ).GetHash(); |
|
|
|
m_filledPolysHash[aLayer] = m_FilledPolysList.at( aLayer )->GetHash(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -466,13 +472,12 @@ bool ZONE::HitTestFilledArea( PCB_LAYER_ID aLayer, const VECTOR2I& aRefPos, int |
|
|
|
// Rule areas have no filled area, but it's generally nice to treat their interior as if it were
|
|
|
|
// filled so that people don't have to select them by their outline (which is min-width)
|
|
|
|
if( GetIsRuleArea() ) |
|
|
|
return m_Poly->Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1, aAccuracy ); |
|
|
|
return m_Poly->Contains( aRefPos, -1, aAccuracy ); |
|
|
|
|
|
|
|
if( !m_FilledPolysList.count( aLayer ) ) |
|
|
|
return false; |
|
|
|
|
|
|
|
return m_FilledPolysList.at( aLayer ).Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1, |
|
|
|
aAccuracy ); |
|
|
|
return m_FilledPolysList.at( aLayer )->Contains( aRefPos, -1, aAccuracy ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -622,7 +627,7 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& |
|
|
|
|
|
|
|
if( layer_it != m_FilledPolysList.end() ) |
|
|
|
{ |
|
|
|
msg.Printf( wxT( "%d" ), layer_it->second.TotalVertices() ); |
|
|
|
msg.Printf( wxT( "%d" ), layer_it->second->TotalVertices() ); |
|
|
|
aList.emplace_back( MSG_PANEL_ITEM( _( "Corner Count" ), msg ) ); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -636,8 +641,8 @@ void ZONE::Move( const VECTOR2I& offset ) |
|
|
|
|
|
|
|
HatchBorder(); |
|
|
|
|
|
|
|
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList ) |
|
|
|
pair.second.Move( offset ); |
|
|
|
for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList ) |
|
|
|
pair.second->Move( offset ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -662,8 +667,8 @@ void ZONE::Rotate( const VECTOR2I& aCentre, const EDA_ANGLE& aAngle ) |
|
|
|
HatchBorder(); |
|
|
|
|
|
|
|
/* rotate filled areas: */ |
|
|
|
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList ) |
|
|
|
pair.second.Rotate( aAngle, aCentre ); |
|
|
|
for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList ) |
|
|
|
pair.second->Rotate( aAngle, aCentre ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -686,8 +691,8 @@ void ZONE::Mirror( const VECTOR2I& aMirrorRef, bool aMirrorLeftRight ) |
|
|
|
|
|
|
|
HatchBorder(); |
|
|
|
|
|
|
|
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList ) |
|
|
|
pair.second.Mirror( aMirrorLeftRight, !aMirrorLeftRight, aMirrorRef ); |
|
|
|
for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList ) |
|
|
|
pair.second->Mirror( aMirrorLeftRight, !aMirrorLeftRight, aMirrorRef ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1018,13 +1023,13 @@ void ZONE::CacheTriangulation( PCB_LAYER_ID aLayer ) |
|
|
|
{ |
|
|
|
if( aLayer == UNDEFINED_LAYER ) |
|
|
|
{ |
|
|
|
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList ) |
|
|
|
pair.second.CacheTriangulation(); |
|
|
|
for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList ) |
|
|
|
pair.second->CacheTriangulation(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if( m_FilledPolysList.count( aLayer ) ) |
|
|
|
m_FilledPolysList[ aLayer ].CacheTriangulation(); |
|
|
|
m_FilledPolysList[ aLayer ]->CacheTriangulation(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1175,16 +1180,16 @@ double ZONE::CalculateFilledArea() |
|
|
|
|
|
|
|
// Iterate over each outline polygon in the zone and then iterate over
|
|
|
|
// each hole it has to compute the total area.
|
|
|
|
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList ) |
|
|
|
for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList ) |
|
|
|
{ |
|
|
|
SHAPE_POLY_SET& poly = pair.second; |
|
|
|
std::shared_ptr<SHAPE_POLY_SET>& poly = pair.second; |
|
|
|
|
|
|
|
for( int i = 0; i < poly.OutlineCount(); i++ ) |
|
|
|
for( int i = 0; i < poly->OutlineCount(); i++ ) |
|
|
|
{ |
|
|
|
m_area += poly.Outline( i ).Area(); |
|
|
|
m_area += poly->Outline( i ).Area(); |
|
|
|
|
|
|
|
for( int j = 0; j < poly.HoleCount( i ); j++ ) |
|
|
|
m_area -= poly.Hole( i, j ).Area(); |
|
|
|
for( int j = 0; j < poly->HoleCount( i ); j++ ) |
|
|
|
m_area -= poly->Hole( i, j ).Area(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1302,7 +1307,7 @@ std::shared_ptr<SHAPE> ZONE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
shape.reset( m_FilledPolysList.at( aLayer ).Clone() ); |
|
|
|
shape.reset( m_FilledPolysList.at( aLayer )->Clone() ); |
|
|
|
} |
|
|
|
|
|
|
|
return shape; |
|
|
|
@ -1318,7 +1323,7 @@ void ZONE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, |
|
|
|
if( !m_FilledPolysList.count( aLayer ) ) |
|
|
|
return; |
|
|
|
|
|
|
|
aCornerBuffer = m_FilledPolysList.at( aLayer ); |
|
|
|
aCornerBuffer = *m_FilledPolysList.at( aLayer ); |
|
|
|
|
|
|
|
// Rebuild filled areas only if clearance is not 0
|
|
|
|
if( aClearance ) |
|
|
|
@ -1332,8 +1337,8 @@ void ZONE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, |
|
|
|
void ZONE::TransformSolidAreasShapesToPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aCornerBuffer, |
|
|
|
int aError ) const |
|
|
|
{ |
|
|
|
if( m_FilledPolysList.count( aLayer ) && !m_FilledPolysList.at( aLayer ).IsEmpty() ) |
|
|
|
aCornerBuffer.Append( m_FilledPolysList.at( aLayer ) ); |
|
|
|
if( m_FilledPolysList.count( aLayer ) && !m_FilledPolysList.at( aLayer )->IsEmpty() ) |
|
|
|
aCornerBuffer.Append( *m_FilledPolysList.at( aLayer ) ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|