Fix filled zone rotation and move operations

This commit is contained in:
Jon Evans 2020-06-30 13:32:48 -04:00
parent 40847c055d
commit 32b7b0c617
2 changed files with 12 additions and 10 deletions

View File

@ -1552,6 +1552,8 @@ void SHAPE_POLY_SET::Rotate( double aAngle, const VECTOR2I& aCenter )
for( SHAPE_LINE_CHAIN& path : poly )
path.Rotate( aAngle, aCenter );
}
CacheTriangulation();
}

View File

@ -198,13 +198,13 @@ bool ZONE_CONTAINER::UnFill()
{
bool change = false;
for( std::pair<PCB_LAYER_ID, SHAPE_POLY_SET> pair : m_FilledPolysList )
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
{
change |= !pair.second.IsEmpty();
pair.second.RemoveAllContours();
}
for( std::pair<PCB_LAYER_ID, ZONE_SEGMENT_FILL> pair : m_FillSegmList )
for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
{
change |= !pair.second.empty();
pair.second.clear();
@ -721,10 +721,10 @@ void ZONE_CONTAINER::Move( const wxPoint& offset )
Hatch();
for( std::pair<PCB_LAYER_ID, SHAPE_POLY_SET> pair : m_FilledPolysList )
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
pair.second.Move( offset );
for( std::pair<PCB_LAYER_ID, ZONE_SEGMENT_FILL> pair : m_FillSegmList )
for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
{
for( SEG& seg : pair.second )
{
@ -760,10 +760,10 @@ void ZONE_CONTAINER::Rotate( const wxPoint& centre, double angle )
Hatch();
/* rotate filled areas: */
for( std::pair<PCB_LAYER_ID, SHAPE_POLY_SET> pair : m_FilledPolysList )
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
pair.second.Rotate( angle, VECTOR2I( centre ) );
for( std::pair<PCB_LAYER_ID, ZONE_SEGMENT_FILL> pair : m_FillSegmList )
for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
{
for( SEG& seg : pair.second )
{
@ -797,10 +797,10 @@ void ZONE_CONTAINER::Mirror( const wxPoint& aMirrorRef, bool aMirrorLeftRight )
Hatch();
for( std::pair<PCB_LAYER_ID, SHAPE_POLY_SET> pair : m_FilledPolysList )
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
pair.second.Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
for( std::pair<PCB_LAYER_ID, ZONE_SEGMENT_FILL> pair : m_FillSegmList )
for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
{
for( SEG& seg : pair.second )
{
@ -1146,7 +1146,7 @@ void ZONE_CONTAINER::SwapData( BOARD_ITEM* aImage )
void ZONE_CONTAINER::CacheTriangulation()
{
for( std::pair<PCB_LAYER_ID, SHAPE_POLY_SET> pair : m_FilledPolysList )
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
pair.second.CacheTriangulation();
}
@ -1255,7 +1255,7 @@ double ZONE_CONTAINER::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<PCB_LAYER_ID, SHAPE_POLY_SET> pair : m_FilledPolysList )
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
{
SHAPE_POLY_SET& poly = pair.second;