From 824c7ecfa78d6809ae817ba064f88b45c19ea4a9 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 18 Mar 2025 14:26:54 +0000 Subject: [PATCH] Improve readability. Also drops a parameter that hasn't been implemented since early 2022. --- 3d-viewer/3d_canvas/board_adapter.cpp | 23 +-- 3d-viewer/3d_canvas/board_adapter.h | 7 +- .../3d_canvas/create_3Dgraphic_brd_items.cpp | 39 ++--- 3d-viewer/3d_canvas/create_layer_items.cpp | 160 +++++------------- .../3d_rendering/opengl/create_scene.cpp | 8 +- 3d-viewer/dialogs/appearance_controls_3D.cpp | 55 +++--- eeschema/sch_painter.cpp | 4 +- pcbnew/footprint.cpp | 3 +- pcbnew/footprint.h | 9 +- pcbnew/plot_board_layers.cpp | 30 ++-- pcbnew/plot_brditems_plotter.cpp | 11 +- 11 files changed, 119 insertions(+), 230 deletions(-) diff --git a/3d-viewer/3d_canvas/board_adapter.cpp b/3d-viewer/3d_canvas/board_adapter.cpp index 4a09ba00bd..948b3ac569 100644 --- a/3d-viewer/3d_canvas/board_adapter.cpp +++ b/3d-viewer/3d_canvas/board_adapter.cpp @@ -412,8 +412,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR { // The copper thickness must be > 0 to avoid draw issues (divide by 0 for // instance). We use a minimal arbitrary value = 1 micrometer here: - int copper_thickness = std::max( item->GetThickness(), - pcbIUScale.mmToIU( 0.001 ) ); + int copper_thickness = std::max( item->GetThickness(), pcbIUScale.mmToIU( 0.001 ) ); if( item->GetBrdLayerId() == F_Cu ) m_frontCopperThickness3DU = copper_thickness * m_biuTo3Dunits; @@ -429,8 +428,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR { // The mask thickness must be > 0 to avoid draw issues (divide by 0 for // instance). We use a minimal arbitrary value = 1 micrometer here: - int mask_thickness = std::max( item->GetThickness(), - pcbIUScale.mmToIU( 0.001 ) ); + int mask_thickness = std::max( item->GetThickness(), pcbIUScale.mmToIU( 0.001 ) ); if( item->GetBrdLayerId() == F_Mask ) m_frontMaskThickness3DU = mask_thickness * m_biuTo3Dunits; @@ -477,8 +475,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR }; m_layerZcoordBottom[layer_id] = m_boardBodyThickness3DU / 2.0 - - ( m_boardBodyThickness3DU * layer_pos - / ( m_copperLayersCount - 1 ) ); + - ( m_boardBodyThickness3DU * layer_pos / ( m_copperLayersCount - 1 ) ); if( layer_pos < (m_copperLayersCount / 2) ) m_layerZcoordTop[layer_id] = m_layerZcoordBottom[layer_id] + m_frontCopperThickness3DU; @@ -554,8 +551,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR m_boardCenter = SFVEC3F( m_boardPos.x * m_biuTo3Dunits, m_boardPos.y * m_biuTo3Dunits, 0.0f ); - SFVEC3F boardSize = SFVEC3F( m_boardSize.x * m_biuTo3Dunits, m_boardSize.y * m_biuTo3Dunits, - 0.0f ); + SFVEC3F boardSize = SFVEC3F( m_boardSize.x * m_biuTo3Dunits, m_boardSize.y * m_biuTo3Dunits, 0.0f ); boardSize /= 2.0f; SFVEC3F boardMin = ( m_boardCenter - boardSize ); @@ -924,9 +920,9 @@ std::bitset BOARD_ADAPTER::GetVisibleLayers() const for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer ) ret.set( layer, layers.test( Map3DLayerToPCBLayer( layer ) ) ); - ret.set( LAYER_FP_REFERENCES, plotParams.GetPlotReference() ); - ret.set( LAYER_FP_VALUES, plotParams.GetPlotValue() ); - ret.set( LAYER_FP_TEXT, plotParams.GetPlotFPText() ); + ret.set( LAYER_FP_REFERENCES, plotParams.GetPlotReference() ); + ret.set( LAYER_FP_VALUES, plotParams.GetPlotValue() ); + ret.set( LAYER_FP_TEXT, plotParams.GetPlotFPText() ); } else if( LAYER_PRESET_3D* preset = m_Cfg->FindPreset( m_Cfg->m_CurrentPreset ) ) { @@ -1063,9 +1059,8 @@ SFVEC4F BOARD_ADAPTER::GetColor( const COLOR4D& aColor ) const SFVEC2F BOARD_ADAPTER::GetSphericalCoord( int i ) const { - SFVEC2F sphericalCoord = - SFVEC2F( ( m_Cfg->m_Render.raytrace_lightElevation[i] + 90.0f ) / 180.0f, - m_Cfg->m_Render.raytrace_lightAzimuth[i] / 180.0f ); + SFVEC2F sphericalCoord = SFVEC2F( ( m_Cfg->m_Render.raytrace_lightElevation[i] + 90.0f ) / 180.0f, + m_Cfg->m_Render.raytrace_lightAzimuth[i] / 180.0f ); sphericalCoord.x = glm::clamp( sphericalCoord.x, 0.0f, 1.0f ); sphericalCoord.y = glm::clamp( sphericalCoord.y, 0.0f, 2.0f ); diff --git a/3d-viewer/3d_canvas/board_adapter.h b/3d-viewer/3d_canvas/board_adapter.h index ae0e6056e7..2fc15d9123 100644 --- a/3d-viewer/3d_canvas/board_adapter.h +++ b/3d-viewer/3d_canvas/board_adapter.h @@ -492,11 +492,8 @@ private: double m_biuTo3Dunits; ///< Scale factor to convert board internal units ///< to 3D units normalized between -1.0 and 1.0. - std::map m_layerZcoordTop; ///< Top (End) Z position of each - ///< layer in 3D units. - - std::map m_layerZcoordBottom; ///< Bottom (Start) Z position of - ///< each layer in 3D units. + std::map m_layerZcoordTop; ///< Top (End) Z pos of each layer in 3D units. + std::map m_layerZcoordBottom; ///< Bottom (Start) Z pos of each layer. float m_frontCopperThickness3DU; float m_backCopperThickness3DU; diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index 4acff477d3..82bda90762 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -96,6 +96,7 @@ void addROUND_SEGMENT_2D( CONTAINER_2D_BASE* aContainer, const SFVEC2F& aStart, void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContainer, const BOARD_ITEM* aOwner ) { + int maxError = m_board->GetDesignSettings().m_MaxError; KIGFX::GAL_DISPLAY_OPTIONS empty_opts; TEXT_ATTRIBUTES attrs = aText->GetAttributes(); float penWidth_3DU = TO_3DU( aText->GetEffectiveTextPenWidth() ); @@ -110,8 +111,7 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine SHAPE_POLY_SET finalPoly; const PCB_TEXT* pcbText = static_cast( aOwner ); - pcbText->TransformTextToPolySet( finalPoly, 0, m_board->GetDesignSettings().m_MaxError, - ERROR_INSIDE ); + pcbText->TransformTextToPolySet( finalPoly, 0, maxError, ERROR_INSIDE ); // Do not call finalPoly.Fracture() here: ConvertPolygonToTriangles() call it // if needed, and Fracture() called twice can create bad results and is useless @@ -281,9 +281,8 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2 } -void BOARD_ADAPTER::createTrackWithMargin( const PCB_TRACK* aTrack, - CONTAINER_2D_BASE* aDstContainer, PCB_LAYER_ID aLayer, - int aMargin ) +void BOARD_ADAPTER::createTrackWithMargin( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDstContainer, + PCB_LAYER_ID aLayer, int aMargin ) { SFVEC2F start3DU = TO_SFVEC2F( aTrack->GetStart() ); SFVEC2F end3DU = TO_SFVEC2F( aTrack->GetEnd() ); @@ -339,8 +338,7 @@ void BOARD_ADAPTER::createTrackWithMargin( const PCB_TRACK* aTrack, } createArcSegments( center, arc->GetStart(), arc_angle, circlesegcount, - arc->GetWidth() + aMargin * 2, - aDstContainer, *arc ); + arc->GetWidth() + aMargin * 2, aDstContainer, *arc ); break; } @@ -371,8 +369,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo // Of course being a hack it falls down when dealing with custom shape pads (where the size // is only the size of the anchor), so for those we punt and just use aMargin.x. - if( ( clearance.x < 0 || clearance.x != clearance.y ) - && aPad->GetShape( aLayer ) != PAD_SHAPE::CUSTOM ) + if( ( clearance.x < 0 || clearance.x != clearance.y ) && aPad->GetShape( aLayer ) != PAD_SHAPE::CUSTOM ) { VECTOR2I dummySize = VECTOR2I( aPad->GetSize( aLayer ) ) + clearance + clearance; @@ -396,8 +393,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo } else { - auto padShapes = - std::static_pointer_cast( aPad->GetEffectiveShape( aLayer ) ); + auto padShapes = std::static_pointer_cast( aPad->GetEffectiveShape( aLayer ) ); for( const SHAPE* shape : padShapes->Shapes() ) { @@ -604,16 +600,15 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta int margin = 0; if( IsSolderMaskLayer( aLayer ) - && aShape->HasSolderMask() - && IsExternalCopperLayer( aShape->GetLayer() ) ) + && aShape->HasSolderMask() + && IsExternalCopperLayer( aShape->GetLayer() ) ) { margin = aShape->GetSolderMaskExpansion(); linewidth += margin * 2; } - float linewidth3DU = TO_3DU( linewidth ); - - LINE_STYLE lineStyle = aShape->GetStroke().GetLineStyle(); + float linewidth3DU = TO_3DU( linewidth ); + LINE_STYLE lineStyle = aShape->GetStroke().GetLineStyle(); if( lineStyle <= LINE_STYLE::FIRST_TYPE ) { @@ -638,8 +633,7 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta { SHAPE_POLY_SET polyList; - aShape->TransformShapeToPolySet( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF, - ERROR_INSIDE ); + aShape->TransformShapeToPolySet( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF, ERROR_INSIDE ); polyList.Simplify(); @@ -685,8 +679,7 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta { SHAPE_POLY_SET polyList; - aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF, - ERROR_INSIDE ); + aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF, ERROR_INSIDE ); // Some polygons can be a bit complex (especially when coming from a // picture of a text converted to a polygon @@ -795,8 +788,7 @@ void BOARD_ADAPTER::addSolidAreasShapes( const ZONE* aZone, CONTAINER_2D_BASE* a PCB_LAYER_ID aLayerId ) { // This convert the poly in outline and holes - ConvertPolygonToTriangles( *aZone->GetFilledPolysList( aLayerId ), *aContainer, m_biuTo3Dunits, - *aZone ); + ConvertPolygonToTriangles( *aZone->GetFilledPolysList( aLayerId ), *aContainer, m_biuTo3Dunits, *aZone ); } @@ -815,8 +807,7 @@ void BOARD_ADAPTER::buildPadOutlineAsSegments( const PAD* aPad, PCB_LAYER_ID aLa else { // For other shapes, add outlines as thick segments in polygon buffer - const std::shared_ptr& corners = aPad->GetEffectivePolygon( aLayer, - ERROR_INSIDE ); + const std::shared_ptr& corners = aPad->GetEffectivePolygon( aLayer, ERROR_INSIDE ); const SHAPE_LINE_CHAIN& path = corners->COutline( 0 ); for( int j = 0; j < path.PointCount(); j++ ) diff --git a/3d-viewer/3d_canvas/create_layer_items.cpp b/3d-viewer/3d_canvas/create_layer_items.cpp index 088b6bca2e..ca6fcce85d 100644 --- a/3d-viewer/3d_canvas/create_layer_items.cpp +++ b/3d-viewer/3d_canvas/create_layer_items.cpp @@ -23,34 +23,17 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file create_layer_items.cpp - * @brief This file implements the creation of the pcb board. - * - * It is based on the function found in the files: - * board_items_to_polygon_shape_transform.cpp - * board_items_to_polygon_shape_transform.cpp - */ - #include "board_adapter.h" #include "../3d_rendering/raytracing/shapes2D/filled_circle_2d.h" #include "raytracing/shapes2D/triangle_2d.h" #include #include -#include #include #include -#include -#include -#include -#include -#include -#include #include #include #include #include -#include #include #include #include @@ -59,9 +42,6 @@ #include #endif - - - /* * This is used to draw pad outlines on silk layers. */ @@ -137,10 +117,7 @@ void transformFPTextToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer, { // border if( textbox->IsBorderEnabled() ) - { - textbox->PCB_SHAPE::TransformShapeToPolygon( aBuffer, aLayer, 0, aMaxError, - aErrorLoc ); - } + textbox->PCB_SHAPE::TransformShapeToPolygon( aBuffer, aLayer, 0, aMaxError, aErrorLoc ); // text textbox->TransformTextToPolySet( aBuffer, 0, aMaxError, aErrorLoc ); @@ -319,7 +296,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) // Create tracks as objects and add it to container for( PCB_LAYER_ID layer : layer_ids ) { - wxASSERT( m_layerMap.find( layer ) != m_layerMap.end() ); + wxASSERT( m_layerMap.contains( layer ) ); BVH_CONTAINER_2D *layerContainer = m_layerMap[layer]; @@ -377,7 +354,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) BVH_CONTAINER_2D *layerHoleContainer = nullptr; // Check if the layer is already created - if( m_layerHoleMap.find( layer ) == m_layerHoleMap.end() ) + if( !m_layerHoleMap.contains( layer ) ) { // not found, create a new container layerHoleContainer = new BVH_CONTAINER_2D; @@ -397,10 +374,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) else if( layer == layer_ids[0] ) // it only adds once the THT holes { // Add through hole object - m_TH_ODs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness, - *track ) ); - m_viaTH_ODs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness, - *track ) ); + m_TH_ODs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness, *track ) ); + m_viaTH_ODs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness, *track ) ); if( cfg.clip_silk_on_via_annuli && ring_radius > 0.0 ) m_viaAnnuli.Add( new FILLED_CIRCLE_2D( via_center, ring_radius, *track ) ); @@ -411,15 +386,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) } if( cfg.DifferentiatePlatedCopper() && layer == F_Cu ) - { - track->TransformShapeToPolygon( *m_frontPlatedCopperPolys, F_Cu, 0, maxError, - ERROR_INSIDE ); - } + track->TransformShapeToPolygon( *m_frontPlatedCopperPolys, F_Cu, 0, maxError, ERROR_INSIDE ); else if( cfg.DifferentiatePlatedCopper() && layer == B_Cu ) - { - track->TransformShapeToPolygon( *m_backPlatedCopperPolys, B_Cu, 0, maxError, - ERROR_INSIDE ); - } + track->TransformShapeToPolygon( *m_backPlatedCopperPolys, B_Cu, 0, maxError, ERROR_INSIDE ); } } @@ -451,13 +420,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) SHAPE_POLY_SET *layerInnerHolesPoly = nullptr; // Check if the layer is already created - if( m_layerHoleOdPolys.find( layer ) == m_layerHoleOdPolys.end() ) + if( !m_layerHoleOdPolys.contains( layer ) ) { // not found, create a new container layerOuterHolesPoly = new SHAPE_POLY_SET; m_layerHoleOdPolys[layer] = layerOuterHolesPoly; - wxASSERT( m_layerHoleIdPolys.find( layer ) == m_layerHoleIdPolys.end() ); + wxASSERT( !m_layerHoleIdPolys.contains( layer ) ); layerInnerHolesPoly = new SHAPE_POLY_SET; m_layerHoleIdPolys[layer] = layerInnerHolesPoly; @@ -467,7 +436,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) // found layerOuterHolesPoly = m_layerHoleOdPolys[layer]; - wxASSERT( m_layerHoleIdPolys.find( layer ) != m_layerHoleIdPolys.end() ); + wxASSERT( m_layerHoleIdPolys.contains( layer ) ); layerInnerHolesPoly = m_layerHoleIdPolys[layer]; } @@ -475,11 +444,11 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) const int holediameter = via->GetDrillValue(); const int hole_outer_radius = (holediameter / 2) + GetHolePlatingThickness(); - TransformCircleToPolygon( *layerOuterHolesPoly, via->GetStart(), - hole_outer_radius, maxError, ERROR_INSIDE ); + TransformCircleToPolygon( *layerOuterHolesPoly, via->GetStart(), hole_outer_radius, + maxError, ERROR_INSIDE ); - TransformCircleToPolygon( *layerInnerHolesPoly, via->GetStart(), - holediameter / 2, maxError, ERROR_INSIDE ); + TransformCircleToPolygon( *layerInnerHolesPoly, via->GetStart(), holediameter / 2, + maxError, ERROR_INSIDE ); } else if( layer == layer_ids[0] ) // it only adds once the THT holes { @@ -497,8 +466,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) if( cfg.clip_silk_on_via_annuli ) { - TransformCircleToPolygon( m_viaAnnuliPolys, via->GetStart(), - hole_outer_ring_radius, maxError, ERROR_INSIDE ); + TransformCircleToPolygon( m_viaAnnuliPolys, via->GetStart(), hole_outer_ring_radius, + maxError, ERROR_INSIDE ); } } } @@ -510,7 +479,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) { for( PCB_LAYER_ID layer : layer_ids ) { - wxASSERT( m_layers_poly.find( layer ) != m_layers_poly.end() ); + wxASSERT( m_layers_poly.contains( layer ) ); SHAPE_POLY_SET *layerPoly = m_layers_poly[layer]; @@ -603,7 +572,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) // Add footprints PADs objects to containers for( PCB_LAYER_ID layer : layer_ids ) { - wxASSERT( m_layerMap.find( layer ) != m_layerMap.end() ); + wxASSERT( m_layerMap.contains( layer ) ); BVH_CONTAINER_2D *layerContainer = m_layerMap[layer]; @@ -614,15 +583,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) addFootprintShapes( footprint, layerContainer, layer, visibilityFlags ); if( cfg.DifferentiatePlatedCopper() && layer == F_Cu ) - { - footprint->TransformPadsToPolySet( *m_frontPlatedCopperPolys, F_Cu, 0, maxError, - ERROR_INSIDE, true ); - } + footprint->TransformPadsToPolySet( *m_frontPlatedCopperPolys, F_Cu, 0, maxError, ERROR_INSIDE ); else if( cfg.DifferentiatePlatedCopper() && layer == B_Cu ) - { - footprint->TransformPadsToPolySet( *m_backPlatedCopperPolys, B_Cu, 0, maxError, - ERROR_INSIDE, true ); - } + footprint->TransformPadsToPolySet( *m_backPlatedCopperPolys, B_Cu, 0, maxError, ERROR_INSIDE ); } } @@ -631,18 +594,14 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) { for( PCB_LAYER_ID layer : layer_ids ) { - wxASSERT( m_layers_poly.find( layer ) != m_layers_poly.end() ); + wxASSERT( m_layers_poly.contains( layer ) ); SHAPE_POLY_SET *layerPoly = m_layers_poly[layer]; // Add pads to polygon list for( FOOTPRINT* footprint : m_board->Footprints() ) { - // Note: NPTH pads are not drawn on copper layers when the pad has same shape as - // its hole - footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE, - true ); - + footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE ); transformFPShapesToPolySet( footprint, layer, *layerPoly, maxError, ERROR_INSIDE ); } } @@ -651,7 +610,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) // Add graphic item on copper layers to object containers for( PCB_LAYER_ID layer : layer_ids ) { - wxASSERT( m_layerMap.find( layer ) != m_layerMap.end() ); + wxASSERT( m_layerMap.contains( layer ) ); BVH_CONTAINER_2D *layerContainer = m_layerMap[layer]; @@ -706,8 +665,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) PCB_TEXTBOX* text_box = static_cast( item ); text_box->TransformTextToPolySet( *copperPolys, 0, maxError, ERROR_INSIDE ); // Add box outlines - text_box->PCB_SHAPE::TransformShapeToPolygon( *copperPolys, layer, 0, maxError, - ERROR_INSIDE ); + text_box->PCB_SHAPE::TransformShapeToPolygon( *copperPolys, layer, 0, maxError, ERROR_INSIDE ); } else if( item->Type() == PCB_TEXT_T ) { @@ -727,7 +685,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) { for( PCB_LAYER_ID layer : layer_ids ) { - wxASSERT( m_layers_poly.find( layer ) != m_layers_poly.end() ); + wxASSERT( m_layers_poly.contains( layer ) ); SHAPE_POLY_SET *layerPoly = m_layers_poly[layer]; @@ -756,10 +714,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) PCB_TEXTBOX* textbox = static_cast( item ); if( textbox->IsBorderEnabled() ) - { - textbox->PCB_SHAPE::TransformShapeToPolygon( *layerPoly, layer, 0, - maxError, ERROR_INSIDE ); - } + textbox->PCB_SHAPE::TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE ); textbox->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE ); break; @@ -807,15 +762,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) layer_lock.emplace( layer, std::make_unique() ); if( cfg.DifferentiatePlatedCopper() && layer == F_Cu ) - { - zone->TransformShapeToPolygon( *m_frontPlatedCopperPolys, F_Cu, 0, maxError, - ERROR_INSIDE ); - } + zone->TransformShapeToPolygon( *m_frontPlatedCopperPolys, F_Cu, 0, maxError, ERROR_INSIDE ); else if( cfg.DifferentiatePlatedCopper() && layer == B_Cu ) - { - zone->TransformShapeToPolygon( *m_backPlatedCopperPolys, B_Cu, 0, maxError, - ERROR_INSIDE ); - } + zone->TransformShapeToPolygon( *m_backPlatedCopperPolys, B_Cu, 0, maxError, ERROR_INSIDE ); } } @@ -841,19 +790,16 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) PCB_LAYER_ID layer = zones[areaId].second; - auto layerContainer = m_layerMap.find( layer ); - auto layerPolyContainer = m_layers_poly.find( layer ); - - if( layerContainer != m_layerMap.end() ) - addSolidAreasShapes( zone, layerContainer->second, layer ); + if( m_layerMap.contains( layer ) ) + addSolidAreasShapes( zone, m_layerMap[layer], layer ); if( cfg.opengl_copper_thickness && cfg.engine == RENDER_ENGINE::OPENGL - && layerPolyContainer != m_layers_poly.end() ) + && m_layers_poly.contains( layer ) ) { auto mut_it = layer_lock.find( layer ); std::lock_guard< std::mutex > lock( *( mut_it->second ) ); - zone->TransformSolidAreasShapesToPolygon( layer, *layerPolyContainer->second ); + zone->TransformSolidAreasShapesToPolygon( layer, *m_layers_poly[layer] ); } } @@ -1093,10 +1039,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) PCB_TEXTBOX* textbox = static_cast( item ); if( textbox->IsBorderEnabled() ) - { - textbox->PCB_SHAPE::TransformShapeToPolygon( *layerPoly, layer, 0, - maxError, ERROR_INSIDE ); - } + textbox->PCB_SHAPE::TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE ); textbox->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE ); break; @@ -1136,8 +1079,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) && static_cast( track )->FlashLayer( layer ) && !static_cast( track )->IsTented( layer ) ) { - track->TransformShapeToPolygon( *layerPoly, layer, maskExpansion, maxError, - ERROR_INSIDE ); + track->TransformShapeToPolygon( *layerPoly, layer, maskExpansion, maxError, ERROR_INSIDE ); } } } @@ -1152,22 +1094,16 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) for( PAD* pad : footprint->Pads() ) { if( pad->IsOnLayer( layer ) ) - { - buildPadOutlineAsPolygon( pad, layer, *layerPoly, linewidth, maxError, - ERROR_INSIDE ); - } + buildPadOutlineAsPolygon( pad, layer, *layerPoly, linewidth, maxError, ERROR_INSIDE ); } } else { - footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, - ERROR_INSIDE ); + footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE ); } - transformFPTextToPolySet( footprint, layer, visibilityFlags, *layerPoly, maxError, - ERROR_INSIDE ); - transformFPShapesToPolySet( footprint, layer, *layerPoly, maxError, - ERROR_INSIDE ); + transformFPTextToPolySet( footprint, layer, visibilityFlags, *layerPoly, maxError, ERROR_INSIDE ); + transformFPShapesToPolySet( footprint, layer, *layerPoly, maxError, ERROR_INSIDE ); } if( cfg.show_zones || layer == F_Mask || layer == B_Mask ) @@ -1217,17 +1153,17 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) aStatusReporter->Report( _( "Calculating plated copper" ) ); // TRIM PLATED COPPER TO SOLDERMASK - if( m_layers_poly.find( F_Mask ) != m_layers_poly.end() ) + if( m_layers_poly.contains( F_Mask ) ) m_frontPlatedCopperPolys->BooleanIntersection( *m_layers_poly.at( F_Mask ) ); - if( m_layers_poly.find( B_Mask ) != m_layers_poly.end() ) + if( m_layers_poly.contains( B_Mask )) m_backPlatedCopperPolys->BooleanIntersection( *m_layers_poly.at( B_Mask ) ); // Subtract plated copper from unplated copper - if( m_layers_poly.find( F_Cu ) != m_layers_poly.end() ) + if( m_layers_poly.contains( F_Cu ) ) m_layers_poly[F_Cu]->BooleanSubtract( *m_frontPlatedCopperPolys ); - if( m_layers_poly.find( B_Cu ) != m_layers_poly.end() ) + if( m_layers_poly.contains( B_Cu ) ) m_layers_poly[B_Cu]->BooleanSubtract( *m_backPlatedCopperPolys ); // ADD PLATED COPPER @@ -1284,13 +1220,11 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) i < selected_layer_id.size(); i = nextItem.fetch_add( 1 ) ) { - auto layerPoly = m_layers_poly.find( selected_layer_id[i] ); - - if( layerPoly != m_layers_poly.end() ) + if( m_layers_poly.contains( selected_layer_id[i] ) ) { // This will make a union of all added contours - layerPoly->second->ClearArcs(); - layerPoly->second->Simplify(); + m_layers_poly[ selected_layer_id[i] ]->ClearArcs(); + m_layers_poly[ selected_layer_id[i] ]->Simplify(); } } @@ -1311,13 +1245,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) for( PCB_LAYER_ID layer : layer_ids ) { - if( m_layerHoleOdPolys.find( layer ) != m_layerHoleOdPolys.end() ) + if( m_layerHoleOdPolys.contains( layer ) ) { // found SHAPE_POLY_SET *polyLayer = m_layerHoleOdPolys[layer]; polyLayer->Simplify(); - wxASSERT( m_layerHoleIdPolys.find( layer ) != m_layerHoleIdPolys.end() ); + wxASSERT( m_layerHoleIdPolys.contains( layer ) ); polyLayer = m_layerHoleIdPolys[layer]; polyLayer->Simplify(); diff --git a/3d-viewer/3d_rendering/opengl/create_scene.cpp b/3d-viewer/3d_rendering/opengl/create_scene.cpp index 31a1ac759a..03faa9666f 100644 --- a/3d-viewer/3d_rendering/opengl/create_scene.cpp +++ b/3d-viewer/3d_rendering/opengl/create_scene.cpp @@ -567,7 +567,7 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo if( m_boardAdapter.m_Cfg->m_Render.opengl_copper_thickness ) { - if( map_poly.find( layer ) != map_poly.end() ) + if( map_poly.contains( layer ) ) { polyListSubtracted = *map_poly.at( layer ); @@ -584,11 +584,11 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo if( m_boardAdapter.m_Cfg->m_Render.subtract_mask_from_silk ) { - if( layer == B_SilkS && map_poly.find( B_Mask ) != map_poly.end() ) + if( layer == B_SilkS && map_poly.contains( B_Mask ) ) { polyListSubtracted.BooleanSubtract( *map_poly.at( B_Mask ) ); } - else if( layer == F_SilkS && map_poly.find( F_Mask ) != map_poly.end() ) + else if( layer == F_SilkS && map_poly.contains( F_Mask ) ) { polyListSubtracted.BooleanSubtract( *map_poly.at( F_Mask ) ); } @@ -962,7 +962,7 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter ) // Check if the fp_model is not present in our cache map // (Not already loaded in memory) - if( m_3dModelMap.find( fp_model.m_Filename ) == m_3dModelMap.end() ) + if( !m_3dModelMap.contains( fp_model.m_Filename ) ) { // It is not present, try get it from cache const S3DMODEL* modelPtr = diff --git a/3d-viewer/dialogs/appearance_controls_3D.cpp b/3d-viewer/dialogs/appearance_controls_3D.cpp index 855318e751..aa44ce2962 100644 --- a/3d-viewer/dialogs/appearance_controls_3D.cpp +++ b/3d-viewer/dialogs/appearance_controls_3D.cpp @@ -47,7 +47,6 @@ /// Render Row abbreviation to reduce source width. #define RR APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D -// clang-format off /// Template for object appearance settings const APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D APPEARANCE_CONTROLS_3D::s_layerSettings[] = { @@ -118,27 +117,26 @@ const APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D APPEARANCE_CONTROLS_3D::s_la RR( _HKI( "Models marked DNP" ), LAYER_3D_MODELS_MARKED_DNP, EDA_3D_ACTIONS::showDNP ), RR( _HKI( "Model Bounding Boxes" ), LAYER_3D_BOUNDING_BOXES, EDA_3D_ACTIONS::showBBoxes ), RR(), - RR( _HKI( "Values" ), LAYER_FP_VALUES, _HKI( "Show footprint values" ) ), - RR( _HKI( "References" ), LAYER_FP_REFERENCES, _HKI( "Show footprint references" ) ), - RR( _HKI( "Footprint Text" ), LAYER_FP_TEXT, _HKI( "Show all footprint text" ) ), - RR( _HKI( "Off-board Silkscreen" ), LAYER_3D_OFF_BOARD_SILK, _HKI( "Do not clip silk layers to board outline" ) ), + RR( _HKI( "Values" ), LAYER_FP_VALUES, _HKI( "Show footprint values" ) ), + RR( _HKI( "References" ), LAYER_FP_REFERENCES, _HKI( "Show footprint references" ) ), + RR( _HKI( "Footprint Text" ), LAYER_FP_TEXT, _HKI( "Show all footprint text" ) ), + RR( _HKI( "Off-board Silkscreen" ), LAYER_3D_OFF_BOARD_SILK, _HKI( "Do not clip silk layers to board outline" ) ), RR(), RR( _HKI( "3D Axis" ), LAYER_3D_AXES, EDA_3D_ACTIONS::showAxis ), RR( _HKI( "Background Start" ), LAYER_3D_BACKGROUND_TOP, _HKI( "Background gradient start color" ) ), RR( _HKI( "Background End" ), LAYER_3D_BACKGROUND_BOTTOM, _HKI( "Background gradient end color" ) ), }; -// clang-format on // The list of IDs that can have colors coming from the board stackup, and cannot be // modified if use colors from stackup is activated -static std::vector inStackupColors{ LAYER_3D_BOARD, LAYER_3D_COPPER_TOP, - LAYER_3D_COPPER_BOTTOM, LAYER_3D_SOLDERPASTE, +static std::vector inStackupColors{ LAYER_3D_BOARD, + LAYER_3D_COPPER_TOP, LAYER_3D_COPPER_BOTTOM, + LAYER_3D_SOLDERPASTE, LAYER_3D_SILKSCREEN_TOP, LAYER_3D_SILKSCREEN_BOTTOM, LAYER_3D_SOLDERMASK_TOP, LAYER_3D_SOLDERMASK_BOTTOM }; -APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent, - wxWindow* aFocusOwner ) : +APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent, wxWindow* aFocusOwner ) : APPEARANCE_CONTROLS_3D_BASE( aParent ), m_frame( aParent ), m_focusOwner( aFocusOwner ), @@ -200,18 +198,17 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent, m_panelLayersSizer->Add( m_cbUseBoardEditorCopperColors, 0, wxEXPAND | wxALL, 5 ); - m_cbLayerPresets->SetToolTip( wxString::Format( _( "Save and restore color and visibility " - "combinations.\n" + m_cbLayerPresets->SetToolTip( wxString::Format( _( "Save and restore color and visibility combinations.\n" "Use %s+Tab to activate selector.\n" - "Successive Tabs while holding %s down will " - "cycle through presets in the popup." ), + "Successive Tabs while holding %s down will cycle through " + "presets in the popup." ), KeyNameFromKeyCode( PRESET_SWITCH_KEY ), KeyNameFromKeyCode( PRESET_SWITCH_KEY ) ) ); m_cbViewports->SetToolTip( wxString::Format( _( "Save and restore camera position and zoom.\n" "Use %s+Tab to activate selector.\n" - "Successive Tabs while holding %s down will " - "cycle through viewports in the popup." ), + "Successive Tabs while holding %s down will cycle through " + "viewports in the popup." ), KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ), KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ) ) ); @@ -475,8 +472,7 @@ void APPEARANCE_CONTROLS_3D::OnLayerVisibilityChanged( int aLayer, bool isVisibl if( doFastRefresh && m_frame->GetAdapter().m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL ) { - RENDER_3D_OPENGL* renderer = - static_cast( m_frame->GetCanvas()->GetCurrentRender() ); + RENDER_3D_OPENGL* renderer = static_cast( m_frame->GetCanvas()->GetCurrentRender() ); renderer->Load3dModelsIfNeeded(); m_frame->GetCanvas()->Request_refresh(); } @@ -595,9 +591,10 @@ void APPEARANCE_CONTROLS_3D::rebuildLayers() } else { - BITMAP_TOGGLE* btn_visible = new BITMAP_TOGGLE( - m_windowLayers, layer, KiBitmapBundle( BITMAPS::visibility ), - KiBitmapBundle( BITMAPS::visibility_off ), aSetting->m_Visible ); + BITMAP_TOGGLE* btn_visible = new BITMAP_TOGGLE( m_windowLayers, layer, + KiBitmapBundle( BITMAPS::visibility ), + KiBitmapBundle( BITMAPS::visibility_off ), + aSetting->m_Visible ); btn_visible->Bind( TOGGLE_CHANGED, [this]( wxCommandEvent& aEvent ) @@ -670,12 +667,8 @@ void APPEARANCE_CONTROLS_3D::UpdateLayerCtls() // if cfg->m_UseStackupColors is set, board colors cannot be modified locally, but // other colors can be - if( std::find( inStackupColors.begin(), inStackupColors.end(), setting->m_Id ) - != inStackupColors.end() ) - { - if( cfg ) - setting->m_Ctl_color->SetReadOnly( cfg->m_UseStackupColors ); - } + if( alg::contains( inStackupColors, setting->m_Id ) && cfg ) + setting->m_Ctl_color->SetReadOnly( cfg->m_UseStackupColors ); } } @@ -722,11 +715,8 @@ void APPEARANCE_CONTROLS_3D::syncLayerPresetSelection() presets.begin(), presets.end(), [&]( const LAYER_PRESET_3D& aPreset ) { - if( aPreset.name.Lower() == _( "legacy colors" ) - && m_cbUseBoardStackupColors->GetValue() ) - { + if( aPreset.name.Lower() == _( "legacy colors" ) && m_cbUseBoardStackupColors->GetValue() ) return false; - } for( int layer = LAYER_3D_BOARD; layer < LAYER_3D_END; ++layer ) { @@ -986,8 +976,7 @@ void APPEARANCE_CONTROLS_3D::onViewportChanged( wxCommandEvent& aEvent ) { m_viewports[name] = VIEWPORT3D( name, m_frame->GetCurrentCamera().GetViewMatrix() ); - index = m_cbViewports->Insert( name, index-1, - static_cast( &m_viewports[name] ) ); + index = m_cbViewports->Insert( name, index-1, static_cast( &m_viewports[name] ) ); } else { diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 08c800a7ff..9fdb4a2e6a 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -727,9 +727,7 @@ void SCH_PAINTER::draw( const LIB_SYMBOL* aSymbol, int aLayer, bool aDrawFields, auto childOnLayer = []( const SCH_ITEM& item, int layer ) { - std::vector layers = item.ViewGetLayers(); - - return std::find( layers.begin(), layers.end(), layer ) != layers.end(); + return alg::contains( item.ViewGetLayers(), layer ); }; for( const SCH_ITEM& item : drawnSymbol->GetDrawItems() ) diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 578e7ae0ef..05aaf9c3fe 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -3851,8 +3851,7 @@ bool FOOTPRINT::cmp_zones::operator()( const ZONE* aFirst, const ZONE* aSecond ) void FOOTPRINT::TransformPadsToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, - int aClearance, int aMaxError, ERROR_LOC aErrorLoc, - bool aSkipNPTHPadsWihNoCopper ) const + int aClearance, int aMaxError, ERROR_LOC aErrorLoc ) const { auto processPad = [&]( const PAD* pad, PCB_LAYER_ID padLayer ) diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index 5a3161e15c..281cde525f 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -533,16 +533,9 @@ public: * @param aBuffer i the buffer to store polygons. * @param aClearance is an additional size to add to pad shapes. * @param aMaxError is the maximum deviation from true for arcs. - * @param aSkipNPTHPadsWihNoCopper if true, do not add a NPTH pad shape, if the shape has - * same size and position as the hole. Usually, these pads are not drawn on copper - * layers, because there is actually no copper - * Due to diff between layers and holes, these pads must be skipped to be sure - * there is no copper left on the board (for instance when creating Gerber Files or - * 3D shapes). Defaults to false. */ void TransformPadsToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance, - int aMaxError, ERROR_LOC aErrorLoc, - bool aSkipNPTHPadsWihNoCopper = false ) const; + int aMaxError, ERROR_LOC aErrorLoc ) const; /** * Generate shapes of graphic items (outlines) on layer \a aLayer as polygons and adds these diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index adfd1b0011..be24e9727e 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -923,8 +923,6 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, void GenerateLayerPoly( SHAPE_POLY_SET* aResult, BOARD *aBoard, PCB_LAYER_ID aLayer, bool aPlotFPText, bool aPlotReferences, bool aPlotValues ) { -#define ERROR maxError, ERROR_OUTSIDE - int maxError = aBoard->GetDesignSettings().m_MaxError; SHAPE_POLY_SET buffer; SHAPE_POLY_SET* boardOutline = nullptr; @@ -963,9 +961,9 @@ void GenerateLayerPoly( SHAPE_POLY_SET* aResult, BOARD *aBoard, PCB_LAYER_ID aLa return; if( inflate != 0 ) - aText.TransformTextToPolySet( exactPolys, 0, ERROR ); + aText.TransformTextToPolySet( exactPolys, 0, maxError, ERROR_OUTSIDE ); - aText.TransformTextToPolySet( *aResult, inflate, ERROR ); + aText.TransformTextToPolySet( *aResult, inflate, maxError, ERROR_OUTSIDE ); }; // Generate polygons with arcs inside the shape or exact shape to minimize shape changes @@ -976,9 +974,9 @@ void GenerateLayerPoly( SHAPE_POLY_SET* aResult, BOARD *aBoard, PCB_LAYER_ID aLa for( const FOOTPRINT* footprint : aBoard->Footprints() ) { if( inflate != 0 ) - footprint->TransformPadsToPolySet( exactPolys, aLayer, 0, ERROR ); + footprint->TransformPadsToPolySet( exactPolys, aLayer, 0, maxError, ERROR_OUTSIDE ); - footprint->TransformPadsToPolySet( *aResult, aLayer, inflate, ERROR ); + footprint->TransformPadsToPolySet( *aResult, aLayer, inflate, maxError, ERROR_OUTSIDE ); for( const PCB_FIELD* field : footprint->GetFields() ) { @@ -1003,9 +1001,9 @@ void GenerateLayerPoly( SHAPE_POLY_SET* aResult, BOARD *aBoard, PCB_LAYER_ID aLa else { if( inflate != 0 ) - item->TransformShapeToPolySet( exactPolys, aLayer, 0, ERROR ); + item->TransformShapeToPolySet( exactPolys, aLayer, 0, maxError, ERROR_OUTSIDE ); - item->TransformShapeToPolySet( *aResult, aLayer, inflate, ERROR ); + item->TransformShapeToPolySet( *aResult, aLayer, inflate, maxError, ERROR_OUTSIDE ); } } } @@ -1021,9 +1019,9 @@ void GenerateLayerPoly( SHAPE_POLY_SET* aResult, BOARD *aBoard, PCB_LAYER_ID aLa int clearance = track->GetSolderMaskExpansion(); if( inflate != 0 ) - track->TransformShapeToPolygon( exactPolys, aLayer, clearance, ERROR ); + track->TransformShapeToPolygon( exactPolys, aLayer, clearance, maxError, ERROR_OUTSIDE ); - track->TransformShapeToPolygon( *aResult, aLayer, clearance + inflate, ERROR ); + track->TransformShapeToPolygon( *aResult, aLayer, clearance + inflate, maxError, ERROR_OUTSIDE ); } for( const BOARD_ITEM* item : aBoard->Drawings() ) @@ -1035,16 +1033,16 @@ void GenerateLayerPoly( SHAPE_POLY_SET* aResult, BOARD *aBoard, PCB_LAYER_ID aLa const PCB_TEXT* text = static_cast( item ); if( inflate != 0 ) - text->TransformTextToPolySet( exactPolys, 0, ERROR ); + text->TransformTextToPolySet( exactPolys, 0, maxError, ERROR_OUTSIDE ); - text->TransformTextToPolySet( *aResult, inflate, ERROR ); + text->TransformTextToPolySet( *aResult, inflate, maxError, ERROR_OUTSIDE ); } else { if( inflate != 0 ) - item->TransformShapeToPolygon( exactPolys, aLayer, 0, ERROR ); + item->TransformShapeToPolygon( exactPolys, aLayer, 0, maxError, ERROR_OUTSIDE ); - item->TransformShapeToPolygon( *aResult, aLayer, inflate, ERROR ); + item->TransformShapeToPolygon( *aResult, aLayer, inflate, maxError, ERROR_OUTSIDE ); } } } @@ -1059,9 +1057,9 @@ void GenerateLayerPoly( SHAPE_POLY_SET* aResult, BOARD *aBoard, PCB_LAYER_ID aLa continue; if( inflate != 0 ) - zone->TransformSmoothedOutlineToPolygon( exactPolys, 0, ERROR, boardOutline ); + zone->TransformSmoothedOutlineToPolygon( exactPolys, 0, maxError, ERROR_OUTSIDE, boardOutline ); - zone->TransformSmoothedOutlineToPolygon( *aResult, inflate, ERROR, boardOutline ); + zone->TransformSmoothedOutlineToPolygon( *aResult, inflate, maxError, ERROR_OUTSIDE, boardOutline ); } } diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 29ec281eb8..f77cbc2941 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -668,6 +668,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItems( const FOOTPRINT* aFootprint ) void BRDITEMS_PLOTTER::PlotText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, bool aIsKnockout, const KIFONT::METRICS& aFontMetrics, bool aStrikeout ) { + int maxError = m_board->GetDesignSettings().m_MaxError; KIFONT::FONT* font = aText->GetFont(); if( !font ) @@ -730,15 +731,9 @@ void BRDITEMS_PLOTTER::PlotText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, boo SHAPE_POLY_SET finalPoly; if( const PCB_TEXT* text = dynamic_cast( aText) ) - { - text->TransformTextToPolySet( finalPoly, 0, m_board->GetDesignSettings().m_MaxError, - ERROR_INSIDE ); - } + text->TransformTextToPolySet( finalPoly, 0, maxError, ERROR_INSIDE ); else if( const PCB_TEXTBOX* textbox = dynamic_cast( aText ) ) - { - textbox->TransformTextToPolySet( finalPoly, 0, m_board->GetDesignSettings().m_MaxError, - ERROR_INSIDE ); - } + textbox->TransformTextToPolySet( finalPoly, 0, maxError, ERROR_INSIDE ); finalPoly.Fracture();