From 78e5e98ea0df5a2ebfc74b9c99ed789728e88077 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Mon, 26 Jul 2021 19:47:26 -0400 Subject: [PATCH] Pass VECTOR2I objects by reference instead of on the stack. --- 3d-viewer/3d_canvas/board_adapter.h | 2 +- .../3d_canvas/create_3Dgraphic_brd_items.cpp | 30 ++-- common/dialogs/dialog_page_settings.cpp | 2 +- common/gr_text.cpp | 2 +- common/widgets/color_swatch.cpp | 29 ++-- eeschema/tools/sch_drawing_tools.cpp | 4 +- eeschema/tools/sch_drawing_tools.h | 2 +- include/dialogs/dialog_page_settings.h | 5 +- include/eda_rect.h | 6 +- include/gr_text.h | 4 +- include/preview_items/selection_area.h | 8 +- include/tool/grid_helper.h | 2 +- include/widgets/color_swatch.h | 23 +-- libs/kimath/include/geometry/seg.h | 2 +- libs/kimath/include/geometry/shape_poly_set.h | 2 +- libs/kimath/include/math/vector2d.h | 4 +- libs/kimath/include/trigo.h | 2 +- libs/kimath/src/geometry/shape_poly_set.cpp | 2 +- libs/kimath/src/trigo.cpp | 9 +- pagelayout_editor/tools/pl_edit_tool.cpp | 4 +- pagelayout_editor/tools/pl_edit_tool.h | 2 +- pcbnew/pcbplot.h | 2 +- pcbnew/plot_brditems_plotter.cpp | 18 ++- pcbnew/router/pns_debug_decorator.h | 40 ++--- pcbnew/router/pns_kicad_iface.cpp | 11 +- pcbnew/router/pns_kicad_iface.h | 4 +- pcbnew/router/pns_line_placer.cpp | 4 +- pcbnew/router/pns_line_placer.h | 4 +- pcbnew/router/pns_logger.cpp | 4 +- pcbnew/router/pns_logger.h | 4 +- pcbnew/router/pns_meander.cpp | 50 +++++-- pcbnew/router/pns_meander.h | 8 +- pcbnew/router/pns_optimizer.cpp | 17 ++- pcbnew/router/pns_optimizer.h | 9 +- pcbnew/router/pns_tool_base.cpp | 2 +- pcbnew/router/pns_tool_base.h | 2 +- pcbnew/tools/pcb_point_editor.cpp | 140 ++++++++++-------- pcbnew/tools/pcb_point_editor.h | 19 ++- 38 files changed, 267 insertions(+), 217 deletions(-) diff --git a/3d-viewer/3d_canvas/board_adapter.h b/3d-viewer/3d_canvas/board_adapter.h index 62de17e4ca..f0ebd26366 100644 --- a/3d-viewer/3d_canvas/board_adapter.h +++ b/3d-viewer/3d_canvas/board_adapter.h @@ -568,7 +568,7 @@ private: int aClearanceValue ); void createPadWithClearance( const PAD *aPad, CONTAINER_2D_BASE* aDstContainer, - PCB_LAYER_ID aLayer, wxSize aClearanceValue ) const; + PCB_LAYER_ID aLayer, const wxSize& aClearanceValue ) const; OBJECT_2D* createPadWithDrill( const PAD* aPad, int aInflateValue ); diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index e4f6b66070..72d592a427 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -306,9 +306,11 @@ void BOARD_ADAPTER::createTrack( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDs void BOARD_ADAPTER::createPadWithClearance( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer, - PCB_LAYER_ID aLayer, wxSize aClearanceValue ) const + PCB_LAYER_ID aLayer, + const wxSize& aClearanceValue ) const { SHAPE_POLY_SET poly; + wxSize clearance = aClearanceValue; // Our shape-based builder can't handle negative or differing x:y clearance values (the // former are common for solder paste while the later get generated when a relative paste @@ -317,13 +319,13 @@ void BOARD_ADAPTER::createPadWithClearance( const PAD* aPad, CONTAINER_2D_BASE* // 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 aClearanceValue.x. - if( ( aClearanceValue.x < 0 || aClearanceValue.x != aClearanceValue.y ) + if( ( clearance.x < 0 || clearance.x != clearance.y ) && aPad->GetShape() != PAD_SHAPE::CUSTOM ) { PAD dummy( *aPad ); - dummy.SetSize( aPad->GetSize() + aClearanceValue + aClearanceValue ); + dummy.SetSize( aPad->GetSize() + clearance + clearance ); dummy.TransformShapeWithClearanceToPolygon( poly, aLayer, 0, ARC_HIGH_DEF, ERROR_INSIDE ); - aClearanceValue = { 0, 0 }; + clearance = { 0, 0 }; } else { @@ -340,14 +342,14 @@ void BOARD_ADAPTER::createPadWithClearance( const PAD* aPad, CONTAINER_2D_BASE* -seg->GetSeg().A.y * m_biuTo3Dunits ); const SFVEC2F end3DU ( seg->GetSeg().B.x * m_biuTo3Dunits, -seg->GetSeg().B.y * m_biuTo3Dunits ); - const int width = seg->GetWidth() + aClearanceValue.x * 2; + const int width = seg->GetWidth() + clearance.x * 2; // Cannot add segments that have the same start and end point if( Is_segment_a_circle( start3DU, end3DU ) ) { aDstContainer->Add( new FILLED_CIRCLE_2D( start3DU, - ( width / 2) * m_biuTo3Dunits, - *aPad ) ); + ( width / 2 ) * m_biuTo3Dunits, + *aPad ) ); } else { @@ -361,7 +363,7 @@ void BOARD_ADAPTER::createPadWithClearance( const PAD* aPad, CONTAINER_2D_BASE* case SH_CIRCLE: { const SHAPE_CIRCLE* circle = (SHAPE_CIRCLE*) shape; - const int radius = circle->GetRadius() + aClearanceValue.x; + const int radius = circle->GetRadius() + clearance.x; const SFVEC2F center( circle->GetCenter().x * m_biuTo3Dunits, -circle->GetCenter().y * m_biuTo3Dunits ); @@ -402,14 +404,14 @@ void BOARD_ADAPTER::createPadWithClearance( const PAD* aPad, CONTAINER_2D_BASE* -seg.GetSeg().A.y * m_biuTo3Dunits ); const SFVEC2F end3DU( seg.GetSeg().B.x * m_biuTo3Dunits, -seg.GetSeg().B.y * m_biuTo3Dunits ); - const int width = arc->GetWidth() + aClearanceValue.x * 2; + const int width = arc->GetWidth() + clearance.x * 2; // Cannot add segments that have the same start and end point if( Is_segment_a_circle( start3DU, end3DU ) ) { aDstContainer->Add( new FILLED_CIRCLE_2D( start3DU, - ( width / 2) * m_biuTo3Dunits, - *aPad ) ); + ( width / 2 ) * m_biuTo3Dunits, + *aPad ) ); } else { @@ -431,8 +433,8 @@ void BOARD_ADAPTER::createPadWithClearance( const PAD* aPad, CONTAINER_2D_BASE* if( !poly.IsEmpty() ) { - if( aClearanceValue.x ) - poly.Inflate( aClearanceValue.x, 32 ); + if( clearance.x ) + poly.Inflate( clearance.x, 32 ); // Add the PAD polygon ConvertPolygonToTriangles( poly, *aDstContainer, m_biuTo3Dunits, *aPad ); @@ -504,11 +506,13 @@ void BOARD_ADAPTER::addPadsWithClearance( const FOOTPRINT* aFootprint, case PAD_SHAPE::CIRCLE: if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE ) continue; + break; case PAD_SHAPE::OVAL: if( pad->GetDrillShape() != PAD_DRILL_SHAPE_CIRCLE ) continue; + break; default: diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 1a5bb070aa..7de8349443 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -70,7 +70,7 @@ static const wxString pageFmts[] = }; DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aIuPerMils, - wxSize aMaxUserSizeMils ) : + const wxSize& aMaxUserSizeMils ) : DIALOG_PAGES_SETTINGS_BASE( aParent ), m_parent( aParent ), m_screen( m_parent->GetScreen() ), diff --git a/common/gr_text.cpp b/common/gr_text.cpp index df524159fd..9f68b91d0d 100644 --- a/common/gr_text.cpp +++ b/common/gr_text.cpp @@ -83,7 +83,7 @@ float Clamp_Text_PenSize( float aPenSize, int aSize, bool aBold ) } -int Clamp_Text_PenSize( int aPenSize, wxSize aSize, bool aBold ) +int Clamp_Text_PenSize( int aPenSize, const wxSize& aSize, bool aBold ) { int size = std::min( std::abs( aSize.x ), std::abs( aSize.y ) ); diff --git a/common/widgets/color_swatch.cpp b/common/widgets/color_swatch.cpp index 87a29e27db..11e230b594 100644 --- a/common/widgets/color_swatch.cpp +++ b/common/widgets/color_swatch.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. - - * Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors. + * + * Copyright (C) 2017-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 @@ -36,13 +36,9 @@ using KIGFX::COLOR4D; extern COLOR4D DisplayColorFrame( wxWindow* aParent, COLOR4D aOldColor ); -/** - * Make a simple color swatch bitmap - * - * @param aWindow - window used as context for device-independent size - */ -wxBitmap COLOR_SWATCH::MakeBitmap( COLOR4D aColor, COLOR4D aBackground, wxSize aSize, - wxSize aCheckerboardSize, COLOR4D aCheckerboardBackground ) +wxBitmap COLOR_SWATCH::MakeBitmap( const COLOR4D& aColor, const COLOR4D& aBackground, + const wxSize& aSize, const wxSize& aCheckerboardSize, + const COLOR4D& aCheckerboardBackground ) { wxBitmap bitmap( aSize ); wxBrush brush; @@ -113,8 +109,9 @@ wxBitmap COLOR_SWATCH::MakeBitmap( COLOR4D aColor, COLOR4D aBackground, wxSize a } -COLOR_SWATCH::COLOR_SWATCH( wxWindow* aParent, COLOR4D aColor, int aID, COLOR4D aBackground, - const COLOR4D aDefault, SWATCH_SIZE aSwatchSize ) : +COLOR_SWATCH::COLOR_SWATCH( wxWindow* aParent, const COLOR4D& aColor, int aID, + const COLOR4D& aBackground, const COLOR4D& aDefault, + SWATCH_SIZE aSwatchSize ) : wxPanel( aParent, aID ), m_color( aColor ), m_background( aBackground ), @@ -149,8 +146,8 @@ COLOR_SWATCH::COLOR_SWATCH( wxWindow* aParent, COLOR4D aColor, int aID, COLOR4D } -COLOR_SWATCH::COLOR_SWATCH( wxWindow *aParent, wxWindowID aID, const wxPoint &aPos, - const wxSize &aSize, long aStyle ) : +COLOR_SWATCH::COLOR_SWATCH( wxWindow* aParent, wxWindowID aID, const wxPoint& aPos, + const wxSize& aSize, long aStyle ) : wxPanel( aParent, aID, aPos, aSize, aStyle ), m_userColors( nullptr ), m_readOnly( false ), @@ -235,7 +232,7 @@ static void sendSwatchChangeEvent( COLOR_SWATCH& aSender ) } -void COLOR_SWATCH::SetSwatchColor( COLOR4D aColor, bool aSendEvent ) +void COLOR_SWATCH::SetSwatchColor( const COLOR4D& aColor, bool aSendEvent ) { m_color = aColor; @@ -247,13 +244,13 @@ void COLOR_SWATCH::SetSwatchColor( COLOR4D aColor, bool aSendEvent ) } -void COLOR_SWATCH::SetDefaultColor( COLOR4D aColor ) +void COLOR_SWATCH::SetDefaultColor( const COLOR4D& aColor ) { m_default = aColor; } -void COLOR_SWATCH::SetSwatchBackground( COLOR4D aBackground ) +void COLOR_SWATCH::SetSwatchBackground( const COLOR4D& aBackground ) { m_background = aBackground; wxBitmap bm = MakeBitmap( m_color, m_background, m_size, m_checkerboardSize, m_checkerboardBg ); diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index ba2b26419f..3a9686595c 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -482,6 +482,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent ) // (Current mouse pos after closing the dialog will be used) KIGFX::VIEW_CONTROLS* controls = getViewControls(); VECTOR2D initialMousePos = controls->GetMousePosition(false); + // Build the rectangle area acceptable to move the cursor without // having an auto-pan EDA_RECT canvas_area = GetCanvasFreeAreaPixels(); @@ -883,6 +884,7 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType if( settings.m_IntersheetRefsShow ) static_cast( textItem )->GetIntersheetRefs()->SetVisible( true ); + break; default: @@ -1419,7 +1421,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent ) } -void SCH_DRAWING_TOOLS::sizeSheet( SCH_SHEET* aSheet, VECTOR2I aPos ) +void SCH_DRAWING_TOOLS::sizeSheet( SCH_SHEET* aSheet, const VECTOR2I& aPos ) { wxPoint pos = aSheet->GetPosition(); wxPoint size = (wxPoint) aPos - pos; diff --git a/eeschema/tools/sch_drawing_tools.h b/eeschema/tools/sch_drawing_tools.h index 87de85e94d..92a105ef3d 100644 --- a/eeschema/tools/sch_drawing_tools.h +++ b/eeschema/tools/sch_drawing_tools.h @@ -75,7 +75,7 @@ private: SCH_SHEET_PIN* createSheetPin( SCH_SHEET* aSheet, SCH_HIERLABEL* aLabel ); - void sizeSheet( SCH_SHEET* aSheet, VECTOR2I aPos ); + void sizeSheet( SCH_SHEET* aSheet, const VECTOR2I& aPos ); ///< Set up handlers for various events. void setTransitions() override; diff --git a/include/dialogs/dialog_page_settings.h b/include/dialogs/dialog_page_settings.h index 7e54805fa9..6dc0e17d8c 100644 --- a/include/dialogs/dialog_page_settings.h +++ b/include/dialogs/dialog_page_settings.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-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 @@ -34,7 +34,8 @@ class DS_DATA_MODEL; class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE { public: - DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aIuPerMils, wxSize aMaxUserSizeMils ); + DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aIuPerMils, + const wxSize& aMaxUserSizeMils ); virtual ~DIALOG_PAGES_SETTINGS(); const wxString GetWksFileName() diff --git a/include/eda_rect.h b/include/eda_rect.h index 65fd665524..f5267196cf 100644 --- a/include/eda_rect.h +++ b/include/eda_rect.h @@ -118,7 +118,7 @@ public: return m_init; } - void SetOrigin( const wxPoint &pos ) + void SetOrigin( const wxPoint& pos ) { m_pos = pos; m_init = true; @@ -131,7 +131,7 @@ public: m_init = true; } - void SetSize( const wxSize &size ) + void SetSize( const wxSize& size ) { m_size = size; m_init = true; @@ -150,7 +150,7 @@ public: m_pos.y += dy; } - void Offset( const wxPoint &offset ) + void Offset( const wxPoint& offset ) { m_pos += offset; } diff --git a/include/gr_text.h b/include/gr_text.h index 605e895289..b72ca667b3 100644 --- a/include/gr_text.h +++ b/include/gr_text.h @@ -64,7 +64,7 @@ class PLOTTER; */ int Clamp_Text_PenSize( int aPenSize, int aSize, bool aBold = true ); float Clamp_Text_PenSize( float aPenSize, int aSize, bool aBold = true ); -int Clamp_Text_PenSize( int aPenSize, wxSize aSize, bool aBold = true ); +int Clamp_Text_PenSize( int aPenSize, const wxSize& aSize, bool aBold = true ); /** * @param aTextSize the char size (height or width). @@ -124,7 +124,7 @@ void GRText( wxDC* aDC, const wxPoint& aPos, const COLOR4D& aColor, const wxStri * in \a aColor2 with \a aColor1 border. Otherwise colors are swapped. */ void GRHaloText( wxDC* aDC, const wxPoint& aPos, const COLOR4D& aBgColor, const COLOR4D& aColor1, - const COLOR4D& aColor2, const wxString& aText, double aOrient, const wxSize &aSize, + const COLOR4D& aColor2, const wxString& aText, double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr, diff --git a/include/preview_items/selection_area.h b/include/preview_items/selection_area.h index 4cf3e78c14..e0422076bf 100644 --- a/include/preview_items/selection_area.h +++ b/include/preview_items/selection_area.h @@ -53,22 +53,20 @@ public: const BOX2I ViewBBox() const override; ///< Set the origin of the rectangle (the fixed corner) - void SetOrigin( VECTOR2I aOrigin ) + void SetOrigin( const VECTOR2I& aOrigin ) { m_origin = aOrigin; } /** - * Set the current end of the rectangle (the corner that moves - * with the cursor. + * Set the current end of the rectangle (the corner that moves with the cursor. */ - void SetEnd( VECTOR2I aEnd ) + void SetEnd( const VECTOR2I& aEnd ) { m_end = aEnd; } /** - * Get class name * @return string "SELECTION_AREA" */ wxString GetClass() const override diff --git a/include/tool/grid_helper.h b/include/tool/grid_helper.h index c847f8145a..b71bc7d891 100644 --- a/include/tool/grid_helper.h +++ b/include/tool/grid_helper.h @@ -87,7 +87,7 @@ protected: struct ANCHOR { - ANCHOR( VECTOR2I aPos, int aFlags = CORNER | SNAPPABLE, EDA_ITEM* aItem = nullptr ) : + ANCHOR( const VECTOR2I& aPos, int aFlags = CORNER | SNAPPABLE, EDA_ITEM* aItem = nullptr ) : pos( aPos ), flags( aFlags ), item( aItem ) diff --git a/include/widgets/color_swatch.h b/include/widgets/color_swatch.h index 9b267071a3..26d2838f22 100644 --- a/include/widgets/color_swatch.h +++ b/include/widgets/color_swatch.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-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 @@ -51,8 +51,7 @@ const static wxSize CHECKERBOARD_SIZE_DU( 3, 3 ); /** - * Class representing a simple color swatch, of the kind used to - * set layer colors + * A simple color swatch of the kind used to set layer colors. */ class COLOR_SWATCH: public wxPanel { @@ -65,8 +64,9 @@ public: * @param aColor initial swatch color * @param aID id to use when sending swatch events */ - COLOR_SWATCH( wxWindow* aParent, KIGFX::COLOR4D aColor, int aID, KIGFX::COLOR4D aBackground, - const KIGFX::COLOR4D aDefault, SWATCH_SIZE aSwatchType ); + COLOR_SWATCH( wxWindow* aParent, const KIGFX::COLOR4D& aColor, int aID, + const KIGFX::COLOR4D& aBackground, const KIGFX::COLOR4D& aDefault, + SWATCH_SIZE aSwatchType ); /** * constructor for wxFormBuilder @@ -77,17 +77,17 @@ public: /** * Set the current swatch color directly. */ - void SetSwatchColor( KIGFX::COLOR4D aColor, bool aSendEvent ); + void SetSwatchColor( const KIGFX::COLOR4D& aColor, bool aSendEvent ); /** * Sets the color that will be chosen with the "Reset to Default" button in the chooser */ - void SetDefaultColor( KIGFX::COLOR4D aColor ); + void SetDefaultColor( const KIGFX::COLOR4D& aColor ); /** * Set the swatch background color. */ - void SetSwatchBackground( KIGFX::COLOR4D aBackground ); + void SetSwatchBackground( const KIGFX::COLOR4D& aBackground ); /** * Fetch a reference to the user colors list. @@ -114,8 +114,9 @@ public: /// Registers a handler for when the user tries to interact with a read-only swatch void SetReadOnlyCallback( std::function aCallback ) { m_readOnlyCallback = aCallback; } - static wxBitmap MakeBitmap( KIGFX::COLOR4D aColor, KIGFX::COLOR4D aBackground, wxSize aSize, - wxSize aCheckerboardSize, KIGFX::COLOR4D aCheckerboardBackground ); + static wxBitmap MakeBitmap( const KIGFX::COLOR4D& aColor, const KIGFX::COLOR4D& aBackground, + const wxSize& aSize, const wxSize& aCheckerboardSize, + const KIGFX::COLOR4D& aCheckerboardBackground ); private: void setupEvents(); @@ -146,7 +147,7 @@ private: /** - * Event signalling a swatch has changed color + * Event signaling a swatch has changed color */ wxDECLARE_EVENT(COLOR_SWATCH_CHANGED, wxCommandEvent); diff --git a/libs/kimath/include/geometry/seg.h b/libs/kimath/include/geometry/seg.h index 38705cf475..9f64ef7e0e 100644 --- a/libs/kimath/include/geometry/seg.h +++ b/libs/kimath/include/geometry/seg.h @@ -170,7 +170,7 @@ public: * * @return the nearest point */ - const VECTOR2I NearestPoint( const VECTOR2I &aP ) const; + const VECTOR2I NearestPoint( const VECTOR2I& aP ) const; /** * Compute a point on the segment (this) that is closest to any point on \a aSeg. diff --git a/libs/kimath/include/geometry/shape_poly_set.h b/libs/kimath/include/geometry/shape_poly_set.h index 941909f359..b8e1e19a07 100644 --- a/libs/kimath/include/geometry/shape_poly_set.h +++ b/libs/kimath/include/geometry/shape_poly_set.h @@ -597,7 +597,7 @@ public: * inserted. * @param aNewVertex is the new inserted vertex. */ - void InsertVertex( int aGlobalIndex, VECTOR2I aNewVertex ); + void InsertVertex( int aGlobalIndex, const VECTOR2I& aNewVertex ); ///< Return the index-th vertex in a given hole outline within a given outline const VECTOR2I& CVertex( int aIndex, int aOutline, int aHole ) const; diff --git a/libs/kimath/include/math/vector2d.h b/libs/kimath/include/math/vector2d.h index f2d64df16c..2a2de73a5c 100644 --- a/libs/kimath/include/math/vector2d.h +++ b/libs/kimath/include/math/vector2d.h @@ -266,7 +266,7 @@ VECTOR2::VECTOR2() #ifdef WX_COMPATIBILITY template -VECTOR2::VECTOR2( wxPoint const& aPoint ) +VECTOR2::VECTOR2( const wxPoint& aPoint ) { x = T( aPoint.x ); y = T( aPoint.y ); @@ -274,7 +274,7 @@ VECTOR2::VECTOR2( wxPoint const& aPoint ) template -VECTOR2::VECTOR2( wxSize const& aSize ) +VECTOR2::VECTOR2( const wxSize& aSize ) { x = T( aSize.x ); y = T( aSize.y ); diff --git a/libs/kimath/include/trigo.h b/libs/kimath/include/trigo.h index ddfa8aa14c..95f904085a 100644 --- a/libs/kimath/include/trigo.h +++ b/libs/kimath/include/trigo.h @@ -109,7 +109,7 @@ void RotatePoint( double *pX, double *pY, double cx, double cy, double angle ); const VECTOR2I GetArcCenter( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd ); const VECTOR2D GetArcCenter( const VECTOR2D& aStart, const VECTOR2D& aMid, const VECTOR2D& aEnd ); const wxPoint GetArcCenter( const wxPoint& aStart, const wxPoint& aMid, const wxPoint& aEnd ); -const wxPoint GetArcCenter( VECTOR2I aStart, VECTOR2I aEnd, double aAngle ); +const wxPoint GetArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle ); /** * Return the subtended angle for a given arc. diff --git a/libs/kimath/src/geometry/shape_poly_set.cpp b/libs/kimath/src/geometry/shape_poly_set.cpp index 80c69b4d8a..8f53843546 100644 --- a/libs/kimath/src/geometry/shape_poly_set.cpp +++ b/libs/kimath/src/geometry/shape_poly_set.cpp @@ -258,7 +258,7 @@ int SHAPE_POLY_SET::Append( SHAPE_ARC& aArc, int aOutline, int aHole ) } -void SHAPE_POLY_SET::InsertVertex( int aGlobalIndex, VECTOR2I aNewVertex ) +void SHAPE_POLY_SET::InsertVertex( int aGlobalIndex, const VECTOR2I& aNewVertex ) { VERTEX_INDEX index; diff --git a/libs/kimath/src/trigo.cpp b/libs/kimath/src/trigo.cpp index 0beeca4788..5dc3d74db6 100644 --- a/libs/kimath/src/trigo.cpp +++ b/libs/kimath/src/trigo.cpp @@ -359,17 +359,20 @@ void RotatePoint( double* pX, double* pY, double angle ) } -const wxPoint GetArcCenter( VECTOR2I aStart, VECTOR2I aEnd, double aAngle ) +const wxPoint GetArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle ) { + VECTOR2I start = aStart; + VECTOR2I end = aEnd; + if( aAngle < 0 ) { - std::swap( aStart, aEnd ); + std::swap( start, end ); aAngle = abs( aAngle ); } if( aAngle > 180 ) { - std::swap( aStart, aEnd ); + std::swap( start, end ); aAngle = 360 - aAngle; } diff --git a/pagelayout_editor/tools/pl_edit_tool.cpp b/pagelayout_editor/tools/pl_edit_tool.cpp index a323215235..d6e95a2a2d 100644 --- a/pagelayout_editor/tools/pl_edit_tool.cpp +++ b/pagelayout_editor/tools/pl_edit_tool.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-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 @@ -272,7 +272,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent ) } -void PL_EDIT_TOOL::moveItem( DS_DATA_ITEM* aItem, VECTOR2I aDelta ) +void PL_EDIT_TOOL::moveItem( DS_DATA_ITEM* aItem, const VECTOR2I& aDelta ) { aItem->MoveToUi( aItem->GetStartPosUi() + (wxPoint) aDelta ); diff --git a/pagelayout_editor/tools/pl_edit_tool.h b/pagelayout_editor/tools/pl_edit_tool.h index 955611198e..bffe1c19b4 100644 --- a/pagelayout_editor/tools/pl_edit_tool.h +++ b/pagelayout_editor/tools/pl_edit_tool.h @@ -66,7 +66,7 @@ public: int DeleteItemCursor( const TOOL_EVENT& aEvent ); private: - void moveItem( DS_DATA_ITEM* aItem, VECTOR2I aDelta ); + void moveItem( DS_DATA_ITEM* aItem, const VECTOR2I& aDelta ); ///< Return the right modification point (e.g. for rotation), depending on the number of ///< selected items. diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index e03458d5fb..5c4bf2d163 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -136,7 +136,7 @@ private: * It compensate and clamp the drill mark size depending on the current plot options. */ void plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const wxPoint& aDrillPos, - wxSize aDrillSize, const wxSize& aPadSize, + const wxSize& aDrillSize, const wxSize& aPadSize, double aOrientation, int aSmallDrill ); PLOTTER* m_plotter; diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 8a08ff8904..fe14abf6e1 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -986,26 +986,28 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape ) void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const wxPoint &aDrillPos, - wxSize aDrillSize, const wxSize &aPadSize, + const wxSize& aDrillSize, const wxSize &aPadSize, double aOrientation, int aSmallDrill ) { + wxSize drillSize = aDrillSize; + // Small drill marks have no significance when applied to slots if( aSmallDrill && aDrillShape == PAD_DRILL_SHAPE_CIRCLE ) - aDrillSize.x = std::min( aSmallDrill, aDrillSize.x ); + drillSize.x = std::min( aSmallDrill, drillSize.x ); // Round holes only have x diameter, slots have both - aDrillSize.x -= getFineWidthAdj(); - aDrillSize.x = Clamp( 1, aDrillSize.x, aPadSize.x - 1 ); + drillSize.x -= getFineWidthAdj(); + drillSize.x = Clamp( 1, drillSize.x, aPadSize.x - 1 ); if( aDrillShape == PAD_DRILL_SHAPE_OBLONG ) { - aDrillSize.y -= getFineWidthAdj(); - aDrillSize.y = Clamp( 1, aDrillSize.y, aPadSize.y - 1 ); - m_plotter->FlashPadOval( aDrillPos, aDrillSize, aOrientation, GetPlotMode(), nullptr ); + drillSize.y -= getFineWidthAdj(); + drillSize.y = Clamp( 1, drillSize.y, aPadSize.y - 1 ); + m_plotter->FlashPadOval( aDrillPos, drillSize, aOrientation, GetPlotMode(), nullptr ); } else { - m_plotter->FlashPadCircle( aDrillPos, aDrillSize.x, GetPlotMode(), nullptr ); + m_plotter->FlashPadCircle( aDrillPos, drillSize.x, GetPlotMode(), nullptr ); } } diff --git a/pcbnew/router/pns_debug_decorator.h b/pcbnew/router/pns_debug_decorator.h index 00825c0571..871503f9c2 100644 --- a/pcbnew/router/pns_debug_decorator.h +++ b/pcbnew/router/pns_debug_decorator.h @@ -2,7 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2021 CERN - * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors. * Author: Christian Gagneraud * * This program is free software: you can redistribute it and/or modify it @@ -38,8 +38,11 @@ public: struct SRC_LOCATION_INFO { - SRC_LOCATION_INFO( std::string aFileName = "", std::string aFuncName = "", int aLine = 0 ) : - fileName( aFileName ), funcName( aFuncName ), line( aLine ) + SRC_LOCATION_INFO( const std::string& aFileName = "", const std::string& aFuncName = "", + int aLine = 0 ) : + fileName( aFileName ), + funcName( aFuncName ), + line( aLine ) { } @@ -54,24 +57,24 @@ public: bool IsDebugEnabled() const { return m_debugEnabled; } virtual void SetIteration( int iter ){}; - virtual void Message( const wxString msg, + virtual void Message( const wxString& msg, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){}; virtual void NewStage( const std::string& name, int iter, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){}; - virtual void BeginGroup( const std::string name, + virtual void BeginGroup( const std::string& name, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){}; virtual void EndGroup( const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){}; - virtual void AddPoint( VECTOR2I aP, const KIGFX::COLOR4D& aColor, int aSize, - const std::string aName, + virtual void AddPoint( const VECTOR2I& aP, const KIGFX::COLOR4D& aColor, int aSize, + const std::string& aName, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){}; virtual void AddLine( const SHAPE_LINE_CHAIN& aLine, const KIGFX::COLOR4D& aColor, - int aWidth, const std::string aName, + int aWidth, const std::string& aName, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){}; - virtual void AddSegment( SEG aS, const KIGFX::COLOR4D& aColor, - const std::string aName, + virtual void AddSegment( const SEG& aS, const KIGFX::COLOR4D& aColor, + const std::string& aName, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){}; - virtual void AddBox( BOX2I aB, const KIGFX::COLOR4D& aColor, - const std::string aName, + virtual void AddBox( const BOX2I& aB, const KIGFX::COLOR4D& aColor, + const std::string& aName, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){}; virtual void Clear(){}; @@ -84,15 +87,16 @@ private: call location of the debug calls without having to create the SRC_LOCATION_INFOs every time DEBUG_DECORATOR::Something() is called. - Also checks if debug is enabled at all prior to calling decorator methods, thus saving some + Also checks if debug is enabled at all prior to calling decorator methods, thus saving some time wasted otherwise for string formatting and copying the geometry. */ -#define PNS_DBG(dbg,method,...) \ - if( dbg && dbg->IsDebugEnabled() ) \ - dbg->method( __VA_ARGS__, PNS::DEBUG_DECORATOR::SRC_LOCATION_INFO( __FILE__, __FUNCTION__, __LINE__ ) ); +#define PNS_DBG( dbg, method, ... ) \ + if( dbg && dbg->IsDebugEnabled() ) \ + dbg->method( __VA_ARGS__, PNS::DEBUG_DECORATOR::SRC_LOCATION_INFO( __FILE__, __FUNCTION__, \ + __LINE__ ) ); -#define PNS_DBGN(dbg,method) \ - if( dbg && dbg->IsDebugEnabled() ) \ +#define PNS_DBGN( dbg, method ) \ + if( dbg && dbg->IsDebugEnabled() ) \ dbg->method( PNS::DEBUG_DECORATOR::SRC_LOCATION_INFO( __FILE__, __FUNCTION__, __LINE__ ) ); } // namespace PNS diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index e0b238706b..4669683805 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -743,7 +743,8 @@ public: m_view->Add( m_items ); } - virtual void AddPoint( VECTOR2I aP, const COLOR4D& aColor, int aSize, const std::string aName, + virtual void AddPoint( const VECTOR2I& aP, const COLOR4D& aColor, int aSize, + const std::string& aName, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override { SHAPE_LINE_CHAIN l; @@ -760,7 +761,7 @@ public: AddLine( l, aColor, 10000, aName ); } - virtual void AddBox( BOX2I aB, const COLOR4D& aColor, const std::string aName, + virtual void AddBox( const BOX2I& aB, const COLOR4D& aColor, const std::string& aName, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override { SHAPE_LINE_CHAIN l; @@ -777,7 +778,7 @@ public: AddLine( l, aColor, 10000, aName, aSrcLoc ); } - virtual void AddSegment( SEG aS, const COLOR4D& aColor, const std::string aName, + virtual void AddSegment( const SEG& aS, const COLOR4D& aColor, const std::string& aName, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override { SHAPE_LINE_CHAIN l; @@ -790,7 +791,7 @@ public: virtual void AddLine( const SHAPE_LINE_CHAIN& aLine, const COLOR4D& aColor, - int aWidth, const std::string aName, + int aWidth, const std::string& aName, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override { if( !m_view ) @@ -981,7 +982,7 @@ std::unique_ptr PNS_KICAD_IFACE_BASE::syncPad( PAD* aPad ) std::unique_ptr PNS_KICAD_IFACE_BASE::syncTrack( PCB_TRACK* aTrack ) { auto segment = std::make_unique( SEG( aTrack->GetStart(), aTrack->GetEnd() ), - aTrack->GetNetCode() ); + aTrack->GetNetCode() ); segment->SetWidth( aTrack->GetWidth() ); segment->SetLayers( LAYER_RANGE( aTrack->GetLayer() ) ); diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h index 8fc68dc6f4..fe9e24a6c3 100644 --- a/pcbnew/router/pns_kicad_iface.h +++ b/pcbnew/router/pns_kicad_iface.h @@ -2,7 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2016 CERN - * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors. * Author: Tomasz Wlostowski * * This program is free software: you can redistribute it and/or modify it @@ -70,7 +70,7 @@ public: void UpdateNet( int aNetCode ) override {} - void SetDebugDecorator( PNS::DEBUG_DECORATOR *aDec ); + void SetDebugDecorator( PNS::DEBUG_DECORATOR* aDec ); virtual PNS::NODE* GetWorld() const override { diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 6a327fe0e3..42eb7659a7 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -1750,8 +1750,8 @@ void FIXED_TAIL::Clear() } -void FIXED_TAIL::AddStage( VECTOR2I aStart, int aLayer, bool placingVias, DIRECTION_45 direction, - NODE *aNode ) +void FIXED_TAIL::AddStage( const VECTOR2I& aStart, int aLayer, bool placingVias, + DIRECTION_45 direction, NODE* aNode ) { STAGE st; FIX_POINT pt; diff --git a/pcbnew/router/pns_line_placer.h b/pcbnew/router/pns_line_placer.h index fff48a41a6..47c04968cb 100644 --- a/pcbnew/router/pns_line_placer.h +++ b/pcbnew/router/pns_line_placer.h @@ -65,8 +65,8 @@ public: }; void Clear(); - void AddStage( VECTOR2I aStart, int aLayer, bool placingVias, DIRECTION_45 direction, - NODE *aNode ); + void AddStage( const VECTOR2I& aStart, int aLayer, bool placingVias, DIRECTION_45 direction, + NODE* aNode ); bool PopStage( STAGE& aStage ); int StageCount() const; diff --git a/pcbnew/router/pns_logger.cpp b/pcbnew/router/pns_logger.cpp index 8271877035..fb02d599c4 100644 --- a/pcbnew/router/pns_logger.cpp +++ b/pcbnew/router/pns_logger.cpp @@ -2,7 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2014 CERN - * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors. * Author: Tomasz Wlostowski * * This program is free software: you can redistribute it and/or modify it @@ -61,7 +61,7 @@ void LOGGER::Save( const std::string& aFilename ) } -void LOGGER::Log( LOGGER::EVENT_TYPE evt, VECTOR2I pos, const ITEM* item ) +void LOGGER::Log( LOGGER::EVENT_TYPE evt, const VECTOR2I& pos, const ITEM* item ) { LOGGER::EVENT_ENTRY ent; diff --git a/pcbnew/router/pns_logger.h b/pcbnew/router/pns_logger.h index f65ec4daf2..d607021611 100644 --- a/pcbnew/router/pns_logger.h +++ b/pcbnew/router/pns_logger.h @@ -2,7 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2014 CERN - * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors. * Author: Tomasz Wlostowski * * This program is free software: you can redistribute it and/or modify it @@ -59,7 +59,7 @@ public: void Save( const std::string& aFilename ); void Clear(); - void Log( EVENT_TYPE evt, VECTOR2I pos, const ITEM* item = nullptr ); + void Log( EVENT_TYPE evt, const VECTOR2I& pos, const ITEM* item = nullptr ); const std::vector& GetEvents() { diff --git a/pcbnew/router/pns_meander.cpp b/pcbnew/router/pns_meander.cpp index 14d9507b48..4a15bf4e77 100644 --- a/pcbnew/router/pns_meander.cpp +++ b/pcbnew/router/pns_meander.cpp @@ -2,7 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2014 CERN - * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors. * Author: Tomasz Wlostowski * * This program is free software: you can redistribute it and/or modify it @@ -106,7 +106,9 @@ void MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex ) } } } - } else { + } + else + { bool rv = m.Fit( MT_CHECK_FINISH, aBase, m_last, side ); if( rv ) @@ -114,7 +116,9 @@ void MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex ) m.Fit( MT_TURN, aBase, m_last, side ); AddMeander( new MEANDER_SHAPE( m ) ); started = true; - } else { + } + else + { m.Fit( MT_FINISH, aBase, m_last, side ); started = false; AddMeander( new MEANDER_SHAPE( m ) ); @@ -123,15 +127,19 @@ void MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex ) side = !side; } - } else if( started ) + } + else if( started ) { bool rv = m.Fit( MT_FINISH, aBase, m_last, side ); + if( rv ) AddMeander( new MEANDER_SHAPE( m ) ); break; - } else { + } + else + { fail = true; } @@ -187,7 +195,8 @@ int MEANDER_SHAPE::spacing( ) const } -SHAPE_LINE_CHAIN MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir, bool aSide ) +SHAPE_LINE_CHAIN MEANDER_SHAPE::makeMiterShape( const VECTOR2D& aP, const VECTOR2D& aDir, + bool aSide ) { SHAPE_LINE_CHAIN lc; @@ -202,7 +211,6 @@ SHAPE_LINE_CHAIN MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir, bool VECTOR2D p = aP; lc.Append( ( int ) p.x, ( int ) p.y ); - // fixme: refactor switch( m_placer->MeanderSettings().m_cornerStyle ) { @@ -218,6 +226,7 @@ SHAPE_LINE_CHAIN MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir, bool { double radius = (double) aDir.EuclideanNorm(); double correction = 0; + if( m_dual && radius > m_meanCornerRadius ) correction = (double)( -2 * abs(m_baselineOffset) ) * tan( 22.5 * M_PI / 180.0 ); @@ -290,8 +299,9 @@ void MEANDER_SHAPE::uShape( int aSides, int aCorner, int aTop ) } -SHAPE_LINE_CHAIN MEANDER_SHAPE::genMeanderShape( VECTOR2D aP, VECTOR2D aDir, - bool aSide, MEANDER_TYPE aType, int aAmpl, int aBaselineOffset ) +SHAPE_LINE_CHAIN MEANDER_SHAPE::genMeanderShape( const VECTOR2D& aP, const VECTOR2D& aDir, + bool aSide, MEANDER_TYPE aType, int aAmpl, + int aBaselineOffset ) { int cr = cornerRadius(); int offset = aBaselineOffset; @@ -332,7 +342,6 @@ SHAPE_LINE_CHAIN MEANDER_SHAPE::genMeanderShape( VECTOR2D aP, VECTOR2D aDir, uShape( aAmpl - 2 * cr + std::abs( offset ), cr + offset, spc - 2 * cr ); forward( std::min( cr - offset, cr + offset ) ); forward( std::abs( offset ) ); - break; } @@ -399,8 +408,10 @@ bool MEANDERED_LINE::CheckSelfIntersections( MEANDER_SHAPE* aShape, int aClearan int n = m->CLine( 0 ).SegmentCount(); for( int j = n - 1; j >= 0; j-- ) + { if( aShape->CLine( 0 ).Collide( m->CLine( 0 ) .CSegment( j ), aClearance ) ) return false; + } } return true; @@ -456,8 +467,11 @@ bool MEANDER_SHAPE::Fit( MEANDER_TYPE aType, const SEG& aSeg, const VECTOR2I& aP updateBaseSegment(); m_baselineOffset = m1.m_baselineOffset; return true; - } else + } + else + { return false; + } } int minAmpl = st.m_minAmplitude; @@ -473,8 +487,10 @@ bool MEANDER_SHAPE::Fit( MEANDER_TYPE aType, const SEG& aSeg, const VECTOR2I& aP { if( m_dual ) { - m_shapes[0] = genMeanderShape( aP, aSeg.B - aSeg.A, aSide, aType, ampl, m_baselineOffset ); - m_shapes[1] = genMeanderShape( aP, aSeg.B - aSeg.A, aSide, aType, ampl, -m_baselineOffset ); + m_shapes[0] = genMeanderShape( aP, aSeg.B - aSeg.A, aSide, aType, ampl, + m_baselineOffset ); + m_shapes[1] = genMeanderShape( aP, aSeg.B - aSeg.A, aSide, aType, ampl, + -m_baselineOffset ); } else { @@ -499,10 +515,12 @@ bool MEANDER_SHAPE::Fit( MEANDER_TYPE aType, const SEG& aSeg, const VECTOR2I& aP void MEANDER_SHAPE::Recalculate() { - m_shapes[0] = genMeanderShape( m_p0, m_baseSeg.B - m_baseSeg.A, m_side, m_type, m_amplitude, m_dual ? m_baselineOffset : 0 ); + m_shapes[0] = genMeanderShape( m_p0, m_baseSeg.B - m_baseSeg.A, m_side, m_type, m_amplitude, + m_dual ? m_baselineOffset : 0 ); if( m_dual ) - m_shapes[1] = genMeanderShape( m_p0, m_baseSeg.B - m_baseSeg.A, m_side, m_type, m_amplitude, -m_baselineOffset ); + m_shapes[1] = genMeanderShape( m_p0, m_baseSeg.B - m_baseSeg.A, m_side, m_type, + m_amplitude, -m_baselineOffset ); updateBaseSegment(); } @@ -545,7 +563,7 @@ void MEANDERED_LINE::AddCorner( const VECTOR2I& aA, const VECTOR2I& aB ) } -void MEANDER_SHAPE::MakeCorner( VECTOR2I aP1, VECTOR2I aP2 ) +void MEANDER_SHAPE::MakeCorner( const VECTOR2I& aP1, const VECTOR2I& aP2 ) { SetType( MT_CORNER ); m_shapes[0].Clear(); diff --git a/pcbnew/router/pns_meander.h b/pcbnew/router/pns_meander.h index 647cee11b3..20b3e78c87 100644 --- a/pcbnew/router/pns_meander.h +++ b/pcbnew/router/pns_meander.h @@ -177,7 +177,7 @@ public: * @param aP1 corner point of the 1st line. * @param aP2 corner point of the 2nd line (if m_dual == true). */ - void MakeCorner( VECTOR2I aP1, VECTOR2I aP2 = VECTOR2I( 0, 0 ) ); + void MakeCorner( const VECTOR2I& aP1, const VECTOR2I& aP2 = VECTOR2I( 0, 0 ) ); /** * Change the amplitude of the meander shape to aAmpl and recalculates the resulting @@ -304,11 +304,11 @@ private: void uShape( int aSides, int aCorner, int aTop ); ///< Generate a 90-degree circular arc. - SHAPE_LINE_CHAIN makeMiterShape( VECTOR2D aP, VECTOR2D aDir, bool aSide ); + SHAPE_LINE_CHAIN makeMiterShape( const VECTOR2D& aP, const VECTOR2D& aDir, bool aSide ); ///< Produce a meander shape of given type. - SHAPE_LINE_CHAIN genMeanderShape( VECTOR2D aP, VECTOR2D aDir, bool aSide, MEANDER_TYPE aType, - int aAmpl, int aBaselineOffset = 0 ); + SHAPE_LINE_CHAIN genMeanderShape( const VECTOR2D& aP, const VECTOR2D& aDir, bool aSide, + MEANDER_TYPE aType, int aAmpl, int aBaselineOffset = 0 ); ///< Recalculate the clipped baseline after the parameters of the meander have been changed. void updateBaseSegment(); diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp index 0c446c3b72..e4baaa1ffc 100644 --- a/pcbnew/router/pns_optimizer.cpp +++ b/pcbnew/router/pns_optimizer.cpp @@ -101,7 +101,6 @@ bool COST_ESTIMATOR::IsBetter( const COST_ESTIMATOR& aOther, double aLengthToler { if( aOther.m_cornerCost < m_cornerCost && aOther.m_lengthCost < m_lengthCost ) return true; - else if( aOther.m_cornerCost < m_cornerCost * aCornerTolerance && aOther.m_lengthCost < m_lengthCost * aLengthTolerance ) return true; @@ -304,15 +303,16 @@ static bool pointInside2( const SHAPE_LINE_CHAIN& aL, const VECTOR2I& aP ) for( size_t i = 1; i <= cnt; ++i ) { - VECTOR2I ipNext = (i == cnt ? aL.CPoint( 0 ) : aL.CPoint( i )); + VECTOR2I ipNext = ( i == cnt ? aL.CPoint( 0 ) : aL.CPoint( i ) ); if( ipNext.y == aP.y ) { - if( (ipNext.x ==aP.x) || ( ip.y == aP.y && ( (ipNext.x >aP.x) == (ip.x aP.x ) == ( ip.x < aP.x ) ) ) ) + return true; // pt on polyground boundary } - if( (ip.y =aP.x ) { @@ -338,8 +338,8 @@ static bool pointInside2( const SHAPE_LINE_CHAIN& aL, const VECTOR2I& aP ) { if( ipNext.x >aP.x ) { - double d = ((double)ip.x -aP.x) * ((double)ipNext.y -aP.y) - - ((double)ipNext.x -aP.x) * ((double)ip.y -aP.y); + double d = ( (double) ip.x - aP.x ) * ( (double) ipNext.y - aP.y ) + - ( (double) ipNext.x - aP.x ) * ( (double) ip.y - aP.y ); if( !d ) return true; // pt on polyground boundary @@ -1078,7 +1078,7 @@ bool OPTIMIZER::runSmartPads( LINE* aLine ) } -bool OPTIMIZER::Optimize( LINE* aLine, int aEffortLevel, NODE* aWorld, const VECTOR2I aV ) +bool OPTIMIZER::Optimize( LINE* aLine, int aEffortLevel, NODE* aWorld, const VECTOR2I& aV ) { OPTIMIZER opt( aWorld ); @@ -1483,6 +1483,7 @@ bool tightenSegment( bool dir, NODE *aNode, const LINE& cur, const SHAPE_LINE_CH return true; } + void Tighten( NODE *aNode, const SHAPE_LINE_CHAIN& aOldLine, const LINE& aNewLine, LINE& aOptimized ) { diff --git a/pcbnew/router/pns_optimizer.h b/pcbnew/router/pns_optimizer.h index 401ba9c53f..fe1425a037 100644 --- a/pcbnew/router/pns_optimizer.h +++ b/pcbnew/router/pns_optimizer.h @@ -114,7 +114,7 @@ public: ///< A quick shortcut to optimize a line without creating and setting up an optimizer. static bool Optimize( LINE* aLine, int aEffortLevel, NODE* aWorld, - const VECTOR2I aV = VECTOR2I(0, 0) ); + const VECTOR2I& aV = VECTOR2I(0, 0) ); bool Optimize( LINE* aLine, LINE* aResult = nullptr, LINE* aRoot = nullptr ); bool Optimize( DIFF_PAIR* aPair ); @@ -251,7 +251,9 @@ public: virtual ~ANGLE_CONSTRAINT_45() {}; - virtual bool Check ( int aVertex1, int aVertex2, const 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; @@ -331,7 +333,8 @@ private: class CORNER_COUNT_LIMIT_CONSTRAINT: public OPT_CONSTRAINT { public: - CORNER_COUNT_LIMIT_CONSTRAINT( NODE* aWorld, int aMinCorners, int aMaxCorners, int aAngleMask ) : + CORNER_COUNT_LIMIT_CONSTRAINT( NODE* aWorld, int aMinCorners, int aMaxCorners, + int aAngleMask ) : OPT_CONSTRAINT( aWorld ), m_minCorners( aMinCorners ), m_maxCorners( aMaxCorners ), diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp index 51aa27d843..df33e7cc34 100644 --- a/pcbnew/router/pns_tool_base.cpp +++ b/pcbnew/router/pns_tool_base.cpp @@ -355,7 +355,7 @@ ROUTER *TOOL_BASE::Router() const } -const VECTOR2I TOOL_BASE::snapToItem( ITEM* aItem, VECTOR2I aP ) +const VECTOR2I TOOL_BASE::snapToItem( ITEM* aItem, const VECTOR2I& aP ) { if( !aItem || !m_iface->IsItemVisible( aItem ) ) { diff --git a/pcbnew/router/pns_tool_base.h b/pcbnew/router/pns_tool_base.h index 6ae1fd12fb..541ca105c2 100644 --- a/pcbnew/router/pns_tool_base.h +++ b/pcbnew/router/pns_tool_base.h @@ -54,7 +54,7 @@ public: protected: bool checkSnap( ITEM* aItem ); - const VECTOR2I snapToItem( ITEM* aSnapToItem, VECTOR2I aP); + const VECTOR2I snapToItem( ITEM* aSnapToItem, const VECTOR2I& aP); virtual ITEM* pickSingleItem( const VECTOR2I& aWhere, int aNet = -1, int aLayer = -1, bool aIgnorePads = false, diff --git a/pcbnew/tools/pcb_point_editor.cpp b/pcbnew/tools/pcb_point_editor.cpp index 23cb9f3211..b880c7e296 100644 --- a/pcbnew/tools/pcb_point_editor.cpp +++ b/pcbnew/tools/pcb_point_editor.cpp @@ -594,10 +594,14 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent ) return 0; } -void PCB_POINT_EDITOR::editArcEndpointKeepTangent( PCB_SHAPE* aArc, VECTOR2I aCenter, - VECTOR2I aStart, VECTOR2I aMid, VECTOR2I aEnd, - const VECTOR2I aCursor ) const +void PCB_POINT_EDITOR::editArcEndpointKeepTangent( PCB_SHAPE* aArc, const VECTOR2I& aCenter, + const VECTOR2I& aStart, const VECTOR2I& aMid, + const VECTOR2I& aEnd, + const VECTOR2I& aCursor ) const { + VECTOR2I start = aStart; + VECTOR2I end = aEnd; + VECTOR2I center = aCenter; VECTOR2D startLine = aStart - aCenter; VECTOR2D endLine = aEnd - aCenter; double newAngle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() ); @@ -606,23 +610,23 @@ void PCB_POINT_EDITOR::editArcEndpointKeepTangent( PCB_SHAPE* aArc, VECTOR2I aCe bool movingStart; bool arcValid = true; - VECTOR2I *p1, *p2, *p3; + VECTOR2I p1, p2, p3; // p1 does not move, p2 does. if( aStart != aArc->GetArcStart() ) { - aStart = aCursor; - p1 = &aEnd; - p2 = &aStart; - p3 = &aMid; + start = aCursor; + p1 = aEnd; + p2 = aStart; + p3 = aMid; movingStart = true; } else if( aEnd != aArc->GetArcEnd() ) { - aEnd = aCursor; - p1 = &aStart; - p2 = &aEnd; - p3 = &aMid; + end = aCursor; + p1 = aStart; + p2 = aEnd; + p3 = aMid; movingStart = false; } else @@ -633,9 +637,9 @@ void PCB_POINT_EDITOR::editArcEndpointKeepTangent( PCB_SHAPE* aArc, VECTOR2I aCe VECTOR2D v1, v2, v3, v4; // Move the coordinate system - v1 = *p1 - aCenter; - v2 = *p2 - aCenter; - v3 = *p3 - aCenter; + v1 = p1 - aCenter; + v2 = p2 - aCenter; + v3 = p3 - aCenter; VECTOR2D u1, u2, u3; @@ -742,10 +746,10 @@ void PCB_POINT_EDITOR::editArcEndpointKeepTangent( PCB_SHAPE* aArc, VECTOR2I aCe v4.x = tmpx; v4.y = tmpy; - aCenter = v4 + aCenter; + center = v4 + aCenter; - startLine = aStart - aCenter; - endLine = aEnd - aCenter; + startLine = start - center; + endLine = end - center; newAngle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() ); if( clockwise && newAngle < 0.0 ) @@ -756,12 +760,12 @@ void PCB_POINT_EDITOR::editArcEndpointKeepTangent( PCB_SHAPE* aArc, VECTOR2I aCe if( arcValid ) { aArc->SetAngle( newAngle, false ); - aArc->SetCenter( wxPoint( aCenter.x, aCenter.y ) ); + aArc->SetCenter( ( wxPoint ) center ); if( movingStart ) - aArc->SetArcStart( wxPoint( aStart.x, aStart.y ) ); + aArc->SetArcStart( ( wxPoint ) start ); else - aArc->SetArcEnd( wxPoint( aEnd.x, aEnd.y ) ); + aArc->SetArcEnd( ( wxPoint ) end ); } } } @@ -782,7 +786,7 @@ void PCB_POINT_EDITOR::editArcEndpointKeepTangent( PCB_SHAPE* aArc, VECTOR2I aCe */ static void pinEditedCorner( int aEditedPointIndex, int aMinWidth, int aMinHeight, VECTOR2I& aTopLeft, VECTOR2I& aTopRight, VECTOR2I& aBotLeft, - VECTOR2I& aBotRight, VECTOR2I aHole, VECTOR2I aHoleSize ) + VECTOR2I& aBotRight, VECTOR2I& aHole, VECTOR2I& aHoleSize ) { switch( aEditedPointIndex ) { @@ -869,37 +873,38 @@ static void pinEditedCorner( int aEditedPointIndex, int aMinWidth, int aMinHeigh } -void PCB_POINT_EDITOR::editArcEndpointKeepCenter( PCB_SHAPE* aArc, VECTOR2I aCenter, - VECTOR2I aStart, VECTOR2I aMid, VECTOR2I aEnd, - const VECTOR2I aCursor ) const +void PCB_POINT_EDITOR::editArcEndpointKeepCenter( PCB_SHAPE* aArc, const VECTOR2I& aCenter, + const VECTOR2I& aStart, const VECTOR2I& aMid, + const VECTOR2I& aEnd, + const VECTOR2I& aCursor ) const { bool clockwise; bool movingStart; - VECTOR2I *p1, *p2; + VECTOR2I p1, p2; VECTOR2I target; // p1 does not move, p2 does. if( aStart != aArc->GetArcStart() ) { - p1 = &aEnd; - p2 = &aStart; + p1 = aEnd; + p2 = aStart; movingStart = true; } else { - p1 = &aStart; - p2 = &aEnd; + p1 = aStart; + p2 = aEnd; movingStart = false; } - target = *p2 - aCenter; + target = p2 - aCenter; - double sqRadius = ( *p1 - aCenter ).SquaredEuclideanNorm(); + double sqRadius = ( p1 - aCenter ).SquaredEuclideanNorm(); - *p1 = *p1 - aCenter; - *p2 = *p2 - aCenter; + p1 = p1 - aCenter; + p2 = p2 - aCenter; // Circle : x^2 + y^2 = R ^ 2 // In this coordinate system, the angular position of the cursor is (r, theta) @@ -908,8 +913,8 @@ void PCB_POINT_EDITOR::editArcEndpointKeepCenter( PCB_SHAPE* aArc, VECTOR2I aCen if( target.x == 0 ) { - p2->x = 0; - p2->y = ( target.y > 0 ) ? sqrt( sqRadius ) : -sqrt( sqRadius ); + p2.x = 0; + p2.y = ( target.y > 0 ) ? sqrt( sqRadius ) : -sqrt( sqRadius ); } else { @@ -920,12 +925,12 @@ void PCB_POINT_EDITOR::editArcEndpointKeepCenter( PCB_SHAPE* aArc, VECTOR2I aCen // Move to the correct quadrant tmp = target.x > 0 ? tmp : -tmp; - p2->y = target.y / static_cast( target.x ) * tmp; - p2->x = tmp; + p2.y = target.y / static_cast( target.x ) * tmp; + p2.x = tmp; } - *p1 = *p1 + aCenter; - *p2 = *p2 + aCenter; + p1 = p1 + aCenter; + p2 = p2 + aCenter; clockwise = aArc->GetAngle() > 0; @@ -948,21 +953,21 @@ void PCB_POINT_EDITOR::editArcEndpointKeepCenter( PCB_SHAPE* aArc, VECTOR2I aCen } -void PCB_POINT_EDITOR::editArcMidKeepCenter( PCB_SHAPE* aArc, VECTOR2I aCenter, VECTOR2I aStart, - VECTOR2I aMid, VECTOR2I aEnd, - const VECTOR2I aCursor ) const +void PCB_POINT_EDITOR::editArcMidKeepCenter( PCB_SHAPE* aArc, const VECTOR2I& aCenter, + const VECTOR2I& aStart, const VECTOR2I& aMid, + const VECTOR2I& aEnd, const VECTOR2I& aCursor ) const { // Now, update the edit point position // Express the point in a circle-centered coordinate system. - aStart = aStart - aCenter; - aEnd = aEnd - aCenter; + VECTOR2I start = aStart - aCenter; + VECTOR2I end = aEnd - aCenter; double sqRadius = ( aCursor - aCenter ).SquaredEuclideanNorm(); // Special case, because the tangent would lead to +/- infinity - if( aStart.x == 0 ) + if( start.x == 0 ) { - aStart.y = aCursor.y > 0 ? sqrt( sqRadius ) : -sqrt( sqRadius ); + start.y = aCursor.y > 0 ? sqrt( sqRadius ) : -sqrt( sqRadius ); } else { @@ -971,19 +976,19 @@ void PCB_POINT_EDITOR::editArcMidKeepCenter( PCB_SHAPE* aArc, VECTOR2I aCenter, // The line coming from the center of the circle is y = start.y / start.x * x // The intersection fulfills : x^2 = R^2 / ( 1 + ( start.y / start.x ) ^ 2 ) - double tan = aStart.y / static_cast( aStart.x ); + double tan = aStart.y / static_cast( start.x ); double tmp = sqrt( sqRadius / ( 1.0 + tan * tan ) ); // Move to the correct quadrant - tmp = aStart.x > 0 ? tmp : -tmp; - aStart.y = aStart.y / static_cast( aStart.x ) * tmp; - aStart.x = tmp; + tmp = start.x > 0 ? tmp : -tmp; + start.y = start.y / static_cast( start.x ) * tmp; + start.x = tmp; } // Special case, because the tangent would lead to +/- infinity - if( aEnd.x == 0 ) + if( end.x == 0 ) { - aEnd.y = aMid.y > 0 ? sqrt( sqRadius ) : -sqrt( sqRadius ); + end.y = aMid.y > 0 ? sqrt( sqRadius ) : -sqrt( sqRadius ); } else { @@ -992,25 +997,26 @@ void PCB_POINT_EDITOR::editArcMidKeepCenter( PCB_SHAPE* aArc, VECTOR2I aCenter, // The line coming from the center of the circle is y = start.y / start.x * x // The intersection fulfills : x^2 = R^2 / ( 1 + ( start.y / start.x ) ^ 2 ) - double tan = aEnd.y / static_cast( aEnd.x ); + double tan = end.y / static_cast( end.x ); double tmp = sqrt( sqRadius / ( 1.0 + tan * tan ) ); // Move to the correct quadrant - tmp = aEnd.x > 0 ? tmp : -tmp; - aEnd.y = aEnd.y / static_cast( aEnd.x ) * tmp; - aEnd.x = tmp; + tmp = end.x > 0 ? tmp : -tmp; + end.y = end.y / static_cast( end.x ) * tmp; + end.x = tmp; } - aStart = aStart + aCenter; - aEnd = aEnd + aCenter; + start = start + aCenter; + end = end + aCenter; - aArc->SetArcStart( (wxPoint) aStart ); - aArc->SetArcEnd( (wxPoint) aEnd ); + aArc->SetArcStart( (wxPoint) start ); + aArc->SetArcEnd( (wxPoint) end ); } -void PCB_POINT_EDITOR::editArcMidKeepEndpoints( PCB_SHAPE* aArc, VECTOR2I aStart, VECTOR2I aEnd, - const VECTOR2I aCursor ) const +void PCB_POINT_EDITOR::editArcMidKeepEndpoints( PCB_SHAPE* aArc, const VECTOR2I& aStart, + const VECTOR2I& aEnd, + const VECTOR2I& aCursor ) const { // Let 'm' be the middle point of the chord between the start and end points VECTOR2I m = ( aStart + aEnd ) / 2; @@ -1226,9 +1232,11 @@ void PCB_POINT_EDITOR::updateItem() const VECTOR2I topRight = m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition(); VECTOR2I botLeft = m_editPoints->Point( RECT_BOT_LEFT ).GetPosition(); VECTOR2I botRight = m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition(); + VECTOR2I holeCenter = pad->GetPosition(); + VECTOR2I holeSize = pad->GetDrillSize(); pinEditedCorner( getEditedPointIndex(), Mils2iu( 1 ), Mils2iu( 1 ), topLeft, topRight, - botLeft, botRight,pad->GetPosition(), pad->GetDrillSize() ); + botLeft, botRight, holeCenter, holeSize ); if( ( pad->GetOffset().x || pad->GetOffset().y ) || ( pad->GetDrillSize().x && pad->GetDrillSize().y ) ) @@ -1328,6 +1336,7 @@ void PCB_POINT_EDITOR::updateItem() const validatePolygon( outline ); zone->HatchBorder(); + // TODO Refill zone when KiCad supports auto re-fill break; } @@ -1606,6 +1615,7 @@ void PCB_POINT_EDITOR::updatePoints() for( unsigned i = 0; i < points.size(); i++ ) m_editPoints->Point( i ).SetPosition( points[i] ); } + break; } @@ -2197,12 +2207,14 @@ int PCB_POINT_EDITOR::modifiedSelection( const TOOL_EVENT& aEvent ) return 0; } + int PCB_POINT_EDITOR::changeEditMethod( const TOOL_EVENT& aEvent ) { m_altEditMethod = !m_altEditMethod; return 0; } + void PCB_POINT_EDITOR::setTransitions() { Go( &PCB_POINT_EDITOR::OnSelectionChange, ACTIONS::activatePointEditor.MakeEvent() ); diff --git a/pcbnew/tools/pcb_point_editor.h b/pcbnew/tools/pcb_point_editor.h index 5eb18649e1..022c478aaf 100644 --- a/pcbnew/tools/pcb_point_editor.h +++ b/pcbnew/tools/pcb_point_editor.h @@ -134,26 +134,29 @@ private: /** * Move an end point of the arc, while keeping the tangent at the other endpoint. */ - void editArcEndpointKeepTangent( PCB_SHAPE* aArc, VECTOR2I aCenter, VECTOR2I aStart, - VECTOR2I aMid, VECTOR2I aEnd, const VECTOR2I aCursor ) const; + void editArcEndpointKeepTangent( PCB_SHAPE* aArc, const VECTOR2I& aCenter, + const VECTOR2I& aStart, const VECTOR2I& aMid, + const VECTOR2I& aEnd, const VECTOR2I& aCursor ) const; /** * Move an end point of the arc around the circumference. */ - void editArcEndpointKeepCenter( PCB_SHAPE* aArc, VECTOR2I aCenter, VECTOR2I aStart, - VECTOR2I aMid, VECTOR2I aEnd, const VECTOR2I aCursor ) const; + void editArcEndpointKeepCenter( PCB_SHAPE* aArc, const VECTOR2I& aCenter, + const VECTOR2I& aStart, const VECTOR2I& aMid, + const VECTOR2I& aEnd, const VECTOR2I& aCursor ) const; /** * Move the mid point of the arc, while keeping the two endpoints. */ - void editArcMidKeepEndpoints( PCB_SHAPE* aArc, VECTOR2I aStart, VECTOR2I aEnd, - const VECTOR2I aCursor ) const; + void editArcMidKeepEndpoints( PCB_SHAPE* aArc, const VECTOR2I& aStart, const VECTOR2I& aEnd, + const VECTOR2I& aCursor ) const; /** * Move the mid point of the arc, while keeping the angle. */ - void editArcMidKeepCenter( PCB_SHAPE* aArc, VECTOR2I aCenter, VECTOR2I aStart, VECTOR2I aMid, - VECTOR2I aEnd, const VECTOR2I aCursor ) const; + void editArcMidKeepCenter( PCB_SHAPE* aArc, const VECTOR2I& aCenter, const VECTOR2I& aStart, + const VECTOR2I& aMid, const VECTOR2I& aEnd, + const VECTOR2I& aCursor ) const; ///< Change the edit method to an alternative method ( currently, arcs only ) int changeEditMethod( const TOOL_EVENT& aEvent );