From 6427197962fba5e1d3791e6ada9ff0dd964af074 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh <stambaughw@gmail.com> Date: Tue, 17 Aug 2021 15:41:08 -0400 Subject: [PATCH] Remove duplicate headers in plot and associated code. --- common/plotters/DXF_plotter.cpp | 5 +- common/plotters/GERBER_plotter.cpp | 3 -- common/plotters/HPGL_plotter.cpp | 1 - common/plotters/PDF_plotter.cpp | 1 - common/plotters/PS_plotter.cpp | 2 - common/plotters/SVG_plotter.cpp | 2 - common/plotters/plotter_dxf.h | 4 +- common/plotters/plotter_gerber.h | 3 -- common/plotters/plotter_hpgl.h | 2 - common/plotters/plotters_pslike.h | 2 - eeschema/dialogs/dialog_plot_schematic.cpp | 5 +- .../symbol_editor/symbol_editor_plotter.cpp | 2 +- include/plotter.h | 2 +- pcbnew/exporters/gen_drill_report_files.cpp | 7 +-- pcbnew/exporters/gendrill_gerber_writer.cpp | 15 +++--- pcbnew/exporters/gerber_placefile_writer.cpp | 29 ++++++------ pcbnew/plot_brditems_plotter.cpp | 47 +++++++++++-------- 17 files changed, 59 insertions(+), 73 deletions(-) diff --git a/common/plotters/DXF_plotter.cpp b/common/plotters/DXF_plotter.cpp index 6c8d3f7bf4..6e14aa564e 100644 --- a/common/plotters/DXF_plotter.cpp +++ b/common/plotters/DXF_plotter.cpp @@ -25,13 +25,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include <eda_base_frame.h> -#include <fill_type.h> -#include <plotters_specific.h> +#include "plotter_dxf.h" #include <macros.h> #include <string_utils.h> #include <convert_basic_shapes_to_polygon.h> -#include <render_settings.h> #include <trigo.h> /** diff --git a/common/plotters/GERBER_plotter.cpp b/common/plotters/GERBER_plotter.cpp index 7b8b2ec012..cea86be09b 100644 --- a/common/plotters/GERBER_plotter.cpp +++ b/common/plotters/GERBER_plotter.cpp @@ -23,13 +23,10 @@ * @brief specialized plotter for GERBER files format */ -#include <eda_base_frame.h> -#include <fill_type.h> #include <string_utils.h> #include <convert_basic_shapes_to_polygon.h> #include <macros.h> #include <math/util.h> // for KiROUND -#include <render_settings.h> #include <trigo.h> #include <wx/log.h> diff --git a/common/plotters/HPGL_plotter.cpp b/common/plotters/HPGL_plotter.cpp index f44d7d21c8..31aceb0fa8 100644 --- a/common/plotters/HPGL_plotter.cpp +++ b/common/plotters/HPGL_plotter.cpp @@ -195,7 +195,6 @@ #include <cstdio> -#include <fill_type.h> #include <string_utils.h> #include <convert_basic_shapes_to_polygon.h> #include <math/util.h> // for KiROUND diff --git a/common/plotters/PDF_plotter.cpp b/common/plotters/PDF_plotter.cpp index f59d22457d..992548de8f 100644 --- a/common/plotters/PDF_plotter.cpp +++ b/common/plotters/PDF_plotter.cpp @@ -35,7 +35,6 @@ #include <advanced_config.h> #include <macros.h> -#include <render_settings.h> #include <trigo.h> #include "plotters_pslike.h" diff --git a/common/plotters/PS_plotter.cpp b/common/plotters/PS_plotter.cpp index 4a8a005ff4..edd27d534c 100644 --- a/common/plotters/PS_plotter.cpp +++ b/common/plotters/PS_plotter.cpp @@ -27,11 +27,9 @@ * @brief KiCad: specialized plotter for PS files format */ -#include <eda_base_frame.h> #include <convert_basic_shapes_to_polygon.h> #include <macros.h> #include <math/util.h> // for KiROUND -#include <render_settings.h> #include <trigo.h> #include "plotters_pslike.h" diff --git a/common/plotters/SVG_plotter.cpp b/common/plotters/SVG_plotter.cpp index 2e4ee75c2b..b1b2124237 100644 --- a/common/plotters/SVG_plotter.cpp +++ b/common/plotters/SVG_plotter.cpp @@ -92,7 +92,6 @@ */ #include <base64.h> -#include <eda_base_frame.h> #include <eda_rect.h> #include <string_utils.h> #include <macros.h> @@ -100,7 +99,6 @@ #include <cstdint> #include <wx/mstream.h> -#include <render_settings.h> #include "plotters_pslike.h" diff --git a/common/plotters/plotter_dxf.h b/common/plotters/plotter_dxf.h index a7122133f4..9206266bf9 100644 --- a/common/plotters/plotter_dxf.h +++ b/common/plotters/plotter_dxf.h @@ -25,8 +25,6 @@ #pragma once -#include <vector> -#include <math/box2.h> #include <plotter.h> @@ -61,7 +59,7 @@ public: } /** - * Opens the DXF plot with a skeleton header. + * Open the DXF plot with a skeleton header. */ virtual bool StartPlot() override; virtual bool EndPlot() override; diff --git a/common/plotters/plotter_gerber.h b/common/plotters/plotter_gerber.h index a521069779..af612a0c3f 100644 --- a/common/plotters/plotter_gerber.h +++ b/common/plotters/plotter_gerber.h @@ -26,9 +26,6 @@ #pragma once -#include <vector> -#include <math/box2.h> - #include <plotter.h> #include "gbr_plotter_apertures.h" diff --git a/common/plotters/plotter_hpgl.h b/common/plotters/plotter_hpgl.h index 40bec3f30b..e4d2e8dd1a 100644 --- a/common/plotters/plotter_hpgl.h +++ b/common/plotters/plotter_hpgl.h @@ -26,9 +26,7 @@ #pragma once #include <list> -#include <vector> -#include <math/box2.h> #include <plotter.h> diff --git a/common/plotters/plotters_pslike.h b/common/plotters/plotters_pslike.h index 21c41e90cf..16a3a49966 100644 --- a/common/plotters/plotters_pslike.h +++ b/common/plotters/plotters_pslike.h @@ -25,8 +25,6 @@ #pragma once -#include <vector> -#include <math/box2.h> #include <plotter.h> diff --git a/eeschema/dialogs/dialog_plot_schematic.cpp b/eeschema/dialogs/dialog_plot_schematic.cpp index b3aafa3916..b5a6d1d8c0 100644 --- a/eeschema/dialogs/dialog_plot_schematic.cpp +++ b/eeschema/dialogs/dialog_plot_schematic.cpp @@ -31,7 +31,9 @@ #include <eeschema_settings.h> #include <kiface_i.h> #include <locale_io.h> -#include <plotters_specific.h> +#include "../../common/plotters/plotter_hpgl.h" +#include "../../common/plotters/plotter_dxf.h" +#include "../../common/plotters/plotters_pslike.h" #include <reporter.h> #include <trace_helpers.h> #include <settings/settings_manager.h> @@ -119,7 +121,6 @@ DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent ) } -// Initialize the dialog options: void DIALOG_PLOT_SCHEMATIC::initDlg() { auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ); diff --git a/eeschema/symbol_editor/symbol_editor_plotter.cpp b/eeschema/symbol_editor/symbol_editor_plotter.cpp index bd2c495be4..911b0f9a91 100644 --- a/eeschema/symbol_editor/symbol_editor_plotter.cpp +++ b/eeschema/symbol_editor/symbol_editor_plotter.cpp @@ -25,7 +25,7 @@ #include <sch_painter.h> #include <symbol_edit_frame.h> #include <locale_io.h> -#include <plotters_specific.h> +#include "../../common/plotters/plotters_pslike.h" void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName ) { diff --git a/include/plotter.h b/include/plotter.h index 99a7796336..54052b6dab 100644 --- a/include/plotter.h +++ b/include/plotter.h @@ -428,7 +428,7 @@ public: bool aItalic, bool aBold, bool aMultilineAllowed = false, - void* aData = nullptr ); + void* aData = nullptr ); /** * Draw a marker (used for the drill map). diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp index 274ae1ff4f..fb549794fa 100644 --- a/pcbnew/exporters/gen_drill_report_files.cpp +++ b/pcbnew/exporters/gen_drill_report_files.cpp @@ -27,7 +27,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include <plotter.h> #include <plotters_specific.h> #include <eda_item.h> #include <gr_text.h> @@ -109,8 +108,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_ plotter->SetPageSettings( page_info ); plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false ); } - break; - + break; default: wxASSERT( false ); @@ -479,8 +477,7 @@ unsigned GENDRILL_WRITER_BASE::printToolSummary( OUTPUTFORMATTER& out, bool aSum if( !aSummaryNPTH && tool.m_Hole_NotPlated ) continue; - // List the tool number assigned to each drill, - // in mm then in inches. + // List the tool number assigned to each drill in mm then in inches. int tool_number = ii+1; out.Print( 0, " T%d %2.3fmm %2.4f\" ", tool_number, diameter_in_mm( tool.m_Diameter ), diff --git a/pcbnew/exporters/gendrill_gerber_writer.cpp b/pcbnew/exporters/gendrill_gerber_writer.cpp index 2c6aeda9c5..4bcea74872 100644 --- a/pcbnew/exporters/gendrill_gerber_writer.cpp +++ b/pcbnew/exporters/gendrill_gerber_writer.cpp @@ -27,13 +27,9 @@ * @brief Functions to create drill files in gerber X2 format. */ -#include <vector> - -#include <plotter.h> -#include <plotters_specific.h> +#include "../../common/plotters/plotter_gerber.h" #include <string_utils.h> #include <locale_io.h> -#include <pcb_edit_frame.h> #include <board.h> #include <footprint.h> #include <pcb_track.h> @@ -206,16 +202,19 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth, if( pad->GetProperty() == PAD_PROP::CASTELLATED ) { - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CASTELLATEDDRILL ); + gbr_metadata.SetApertureAttrib( + GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CASTELLATEDDRILL ); } else { // Good practice of oblong pad holes (slots) is to use a specific aperture for // routing, not used in drill commands. if( hole_descr.m_Hole_Shape ) - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CMP_OBLONG_DRILL ); + gbr_metadata.SetApertureAttrib( + GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CMP_OBLONG_DRILL ); else - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CMP_DRILL ); + gbr_metadata.SetApertureAttrib( + GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CMP_DRILL ); } // Add object attribute: component reference to pads (mainly useful for users) diff --git a/pcbnew/exporters/gerber_placefile_writer.cpp b/pcbnew/exporters/gerber_placefile_writer.cpp index addccfbe8a..f1862c4ca0 100644 --- a/pcbnew/exporters/gerber_placefile_writer.cpp +++ b/pcbnew/exporters/gerber_placefile_writer.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 Jean_Pierre Charras <jp.charras at wanadoo.fr> - * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * * 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 @@ -27,12 +27,10 @@ #include <vector> -#include <plotter.h> -#include <plotters_specific.h> +#include "../../common/plotters/plotter_gerber.h" #include <string_utils.h> #include <locale_io.h> #include <macros.h> -#include <pcb_edit_frame.h> #include <board.h> #include <board_design_settings.h> @@ -86,6 +84,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER // Add the standard X2 header, without FileFunction AddGerberX2Header( &plotter, m_pcb ); plotter.SetViewport( m_offset, IU_PER_MILS/10, /* scale */ 1.0, /* mirror */false ); + // has meaning only for gerber plotter. Must be called only after SetViewport plotter.SetGerberCoordinatesFormat( 6 ); plotter.SetCreator( wxT( "PCBNEW" ) ); @@ -113,10 +112,10 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER // Some tools in P&P files have the type and size defined. // they are position flash (round), pad1 flash (diamond), other pads flash (round) // and component outline thickness (polyline) - int flash_position_shape_diam = Millimeter2iu( 0.3 ); // defined size for position shape (circle) - int pad1_mark_size = Millimeter2iu( 0.36 ); // defined size for pad 1 position (diamond) - int other_pads_mark_size = 0; // defined size for position shape (circle) - int line_thickness = Millimeter2iu( 0.1 ); // defined size for component outlines + int flash_position_shape_diam = Millimeter2iu( 0.3 ); // defined size for position shape (circle) + int pad1_mark_size = Millimeter2iu( 0.36 ); // defined size for pad 1 position (diamond) + int other_pads_mark_size = 0; // defined size for position shape (circle) + int line_thickness = Millimeter2iu( 0.1 ); // defined size for component outlines brd_plotter.SetLayerSet( LSET( aLayer ) ); int cmp_count = 0; @@ -183,7 +182,8 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER if( ( footprint->GetFlags() & checkFlag ) == 0 ) { - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CMP_COURTYARD ); + gbr_metadata.SetApertureAttrib( + GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CMP_COURTYARD ); const SHAPE_POLY_SET& courtyard = footprint->GetPolyCourtyard( aLayer ); @@ -195,13 +195,15 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER continue; useFpPadsBbox = false; - plotter.PLOTTER::PlotPoly( poly, FILL_TYPE::NO_FILL, line_thickness, &gbr_metadata ); + plotter.PLOTTER::PlotPoly( poly, FILL_TYPE::NO_FILL, line_thickness, + &gbr_metadata ); } } if( useFpPadsBbox ) { - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CMP_FOOTPRINT ); + gbr_metadata.SetApertureAttrib( + GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CMP_FOOTPRINT ); // bbox of fp pads, pos 0, rot 0, non flipped EDA_RECT bbox = footprint->GetFpPadsLocalBbox(); @@ -309,7 +311,6 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER } } - plotter.EndPlot(); return cmp_count; @@ -318,8 +319,8 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER double PLACEFILE_GERBER_WRITER::mapRotationAngle( double aAngle ) { - // convert a kicad footprint orientation to gerber rotation, depending on the layer - // Currently, same notation as kicad + // Convert a KiCad footprint orientation to gerber rotation, depending on the layer + // Currently, same notation as KiCad. return aAngle; } diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 294395ed8f..9f374a8177 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -25,7 +25,6 @@ #include <bitset> // for bitset, operator&, __bi... #include <math.h> // for abs #include <stddef.h> // for NULL, size_t -#include <vector> // for vector, __vector_base<>... #include <geometry/seg.h> // for SEG #include <geometry/shape_circle.h> @@ -36,17 +35,14 @@ #include <macros.h> #include <math/util.h> // for KiROUND, Clamp #include <math/vector2d.h> // for VECTOR2I -#include <plotter.h> -#include <plotters_specific.h> +#include "../common/plotters/plotter_gerber.h" #include <trigo.h> #include <board_design_settings.h> // for BOARD_DESIGN_SETTINGS #include <core/typeinfo.h> // for dyn_cast, PCB_DIMENSION_T -#include <outline_mode.h> -#include <gal/color4d.h> // for COLOR4D, operator!= #include <gbr_metadata.h> #include <gbr_netlist_metadata.h> // for GBR_NETLIST_METADATA -#include <layer_ids.h> // for LSET, IsCopperLayer +#include <layer_ids.h> // for LSET, IsCopperLayer #include <pad_shapes.h> // for PAD_ATTRIB::NPTH #include <pcbplot.h> #include <pcb_plot_params.h> // for PCB_PLOT_PARAMS, PCB_PL... @@ -148,18 +144,21 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_ break; case PAD_ATTRIB::PTH : // Pad through hole, a hole is also expected - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_COMPONENTPAD ); + gbr_metadata.SetApertureAttrib( + GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_COMPONENTPAD ); break; case PAD_ATTRIB::CONN: // Connector pads, no solder paste but with solder mask. if( plotOnExternalCopperLayer ) - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONNECTORPAD ); + gbr_metadata.SetApertureAttrib( + GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONNECTORPAD ); break; case PAD_ATTRIB::SMD: // SMD pads (on external copper layer only) // with solder paste and mask if( plotOnExternalCopperLayer ) - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_SMDPAD_CUDEF ); + gbr_metadata.SetApertureAttrib( + GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_SMDPAD_CUDEF ); break; } @@ -169,28 +168,34 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_ { case PAD_PROP::BGA: // Only applicable to outer layers if( plotOnExternalCopperLayer ) - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_BGAPAD_CUDEF ); + gbr_metadata.SetApertureAttrib( + GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_BGAPAD_CUDEF ); break; case PAD_PROP::FIDUCIAL_GLBL: - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_FIDUCIAL_GLBL ); + gbr_metadata.SetApertureAttrib( + GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_FIDUCIAL_GLBL ); break; case PAD_PROP::FIDUCIAL_LOCAL: - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_FIDUCIAL_LOCAL ); + gbr_metadata.SetApertureAttrib( + GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_FIDUCIAL_LOCAL ); break; case PAD_PROP::TESTPOINT: // Only applicable to outer layers if( plotOnExternalCopperLayer ) - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_TESTPOINT ); + gbr_metadata.SetApertureAttrib( + GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_TESTPOINT ); break; case PAD_PROP::HEATSINK: - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_HEATSINKPAD ); + gbr_metadata.SetApertureAttrib( + GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_HEATSINKPAD ); break; case PAD_PROP::CASTELLATED: - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CASTELLATEDPAD ); + gbr_metadata.SetApertureAttrib( + GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CASTELLATEDPAD ); break; case PAD_PROP::NONE: @@ -240,7 +245,8 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_ // (i.e. for a pad at pos 0,0, rot 0.0). Needed to use aperture macros, // to be able to create a pattern common to all trapezoid pads having the same shape wxPoint coord[4]; - // Order is lower left, lower right, upper right, upper left + + // Order is lower left, lower right, upper right, upper left. wxSize half_size = aPad->GetSize()/2; wxSize trap_delta = aPad->GetDelta()/2; @@ -265,6 +271,7 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_ aPad->GetOrientation(), aPlotMode, &gbr_metadata ); break; } + KI_FALLTHROUGH; default: @@ -364,6 +371,7 @@ void BRDITEMS_PLOTTER::PlotBoardGraphicItems() } } + void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aTextMod, const COLOR4D& aColor ) { COLOR4D color = aColor; @@ -766,7 +774,8 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( const ZONE* aZone, const SHAPE_POLY_SET& // be set as conductor if( aZone->GetNetname().IsEmpty() ) { - gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_NONCONDUCTOR ); + gbr_metadata.SetApertureAttrib( + GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_NONCONDUCTOR ); } else { @@ -985,8 +994,8 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape ) } -void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const wxPoint &aDrillPos, - const wxSize& aDrillSize, const wxSize &aPadSize, +void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const wxPoint& aDrillPos, + const wxSize& aDrillSize, const wxSize& aPadSize, double aOrientation, int aSmallDrill ) { wxSize drillSize = aDrillSize;