diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index 425c23ab4a..34b4271593 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -454,7 +454,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo if( !poly.IsEmpty() ) { if( clearance.x ) - poly.Inflate( clearance.x, SHAPE_POLY_SET::ROUND_ALL_CORNERS, maxError ); + poly.Inflate( clearance.x, CORNER_STRATEGY::ROUND_ALL_CORNERS, maxError ); // Add the PAD polygon ConvertPolygonToTriangles( poly, *aContainer, m_biuTo3Dunits, *aPad ); diff --git a/common/eda_shape.cpp b/common/eda_shape.cpp index 45ea974f7c..b7519a6358 100644 --- a/common/eda_shape.cpp +++ b/common/eda_shape.cpp @@ -1664,7 +1664,7 @@ void EDA_SHAPE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance tmp.Append( poly.GetPoint( jj ) ); if( width > 0 ) - tmp.Inflate( width/2, SHAPE_POLY_SET::ROUND_ALL_CORNERS, aError, false); + tmp.Inflate( width/2, CORNER_STRATEGY::ROUND_ALL_CORNERS, aError, false); aBuffer.Append( tmp ); } diff --git a/common/view/view.cpp b/common/view/view.cpp index 6172d175b1..833b6592ae 100644 --- a/common/view/view.cpp +++ b/common/view/view.cpp @@ -620,7 +620,7 @@ void VIEW::SetCenter( const VECTOR2D& aCenter, const std::vector& obscuri while( !unobscuredPoly.IsEmpty() ) { unobscuredCenter = unobscuredPoly.BBox().Centre(); - unobscuredPoly.Deflate( step, SHAPE_POLY_SET::ALLOW_ACUTE_CORNERS, ARC_LOW_DEF ); + unobscuredPoly.Deflate( step, CORNER_STRATEGY::ALLOW_ACUTE_CORNERS, ARC_LOW_DEF ); } SetCenter( aCenter - ToWorld( unobscuredCenter - screenRect.Centre(), false ) ); diff --git a/libs/kimath/include/geometry/corner_strategy.h b/libs/kimath/include/geometry/corner_strategy.h new file mode 100644 index 0000000000..cccd4841c5 --- /dev/null +++ b/libs/kimath/include/geometry/corner_strategy.h @@ -0,0 +1,49 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2015-2019 CERN + * Copyright (C) 2021-2023 KiCad Developers, see AUTHORS.txt for contributors. + * + * @author Tomasz Wlostowski + * @author Alejandro García Montoro + * + * Point in polygon algorithm adapted from Clipper Library (C) Angus Johnson, + * subject to Clipper library license. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef CORNER_STRATEGY_H_ +#define CORNER_STRATEGY_H_ + + +/// define how inflate transform build inflated polygon +enum class CORNER_STRATEGY +{ + ALLOW_ACUTE_CORNERS, ///< just inflate the polygon. Acute angles create spikes + CHAMFER_ACUTE_CORNERS, ///< Acute angles are chamfered + ROUND_ACUTE_CORNERS, ///< Acute angles are rounded + CHAMFER_ALL_CORNERS, ///< All angles are chamfered. + ///< The distance between new and old polygon edges is not + ///< constant, but do not change a lot + ROUND_ALL_CORNERS ///< All angles are rounded. + ///< The distance between new and old polygon edges is constant +}; + + +#endif // CORNER_STRATEGY_H_ \ No newline at end of file diff --git a/libs/kimath/include/geometry/shape_poly_set.h b/libs/kimath/include/geometry/shape_poly_set.h index dbea0edce5..79b903e413 100644 --- a/libs/kimath/include/geometry/shape_poly_set.h +++ b/libs/kimath/include/geometry/shape_poly_set.h @@ -39,6 +39,7 @@ #include // for ClipType, PolyTree (ptr only) #include +#include #include // for SEG #include #include @@ -1008,19 +1009,6 @@ public: */ void RebuildHolesFromContours(); - /// define how inflate transform build inflated polygon - enum CORNER_STRATEGY - { - ALLOW_ACUTE_CORNERS, ///< just inflate the polygon. Acute angles create spikes - CHAMFER_ACUTE_CORNERS, ///< Acute angles are chamfered - ROUND_ACUTE_CORNERS, ///< Acute angles are rounded - CHAMFER_ALL_CORNERS, ///< All angles are chamfered. - ///< The distance between new and old polygon edges is not - ///< constant, but do not change a lot - ROUND_ALL_CORNERS ///< All angles are rounded. - ///< The distance between new and old polygon edges is constant - }; - /** * Perform outline inflation/deflation. * diff --git a/libs/kimath/src/geometry/shape_poly_set.cpp b/libs/kimath/src/geometry/shape_poly_set.cpp index f337b13c41..10b199a278 100644 --- a/libs/kimath/src/geometry/shape_poly_set.cpp +++ b/libs/kimath/src/geometry/shape_poly_set.cpp @@ -1031,8 +1031,7 @@ void SHAPE_POLY_SET::BooleanXor( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& } -void SHAPE_POLY_SET::InflateWithLinkedHoles( int aFactor, - SHAPE_POLY_SET::CORNER_STRATEGY aCornerStrategy, +void SHAPE_POLY_SET::InflateWithLinkedHoles( int aFactor, CORNER_STRATEGY aCornerStrategy, int aMaxError, POLYGON_MODE aFastMode ) { Unfracture( aFastMode ); @@ -1061,28 +1060,28 @@ void SHAPE_POLY_SET::inflate1( int aAmount, int aCircleSegCount, CORNER_STRATEGY switch( aCornerStrategy ) { - case ALLOW_ACUTE_CORNERS: + case CORNER_STRATEGY::ALLOW_ACUTE_CORNERS: joinType = jtMiter; miterLimit = 10; // Allows large spikes miterFallback = jtSquare; break; - case CHAMFER_ACUTE_CORNERS: // Acute angles are chamfered + case CORNER_STRATEGY::CHAMFER_ACUTE_CORNERS: // Acute angles are chamfered joinType = jtMiter; miterFallback = jtRound; break; - case ROUND_ACUTE_CORNERS: // Acute angles are rounded + case CORNER_STRATEGY::ROUND_ACUTE_CORNERS: // Acute angles are rounded joinType = jtMiter; miterFallback = jtSquare; break; - case CHAMFER_ALL_CORNERS: // All angles are chamfered. + case CORNER_STRATEGY::CHAMFER_ALL_CORNERS: // All angles are chamfered. joinType = jtSquare; miterFallback = jtSquare; break; - case ROUND_ALL_CORNERS: // All angles are rounded. + case CORNER_STRATEGY::ROUND_ALL_CORNERS: // All angles are rounded. joinType = jtRound; miterFallback = jtSquare; break; @@ -1152,24 +1151,24 @@ void SHAPE_POLY_SET::inflate2( int aAmount, int aCircleSegCount, CORNER_STRATEGY switch( aCornerStrategy ) { - case ALLOW_ACUTE_CORNERS: + case CORNER_STRATEGY::ALLOW_ACUTE_CORNERS: joinType = JoinType::Miter; miterLimit = 10; // Allows large spikes break; - case CHAMFER_ACUTE_CORNERS: // Acute angles are chamfered + case CORNER_STRATEGY::CHAMFER_ACUTE_CORNERS: // Acute angles are chamfered joinType = JoinType::Miter; break; - case ROUND_ACUTE_CORNERS: // Acute angles are rounded + case CORNER_STRATEGY::ROUND_ACUTE_CORNERS: // Acute angles are rounded joinType = JoinType::Miter; break; - case CHAMFER_ALL_CORNERS: // All angles are chamfered. + case CORNER_STRATEGY::CHAMFER_ALL_CORNERS: // All angles are chamfered. joinType = JoinType::Square; break; - case ROUND_ALL_CORNERS: // All angles are rounded. + case CORNER_STRATEGY::ROUND_ALL_CORNERS: // All angles are rounded. joinType = JoinType::Round; break; } diff --git a/pcbnew/drc/drc_test_provider_disallow.cpp b/pcbnew/drc/drc_test_provider_disallow.cpp index c3a9d7b329..31a667a0f2 100644 --- a/pcbnew/drc/drc_test_provider_disallow.cpp +++ b/pcbnew/drc/drc_test_provider_disallow.cpp @@ -127,7 +127,7 @@ bool DRC_TEST_PROVIDER_DISALLOW::Run() // they will be exactly touching along the entire exclusion border. SHAPE_POLY_SET areaPoly = ruleArea->Outline()->CloneDropTriangulation(); areaPoly.Fracture( SHAPE_POLY_SET::PM_FAST ); - areaPoly.Deflate( epsilon, SHAPE_POLY_SET::ALLOW_ACUTE_CORNERS, ARC_LOW_DEF ); + areaPoly.Deflate( epsilon, CORNER_STRATEGY::ALLOW_ACUTE_CORNERS, ARC_LOW_DEF ); DRC_RTREE* zoneRTree = board->m_CopperZoneRTreeCache[ copperZone ].get(); diff --git a/pcbnew/drc/drc_test_provider_solder_mask.cpp b/pcbnew/drc/drc_test_provider_solder_mask.cpp index 5051ffd21f..41f0172159 100644 --- a/pcbnew/drc/drc_test_provider_solder_mask.cpp +++ b/pcbnew/drc/drc_test_provider_solder_mask.cpp @@ -225,9 +225,9 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::buildRTrees() solderMask->GetFill( F_Mask )->Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); solderMask->GetFill( B_Mask )->Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); - solderMask->GetFill( F_Mask )->Deflate( m_webWidth / 2, SHAPE_POLY_SET::CHAMFER_ALL_CORNERS, + solderMask->GetFill( F_Mask )->Deflate( m_webWidth / 2, CORNER_STRATEGY::CHAMFER_ALL_CORNERS, m_maxError ); - solderMask->GetFill( B_Mask )->Deflate( m_webWidth / 2, SHAPE_POLY_SET::CHAMFER_ALL_CORNERS, + solderMask->GetFill( B_Mask )->Deflate( m_webWidth / 2, CORNER_STRATEGY::CHAMFER_ALL_CORNERS, m_maxError ); solderMask->SetFillFlag( F_Mask, true ); diff --git a/pcbnew/drc/drc_test_provider_text_dims.cpp b/pcbnew/drc/drc_test_provider_text_dims.cpp index 021d99e567..0fba8b39bc 100644 --- a/pcbnew/drc/drc_test_provider_text_dims.cpp +++ b/pcbnew/drc/drc_test_provider_text_dims.cpp @@ -177,7 +177,7 @@ bool DRC_TEST_PROVIDER_TEXT_DIMS::Run() SHAPE_POLY_SET poly = outlineGlyph->CloneDropTriangulation(); poly.Deflate( constraint.Value().Min() / 2, - SHAPE_POLY_SET::CHAMFER_ALL_CORNERS, ARC_LOW_DEF ); + CORNER_STRATEGY::CHAMFER_ALL_CORNERS, ARC_LOW_DEF ); poly.Simplify( SHAPE_POLY_SET::PM_FAST ); int resultingOutlineCount = poly.OutlineCount(); @@ -199,7 +199,7 @@ bool DRC_TEST_PROVIDER_TEXT_DIMS::Run() continue; poly.Inflate( constraint.Value().Min() / 2, - SHAPE_POLY_SET::CHAMFER_ALL_CORNERS, ARC_LOW_DEF, true ); + CORNER_STRATEGY::CHAMFER_ALL_CORNERS, ARC_LOW_DEF, true ); double resultingGlyphArea = poly.Area(); diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 897e6c3a94..dcb5f68c86 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -2487,7 +2487,7 @@ void FOOTPRINT::BuildCourtyardCaches( OUTLINE_ERROR_HANDLER* aErrorHandler ) true, aErrorHandler ) ) { // Touching courtyards, or courtyards -at- the clearance distance are legal. - m_courtyard_cache_front.Inflate( -1, SHAPE_POLY_SET::CHAMFER_ACUTE_CORNERS, maxError ); + m_courtyard_cache_front.Inflate( -1, CORNER_STRATEGY::CHAMFER_ACUTE_CORNERS, maxError ); m_courtyard_cache_front.CacheTriangulation( false ); } @@ -2500,7 +2500,7 @@ void FOOTPRINT::BuildCourtyardCaches( OUTLINE_ERROR_HANDLER* aErrorHandler ) true, aErrorHandler ) ) { // Touching courtyards, or courtyards -at- the clearance distance are legal. - m_courtyard_cache_back.Inflate( -1, SHAPE_POLY_SET::CHAMFER_ACUTE_CORNERS, maxError ); + m_courtyard_cache_back.Inflate( -1, CORNER_STRATEGY::CHAMFER_ACUTE_CORNERS, maxError ); m_courtyard_cache_back.CacheTriangulation( false ); } diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index 9dae09402a..fda4d19cf0 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -1654,7 +1654,7 @@ void PAD::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, if( aErrorLoc == ERROR_OUTSIDE ) aClearance += aMaxError; - outline.Inflate( aClearance, SHAPE_POLY_SET::ROUND_ALL_CORNERS, aMaxError ); + outline.Inflate( aClearance, CORNER_STRATEGY::ROUND_ALL_CORNERS, aMaxError ); outline.Fracture( SHAPE_POLY_SET::PM_FAST ); } else if( aClearance < 0 ) @@ -1663,7 +1663,7 @@ void PAD::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, // worry ourselves overly about which side the error is on. // aClearance is negative so this is actually a deflate - outline.Inflate( aClearance, SHAPE_POLY_SET::ALLOW_ACUTE_CORNERS, aMaxError ); + outline.Inflate( aClearance, CORNER_STRATEGY::ALLOW_ACUTE_CORNERS, aMaxError ); outline.Fracture( SHAPE_POLY_SET::PM_FAST ); } diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 94c7845c80..fd29f2addc 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -477,7 +477,7 @@ void PCB_BASE_FRAME::FocusOnItems( std::vector aItems, PCB_LAYER_ID try { - itemPoly.Deflate( step, SHAPE_POLY_SET::ALLOW_ACUTE_CORNERS, ARC_LOW_DEF ); + itemPoly.Deflate( step, CORNER_STRATEGY::ALLOW_ACUTE_CORNERS, ARC_LOW_DEF ); } catch( const std::exception& exc ) { diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index d0eb960210..d946558c8a 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -1574,7 +1574,7 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer ) for( int ii = 0; ii < poly->PointCount(); ++ii ) outline.Append( poly->CPoint( ii ) ); - outline.Deflate( -margin.x, SHAPE_POLY_SET::CHAMFER_ALL_CORNERS, + outline.Deflate( -margin.x, CORNER_STRATEGY::CHAMFER_ALL_CORNERS, m_maxError ); m_gal->DrawPolygon( outline ); diff --git a/pcbnew/pcb_text.cpp b/pcbnew/pcb_text.cpp index 019bf76a51..27e6d7f429 100644 --- a/pcbnew/pcb_text.cpp +++ b/pcbnew/pcb_text.cpp @@ -507,7 +507,7 @@ void PCB_TEXT::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, int aClearance, if( aErrorLoc == ERROR_OUTSIDE ) aClearance += aMaxError; - textShape.Inflate( aClearance, SHAPE_POLY_SET::ROUND_ALL_CORNERS, aMaxError ); + textShape.Inflate( aClearance, CORNER_STRATEGY::ROUND_ALL_CORNERS, aMaxError ); } aBuffer.Append( textShape ); diff --git a/pcbnew/pcb_textbox.cpp b/pcbnew/pcb_textbox.cpp index 4f716fb0fb..fabcbd4789 100644 --- a/pcbnew/pcb_textbox.cpp +++ b/pcbnew/pcb_textbox.cpp @@ -507,7 +507,7 @@ void PCB_TEXTBOX::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, int aClearanc if( aErrorLoc == ERROR_OUTSIDE ) aClearance += aMaxError; - buffer.Inflate( aClearance, SHAPE_POLY_SET::ROUND_ALL_CORNERS, aMaxError, true ); + buffer.Inflate( aClearance, CORNER_STRATEGY::ROUND_ALL_CORNERS, aMaxError, true ); } else { diff --git a/pcbnew/pcbexpr_functions.cpp b/pcbnew/pcbexpr_functions.cpp index c40ff3d77d..2ec684e257 100644 --- a/pcbnew/pcbexpr_functions.cpp +++ b/pcbnew/pcbexpr_functions.cpp @@ -429,7 +429,7 @@ bool collidesWithArea( BOARD_ITEM* aItem, PCBEXPR_CONTEXT* aCtx, ZONE* aArea ) SHAPE_POLY_SET areaOutline = aArea->Outline()->CloneDropTriangulation(); areaOutline.ClearArcs(); areaOutline.Deflate( board->GetDesignSettings().GetDRCEpsilon(), - SHAPE_POLY_SET::ALLOW_ACUTE_CORNERS, ARC_LOW_DEF ); + CORNER_STRATEGY::ALLOW_ACUTE_CORNERS, ARC_LOW_DEF ); if( aItem->GetFlags() & HOLE_PROXY ) { diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index c8a70a425e..13b26b05e0 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -451,7 +451,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, // Shape polygon can have holes so use InflateWithLinkedHoles(), not Inflate() // which can create bad shapes if margin.x is < 0 outline.InflateWithLinkedHoles( mask_clearance, - SHAPE_POLY_SET::ROUND_ALL_CORNERS, maxError, + CORNER_STRATEGY::ROUND_ALL_CORNERS, maxError, SHAPE_POLY_SET::PM_FAST ); dummy.DeletePrimitivesList(); dummy.AddPrimitivePoly( outline, 0, true ); @@ -500,7 +500,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, dummy.TransformShapeToPolygon( outline, UNDEFINED_LAYER, 0, maxError, ERROR_INSIDE ); outline.InflateWithLinkedHoles( mask_clearance, - SHAPE_POLY_SET::ROUND_ALL_CORNERS, maxError, + CORNER_STRATEGY::ROUND_ALL_CORNERS, maxError, SHAPE_POLY_SET::PM_FAST ); // Initialize the dummy pad shape: @@ -532,7 +532,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, // Shape polygon can have holes so use InflateWithLinkedHoles(), not Inflate() // which can create bad shapes if margin.x is < 0 shape.InflateWithLinkedHoles( mask_clearance, - SHAPE_POLY_SET::ROUND_ALL_CORNERS, maxError, + CORNER_STRATEGY::ROUND_ALL_CORNERS, maxError, SHAPE_POLY_SET::PM_FAST ); dummy.DeletePrimitivesList(); dummy.AddPrimitivePoly( shape, 0, true ); @@ -982,7 +982,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, // Merge all polygons: After deflating, not merged (not overlapping) polygons will have the // initial shape (with perhaps small changes due to deflating transform) areas.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); - areas.Deflate( inflate, SHAPE_POLY_SET::CHAMFER_ALL_CORNERS, maxError ); + areas.Deflate( inflate, CORNER_STRATEGY::CHAMFER_ALL_CORNERS, maxError ); // To avoid a lot of code, use a ZONE to handle and plot polygons, because our polygons look // exactly like filled areas in zones. diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp index a0c127fdcf..5f6f4674b9 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp @@ -2145,7 +2145,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers() { fill = getPolySetFromCadstarShape( csCopper.Shape, -1 ); fill.ClearArcs(); - fill.Inflate( copperWidth / 2, SHAPE_POLY_SET::ROUND_ALL_CORNERS, ARC_HIGH_DEF ); + fill.Inflate( copperWidth / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS, ARC_HIGH_DEF ); } if( pouredZone->HasFilledPolysForLayer( getKiCadLayer( csCopper.LayerID ) ) ) @@ -3039,7 +3039,7 @@ SHAPE_POLY_SET CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape( const SHA polySet.ClearArcs(); if( aLineThickness > 0 ) - polySet.Inflate( aLineThickness / 2, SHAPE_POLY_SET::ROUND_ALL_CORNERS, ARC_HIGH_DEF ); + polySet.Inflate( aLineThickness / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS, ARC_HIGH_DEF ); #ifdef DEBUG for( int i = 0; i < polySet.OutlineCount(); ++i ) @@ -3734,7 +3734,7 @@ bool CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities( PCB_LAYER_ID& aLayer ) { SHAPE_POLY_SET intersectShape( *aHigherZone->Outline() ); intersectShape.Inflate( inflateValue( aLowerZone, aHigherZone ), - SHAPE_POLY_SET::ROUND_ALL_CORNERS, ARC_HIGH_DEF ); + CORNER_STRATEGY::ROUND_ALL_CORNERS, ARC_HIGH_DEF ); SHAPE_POLY_SET lowerZoneFill( *aLowerZone->GetFilledPolysList( aLayer ) ); SHAPE_POLY_SET lowerZoneOutline( *aLowerZone->Outline() ); @@ -3752,11 +3752,11 @@ bool CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities( PCB_LAYER_ID& aLayer ) [&]( ZONE* aZoneA, ZONE* aZoneB ) -> double { SHAPE_POLY_SET outLineA( *aZoneA->Outline() ); - outLineA.Inflate( inflateValue( aZoneA, aZoneB ), SHAPE_POLY_SET::ROUND_ALL_CORNERS, + outLineA.Inflate( inflateValue( aZoneA, aZoneB ), CORNER_STRATEGY::ROUND_ALL_CORNERS, ARC_HIGH_DEF ); SHAPE_POLY_SET outLineB( *aZoneA->Outline() ); - outLineB.Inflate( inflateValue( aZoneA, aZoneB ), SHAPE_POLY_SET::ROUND_ALL_CORNERS, + outLineB.Inflate( inflateValue( aZoneA, aZoneB ), CORNER_STRATEGY::ROUND_ALL_CORNERS, ARC_HIGH_DEF ); outLineA.BooleanIntersection( outLineB, SHAPE_POLY_SET::PM_FAST ); diff --git a/pcbnew/plugins/eagle/eagle_plugin.cpp b/pcbnew/plugins/eagle/eagle_plugin.cpp index 9816b8d1b5..8868b7fd36 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.cpp +++ b/pcbnew/plugins/eagle/eagle_plugin.cpp @@ -1526,7 +1526,7 @@ ZONE* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode ) // We trace the zone such that the copper is completely inside. if( p.width.ToPcbUnits() > 0 ) { - polygon.Inflate( p.width.ToPcbUnits() / 2, SHAPE_POLY_SET::ALLOW_ACUTE_CORNERS, + polygon.Inflate( p.width.ToPcbUnits() / 2, CORNER_STRATEGY::ALLOW_ACUTE_CORNERS, ARC_HIGH_DEF, true ); } @@ -2283,7 +2283,7 @@ void EAGLE_PLUGIN::packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) con dwg->Rotate( { 0, 0 }, aFootprint->GetOrientation() ); dwg->Move( aFootprint->GetPosition() ); dwg->GetPolyShape().Inflate( p.width.ToPcbUnits() / 2, - SHAPE_POLY_SET::ALLOW_ACUTE_CORNERS, ARC_HIGH_DEF ); + CORNER_STRATEGY::ALLOW_ACUTE_CORNERS, ARC_HIGH_DEF ); } } diff --git a/pcbnew/plugins/easyedapro/pcb_easyedapro_parser.cpp b/pcbnew/plugins/easyedapro/pcb_easyedapro_parser.cpp index ffa6aaed1c..6d68d644c8 100644 --- a/pcbnew/plugins/easyedapro/pcb_easyedapro_parser.cpp +++ b/pcbnew/plugins/easyedapro/pcb_easyedapro_parser.cpp @@ -1257,7 +1257,7 @@ void PCB_EASYEDAPRO_PARSER::ParseBoard( const int strokeWidth = pcbIUScale.MilsToIU( 8 ); // Seems to be 8 mils - fillPolySet.Inflate( strokeWidth / 2, SHAPE_POLY_SET::ROUND_ALL_CORNERS, + fillPolySet.Inflate( strokeWidth / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS, ARC_HIGH_DEF, false ); fillPolySet.BooleanAdd( thermalSpokes, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index b58791ba53..5a8b6643ba 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -5708,7 +5708,7 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent ) for( auto& [layer, polyset] : pts ) { polyset.InflateWithLinkedHoles( - zone->GetMinThickness() / 2, SHAPE_POLY_SET::ROUND_ALL_CORNERS, + zone->GetMinThickness() / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS, ARC_HIGH_DEF / 2, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); } } diff --git a/pcbnew/plugins/legacy/legacy_plugin.cpp b/pcbnew/plugins/legacy/legacy_plugin.cpp index 3d9aa4b745..dbf5ebbcab 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.cpp +++ b/pcbnew/plugins/legacy/legacy_plugin.cpp @@ -2617,7 +2617,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() SHAPE_POLY_SET inflatedFill = SHAPE_POLY_SET( *zc->GetFilledPolysList( layer ) ); inflatedFill.InflateWithLinkedHoles( zc->GetMinThickness() / 2, - SHAPE_POLY_SET::ROUND_ALL_CORNERS, + CORNER_STRATEGY::ROUND_ALL_CORNERS, ARC_HIGH_DEF / 2, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); diff --git a/pcbnew/zone.cpp b/pcbnew/zone.cpp index 352954040a..64ddcf688c 100644 --- a/pcbnew/zone.cpp +++ b/pcbnew/zone.cpp @@ -1262,7 +1262,7 @@ bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer if( aSmoothedPolyWithApron ) { SHAPE_POLY_SET poly = maxExtents->CloneDropTriangulation(); - poly.Inflate( m_ZoneMinThickness, SHAPE_POLY_SET::ROUND_ALL_CORNERS, maxError ); + poly.Inflate( m_ZoneMinThickness, CORNER_STRATEGY::ROUND_ALL_CORNERS, maxError ); *aSmoothedPolyWithApron = aSmoothedPoly; aSmoothedPolyWithApron->BooleanIntersection( poly, SHAPE_POLY_SET::PM_FAST ); } @@ -1326,7 +1326,7 @@ void ZONE::TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aBuffer, int aClea if( aErrorLoc == ERROR_OUTSIDE ) aClearance += maxError; - polybuffer.Inflate( aClearance, SHAPE_POLY_SET::ROUND_ALL_CORNERS, maxError ); + polybuffer.Inflate( aClearance, CORNER_STRATEGY::ROUND_ALL_CORNERS, maxError ); } polybuffer.Fracture( SHAPE_POLY_SET::PM_FAST ); @@ -1365,7 +1365,7 @@ void ZONE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer if( aErrorLoc == ERROR_OUTSIDE ) aClearance += aError; - temp_buf.InflateWithLinkedHoles( aClearance, SHAPE_POLY_SET::ROUND_ALL_CORNERS, aError, + temp_buf.InflateWithLinkedHoles( aClearance, CORNER_STRATEGY::ROUND_ALL_CORNERS, aError, SHAPE_POLY_SET::PM_FAST ); } diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index b0601b8ab9..e58dfecd2f 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -1396,8 +1396,8 @@ bool ZONE_FILLER::fillCopperZone( const ZONE* aZone, PCB_LAYER_ID aLayer, PCB_LA // as a "less-safe" option. // ROUND_ALL_CORNERS produces the uniformly nicest shapes, but also a lot of segments. // CHAMFER_ALL_CORNERS improves the segment count. - SHAPE_POLY_SET::CORNER_STRATEGY fastCornerStrategy = SHAPE_POLY_SET::CHAMFER_ALL_CORNERS; - SHAPE_POLY_SET::CORNER_STRATEGY cornerStrategy = SHAPE_POLY_SET::ROUND_ALL_CORNERS; + CORNER_STRATEGY fastCornerStrategy = CORNER_STRATEGY::CHAMFER_ALL_CORNERS; + CORNER_STRATEGY cornerStrategy = CORNER_STRATEGY::ROUND_ALL_CORNERS; std::vector thermalConnectionPads; std::vector noConnectionPads; @@ -1664,7 +1664,7 @@ bool ZONE_FILLER::fillNonCopperZone( const ZONE* aZone, PCB_LAYER_ID aLayer, int half_min_width = aZone->GetMinThickness() / 2; int epsilon = pcbIUScale.mmToIU( 0.001 ); - aFillPolys.Deflate( half_min_width - epsilon, SHAPE_POLY_SET::CHAMFER_ALL_CORNERS, m_maxError ); + aFillPolys.Deflate( half_min_width - epsilon, CORNER_STRATEGY::CHAMFER_ALL_CORNERS, m_maxError ); // Remove the non filled areas due to the hatch pattern if( aZone->GetFillMode() == ZONE_FILL_MODE::HATCH_PATTERN ) @@ -1675,7 +1675,7 @@ bool ZONE_FILLER::fillNonCopperZone( const ZONE* aZone, PCB_LAYER_ID aLayer, // Re-inflate after pruning of areas that don't meet minimum-width criteria if( half_min_width - epsilon > epsilon ) - aFillPolys.Inflate( half_min_width - epsilon, SHAPE_POLY_SET::ROUND_ALL_CORNERS, m_maxError ); + aFillPolys.Inflate( half_min_width - epsilon, CORNER_STRATEGY::ROUND_ALL_CORNERS, m_maxError ); aFillPolys.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); return true; @@ -2127,12 +2127,12 @@ bool ZONE_FILLER::addHatchFillTypeOnZone( const ZONE* aZone, PCB_LAYER_ID aLayer // account for anything beyond that. SHAPE_POLY_SET deflatedFilledPolys = aFillPolys.CloneDropTriangulation(); deflatedFilledPolys.Deflate( outline_margin - aZone->GetMinThickness(), - SHAPE_POLY_SET::CHAMFER_ALL_CORNERS, maxError ); + CORNER_STRATEGY::CHAMFER_ALL_CORNERS, maxError ); holes.BooleanIntersection( deflatedFilledPolys, SHAPE_POLY_SET::PM_FAST ); DUMP_POLYS_TO_COPPER_LAYER( holes, In11_Cu, wxT( "fill-clipped-hatch-holes" ) ); SHAPE_POLY_SET deflatedOutline = aZone->Outline()->CloneDropTriangulation(); - deflatedOutline.Deflate( outline_margin, SHAPE_POLY_SET::CHAMFER_ALL_CORNERS, maxError ); + deflatedOutline.Deflate( outline_margin, CORNER_STRATEGY::CHAMFER_ALL_CORNERS, maxError ); holes.BooleanIntersection( deflatedOutline, SHAPE_POLY_SET::PM_FAST ); DUMP_POLYS_TO_COPPER_LAYER( holes, In12_Cu, wxT( "outline-clipped-hatch-holes" ) );