From 0e44f5128c5c430157815ae59e40843d92e408c2 Mon Sep 17 00:00:00 2001 From: Werni Date: Wed, 18 Nov 2020 19:50:36 +0000 Subject: [PATCH] Add const specifiers --- common/dialog_shim.cpp | 4 +- common/dialogs/wx_html_report_panel.cpp | 4 +- common/dialogs/wx_html_report_panel.h | 4 +- common/dsnlexer.cpp | 18 ++--- common/gbr_metadata.cpp | 8 +-- common/observable.cpp | 2 +- common/ptree.cpp | 19 +++--- .../dialogs/dialog_lib_edit_pin_table.cpp | 2 +- eeschema/dialogs/dialog_plot_schematic.cpp | 4 +- eeschema/dialogs/dialog_plot_schematic.h | 3 +- eeschema/tools/ee_grid_helper.cpp | 2 +- eeschema/tools/ee_grid_helper.h | 2 +- gerbview/export_to_pcbnew.cpp | 21 +++--- gerbview/export_to_pcbnew.h | 23 +++---- include/dialog_shim.h | 6 +- include/dsnlexer.h | 65 +++++++++--------- include/gbr_metadata.h | 4 +- include/gbr_netlist_metadata.h | 2 +- include/kiway_holder.h | 2 +- include/ptree.h | 2 +- libs/kimath/include/geometry/shape_file_io.h | 4 +- libs/kimath/src/geometry/shape_line_chain.cpp | 4 +- .../class_board_stackup.cpp | 4 +- .../class_board_stackup.h | 8 +-- pcbnew/dialogs/dialog_board_reannotate.cpp | 4 +- pcbnew/dialogs/dialog_board_reannotate.h | 2 +- .../dialog_pad_basicshapes_properties.cpp | 2 +- pcbnew/exporters/export_vrml.cpp | 2 +- pcbnew/plugins/pcad/pcb.cpp | 18 ++--- pcbnew/plugins/pcad/pcb.h | 18 ++--- pcbnew/plugins/pcad/pcb_callbacks.h | 8 +-- pcbnew/plugins/pcad/pcb_component.h | 4 +- pcbnew/router/pns_diff_pair.h | 2 +- pcbnew/router/pns_node.cpp | 2 +- pcbnew/router/pns_node.h | 4 +- pcbnew/router/pns_optimizer.cpp | 66 +++++++++---------- pcbnew/router/pns_optimizer.h | 22 +++---- pcbnew/zone.h | 4 +- utils/kicad2step/pcb/base.cpp | 8 +-- utils/kicad2step/pcb/base.h | 8 +-- utils/kicad2step/pcb/kicadpad.cpp | 4 +- utils/kicad2step/pcb/kicadpad.h | 6 +- utils/kicad2step/pcb/oce_utils.cpp | 6 +- utils/kicad2step/pcb/oce_utils.h | 6 +- 44 files changed, 208 insertions(+), 205 deletions(-) diff --git a/common/dialog_shim.cpp b/common/dialog_shim.cpp index 5b7b14e39d..12dec84685 100644 --- a/common/dialog_shim.cpp +++ b/common/dialog_shim.cpp @@ -162,14 +162,14 @@ void DIALOG_SHIM::setSizeInDU( int x, int y ) } -int DIALOG_SHIM::horizPixelsFromDU( int x ) +int DIALOG_SHIM::horizPixelsFromDU( int x ) const { wxSize sz( x, 0 ); return ConvertDialogToPixels( sz ).x; } -int DIALOG_SHIM::vertPixelsFromDU( int y ) +int DIALOG_SHIM::vertPixelsFromDU( int y ) const { wxSize sz( 0, y ); return ConvertDialogToPixels( sz ).y; diff --git a/common/dialogs/wx_html_report_panel.cpp b/common/dialogs/wx_html_report_panel.cpp index 9aa2e379cf..d704e6021a 100644 --- a/common/dialogs/wx_html_report_panel.cpp +++ b/common/dialogs/wx_html_report_panel.cpp @@ -379,13 +379,13 @@ void WX_HTML_REPORT_PANEL::SetVisibleSeverities( int aSeverities ) } -int WX_HTML_REPORT_PANEL::GetVisibleSeverities() +int WX_HTML_REPORT_PANEL::GetVisibleSeverities() const { return m_severities; } -void WX_HTML_REPORT_PANEL::SetFileName( wxString& aReportFileName ) +void WX_HTML_REPORT_PANEL::SetFileName( const wxString& aReportFileName ) { m_reportFileName = aReportFileName; } diff --git a/common/dialogs/wx_html_report_panel.h b/common/dialogs/wx_html_report_panel.h index abb66e4fec..325132c597 100644 --- a/common/dialogs/wx_html_report_panel.h +++ b/common/dialogs/wx_html_report_panel.h @@ -85,7 +85,7 @@ public: ///> @return the visible severity filter. ///> If the m_showAll option is set, the mask is < 0 - int GetVisibleSeverities(); + int GetVisibleSeverities() const; ///> If true prints Info: at the beginning of each Info severity line (Default) void SetPrintInfo( bool aPrintInfo ); @@ -95,7 +95,7 @@ public: void SetShowSeverity( SEVERITY aSeverity, bool aValue ); ///> Set the report full file name to the string - void SetFileName( wxString& aReportFileName ); + void SetFileName( const wxString& aReportFileName ); ///> @return reference to the current report fill file name string. wxString& GetFileName( void ); diff --git a/common/dsnlexer.cpp b/common/dsnlexer.cpp index f8703d32f0..f39e0cf026 100644 --- a/common/dsnlexer.cpp +++ b/common/dsnlexer.cpp @@ -225,7 +225,7 @@ LINE_READER* DSNLEXER::PopReader() } -int DSNLEXER::findToken( const std::string& tok ) +int DSNLEXER::findToken( const std::string& tok ) const { KEYWORD_MAP::const_iterator it = keyword_hash.find( tok.c_str() ); @@ -280,7 +280,7 @@ const char* DSNLEXER::Syntax( int aTok ) } -const char* DSNLEXER::GetTokenText( int aTok ) +const char* DSNLEXER::GetTokenText( int aTok ) const { const char* ret; @@ -299,9 +299,9 @@ const char* DSNLEXER::GetTokenText( int aTok ) } -wxString DSNLEXER::GetTokenString( int aTok ) +wxString DSNLEXER::GetTokenString( int aTok ) const { - wxString ret; + wxString ret; ret << wxT("'") << wxString::FromUTF8( GetTokenText(aTok) ) << wxT("'"); @@ -314,11 +314,11 @@ bool DSNLEXER::IsSymbol( int aTok ) // This is static and not inline to reduce code space. // if aTok is >= 0, then it is a coincidental match to a keyword. - return aTok==DSN_SYMBOL || aTok==DSN_STRING || aTok>=0; + return aTok == DSN_SYMBOL || aTok == DSN_STRING || aTok >= 0; } -void DSNLEXER::Expecting( int aTok ) +void DSNLEXER::Expecting( int aTok ) const { wxString errText = wxString::Format( _( "Expecting %s" ), GetTokenString( aTok ) ); @@ -326,7 +326,7 @@ void DSNLEXER::Expecting( int aTok ) } -void DSNLEXER::Expecting( const char* text ) +void DSNLEXER::Expecting( const char* text ) const { wxString errText = wxString::Format( _( "Expecting '%s'" ), wxString::FromUTF8( text ) ); @@ -334,7 +334,7 @@ void DSNLEXER::Expecting( const char* text ) } -void DSNLEXER::Unexpected( int aTok ) +void DSNLEXER::Unexpected( int aTok ) const { wxString errText = wxString::Format( _( "Unexpected %s" ), GetTokenString( aTok ) ); @@ -350,7 +350,7 @@ void DSNLEXER::Duplicate( int aTok ) } -void DSNLEXER::Unexpected( const char* text ) +void DSNLEXER::Unexpected( const char* text ) const { wxString errText = wxString::Format( _( "Unexpected '%s'" ), wxString::FromUTF8( text ) ); diff --git a/common/gbr_metadata.cpp b/common/gbr_metadata.cpp index d9f56dc6b6..b5a610afba 100644 --- a/common/gbr_metadata.cpp +++ b/common/gbr_metadata.cpp @@ -75,7 +75,7 @@ wxString GbrMakeCreationDateAttributeString( GBR_NC_STRING_FORMAT aFormat ) } -wxString GbrMakeProjectGUIDfromString( wxString& aText ) +wxString GbrMakeProjectGUIDfromString( const wxString& aText ) { /* Gerber GUID format should be RFC4122 Version 1 or 4. * See en.wikipedia.org/wiki/Universally_unique_identifier @@ -482,14 +482,14 @@ wxString ConvertNotAllowedCharsInGerber( const wxString& aString, bool aAllowUtf } -std::string GBR_DATA_FIELD::GetGerberString() +std::string GBR_DATA_FIELD::GetGerberString() const { wxString converted; if( !m_field.IsEmpty() ) converted = ConvertNotAllowedCharsInGerber( m_field, m_useUTF8, m_escapeString ); - // Convert the char string to std::string. Be carefull when converting awxString to + // Convert the char string to std::string. Be carefull when converting a wxString to // a std::string: using static_cast is mandatory std::string txt = static_cast( converted.utf8_str() ); @@ -525,7 +525,7 @@ std::string FormatStringToGerber( const wxString& aString ) #define NO_PAD_NAME wxT( "" ) // pad name of pads without pad name/number (not normalized) bool FormatNetAttribute( std::string& aPrintedText, std::string& aLastNetAttributes, - GBR_NETLIST_METADATA* aData, bool& aClearPreviousAttributes, + const GBR_NETLIST_METADATA* aData, bool& aClearPreviousAttributes, bool aUseX1StructuredComment ) { aClearPreviousAttributes = false; diff --git a/common/observable.cpp b/common/observable.cpp index b172a75fc9..1a80ef884a 100644 --- a/common/observable.cpp +++ b/common/observable.cpp @@ -32,7 +32,7 @@ namespace UTIL { struct equals { equals( const T& val ) : val_( val ) {} - bool operator()( const T& val ) + bool operator()( const T& val ) const { return val == val_; } diff --git a/common/ptree.cpp b/common/ptree.cpp index 5e6b47c4ac..79fabe78b4 100644 --- a/common/ptree.cpp +++ b/common/ptree.cpp @@ -75,7 +75,7 @@ inline void scanList( PTREE* aTree, DSNLEXER* aLexer ) } -inline void scanAtom( PTREE* aTree, DSNLEXER* aLexer ) +inline void scanAtom( PTREE* aTree, const DSNLEXER* aLexer ) { const char* key = aLexer->CurText(); @@ -109,13 +109,13 @@ void Scan( PTREE* aTree, DSNLEXER* aLexer ) //----------------------------------------------------------------------- -inline bool isAtom( CPTREE& aTree ) +inline bool isAtom( const CPTREE& aTree ) { - return aTree.size()==0 && aTree.data().size()==0; + return aTree.size() == 0 && aTree.data().size() == 0; } -inline bool isLast( CPTREE& aTree, CITER it ) +inline bool isLast( const CPTREE& aTree, CITER it ) { CITER next = it; ++next; @@ -131,13 +131,12 @@ inline CITER next( CITER it ) static void formatNode( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, - const std::string& aKey, CPTREE& aTree ); + const std::string& aKey, const CPTREE& aTree ); -static void formatList( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, CPTREE& aTree ) - +static void formatList( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, const CPTREE& aTree ) { - for( CITER it = aTree.begin(); it != aTree.end(); ++it ) + for( CITER it = aTree.begin(); it != aTree.end(); ++it ) { // Processing a tree which was read in with xml_parser? if( it->first == "" ) @@ -165,7 +164,7 @@ static void formatList( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, CPTREE& static void formatNode( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, - const std::string& aKey, CPTREE& aTree ) + const std::string& aKey, const CPTREE& aTree ) { if( !isAtom( aTree ) ) // is a list, not an atom @@ -198,7 +197,7 @@ static void formatNode( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, } -void Format( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, CPTREE& aTree ) +void Format( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, const CPTREE& aTree ) { if( aTree.size() == 1 && !aTree.data().size() ) { diff --git a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp index a33e8438b5..dd9869fd62 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp @@ -278,7 +278,7 @@ public: return res; } - void RebuildRows( LIB_PINS& aPins, bool groupByName ) + void RebuildRows( const LIB_PINS& aPins, bool groupByName ) { if ( GetView() ) { diff --git a/eeschema/dialogs/dialog_plot_schematic.cpp b/eeschema/dialogs/dialog_plot_schematic.cpp index 0d05ec2f7b..ab00b05ad6 100644 --- a/eeschema/dialogs/dialog_plot_schematic.cpp +++ b/eeschema/dialogs/dialog_plot_schematic.cpp @@ -358,8 +358,8 @@ void DIALOG_PLOT_SCHEMATIC::PlotSchematic( bool aPlotAll ) } -wxFileName DIALOG_PLOT_SCHEMATIC::createPlotFileName( wxString& aPlotFileName, - wxString& aExtension, +wxFileName DIALOG_PLOT_SCHEMATIC::createPlotFileName( const wxString& aPlotFileName, + const wxString& aExtension, REPORTER* aReporter ) { wxString path = ExpandEnvVarSubstitutions( m_outputDirectoryName->GetValue(), &Prj() ); diff --git a/eeschema/dialogs/dialog_plot_schematic.h b/eeschema/dialogs/dialog_plot_schematic.h index 857f569ecf..765030b181 100644 --- a/eeschema/dialogs/dialog_plot_schematic.h +++ b/eeschema/dialogs/dialog_plot_schematic.h @@ -148,6 +148,7 @@ private: * @return the created file name * @throw IO_ERROR on file I/O errors */ - wxFileName createPlotFileName( wxString& aPlotFileName, wxString& aExtension, + wxFileName createPlotFileName( const wxString& aPlotFileName, + const wxString& aExtension, REPORTER* aReporter = NULL ); }; diff --git a/eeschema/tools/ee_grid_helper.cpp b/eeschema/tools/ee_grid_helper.cpp index 2d8d83a54d..87dd556a8b 100644 --- a/eeschema/tools/ee_grid_helper.cpp +++ b/eeschema/tools/ee_grid_helper.cpp @@ -174,7 +174,7 @@ VECTOR2I EE_GRID_HELPER::AlignToWire( const VECTOR2I& aPoint, const SEG& aSeg ) return nearest; } -VECTOR2I EE_GRID_HELPER::BestDragOrigin( const VECTOR2I &aMousePos, std::vector& aItems ) +VECTOR2I EE_GRID_HELPER::BestDragOrigin( const VECTOR2I &aMousePos, const std::vector& aItems ) { clearAnchors(); diff --git a/eeschema/tools/ee_grid_helper.h b/eeschema/tools/ee_grid_helper.h index fb8fe92d40..ee3a7d1613 100644 --- a/eeschema/tools/ee_grid_helper.h +++ b/eeschema/tools/ee_grid_helper.h @@ -60,7 +60,7 @@ public: VECTOR2I AlignToWire( const VECTOR2I& aPoint, const SEG& aSeg ); - VECTOR2I BestDragOrigin( const VECTOR2I& aMousePos, std::vector& aItem ); + VECTOR2I BestDragOrigin( const VECTOR2I& aMousePos, const std::vector& aItem ); VECTOR2I BestSnapAnchor( const VECTOR2I& aOrigin, SCH_ITEM* aDraggedItem ); VECTOR2I BestSnapAnchor( const VECTOR2I& aOrigin, const LSET& aLayers, diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index 13847fe386..7fcaccaebd 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -55,7 +55,7 @@ GBR_TO_PCB_EXPORTER::~GBR_TO_PCB_EXPORTER() } -bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* aLayerLookUpTable, int aCopperLayers ) +bool GBR_TO_PCB_EXPORTER::ExportPcb( const LAYER_NUM* aLayerLookUpTable, int aCopperLayers ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -138,7 +138,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* aLayerLookUpTable, int aCopperLa } -void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ) +void GBR_TO_PCB_EXPORTER::export_non_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ) { // used when a D_CODE is not found. default D_CODE to draw a flashed item static D_CODE dummyD_CODE( 0 ); @@ -252,7 +252,7 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, LA * the pad gets drawn as a copper polygon, or increase it to the proper size if it has a * circular, concentric copper flashing. */ -void GBR_TO_PCB_EXPORTER::collect_hole( GERBER_DRAW_ITEM* aGbrItem ) +void GBR_TO_PCB_EXPORTER::collect_hole( const GERBER_DRAW_ITEM* aGbrItem ) { int size = std::min( aGbrItem->m_Size.x, aGbrItem->m_Size.y ); m_vias.emplace_back( aGbrItem->m_Start, size + 1, size ); @@ -279,7 +279,7 @@ void GBR_TO_PCB_EXPORTER::export_via( const EXPORT_VIA& aVia ) } -void GBR_TO_PCB_EXPORTER::export_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ) +void GBR_TO_PCB_EXPORTER::export_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ) { switch( aGbrItem->m_Shape ) { @@ -313,7 +313,7 @@ void GBR_TO_PCB_EXPORTER::export_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_ } -void GBR_TO_PCB_EXPORTER::export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ) +void GBR_TO_PCB_EXPORTER::export_segline_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ) { wxPoint seg_start, seg_end; @@ -328,7 +328,8 @@ void GBR_TO_PCB_EXPORTER::export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem } -void GBR_TO_PCB_EXPORTER::writeCopperLineItem( wxPoint& aStart, wxPoint& aEnd, +void GBR_TO_PCB_EXPORTER::writeCopperLineItem( const wxPoint& aStart, + const wxPoint& aEnd, int aWidth, LAYER_NUM aLayer ) { fprintf( m_fp, "(segment (start %s %s) (end %s %s) (width %s) (layer %s) (net 0))\n", @@ -341,7 +342,7 @@ void GBR_TO_PCB_EXPORTER::writeCopperLineItem( wxPoint& aStart, wxPoint& aEnd, } -void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ) +void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ) { double a = atan2( (double) ( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y ), (double) ( aGbrItem->m_Start.x - aGbrItem->m_ArcCentre.x ) ); @@ -402,7 +403,7 @@ void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, * then we'll enlarge the via to the proper size. Otherwise we create a copper polygon to * represent the flashed item (which is presumably a pad). */ -void GBR_TO_PCB_EXPORTER::export_flashed_copper_item( GERBER_DRAW_ITEM* aGbrItem, +void GBR_TO_PCB_EXPORTER::export_flashed_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ) { static D_CODE flashed_item_D_CODE( 0 ); @@ -433,7 +434,7 @@ void GBR_TO_PCB_EXPORTER::export_flashed_copper_item( GERBER_DRAW_ITEM* aGbrItem } -void GBR_TO_PCB_EXPORTER::writePcbHeader( LAYER_NUM* aLayerLookUpTable ) +void GBR_TO_PCB_EXPORTER::writePcbHeader( const LAYER_NUM* aLayerLookUpTable ) { fprintf( m_fp, "(kicad_pcb (version 4) (host Gerbview \"%s\")\n\n", TO_UTF8( GetBuildVersion() ) ); @@ -512,7 +513,7 @@ void GBR_TO_PCB_EXPORTER::writePcbPolygon( const SHAPE_POLY_SET& aPolys, LAYER_N } -void GBR_TO_PCB_EXPORTER::writePcbZoneItem( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ) +void GBR_TO_PCB_EXPORTER::writePcbZoneItem( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ) { SHAPE_POLY_SET polys = aGbrItem->m_Polygon; polys.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); diff --git a/gerbview/export_to_pcbnew.h b/gerbview/export_to_pcbnew.h index c92d1fa254..c7cb766e39 100644 --- a/gerbview/export_to_pcbnew.h +++ b/gerbview/export_to_pcbnew.h @@ -64,7 +64,7 @@ public: * Function ExportPcb * saves a board from a set of Gerber images. */ - bool ExportPcb( LAYER_NUM* aLayerLookUpTable, int aCopperLayers ); + bool ExportPcb( const LAYER_NUM* aLayerLookUpTable, int aCopperLayers ); private: /** @@ -72,7 +72,7 @@ private: * We'll use these later when writing pads & vias. * @param aGbrItem */ - void collect_hole( GERBER_DRAW_ITEM* aGbrItem ); + void collect_hole( const GERBER_DRAW_ITEM* aGbrItem ); /** * write a via to the board file. @@ -88,7 +88,7 @@ private: * @param aGbrItem = the Gerber item (line, arc) to export * @param aLayer = the technical layer to use */ - void export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); + void export_non_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); /** * write a non-copper polygon to the board file. @@ -103,14 +103,14 @@ private: * @param aGbrItem = the Gerber item (line, arc) to export * @param aLayer = the technical layer to use */ - void writePcbZoneItem( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); + void writePcbZoneItem( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); /** * write a track (or via) to the board file. * @param aGbrItem = the Gerber item (line, arc, flashed) to export * @param aLayer = the copper layer to use */ - void export_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); + void export_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); /** * Function export_flashed_copper_item @@ -120,7 +120,7 @@ private: * the pad. * @param aGbrItem = the flashed Gerber item to export */ - void export_flashed_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); + void export_flashed_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); /** * Function export_segline_copper_item @@ -128,7 +128,7 @@ private: * @param aGbrItem = the Gerber item (line only) to export * @param aLayer = the copper layer to use */ - void export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); + void export_segline_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); /** * Function export_segarc_copper_item @@ -137,27 +137,28 @@ private: * @param aGbrItem = the Gerber item (arc only) to export * @param aLayer = the copper layer to use */ - void export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); + void export_segarc_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); /** * function writeCopperLineItem * basic write function to write a a TRACK item * to the board file, from a non flashed item */ - void writeCopperLineItem( wxPoint& aStart, wxPoint& aEnd, + void writeCopperLineItem( const wxPoint& aStart, + const wxPoint& aEnd, int aWidth, LAYER_NUM aLayer ); /** * function writePcbHeader * Write a very basic header to the board file */ - void writePcbHeader( LAYER_NUM* aLayerLookUpTable ); + void writePcbHeader( const LAYER_NUM* aLayerLookUpTable ); /** In Pcbnew files units are mm for coordinates. * So MapToPcbUnits converts internal gerbview to mm any pcbnew value * @param aValue is a coordinate value to convert in mm */ - double MapToPcbUnits( int aValue ) + double MapToPcbUnits( int aValue ) const { return aValue / IU_PER_MM; } diff --git a/include/dialog_shim.h b/include/dialog_shim.h index f713fbb5d0..a08d72bd72 100644 --- a/include/dialog_shim.h +++ b/include/dialog_shim.h @@ -120,7 +120,7 @@ public: void EndQuasiModal( int retCode ); // End quasi-modal mode - bool IsQuasiModal() { return m_qmodal_showing; } + bool IsQuasiModal() const { return m_qmodal_showing; } bool Show( bool show ) override; @@ -170,13 +170,13 @@ protected: * Convert an integer number of dialog units to pixels, horizontally. See SetSizeInDU or * wxDialog documentation for more information. */ - int horizPixelsFromDU( int x ); + int horizPixelsFromDU( int x ) const; /** * Convert an integer number of dialog units to pixels, vertically. See SetSizeInDU or * wxDialog documentation for more information. */ - int vertPixelsFromDU( int y ); + int vertPixelsFromDU( int y ) const; /** * Clear the existing dialog size and position. diff --git a/include/dsnlexer.h b/include/dsnlexer.h index a553dacd6c..d16e2c92ae 100644 --- a/include/dsnlexer.h +++ b/include/dsnlexer.h @@ -42,7 +42,7 @@ struct KEYWORD const char* name; ///< unique keyword. int token; ///< a zero based index into an array of KEYWORDs }; -#endif +#endif // SWIG // something like this macro can be used to help initialize a KEYWORD table. // see SPECCTRA_DB::keywords[] as an example. @@ -55,18 +55,19 @@ struct KEYWORD * lists all the DSN lexer's tokens that are supported in lexing. It is up * to the parser if it wants also to support them. */ -enum DSN_SYNTAX_T { - DSN_NONE = -11, - DSN_COMMENT = -10, +enum DSN_SYNTAX_T +{ + DSN_NONE = -11, + DSN_COMMENT = -10, DSN_STRING_QUOTE = -9, - DSN_QUOTE_DEF = -8, - DSN_DASH = -7, - DSN_SYMBOL = -6, - DSN_NUMBER = -5, - DSN_RIGHT = -4, // right bracket, ')' - DSN_LEFT = -3, // left bracket, '(' - DSN_STRING = -2, // a quoted string, stripped of the quotes - DSN_EOF = -1 // special case for end of file + DSN_QUOTE_DEF = -8, + DSN_DASH = -7, + DSN_SYMBOL = -6, + DSN_NUMBER = -5, + DSN_RIGHT = -4, // right bracket, ')' + DSN_LEFT = -3, // left bracket, '(' + DSN_STRING = -2, // a quoted string, stripped of the quotes + DSN_EOF = -1 // special case for end of file }; @@ -142,11 +143,11 @@ protected: * @return int - with a value from the enum DSN_T matching the keyword text, * or DSN_SYMBOL if @a aToken is not in the kewords table. */ - int findToken( const std::string& aToken ); + int findToken( const std::string& aToken ) const; - bool isStringTerminator( char cc ) + bool isStringTerminator( char cc ) const { - if( !space_in_quoted_tokens && cc==' ' ) + if( !space_in_quoted_tokens && cc == ' ' ) return true; if( cc == stringDelimiter ) @@ -155,7 +156,7 @@ protected: return false; } -#endif +#endif // SWIG public: @@ -317,7 +318,7 @@ public: * Function CurTok * returns whatever NextTok() returned the last time it was called. */ - int CurTok() + int CurTok() const { return curTok; } @@ -326,7 +327,7 @@ public: * Function PrevTok * returns whatever NextTok() returned the 2nd to last time it was called. */ - int PrevTok() + int PrevTok() const { return prevTok; } @@ -335,7 +336,7 @@ public: * Function GetCurStrAsToken * Used to support "loose" matches (quoted tokens) */ - int GetCurStrAsToken() + int GetCurStrAsToken() const { return findToken( curText ); } @@ -412,7 +413,7 @@ public: * @param aTok is the token/keyword type which was expected at the current input location. * @throw IO_ERROR with the location within the input file of the problem. */ - void Expecting( int aTok ); + void Expecting( int aTok ) const; /** * Function Expecting @@ -421,7 +422,7 @@ public: * current input location, e.g. "pin|graphic|property" * @throw IO_ERROR with the location within the input file of the problem. */ - void Expecting( const char* aTokenList ); + void Expecting( const char* aTokenList ) const; /** * Function Unexpected @@ -430,7 +431,7 @@ public: * current input location. * @throw IO_ERROR with the location within the input file of the problem. */ - void Unexpected( int aTok ); + void Unexpected( int aTok ) const; /** * Function Unexpected @@ -439,7 +440,7 @@ public: * current input location. * @throw IO_ERROR with the location within the input file of the problem. */ - void Unexpected( const char* aToken ); + void Unexpected( const char* aToken ) const; /** * Function Duplicate @@ -471,13 +472,13 @@ public: * Function GetTokenText * returns the C string representation of a DSN_T value. */ - const char* GetTokenText( int aTok ); + const char* GetTokenText( int aTok ) const; /** * Function GetTokenString * returns a quote wrapped wxString representation of a token value. */ - wxString GetTokenString( int aTok ); + wxString GetTokenString( int aTok ) const; static const char* Syntax( int aTok ); @@ -485,7 +486,7 @@ public: * Function CurText * returns a pointer to the current token's text. */ - const char* CurText() + const char* CurText() const { return curText.c_str(); } @@ -494,7 +495,7 @@ public: * Function CurStr * returns a reference to current token in std::string form. */ - const std::string& CurStr() + const std::string& CurStr() const { return curText; } @@ -504,7 +505,7 @@ public: * returns the current token text as a wxString, assuming that the input * byte stream is UTF8 encoded. */ - wxString FromUTF8() + wxString FromUTF8() const { return wxString::FromUTF8( curText.c_str() ); } @@ -513,7 +514,7 @@ public: * Function CurLineNumber * returns the current line number within my LINE_READER */ - int CurLineNumber() + int CurLineNumber() const { return reader->LineNumber(); } @@ -523,7 +524,7 @@ public: * returns the current line of text, from which the CurText() would return * its token. */ - const char* CurLine() + const char* CurLine() const { return (const char*)(*reader); } @@ -534,7 +535,7 @@ public: * @return const wxString& - the source of the lines of text, * e.g. a filename or "clipboard". */ - const wxString& CurSource() + const wxString& CurSource() const { return reader->GetSource(); } @@ -544,7 +545,7 @@ public: * returns the byte offset within the current line, using a 1 based index. * @return int - a one based index into the current line. */ - int CurOffset() + int CurOffset() const { return curOffset + 1; } diff --git a/include/gbr_metadata.h b/include/gbr_metadata.h index 10671f8388..c289c6e052 100644 --- a/include/gbr_metadata.h +++ b/include/gbr_metadata.h @@ -66,7 +66,7 @@ wxString GbrMakeCreationDateAttributeString( GBR_NC_STRING_FORMAT aFormat ); * * See en.wikipedia.org/wiki/Universally_unique_identifier */ -wxString GbrMakeProjectGUIDfromString( wxString& aText ); +wxString GbrMakeProjectGUIDfromString( const wxString& aText ); // this class handle info which can be added in a gerber file as attribute @@ -272,7 +272,7 @@ wxString FormatStringFromGerber( const wxString& aString ); * will be empty */ bool FormatNetAttribute( std::string& aPrintedText, std::string& aLastNetAttributes, - GBR_NETLIST_METADATA* aData, bool& aClearPreviousAttributes, + const GBR_NETLIST_METADATA* aData, bool& aClearPreviousAttributes, bool aUseX1StructuredComment ); #endif // GBR_METADATA_H diff --git a/include/gbr_netlist_metadata.h b/include/gbr_netlist_metadata.h index ce82d8be26..623946cace 100644 --- a/include/gbr_netlist_metadata.h +++ b/include/gbr_netlist_metadata.h @@ -118,7 +118,7 @@ public: bool IsEmpty() const { return m_field.IsEmpty(); } - std::string GetGerberString(); + std::string GetGerberString() const; private: diff --git a/include/kiway_holder.h b/include/kiway_holder.h index 7755ccdc7b..202ff25aa4 100644 --- a/include/kiway_holder.h +++ b/include/kiway_holder.h @@ -46,7 +46,7 @@ public: m_type( aType ) {} - HOLDER_TYPE GetType() { return m_type; } + HOLDER_TYPE GetType() const { return m_type; } /** * Function Kiway diff --git a/include/ptree.h b/include/ptree.h index 494b216c56..d3fbd23295 100644 --- a/include/ptree.h +++ b/include/ptree.h @@ -90,6 +90,6 @@ void Scan( PTREE* aTree, DSNLEXER* aLexer ); * Function Format * outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative. */ -void Format( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, CPTREE& aTree ); +void Format( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, const CPTREE& aTree ); #endif // PTREE_H_ diff --git a/libs/kimath/include/geometry/shape_file_io.h b/libs/kimath/include/geometry/shape_file_io.h index 46930d8ab8..7392ffcf58 100644 --- a/libs/kimath/include/geometry/shape_file_io.h +++ b/libs/kimath/include/geometry/shape_file_io.h @@ -57,7 +57,7 @@ class SHAPE_FILE_IO void Write( const SHAPE* aShape, const std::string& aName = "" ); - void Write( const SHAPE& aShape, const std::string aName = "" ) + void Write( const SHAPE& aShape, const std::string& aName = "" ) { Write( &aShape, aName ); } @@ -68,4 +68,4 @@ class SHAPE_FILE_IO IO_MODE m_mode; }; -#endif +#endif // __SHAPE_FILE_IO_H diff --git a/libs/kimath/src/geometry/shape_line_chain.cpp b/libs/kimath/src/geometry/shape_line_chain.cpp index e36f3f361d..034a8405f2 100644 --- a/libs/kimath/src/geometry/shape_line_chain.cpp +++ b/libs/kimath/src/geometry/shape_line_chain.cpp @@ -534,11 +534,11 @@ void SHAPE_LINE_CHAIN::Insert( size_t aVertex, const SHAPE_ARC& aArc ) struct compareOriginDistance { - compareOriginDistance( VECTOR2I& aOrigin ) : + compareOriginDistance( const VECTOR2I& aOrigin ) : m_origin( aOrigin ) {}; bool operator()( const SHAPE_LINE_CHAIN::INTERSECTION& aA, - const SHAPE_LINE_CHAIN::INTERSECTION& aB ) + const SHAPE_LINE_CHAIN::INTERSECTION& aB ) const { return ( m_origin - aA.p ).EuclideanNorm() < ( m_origin - aB.p ).EuclideanNorm(); } diff --git a/pcbnew/board_stackup_manager/class_board_stackup.cpp b/pcbnew/board_stackup_manager/class_board_stackup.cpp index cfa294b5e1..ef0c08c3d4 100644 --- a/pcbnew/board_stackup_manager/class_board_stackup.cpp +++ b/pcbnew/board_stackup_manager/class_board_stackup.cpp @@ -78,7 +78,7 @@ BOARD_STACKUP_ITEM::BOARD_STACKUP_ITEM( BOARD_STACKUP_ITEM_TYPE aType ) } -BOARD_STACKUP_ITEM::BOARD_STACKUP_ITEM( BOARD_STACKUP_ITEM& aOther ) +BOARD_STACKUP_ITEM::BOARD_STACKUP_ITEM( const BOARD_STACKUP_ITEM& aOther ) { m_LayerId = aOther.m_LayerId; m_DielectricLayerId = aOther.m_DielectricLayerId; @@ -320,7 +320,7 @@ BOARD_STACKUP::BOARD_STACKUP() } -BOARD_STACKUP::BOARD_STACKUP( BOARD_STACKUP& aOther ) +BOARD_STACKUP::BOARD_STACKUP( const BOARD_STACKUP& aOther ) { m_HasDielectricConstrains = aOther.m_HasDielectricConstrains; m_HasThicknessConstrains = aOther.m_HasThicknessConstrains; diff --git a/pcbnew/board_stackup_manager/class_board_stackup.h b/pcbnew/board_stackup_manager/class_board_stackup.h index 6a7590f4d7..eccf0a3eaa 100644 --- a/pcbnew/board_stackup_manager/class_board_stackup.h +++ b/pcbnew/board_stackup_manager/class_board_stackup.h @@ -89,7 +89,7 @@ class BOARD_STACKUP_ITEM { public: BOARD_STACKUP_ITEM( BOARD_STACKUP_ITEM_TYPE aType ); - BOARD_STACKUP_ITEM( BOARD_STACKUP_ITEM& aOther ); + BOARD_STACKUP_ITEM( const BOARD_STACKUP_ITEM& aOther ); private: @@ -243,7 +243,7 @@ public: public: BOARD_STACKUP(); - BOARD_STACKUP( BOARD_STACKUP& aOther ); + BOARD_STACKUP( const BOARD_STACKUP& aOther ); BOARD_STACKUP& operator=( const BOARD_STACKUP& aOther ); ~BOARD_STACKUP() { RemoveAll(); } @@ -267,7 +267,7 @@ public: void RemoveAll(); /// @return the number of layers in the stackup - int GetCount() { return (int) m_list.size(); } + int GetCount() const { return (int) m_list.size(); } /// @return the board thickness ( in UI) from the thickness of BOARD_STACKUP_ITEM list int BuildBoardTicknessFromStackup() const; @@ -306,4 +306,4 @@ public: }; -#endif // #ifndef CLASS_BOARD_STACKUP_H +#endif // CLASS_BOARD_STACKUP_H diff --git a/pcbnew/dialogs/dialog_board_reannotate.cpp b/pcbnew/dialogs/dialog_board_reannotate.cpp index 36cbaef9bb..9104462f62 100644 --- a/pcbnew/dialogs/dialog_board_reannotate.cpp +++ b/pcbnew/dialogs/dialog_board_reannotate.cpp @@ -556,8 +556,8 @@ void DIALOG_BOARD_REANNOTATE::LogChangePlan() // /// Create a list of the footprints and their coordinates -void DIALOG_BOARD_REANNOTATE::LogFootprints( wxString& aMessage, - std::vector& aFootprints ) +void DIALOG_BOARD_REANNOTATE::LogFootprints( const wxString& aMessage, + const std::vector& aFootprints ) { wxString message = aMessage; diff --git a/pcbnew/dialogs/dialog_board_reannotate.h b/pcbnew/dialogs/dialog_board_reannotate.h index f67473fe85..f3fc563a5b 100644 --- a/pcbnew/dialogs/dialog_board_reannotate.h +++ b/pcbnew/dialogs/dialog_board_reannotate.h @@ -172,7 +172,7 @@ private: void FilterBackPrefix( wxCommandEvent& event ) override; void ShowReport( wxString aMessage, SEVERITY aSeverity ); - void LogFootprints( wxString& aMessage, std::vector& aFootprints ); + void LogFootprints( const wxString& aMessage, const std::vector& aFootprints ); void LogChangePlan( void ); bool ReannotateBoard( void ); diff --git a/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp b/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp index 67fcb20d45..d2269998f8 100644 --- a/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp @@ -559,7 +559,7 @@ DIALOG_PAD_PRIMITIVES_TRANSFORM::DIALOG_PAD_PRIMITIVES_TRANSFORM( wxWindow* aPar // A helper function in geometry transform -inline void geom_transf( wxPoint& aCoord, wxPoint& aMove, double aScale, double aRotation ) +inline void geom_transf( wxPoint& aCoord, const wxPoint& aMove, double aScale, double aRotation ) { aCoord.x = KiROUND( aCoord.x * aScale ); aCoord.y = KiROUND( aCoord.y * aScale ); diff --git a/pcbnew/exporters/export_vrml.cpp b/pcbnew/exporters/export_vrml.cpp index 02d97eba64..ddf0c55986 100644 --- a/pcbnew/exporters/export_vrml.cpp +++ b/pcbnew/exporters/export_vrml.cpp @@ -300,7 +300,7 @@ static void create_vrml_shell( IFSG_TRANSFORM& PcbOutput, VRML_COLOR_INDEX color static void create_vrml_plane( IFSG_TRANSFORM& PcbOutput, VRML_COLOR_INDEX colorID, VRML_LAYER* layer, double aHeight, bool aTopPlane ); -static void write_triangle_bag( std::ostream& aOut_file, VRML_COLOR& aColor, +static void write_triangle_bag( std::ostream& aOut_file, const VRML_COLOR& aColor, VRML_LAYER* aLayer, bool aPlane, bool aTop, double aTop_z, double aBottom_z ) { diff --git a/pcbnew/plugins/pcad/pcb.cpp b/pcbnew/plugins/pcad/pcb.cpp index 05c347558f..5ab1bef949 100644 --- a/pcbnew/plugins/pcad/pcb.cpp +++ b/pcbnew/plugins/pcad/pcb.cpp @@ -41,7 +41,7 @@ namespace PCAD2KICAD { -PCB_LAYER_ID PCB::GetKiCadLayer( int aPCadLayer ) +PCB_LAYER_ID PCB::GetKiCadLayer( int aPCadLayer ) const { auto it = m_LayersMap.find( aPCadLayer ); @@ -51,7 +51,7 @@ PCB_LAYER_ID PCB::GetKiCadLayer( int aPCadLayer ) return it->second.KiCadLayer; } -LAYER_TYPE_T PCB::GetLayerType( int aPCadLayer ) +LAYER_TYPE_T PCB::GetLayerType( int aPCadLayer ) const { auto it = m_LayersMap.find( aPCadLayer ); @@ -61,7 +61,7 @@ LAYER_TYPE_T PCB::GetLayerType( int aPCadLayer ) return it->second.layerType; } -wxString PCB::GetLayerNetNameRef( int aPCadLayer ) +wxString PCB::GetLayerNetNameRef( int aPCadLayer ) const { auto it = m_LayersMap.find( aPCadLayer ); @@ -117,9 +117,9 @@ PCB::~PCB() } -int PCB::GetNetCode( wxString aNetName ) +int PCB::GetNetCode( const wxString& aNetName ) const { - PCB_NET* net; + const PCB_NET* net; for( int i = 0; i < (int) m_PcbNetlist.GetCount(); i++ ) { @@ -134,7 +134,7 @@ int PCB::GetNetCode( wxString aNetName ) return 0; } -XNODE* PCB::FindCompDefName( XNODE* aNode, const wxString& aName ) +XNODE* PCB::FindCompDefName( XNODE* aNode, const wxString& aName ) const { XNODE* result = NULL, * lNode; wxString propValue; @@ -449,7 +449,7 @@ void PCB::ConnectPinToNet( const wxString& aCompRef, const wxString& aPinRef, } -int PCB::FindLayer( const wxString& aLayerName ) +int PCB::FindLayer( const wxString& aLayerName ) const { for( LAYER_NUM i = 0; i < (int)m_layersStackup.GetCount(); ++i ) { @@ -554,7 +554,7 @@ void PCB::MapLayer( XNODE* aNode ) } } -int PCB::FindOutlinePoint( VERTICES_ARRAY* aOutline, wxRealPoint aPoint ) +int PCB::FindOutlinePoint( const VERTICES_ARRAY* aOutline, wxRealPoint aPoint ) const { int i; @@ -572,7 +572,7 @@ int PCB::FindOutlinePoint( VERTICES_ARRAY* aOutline, wxRealPoint aPoint ) return 0; }*/ -double PCB::GetDistance( wxRealPoint* aPoint1, wxRealPoint* aPoint2 ) +double PCB::GetDistance( const wxRealPoint* aPoint1, const wxRealPoint* aPoint2 ) const { return sqrt( ( aPoint1->x - aPoint2->x ) * ( aPoint1->x - aPoint2->x ) + diff --git a/pcbnew/plugins/pcad/pcb.h b/pcbnew/plugins/pcad/pcb.h index cfaf2d4bd9..761ab26834 100644 --- a/pcbnew/plugins/pcad/pcb.h +++ b/pcbnew/plugins/pcad/pcb.h @@ -52,10 +52,10 @@ public: PCB( BOARD* aBoard ); ~PCB(); - PCB_LAYER_ID GetKiCadLayer( int aPCadLayer ) override; - LAYER_TYPE_T GetLayerType( int aPCadLayer ) override; - wxString GetLayerNetNameRef( int aPCadLayer ) override; - int GetNetCode( wxString aNetName ) override; + PCB_LAYER_ID GetKiCadLayer( int aPCadLayer ) const override; + LAYER_TYPE_T GetLayerType( int aPCadLayer ) const override; + wxString GetLayerNetNameRef( int aPCadLayer ) const override; + int GetNetCode( const wxString& aNetName ) const override; void ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, const wxString& aActualConversion ); @@ -65,20 +65,20 @@ public: private: wxArrayString m_layersStackup; - XNODE* FindCompDefName( XNODE* aNode, const wxString& aName ); + XNODE* FindCompDefName( XNODE* aNode, const wxString& aName ) const; void SetTextProperty( XNODE* aNode, TTEXTVALUE* aTextValue, const wxString& aPatGraphRefName, const wxString& aXmlName, const wxString& aActualConversion ); - void DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxString& aActualConversion, + void DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxString& aActualConversion, wxStatusBar* aStatusBar ); void ConnectPinToNet( const wxString& aCr, const wxString& aPr, const wxString& aNetName ); - int FindLayer( const wxString& aLayerName ); + int FindLayer( const wxString& aLayerName ) const; void MapLayer( XNODE* aNode ); - int FindOutlinePoint( VERTICES_ARRAY* aOutline, wxRealPoint aPoint ); - double GetDistance( wxRealPoint* aPoint1, wxRealPoint* aPoint2 ); + int FindOutlinePoint( const VERTICES_ARRAY* aOutline, wxRealPoint aPoint ) const; + double GetDistance( const wxRealPoint* aPoint1, const wxRealPoint* aPoint2 ) const; void GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConversion ); }; diff --git a/pcbnew/plugins/pcad/pcb_callbacks.h b/pcbnew/plugins/pcad/pcb_callbacks.h index 31616cc179..f5ddb9bed9 100644 --- a/pcbnew/plugins/pcad/pcb_callbacks.h +++ b/pcbnew/plugins/pcad/pcb_callbacks.h @@ -57,10 +57,10 @@ namespace PCAD2KICAD { } - virtual PCB_LAYER_ID GetKiCadLayer( int aPCadLayer ) = 0; - virtual LAYER_TYPE_T GetLayerType( int aPCadLayer ) = 0; - virtual wxString GetLayerNetNameRef( int aPCadLayer ) = 0; - virtual int GetNetCode( wxString netName ) = 0; + virtual PCB_LAYER_ID GetKiCadLayer( int aPCadLayer ) const = 0; + virtual LAYER_TYPE_T GetLayerType( int aPCadLayer ) const = 0; + virtual wxString GetLayerNetNameRef( int aPCadLayer ) const = 0; + virtual int GetNetCode( const wxString& netName ) const = 0; }; } diff --git a/pcbnew/plugins/pcad/pcb_component.h b/pcbnew/plugins/pcad/pcb_component.h index d072b684f3..fa509b0fae 100644 --- a/pcbnew/plugins/pcad/pcb_component.h +++ b/pcbnew/plugins/pcad/pcb_component.h @@ -67,8 +67,8 @@ public: virtual void AddToFootprint( FOOTPRINT* aFootprint ); virtual void AddToBoard() = 0; - PCB_LAYER_ID GetKiCadLayer() { return m_callbacks->GetKiCadLayer( m_PCadLayer ); } - int GetNetCode( wxString aNetName ) { return m_callbacks->GetNetCode( aNetName ); } + PCB_LAYER_ID GetKiCadLayer() const { return m_callbacks->GetKiCadLayer( m_PCadLayer ); } + int GetNetCode( wxString aNetName ) const { return m_callbacks->GetNetCode( aNetName ); } protected: PCB_CALLBACKS* m_callbacks; diff --git a/pcbnew/router/pns_diff_pair.h b/pcbnew/router/pns_diff_pair.h index faf2e5c2b3..2c4995bdcb 100644 --- a/pcbnew/router/pns_diff_pair.h +++ b/pcbnew/router/pns_diff_pair.h @@ -497,7 +497,7 @@ public: } private: - void updateLine( LINE &aLine, const SHAPE_LINE_CHAIN& aShape, int aNet, VIA& aVia ) + void updateLine( LINE &aLine, const SHAPE_LINE_CHAIN& aShape, int aNet, const VIA& aVia ) { aLine.SetShape( aShape ); aLine.SetWidth( m_width ); diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index bb353c6710..d240620fb3 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -994,7 +994,7 @@ void NODE::MapConnectivity( JOINT* aStart, std::vector& aFoundJoints ) #endif -int NODE::FindLinesBetweenJoints( JOINT& aA, JOINT& aB, std::vector& aLines ) +int NODE::FindLinesBetweenJoints( const JOINT& aA, const JOINT& aB, std::vector& aLines ) { for( ITEM* item : aA.LinkList() ) { diff --git a/pcbnew/router/pns_node.h b/pcbnew/router/pns_node.h index 1df13c3e7f..d476b371a4 100644 --- a/pcbnew/router/pns_node.h +++ b/pcbnew/router/pns_node.h @@ -425,8 +425,8 @@ public: #endif ///> finds all lines between a pair of joints. Used by the loop removal procedure. - int FindLinesBetweenJoints( JOINT& aA, - JOINT& aB, + int FindLinesBetweenJoints( const JOINT& aA, + const JOINT& aB, std::vector& aLines ); ///> finds the joints corresponding to the ends of line aLine diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp index ea97a919b0..cc4cc80d91 100644 --- a/pcbnew/router/pns_optimizer.cpp +++ b/pcbnew/router/pns_optimizer.cpp @@ -89,21 +89,21 @@ int COST_ESTIMATOR::CornerCost( const LINE& aLine ) } -void COST_ESTIMATOR::Add( LINE& aLine ) +void COST_ESTIMATOR::Add( const LINE& aLine ) { m_lengthCost += aLine.CLine().Length(); m_cornerCost += CornerCost( aLine ); } -void COST_ESTIMATOR::Remove( LINE& aLine ) +void COST_ESTIMATOR::Remove( const LINE& aLine ) { m_lengthCost -= aLine.CLine().Length(); m_cornerCost -= CornerCost( aLine ); } -void COST_ESTIMATOR::Replace( LINE& aOldLine, LINE& aNewLine ) +void COST_ESTIMATOR::Replace( const LINE& aOldLine, const LINE& aNewLine ) { m_lengthCost -= aOldLine.CLine().Length(); m_cornerCost -= CornerCost( aOldLine ); @@ -112,7 +112,7 @@ void COST_ESTIMATOR::Replace( LINE& aOldLine, LINE& aNewLine ) } -bool COST_ESTIMATOR::IsBetter( COST_ESTIMATOR& aOther, +bool COST_ESTIMATOR::IsBetter( const COST_ESTIMATOR& aOther, double aLengthTolerance, double aCornerTolerance ) const { @@ -216,7 +216,7 @@ void OPTIMIZER::CacheStaticItem( ITEM* aItem ) } -void OPTIMIZER::ClearCache( bool aStaticOnly ) +void OPTIMIZER::ClearCache( bool aStaticOnly ) { if( !aStaticOnly ) { @@ -236,7 +236,7 @@ void OPTIMIZER::ClearCache( bool aStaticOnly ) } -bool ANGLE_CONSTRAINT_45::Check ( int aVertex1, int aVertex2, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) +bool ANGLE_CONSTRAINT_45::Check( int aVertex1, int aVertex2, const LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) { auto dir_orig0 = DIRECTION_45( aOriginLine->CSegment( aVertex1 ) ); auto dir_orig1 = DIRECTION_45( aOriginLine->CSegment( aVertex2 - 1) ); @@ -261,7 +261,7 @@ bool ANGLE_CONSTRAINT_45::Check ( int aVertex1, int aVertex2, LINE* aOriginLine, return true; } -bool AREA_CONSTRAINT::Check ( int aVertex1, int aVertex2, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) +bool AREA_CONSTRAINT::Check( int aVertex1, int aVertex2, const LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) { auto p1 = aOriginLine->CPoint( aVertex1 ); auto p2 = aOriginLine->CPoint( aVertex2 ); @@ -288,7 +288,7 @@ class JOINT_CACHE }; -bool PRESERVE_VERTEX_CONSTRAINT::Check ( int aVertex1, int aVertex2, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) +bool PRESERVE_VERTEX_CONSTRAINT::Check( int aVertex1, int aVertex2, const LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) { bool cv = false; @@ -321,7 +321,7 @@ bool PRESERVE_VERTEX_CONSTRAINT::Check ( int aVertex1, int aVertex2, LINE* aOrig } -bool RESTRICT_VERTEX_RANGE_CONSTRAINT::Check ( int aVertex1, int aVertex2, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) +bool RESTRICT_VERTEX_RANGE_CONSTRAINT::Check( int aVertex1, int aVertex2, const LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) { return true; } @@ -393,7 +393,7 @@ static bool pointInside2( const SHAPE_LINE_CHAIN& aL, const VECTOR2I& aP ) } -bool KEEP_TOPOLOGY_CONSTRAINT::Check ( int aVertex1, int aVertex2, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) +bool KEEP_TOPOLOGY_CONSTRAINT::Check( int aVertex1, int aVertex2, const LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) { SHAPE_LINE_CHAIN encPoly = aOriginLine->CLine().Slice( aVertex1, aVertex2 ); @@ -410,18 +410,20 @@ bool KEEP_TOPOLOGY_CONSTRAINT::Check ( int aVertex1, int aVertex2, LINE* aOrigin return true; for( auto j : joints ) - { - if ( j->Net() == aOriginLine->Net() ) + { + if( j->Net() == aOriginLine->Net() ) continue; - if ( pointInside2( encPoly, j->Pos() ) ) - { + if( pointInside2( encPoly, j->Pos() ) ) + { bool falsePositive = false; - for( int k = 0; k < encPoly.PointCount(); k++) - if(encPoly.CPoint(k) == j->Pos() ) + for( int k = 0; k < encPoly.PointCount(); k++ ) + { + if( encPoly.CPoint(k) == j->Pos() ) { falsePositive = true; break; + } } if( !falsePositive ) @@ -444,21 +446,21 @@ bool OPTIMIZER::checkColliding( ITEM* aItem, bool aUpdateCache ) void OPTIMIZER::ClearConstraints() { - for (auto c : m_constraints) + for( auto c : m_constraints) delete c; m_constraints.clear(); } void OPTIMIZER::AddConstraint ( OPT_CONSTRAINT *aConstraint ) - { +{ m_constraints.push_back(aConstraint); } -bool OPTIMIZER::checkConstraints( int aVertex1, int aVertex2, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) +bool OPTIMIZER::checkConstraints( int aVertex1, int aVertex2, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) { for( auto c: m_constraints) { - if ( !c->Check( aVertex1, aVertex2, aOriginLine, aCurrentPath, aReplacement ) ) + if( !c->Check( aVertex1, aVertex2, aOriginLine, aCurrentPath, aReplacement ) ) { return false; } @@ -610,19 +612,19 @@ bool OPTIMIZER::Optimize( LINE* aLine, LINE* aResult ) bool rv = false; - if ( m_effortLevel & PRESERVE_VERTEX ) + if( m_effortLevel & PRESERVE_VERTEX ) { auto c = new PRESERVE_VERTEX_CONSTRAINT( m_world, m_preservedVertex ); AddConstraint( c ); } - if ( m_effortLevel & RESTRICT_VERTEX_RANGE ) + if( m_effortLevel & RESTRICT_VERTEX_RANGE ) { auto c = new RESTRICT_VERTEX_RANGE_CONSTRAINT( m_world, m_restrictedVertexRange.first, m_restrictedVertexRange.second ); AddConstraint( c ); } - if ( m_effortLevel & KEEP_TOPOLOGY ) + if( m_effortLevel & KEEP_TOPOLOGY ) { auto c = new KEEP_TOPOLOGY_CONSTRAINT( m_world ); AddConstraint( c ); @@ -677,7 +679,7 @@ bool OPTIMIZER::mergeStep( LINE* aLine, SHAPE_LINE_CHAIN& aCurrentPath, int step bool ok = false; - if ( !checkColliding( aLine, bypass ) ) + if( !checkColliding( aLine, bypass ) ) { ok = checkConstraints ( n, n + step + 1, aLine, aCurrentPath, bypass ); } @@ -1426,32 +1428,30 @@ bool tightenSegment( bool dir, NODE *aNode, const LINE& cur, return true; } -void Tighten( NODE *aNode, SHAPE_LINE_CHAIN& aOldLine, LINE& aNewLine, LINE& aOptimized ) +void Tighten( NODE *aNode, const SHAPE_LINE_CHAIN& aOldLine, const LINE& aNewLine, LINE& aOptimized ) { LINE tmp; - - - if ( aNewLine.SegmentCount() < 3 ) + if( aNewLine.SegmentCount() < 3 ) return; SHAPE_LINE_CHAIN current ( aNewLine.CLine() ); - for (int step = 0; step < 3; step++) + for( int step = 0; step < 3; step++) { current.Simplify(); - for ( int i = 0; i <= current.SegmentCount() - 3; i++) + for( int i = 0; i <= current.SegmentCount() - 3; i++) { SHAPE_LINE_CHAIN l_in, l_out; l_in = current.Slice(i, i+3); - for (int dir = 0; dir < 1; dir++) + for( int dir = 0; dir < 1; dir++) { - if( tightenSegment( dir ? true : false, aNode, aNewLine, l_in, l_out ) ) + if( tightenSegment( dir ? true : false, aNode, aNewLine, l_in, l_out ) ) { SHAPE_LINE_CHAIN opt = current; - opt.Replace(i, i+3, l_out); + opt.Replace(i, i + 3, l_out); auto optArea = std::abs(shovedArea( aOldLine, opt )); auto prevArea = std::abs(shovedArea( aOldLine, current )); diff --git a/pcbnew/router/pns_optimizer.h b/pcbnew/router/pns_optimizer.h index aef99423ca..91a0b2ab34 100644 --- a/pcbnew/router/pns_optimizer.h +++ b/pcbnew/router/pns_optimizer.h @@ -64,11 +64,11 @@ public: static int CornerCost( const SHAPE_LINE_CHAIN& aLine ); static int CornerCost( const LINE& aLine ); - void Add( LINE& aLine ); - void Remove( LINE& aLine ); - void Replace( LINE& aOldLine, LINE& aNewLine ); + void Add( const LINE& aLine ); + void Remove( const LINE& aLine ); + void Replace( const LINE& aOldLine, const LINE& aNewLine ); - bool IsBetter( COST_ESTIMATOR& aOther, double aLengthTolerance, + bool IsBetter( const COST_ESTIMATOR& aOther, double aLengthTolerance, double aCornerTollerace ) const; double GetLengthCost() const { return m_lengthCost; } @@ -226,7 +226,7 @@ public: virtual ~OPT_CONSTRAINT() {}; - virtual bool Check ( int aVertex1, int aVertex2, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) = 0; + virtual bool Check( int aVertex1, int aVertex2, const LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) = 0; int GetPriority() const { @@ -256,7 +256,7 @@ public: virtual ~ANGLE_CONSTRAINT_45() {}; - virtual bool Check ( int aVertex1, int aVertex2, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) override; + virtual bool Check( int aVertex1, int aVertex2, const LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) override; private: int m_entryDirectionMask; @@ -270,7 +270,7 @@ public: OPT_CONSTRAINT( aWorld ), m_allowedArea ( aAllowedArea ) {}; - virtual bool Check ( int aVertex1, int aVertex2, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) override; + virtual bool Check( int aVertex1, int aVertex2, const LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) override; private: BOX2I m_allowedArea; @@ -284,7 +284,7 @@ public: OPT_CONSTRAINT( aWorld ) {}; - virtual bool Check ( int aVertex1, int aVertex2, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) override; + virtual bool Check( int aVertex1, int aVertex2, const LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) override; }; class PRESERVE_VERTEX_CONSTRAINT: public OPT_CONSTRAINT @@ -295,7 +295,7 @@ public: m_v( aV ) {}; - virtual bool Check ( int aVertex1, int aVertex2, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) override; + virtual bool Check( int aVertex1, int aVertex2, const LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) override; private: VECTOR2I m_v; @@ -310,7 +310,7 @@ public: m_end( aEnd ) {}; - virtual bool Check ( int aVertex1, int aVertex2, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) override; + virtual bool Check( int aVertex1, int aVertex2, const LINE* aOriginLine, const SHAPE_LINE_CHAIN& aCurrentPath, const SHAPE_LINE_CHAIN& aReplacement ) override; private: int m_start; @@ -320,4 +320,4 @@ private: }; -#endif +#endif // __PNS_OPTIMIZER_H diff --git a/pcbnew/zone.h b/pcbnew/zone.h index 171193117f..bdd6340de6 100644 --- a/pcbnew/zone.h +++ b/pcbnew/zone.h @@ -659,7 +659,7 @@ public: * Function SetFilledPolysList * sets the list of filled polygons. */ - void SetFilledPolysList( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aPolysList ) + void SetFilledPolysList( PCB_LAYER_ID aLayer, const SHAPE_POLY_SET& aPolysList ) { m_FilledPolysList[aLayer] = aPolysList; } @@ -668,7 +668,7 @@ public: * Function SetFilledPolysList * sets the list of filled polygons. */ - void SetRawPolysList( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aPolysList ) + void SetRawPolysList( PCB_LAYER_ID aLayer, const SHAPE_POLY_SET& aPolysList ) { m_RawPolysList[aLayer] = aPolysList; } diff --git a/utils/kicad2step/pcb/base.cpp b/utils/kicad2step/pcb/base.cpp index 121f750ab3..0f6ae8a377 100644 --- a/utils/kicad2step/pcb/base.cpp +++ b/utils/kicad2step/pcb/base.cpp @@ -45,7 +45,7 @@ std::ostream& operator<<( std::ostream& aStream, const TRIPLET& aTriplet ) } -bool Get2DPositionAndRotation( SEXPR::SEXPR* data, DOUBLET& aPosition, double& aRotation ) +bool Get2DPositionAndRotation( const SEXPR::SEXPR* data, DOUBLET& aPosition, double& aRotation ) { // form: (at X Y {rot}) int nchild = data->GetNumberOfChildren(); @@ -130,7 +130,7 @@ bool Get2DPositionAndRotation( SEXPR::SEXPR* data, DOUBLET& aPosition, double& a } -bool Get2DCoordinate( SEXPR::SEXPR* data, DOUBLET& aCoordinate ) +bool Get2DCoordinate( const SEXPR::SEXPR* data, DOUBLET& aCoordinate ) { // form: (at X Y {rot}) int nchild = data->GetNumberOfChildren(); @@ -180,7 +180,7 @@ bool Get2DCoordinate( SEXPR::SEXPR* data, DOUBLET& aCoordinate ) } -bool Get3DCoordinate( SEXPR::SEXPR* data, TRIPLET& aCoordinate ) +bool Get3DCoordinate( const SEXPR::SEXPR* data, TRIPLET& aCoordinate ) { // form: (at X Y Z) int nchild = data->GetNumberOfChildren(); @@ -221,7 +221,7 @@ bool Get3DCoordinate( SEXPR::SEXPR* data, TRIPLET& aCoordinate ) } -bool GetXYZRotation( SEXPR::SEXPR* data, TRIPLET& aRotation ) +bool GetXYZRotation( const SEXPR::SEXPR* data, TRIPLET& aRotation ) { const char bad_rotation[] = "* invalid 3D rotation"; diff --git a/utils/kicad2step/pcb/base.h b/utils/kicad2step/pcb/base.h index 5a545755ba..4530f5ea89 100644 --- a/utils/kicad2step/pcb/base.h +++ b/utils/kicad2step/pcb/base.h @@ -93,10 +93,10 @@ struct TRIPLET std::ostream& operator<<( std::ostream& aStream, const TRIPLET& aTriplet ); -bool Get2DPositionAndRotation( SEXPR::SEXPR* data, DOUBLET& aPosition, double& aRotation ); -bool Get2DCoordinate( SEXPR::SEXPR* data, DOUBLET& aCoordinate ); -bool Get3DCoordinate( SEXPR::SEXPR* data, TRIPLET& aCoordinate ); -bool GetXYZRotation( SEXPR::SEXPR* data, TRIPLET& aRotation ); +bool Get2DPositionAndRotation( const SEXPR::SEXPR* data, DOUBLET& aPosition, double& aRotation ); +bool Get2DCoordinate( const SEXPR::SEXPR* data, DOUBLET& aCoordinate ); +bool Get3DCoordinate( const SEXPR::SEXPR* data, TRIPLET& aCoordinate ); +bool GetXYZRotation( const SEXPR::SEXPR* data, TRIPLET& aRotation ); /** * Get the layer name from a layer element, if the layer is syntactically diff --git a/utils/kicad2step/pcb/kicadpad.cpp b/utils/kicad2step/pcb/kicadpad.cpp index 508a32056e..fa1f274096 100644 --- a/utils/kicad2step/pcb/kicadpad.cpp +++ b/utils/kicad2step/pcb/kicadpad.cpp @@ -49,7 +49,7 @@ KICADPAD::~KICADPAD() } -bool KICADPAD::Read( SEXPR::SEXPR* aEntry ) +bool KICADPAD::Read( const SEXPR::SEXPR* aEntry ) { // form: ( pad N thru_hole shape (at x y {r}) (size x y) (drill {oval} x {y}) (layers X X X) ) int nchild = aEntry->GetNumberOfChildren(); @@ -100,7 +100,7 @@ bool KICADPAD::Read( SEXPR::SEXPR* aEntry ) } -bool KICADPAD::parseDrill( SEXPR::SEXPR* aDrill ) +bool KICADPAD::parseDrill( const SEXPR::SEXPR* aDrill ) { // form: (drill {oval} X {Y}) const char bad_drill[] = "* corrupt module in PCB file; bad drill"; diff --git a/utils/kicad2step/pcb/kicadpad.h b/utils/kicad2step/pcb/kicadpad.h index db44114702..7d32e7bc50 100644 --- a/utils/kicad2step/pcb/kicadpad.h +++ b/utils/kicad2step/pcb/kicadpad.h @@ -45,15 +45,15 @@ class KICADPAD { private: bool m_thruhole; - bool parseDrill( SEXPR::SEXPR* aDrill ); + bool parseDrill( const SEXPR::SEXPR* aDrill ); public: KICADPAD(); virtual ~KICADPAD(); - bool Read( SEXPR::SEXPR* aEntry ); + bool Read( const SEXPR::SEXPR* aEntry ); - bool IsThruHole() + bool IsThruHole() const { return m_thruhole; } diff --git a/utils/kicad2step/pcb/oce_utils.cpp b/utils/kicad2step/pcb/oce_utils.cpp index 8ffc6f3617..906da80494 100644 --- a/utils/kicad2step/pcb/oce_utils.cpp +++ b/utils/kicad2step/pcb/oce_utils.cpp @@ -308,7 +308,7 @@ bool PCBMODEL::AddOutlineSegment( KICADCURVE* aCurve ) if( aCurve->m_startangle < 0.0 ) aCurve->m_startangle += 2.0 * M_PI; - double eang = aCurve->m_startangle + aCurve->m_angle; + double eang = aCurve->m_startangle + aCurve->m_angle; if( eang < 0.0 ) eang += 2.0 * M_PI; @@ -460,7 +460,7 @@ bool PCBMODEL::AddOutlineSegment( KICADCURVE* aCurve ) // add a pad hole or slot -bool PCBMODEL::AddPadHole( KICADPAD* aPad ) +bool PCBMODEL::AddPadHole( const KICADPAD* aPad ) { if( NULL == aPad || !aPad->IsThruHole() ) return false; @@ -1623,7 +1623,7 @@ bool OUTLINE::addEdge( BRepBuilderAPI_MakeWire* aWire, KICADCURVE& aCurve, DOUBL } -bool OUTLINE::testClosed( KICADCURVE& aFrontCurve, KICADCURVE& aBackCurve ) +bool OUTLINE::testClosed( const KICADCURVE& aFrontCurve, const KICADCURVE& aBackCurve ) { double spx0, spy0, epx0, epy0; getEndPoints( aFrontCurve, spx0, spy0, epx0, epy0 ); diff --git a/utils/kicad2step/pcb/oce_utils.h b/utils/kicad2step/pcb/oce_utils.h index a00b994266..989e735f24 100644 --- a/utils/kicad2step/pcb/oce_utils.h +++ b/utils/kicad2step/pcb/oce_utils.h @@ -53,7 +53,7 @@ private: double m_minDistance2; // min squared distance to treat points as separate entities (mm) bool addEdge( BRepBuilderAPI_MakeWire* aWire, KICADCURVE& aCurve, DOUBLET& aLastPoint ); - bool testClosed( KICADCURVE& aFrontCurve, KICADCURVE& aBackCurve ); + bool testClosed( const KICADCURVE& aFrontCurve, const KICADCURVE& aBackCurve ); public: std::list< KICADCURVE > m_curves; // list of contiguous segments @@ -118,7 +118,7 @@ public: bool AddOutlineSegment( KICADCURVE* aCurve ); // add a pad hole or slot (must be in final position) - bool AddPadHole( KICADPAD* aPad ); + bool AddPadHole( const KICADPAD* aPad ); // add a component at the given position and orientation bool AddComponent( const std::string& aFileName, const std::string& aRefDes, @@ -149,4 +149,4 @@ public: bool WriteSTEP( const wxString& aFileName ); }; -#endif //OCE_VIS_OCE_UTILS_H +#endif // OCE_VIS_OCE_UTILS_H