Pass VECTOR2I objects by reference instead of on the stack.

This commit is contained in:
Wayne Stambaugh 2021-07-26 19:47:26 -04:00
parent 8ff76de18e
commit 78e5e98ea0
38 changed files with 267 additions and 217 deletions

View File

@ -568,7 +568,7 @@ private:
int aClearanceValue ); int aClearanceValue );
void createPadWithClearance( const PAD *aPad, CONTAINER_2D_BASE* aDstContainer, 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 ); OBJECT_2D* createPadWithDrill( const PAD* aPad, int aInflateValue );

View File

@ -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, 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; SHAPE_POLY_SET poly;
wxSize clearance = aClearanceValue;
// Our shape-based builder can't handle negative or differing x:y clearance values (the // 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 // 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 // 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. // 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 ) && aPad->GetShape() != PAD_SHAPE::CUSTOM )
{ {
PAD dummy( *aPad ); 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 ); dummy.TransformShapeWithClearanceToPolygon( poly, aLayer, 0, ARC_HIGH_DEF, ERROR_INSIDE );
aClearanceValue = { 0, 0 }; clearance = { 0, 0 };
} }
else else
{ {
@ -340,7 +342,7 @@ void BOARD_ADAPTER::createPadWithClearance( const PAD* aPad, CONTAINER_2D_BASE*
-seg->GetSeg().A.y * m_biuTo3Dunits ); -seg->GetSeg().A.y * m_biuTo3Dunits );
const SFVEC2F end3DU ( seg->GetSeg().B.x * m_biuTo3Dunits, const SFVEC2F end3DU ( seg->GetSeg().B.x * m_biuTo3Dunits,
-seg->GetSeg().B.y * 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 // Cannot add segments that have the same start and end point
if( Is_segment_a_circle( start3DU, end3DU ) ) if( Is_segment_a_circle( start3DU, end3DU ) )
@ -361,7 +363,7 @@ void BOARD_ADAPTER::createPadWithClearance( const PAD* aPad, CONTAINER_2D_BASE*
case SH_CIRCLE: case SH_CIRCLE:
{ {
const SHAPE_CIRCLE* circle = (SHAPE_CIRCLE*) shape; 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, const SFVEC2F center( circle->GetCenter().x * m_biuTo3Dunits,
-circle->GetCenter().y * m_biuTo3Dunits ); -circle->GetCenter().y * m_biuTo3Dunits );
@ -402,7 +404,7 @@ void BOARD_ADAPTER::createPadWithClearance( const PAD* aPad, CONTAINER_2D_BASE*
-seg.GetSeg().A.y * m_biuTo3Dunits ); -seg.GetSeg().A.y * m_biuTo3Dunits );
const SFVEC2F end3DU( seg.GetSeg().B.x * m_biuTo3Dunits, const SFVEC2F end3DU( seg.GetSeg().B.x * m_biuTo3Dunits,
-seg.GetSeg().B.y * 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 // Cannot add segments that have the same start and end point
if( Is_segment_a_circle( start3DU, end3DU ) ) if( Is_segment_a_circle( start3DU, end3DU ) )
@ -431,8 +433,8 @@ void BOARD_ADAPTER::createPadWithClearance( const PAD* aPad, CONTAINER_2D_BASE*
if( !poly.IsEmpty() ) if( !poly.IsEmpty() )
{ {
if( aClearanceValue.x ) if( clearance.x )
poly.Inflate( aClearanceValue.x, 32 ); poly.Inflate( clearance.x, 32 );
// Add the PAD polygon // Add the PAD polygon
ConvertPolygonToTriangles( poly, *aDstContainer, m_biuTo3Dunits, *aPad ); ConvertPolygonToTriangles( poly, *aDstContainer, m_biuTo3Dunits, *aPad );
@ -504,11 +506,13 @@ void BOARD_ADAPTER::addPadsWithClearance( const FOOTPRINT* aFootprint,
case PAD_SHAPE::CIRCLE: case PAD_SHAPE::CIRCLE:
if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE ) if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
continue; continue;
break; break;
case PAD_SHAPE::OVAL: case PAD_SHAPE::OVAL:
if( pad->GetDrillShape() != PAD_DRILL_SHAPE_CIRCLE ) if( pad->GetDrillShape() != PAD_DRILL_SHAPE_CIRCLE )
continue; continue;
break; break;
default: default:

View File

@ -70,7 +70,7 @@ static const wxString pageFmts[] =
}; };
DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aIuPerMils, DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aIuPerMils,
wxSize aMaxUserSizeMils ) : const wxSize& aMaxUserSizeMils ) :
DIALOG_PAGES_SETTINGS_BASE( aParent ), DIALOG_PAGES_SETTINGS_BASE( aParent ),
m_parent( aParent ), m_parent( aParent ),
m_screen( m_parent->GetScreen() ), m_screen( m_parent->GetScreen() ),

View File

@ -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 ) ); int size = std::min( std::abs( aSize.x ), std::abs( aSize.y ) );

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * 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 ); extern COLOR4D DisplayColorFrame( wxWindow* aParent, COLOR4D aOldColor );
/** wxBitmap COLOR_SWATCH::MakeBitmap( const COLOR4D& aColor, const COLOR4D& aBackground,
* Make a simple color swatch bitmap const wxSize& aSize, const wxSize& aCheckerboardSize,
* const COLOR4D& aCheckerboardBackground )
* @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 bitmap( aSize ); wxBitmap bitmap( aSize );
wxBrush brush; 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, COLOR_SWATCH::COLOR_SWATCH( wxWindow* aParent, const COLOR4D& aColor, int aID,
const COLOR4D aDefault, SWATCH_SIZE aSwatchSize ) : const COLOR4D& aBackground, const COLOR4D& aDefault,
SWATCH_SIZE aSwatchSize ) :
wxPanel( aParent, aID ), wxPanel( aParent, aID ),
m_color( aColor ), m_color( aColor ),
m_background( aBackground ), m_background( aBackground ),
@ -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; 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; m_default = aColor;
} }
void COLOR_SWATCH::SetSwatchBackground( COLOR4D aBackground ) void COLOR_SWATCH::SetSwatchBackground( const COLOR4D& aBackground )
{ {
m_background = aBackground; m_background = aBackground;
wxBitmap bm = MakeBitmap( m_color, m_background, m_size, m_checkerboardSize, m_checkerboardBg ); wxBitmap bm = MakeBitmap( m_color, m_background, m_size, m_checkerboardSize, m_checkerboardBg );

View File

@ -482,6 +482,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
// (Current mouse pos after closing the dialog will be used) // (Current mouse pos after closing the dialog will be used)
KIGFX::VIEW_CONTROLS* controls = getViewControls(); KIGFX::VIEW_CONTROLS* controls = getViewControls();
VECTOR2D initialMousePos = controls->GetMousePosition(false); VECTOR2D initialMousePos = controls->GetMousePosition(false);
// Build the rectangle area acceptable to move the cursor without // Build the rectangle area acceptable to move the cursor without
// having an auto-pan // having an auto-pan
EDA_RECT canvas_area = GetCanvasFreeAreaPixels(); EDA_RECT canvas_area = GetCanvasFreeAreaPixels();
@ -883,6 +884,7 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
if( settings.m_IntersheetRefsShow ) if( settings.m_IntersheetRefsShow )
static_cast<SCH_GLOBALLABEL*>( textItem )->GetIntersheetRefs()->SetVisible( true ); static_cast<SCH_GLOBALLABEL*>( textItem )->GetIntersheetRefs()->SetVisible( true );
break; break;
default: 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 pos = aSheet->GetPosition();
wxPoint size = (wxPoint) aPos - pos; wxPoint size = (wxPoint) aPos - pos;

View File

@ -75,7 +75,7 @@ private:
SCH_SHEET_PIN* createSheetPin( SCH_SHEET* aSheet, SCH_HIERLABEL* aLabel ); 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. ///< Set up handlers for various events.
void setTransitions() override; void setTransitions() override;

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * 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 * 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 class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE
{ {
public: 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(); virtual ~DIALOG_PAGES_SETTINGS();
const wxString GetWksFileName() const wxString GetWksFileName()

View File

@ -64,7 +64,7 @@ class PLOTTER;
*/ */
int Clamp_Text_PenSize( int aPenSize, int aSize, bool aBold = true ); int Clamp_Text_PenSize( int aPenSize, int aSize, bool aBold = true );
float Clamp_Text_PenSize( float 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). * @param aTextSize the char size (height or width).

View File

@ -53,22 +53,20 @@ public:
const BOX2I ViewBBox() const override; const BOX2I ViewBBox() const override;
///< Set the origin of the rectangle (the fixed corner) ///< Set the origin of the rectangle (the fixed corner)
void SetOrigin( VECTOR2I aOrigin ) void SetOrigin( const VECTOR2I& aOrigin )
{ {
m_origin = aOrigin; m_origin = aOrigin;
} }
/** /**
* Set the current end of the rectangle (the corner that moves * Set the current end of the rectangle (the corner that moves with the cursor.
* with the cursor.
*/ */
void SetEnd( VECTOR2I aEnd ) void SetEnd( const VECTOR2I& aEnd )
{ {
m_end = aEnd; m_end = aEnd;
} }
/** /**
* Get class name
* @return string "SELECTION_AREA" * @return string "SELECTION_AREA"
*/ */
wxString GetClass() const override wxString GetClass() const override

View File

@ -87,7 +87,7 @@ protected:
struct ANCHOR 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 ), pos( aPos ),
flags( aFlags ), flags( aFlags ),
item( aItem ) item( aItem )

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * 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 * A simple color swatch of the kind used to set layer colors.
* set layer colors
*/ */
class COLOR_SWATCH: public wxPanel class COLOR_SWATCH: public wxPanel
{ {
@ -65,8 +64,9 @@ public:
* @param aColor initial swatch color * @param aColor initial swatch color
* @param aID id to use when sending swatch events * @param aID id to use when sending swatch events
*/ */
COLOR_SWATCH( wxWindow* aParent, KIGFX::COLOR4D aColor, int aID, KIGFX::COLOR4D aBackground, COLOR_SWATCH( wxWindow* aParent, const KIGFX::COLOR4D& aColor, int aID,
const KIGFX::COLOR4D aDefault, SWATCH_SIZE aSwatchType ); const KIGFX::COLOR4D& aBackground, const KIGFX::COLOR4D& aDefault,
SWATCH_SIZE aSwatchType );
/** /**
* constructor for wxFormBuilder * constructor for wxFormBuilder
@ -77,17 +77,17 @@ public:
/** /**
* Set the current swatch color directly. * 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 * 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. * Set the swatch background color.
*/ */
void SetSwatchBackground( KIGFX::COLOR4D aBackground ); void SetSwatchBackground( const KIGFX::COLOR4D& aBackground );
/** /**
* Fetch a reference to the user colors list. * 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 /// Registers a handler for when the user tries to interact with a read-only swatch
void SetReadOnlyCallback( std::function<void()> aCallback ) { m_readOnlyCallback = aCallback; } void SetReadOnlyCallback( std::function<void()> aCallback ) { m_readOnlyCallback = aCallback; }
static wxBitmap MakeBitmap( KIGFX::COLOR4D aColor, KIGFX::COLOR4D aBackground, wxSize aSize, static wxBitmap MakeBitmap( const KIGFX::COLOR4D& aColor, const KIGFX::COLOR4D& aBackground,
wxSize aCheckerboardSize, KIGFX::COLOR4D aCheckerboardBackground ); const wxSize& aSize, const wxSize& aCheckerboardSize,
const KIGFX::COLOR4D& aCheckerboardBackground );
private: private:
void setupEvents(); 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); wxDECLARE_EVENT(COLOR_SWATCH_CHANGED, wxCommandEvent);

View File

@ -597,7 +597,7 @@ public:
* inserted. * inserted.
* @param aNewVertex is the new inserted vertex. * @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 ///< Return the index-th vertex in a given hole outline within a given outline
const VECTOR2I& CVertex( int aIndex, int aOutline, int aHole ) const; const VECTOR2I& CVertex( int aIndex, int aOutline, int aHole ) const;

View File

@ -266,7 +266,7 @@ VECTOR2<T>::VECTOR2()
#ifdef WX_COMPATIBILITY #ifdef WX_COMPATIBILITY
template <class T> template <class T>
VECTOR2<T>::VECTOR2( wxPoint const& aPoint ) VECTOR2<T>::VECTOR2( const wxPoint& aPoint )
{ {
x = T( aPoint.x ); x = T( aPoint.x );
y = T( aPoint.y ); y = T( aPoint.y );
@ -274,7 +274,7 @@ VECTOR2<T>::VECTOR2( wxPoint const& aPoint )
template <class T> template <class T>
VECTOR2<T>::VECTOR2( wxSize const& aSize ) VECTOR2<T>::VECTOR2( const wxSize& aSize )
{ {
x = T( aSize.x ); x = T( aSize.x );
y = T( aSize.y ); y = T( aSize.y );

View File

@ -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 VECTOR2I GetArcCenter( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd );
const VECTOR2D GetArcCenter( const VECTOR2D& aStart, const VECTOR2D& aMid, const VECTOR2D& 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( 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. * Return the subtended angle for a given arc.

View File

@ -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; VERTEX_INDEX index;

View File

@ -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 ) if( aAngle < 0 )
{ {
std::swap( aStart, aEnd ); std::swap( start, end );
aAngle = abs( aAngle ); aAngle = abs( aAngle );
} }
if( aAngle > 180 ) if( aAngle > 180 )
{ {
std::swap( aStart, aEnd ); std::swap( start, end );
aAngle = 360 - aAngle; aAngle = 360 - aAngle;
} }

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2019 CERN * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * 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 ); aItem->MoveToUi( aItem->GetStartPosUi() + (wxPoint) aDelta );

View File

@ -66,7 +66,7 @@ public:
int DeleteItemCursor( const TOOL_EVENT& aEvent ); int DeleteItemCursor( const TOOL_EVENT& aEvent );
private: 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 ///< Return the right modification point (e.g. for rotation), depending on the number of
///< selected items. ///< selected items.

View File

@ -136,7 +136,7 @@ private:
* It compensate and clamp the drill mark size depending on the current plot options. * It compensate and clamp the drill mark size depending on the current plot options.
*/ */
void plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const wxPoint& aDrillPos, 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 ); double aOrientation, int aSmallDrill );
PLOTTER* m_plotter; PLOTTER* m_plotter;

View File

@ -986,26 +986,28 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const wxPoint &aDrillPos, 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 ) double aOrientation, int aSmallDrill )
{ {
wxSize drillSize = aDrillSize;
// Small drill marks have no significance when applied to slots // Small drill marks have no significance when applied to slots
if( aSmallDrill && aDrillShape == PAD_DRILL_SHAPE_CIRCLE ) 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 // Round holes only have x diameter, slots have both
aDrillSize.x -= getFineWidthAdj(); drillSize.x -= getFineWidthAdj();
aDrillSize.x = Clamp( 1, aDrillSize.x, aPadSize.x - 1 ); drillSize.x = Clamp( 1, drillSize.x, aPadSize.x - 1 );
if( aDrillShape == PAD_DRILL_SHAPE_OBLONG ) if( aDrillShape == PAD_DRILL_SHAPE_OBLONG )
{ {
aDrillSize.y -= getFineWidthAdj(); drillSize.y -= getFineWidthAdj();
aDrillSize.y = Clamp( 1, aDrillSize.y, aPadSize.y - 1 ); drillSize.y = Clamp( 1, drillSize.y, aPadSize.y - 1 );
m_plotter->FlashPadOval( aDrillPos, aDrillSize, aOrientation, GetPlotMode(), nullptr ); m_plotter->FlashPadOval( aDrillPos, drillSize, aOrientation, GetPlotMode(), nullptr );
} }
else else
{ {
m_plotter->FlashPadCircle( aDrillPos, aDrillSize.x, GetPlotMode(), nullptr ); m_plotter->FlashPadCircle( aDrillPos, drillSize.x, GetPlotMode(), nullptr );
} }
} }

View File

@ -2,7 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router * KiRouter - a push-and-(sometimes-)shove PCB router
* *
* Copyright (C) 2013-2021 CERN * 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 <chgans@gna.org> * Author: Christian Gagneraud <chgans@gna.org>
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@ -38,8 +38,11 @@ public:
struct SRC_LOCATION_INFO struct SRC_LOCATION_INFO
{ {
SRC_LOCATION_INFO( std::string aFileName = "", std::string aFuncName = "", int aLine = 0 ) : SRC_LOCATION_INFO( const std::string& aFileName = "", const std::string& aFuncName = "",
fileName( aFileName ), funcName( aFuncName ), line( aLine ) int aLine = 0 ) :
fileName( aFileName ),
funcName( aFuncName ),
line( aLine )
{ {
} }
@ -54,24 +57,24 @@ public:
bool IsDebugEnabled() const { return m_debugEnabled; } bool IsDebugEnabled() const { return m_debugEnabled; }
virtual void SetIteration( int iter ){}; 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() ){}; const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){};
virtual void NewStage( const std::string& name, int iter, virtual void NewStage( const std::string& name, int iter,
const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){}; 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() ){}; const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){};
virtual void EndGroup( 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, virtual void AddPoint( const VECTOR2I& aP, const KIGFX::COLOR4D& aColor, int aSize,
const std::string aName, const std::string& aName,
const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){}; const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){};
virtual void AddLine( const SHAPE_LINE_CHAIN& aLine, const KIGFX::COLOR4D& aColor, 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() ){}; const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){};
virtual void AddSegment( SEG aS, const KIGFX::COLOR4D& aColor, virtual void AddSegment( const SEG& aS, const KIGFX::COLOR4D& aColor,
const std::string aName, const std::string& aName,
const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){}; const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){};
virtual void AddBox( BOX2I aB, const KIGFX::COLOR4D& aColor, virtual void AddBox( const BOX2I& aB, const KIGFX::COLOR4D& aColor,
const std::string aName, const std::string& aName,
const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){}; const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ){};
virtual void Clear(){}; virtual void Clear(){};
@ -89,7 +92,8 @@ private:
#define PNS_DBG( dbg, method, ... ) \ #define PNS_DBG( dbg, method, ... ) \
if( dbg && dbg->IsDebugEnabled() ) \ if( dbg && dbg->IsDebugEnabled() ) \
dbg->method( __VA_ARGS__, PNS::DEBUG_DECORATOR::SRC_LOCATION_INFO( __FILE__, __FUNCTION__, __LINE__ ) ); dbg->method( __VA_ARGS__, PNS::DEBUG_DECORATOR::SRC_LOCATION_INFO( __FILE__, __FUNCTION__, \
__LINE__ ) );
#define PNS_DBGN( dbg, method ) \ #define PNS_DBGN( dbg, method ) \
if( dbg && dbg->IsDebugEnabled() ) \ if( dbg && dbg->IsDebugEnabled() ) \

View File

@ -743,7 +743,8 @@ public:
m_view->Add( m_items ); 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 const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override
{ {
SHAPE_LINE_CHAIN l; SHAPE_LINE_CHAIN l;
@ -760,7 +761,7 @@ public:
AddLine( l, aColor, 10000, aName ); 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 const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override
{ {
SHAPE_LINE_CHAIN l; SHAPE_LINE_CHAIN l;
@ -777,7 +778,7 @@ public:
AddLine( l, aColor, 10000, aName, aSrcLoc ); 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 const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override
{ {
SHAPE_LINE_CHAIN l; SHAPE_LINE_CHAIN l;
@ -790,7 +791,7 @@ public:
virtual void AddLine( const SHAPE_LINE_CHAIN& aLine, const COLOR4D& aColor, 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 const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override
{ {
if( !m_view ) if( !m_view )

View File

@ -2,7 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router * KiRouter - a push-and-(sometimes-)shove PCB router
* *
* Copyright (C) 2013-2016 CERN * 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 <tomasz.wlostowski@cern.ch> * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it

View File

@ -1750,8 +1750,8 @@ void FIXED_TAIL::Clear()
} }
void FIXED_TAIL::AddStage( VECTOR2I aStart, int aLayer, bool placingVias, DIRECTION_45 direction, void FIXED_TAIL::AddStage( const VECTOR2I& aStart, int aLayer, bool placingVias,
NODE *aNode ) DIRECTION_45 direction, NODE* aNode )
{ {
STAGE st; STAGE st;
FIX_POINT pt; FIX_POINT pt;

View File

@ -65,7 +65,7 @@ public:
}; };
void Clear(); void Clear();
void AddStage( VECTOR2I aStart, int aLayer, bool placingVias, DIRECTION_45 direction, void AddStage( const VECTOR2I& aStart, int aLayer, bool placingVias, DIRECTION_45 direction,
NODE* aNode ); NODE* aNode );
bool PopStage( STAGE& aStage ); bool PopStage( STAGE& aStage );
int StageCount() const; int StageCount() const;

View File

@ -2,7 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router * KiRouter - a push-and-(sometimes-)shove PCB router
* *
* Copyright (C) 2013-2014 CERN * 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 <tomasz.wlostowski@cern.ch> * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software: you can redistribute it and/or modify it * 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; LOGGER::EVENT_ENTRY ent;

View File

@ -2,7 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router * KiRouter - a push-and-(sometimes-)shove PCB router
* *
* Copyright (C) 2013-2014 CERN * 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 <tomasz.wlostowski@cern.ch> * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software: you can redistribute it and/or modify it * 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 Save( const std::string& aFilename );
void Clear(); 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<EVENT_ENTRY>& GetEvents() const std::vector<EVENT_ENTRY>& GetEvents()
{ {

View File

@ -2,7 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router * KiRouter - a push-and-(sometimes-)shove PCB router
* *
* Copyright (C) 2013-2014 CERN * 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 <tomasz.wlostowski@cern.ch> * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software: you can redistribute it and/or modify it * 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 ); bool rv = m.Fit( MT_CHECK_FINISH, aBase, m_last, side );
if( rv ) if( rv )
@ -114,7 +116,9 @@ void MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
m.Fit( MT_TURN, aBase, m_last, side ); m.Fit( MT_TURN, aBase, m_last, side );
AddMeander( new MEANDER_SHAPE( m ) ); AddMeander( new MEANDER_SHAPE( m ) );
started = true; started = true;
} else { }
else
{
m.Fit( MT_FINISH, aBase, m_last, side ); m.Fit( MT_FINISH, aBase, m_last, side );
started = false; started = false;
AddMeander( new MEANDER_SHAPE( m ) ); AddMeander( new MEANDER_SHAPE( m ) );
@ -123,15 +127,19 @@ void MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
side = !side; side = !side;
} }
} else if( started ) }
else if( started )
{ {
bool rv = m.Fit( MT_FINISH, aBase, m_last, side ); bool rv = m.Fit( MT_FINISH, aBase, m_last, side );
if( rv ) if( rv )
AddMeander( new MEANDER_SHAPE( m ) ); AddMeander( new MEANDER_SHAPE( m ) );
break; break;
} else { }
else
{
fail = true; 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; SHAPE_LINE_CHAIN lc;
@ -202,7 +211,6 @@ SHAPE_LINE_CHAIN MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir, bool
VECTOR2D p = aP; VECTOR2D p = aP;
lc.Append( ( int ) p.x, ( int ) p.y ); lc.Append( ( int ) p.x, ( int ) p.y );
// fixme: refactor // fixme: refactor
switch( m_placer->MeanderSettings().m_cornerStyle ) 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 radius = (double) aDir.EuclideanNorm();
double correction = 0; double correction = 0;
if( m_dual && radius > m_meanCornerRadius ) if( m_dual && radius > m_meanCornerRadius )
correction = (double)( -2 * abs(m_baselineOffset) ) * tan( 22.5 * M_PI / 180.0 ); 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, SHAPE_LINE_CHAIN MEANDER_SHAPE::genMeanderShape( const VECTOR2D& aP, const VECTOR2D& aDir,
bool aSide, MEANDER_TYPE aType, int aAmpl, int aBaselineOffset ) bool aSide, MEANDER_TYPE aType, int aAmpl,
int aBaselineOffset )
{ {
int cr = cornerRadius(); int cr = cornerRadius();
int offset = aBaselineOffset; 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 ); uShape( aAmpl - 2 * cr + std::abs( offset ), cr + offset, spc - 2 * cr );
forward( std::min( cr - offset, cr + offset ) ); forward( std::min( cr - offset, cr + offset ) );
forward( std::abs( offset ) ); forward( std::abs( offset ) );
break; break;
} }
@ -399,9 +408,11 @@ bool MEANDERED_LINE::CheckSelfIntersections( MEANDER_SHAPE* aShape, int aClearan
int n = m->CLine( 0 ).SegmentCount(); int n = m->CLine( 0 ).SegmentCount();
for( int j = n - 1; j >= 0; j-- ) for( int j = n - 1; j >= 0; j-- )
{
if( aShape->CLine( 0 ).Collide( m->CLine( 0 ) .CSegment( j ), aClearance ) ) if( aShape->CLine( 0 ).Collide( m->CLine( 0 ) .CSegment( j ), aClearance ) )
return false; return false;
} }
}
return true; return true;
} }
@ -456,9 +467,12 @@ bool MEANDER_SHAPE::Fit( MEANDER_TYPE aType, const SEG& aSeg, const VECTOR2I& aP
updateBaseSegment(); updateBaseSegment();
m_baselineOffset = m1.m_baselineOffset; m_baselineOffset = m1.m_baselineOffset;
return true; return true;
} else }
else
{
return false; return false;
} }
}
int minAmpl = st.m_minAmplitude; int minAmpl = st.m_minAmplitude;
int maxAmpl = st.m_maxAmplitude; int maxAmpl = st.m_maxAmplitude;
@ -473,8 +487,10 @@ bool MEANDER_SHAPE::Fit( MEANDER_TYPE aType, const SEG& aSeg, const VECTOR2I& aP
{ {
if( m_dual ) if( m_dual )
{ {
m_shapes[0] = genMeanderShape( aP, aSeg.B - aSeg.A, aSide, aType, ampl, m_baselineOffset ); m_shapes[0] = genMeanderShape( aP, aSeg.B - aSeg.A, aSide, aType, ampl,
m_shapes[1] = genMeanderShape( aP, aSeg.B - aSeg.A, aSide, aType, ampl, -m_baselineOffset ); m_baselineOffset );
m_shapes[1] = genMeanderShape( aP, aSeg.B - aSeg.A, aSide, aType, ampl,
-m_baselineOffset );
} }
else else
{ {
@ -499,10 +515,12 @@ bool MEANDER_SHAPE::Fit( MEANDER_TYPE aType, const SEG& aSeg, const VECTOR2I& aP
void MEANDER_SHAPE::Recalculate() 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 ) 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(); 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 ); SetType( MT_CORNER );
m_shapes[0].Clear(); m_shapes[0].Clear();

View File

@ -177,7 +177,7 @@ public:
* @param aP1 corner point of the 1st line. * @param aP1 corner point of the 1st line.
* @param aP2 corner point of the 2nd line (if m_dual == true). * @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 * 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 ); void uShape( int aSides, int aCorner, int aTop );
///< Generate a 90-degree circular arc. ///< 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. ///< Produce a meander shape of given type.
SHAPE_LINE_CHAIN genMeanderShape( VECTOR2D aP, VECTOR2D aDir, bool aSide, MEANDER_TYPE aType, SHAPE_LINE_CHAIN genMeanderShape( const VECTOR2D& aP, const VECTOR2D& aDir, bool aSide,
int aAmpl, int aBaselineOffset = 0 ); MEANDER_TYPE aType, int aAmpl, int aBaselineOffset = 0 );
///< Recalculate the clipped baseline after the parameters of the meander have been changed. ///< Recalculate the clipped baseline after the parameters of the meander have been changed.
void updateBaseSegment(); void updateBaseSegment();

View File

@ -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 ) if( aOther.m_cornerCost < m_cornerCost && aOther.m_lengthCost < m_lengthCost )
return true; return true;
else if( aOther.m_cornerCost < m_cornerCost * aCornerTolerance && else if( aOther.m_cornerCost < m_cornerCost * aCornerTolerance &&
aOther.m_lengthCost < m_lengthCost * aLengthTolerance ) aOther.m_lengthCost < m_lengthCost * aLengthTolerance )
return true; return true;
@ -308,7 +307,8 @@ static bool pointInside2( const SHAPE_LINE_CHAIN& aL, const VECTOR2I& aP )
if( ipNext.y == aP.y ) if( ipNext.y == aP.y )
{ {
if( (ipNext.x ==aP.x) || ( ip.y == aP.y && ( (ipNext.x >aP.x) == (ip.x <aP.x) ) ) ) if( ( ipNext.x == aP.x )
|| ( ip.y == aP.y && ( ( ipNext.x > aP.x ) == ( ip.x < aP.x ) ) ) )
return true; // pt on polyground boundary return true; // pt on polyground boundary
} }
@ -338,8 +338,8 @@ static bool pointInside2( const SHAPE_LINE_CHAIN& aL, const VECTOR2I& aP )
{ {
if( ipNext.x >aP.x ) if( ipNext.x >aP.x )
{ {
double d = ((double)ip.x -aP.x) * ((double)ipNext.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); - ( (double) ipNext.x - aP.x ) * ( (double) ip.y - aP.y );
if( !d ) if( !d )
return true; // pt on polyground boundary 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 ); OPTIMIZER opt( aWorld );
@ -1483,6 +1483,7 @@ bool tightenSegment( bool dir, NODE *aNode, const LINE& cur, const SHAPE_LINE_CH
return true; return true;
} }
void Tighten( NODE *aNode, const SHAPE_LINE_CHAIN& aOldLine, const LINE& aNewLine, void Tighten( NODE *aNode, const SHAPE_LINE_CHAIN& aOldLine, const LINE& aNewLine,
LINE& aOptimized ) LINE& aOptimized )
{ {

View File

@ -114,7 +114,7 @@ public:
///< A quick shortcut to optimize a line without creating and setting up an optimizer. ///< A quick shortcut to optimize a line without creating and setting up an optimizer.
static bool Optimize( LINE* aLine, int aEffortLevel, NODE* aWorld, 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( LINE* aLine, LINE* aResult = nullptr, LINE* aRoot = nullptr );
bool Optimize( DIFF_PAIR* aPair ); bool Optimize( DIFF_PAIR* aPair );
@ -251,7 +251,9 @@ public:
virtual ~ANGLE_CONSTRAINT_45() {}; 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: private:
int m_entryDirectionMask; int m_entryDirectionMask;
@ -331,7 +333,8 @@ private:
class CORNER_COUNT_LIMIT_CONSTRAINT: public OPT_CONSTRAINT class CORNER_COUNT_LIMIT_CONSTRAINT: public OPT_CONSTRAINT
{ {
public: 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 ), OPT_CONSTRAINT( aWorld ),
m_minCorners( aMinCorners ), m_minCorners( aMinCorners ),
m_maxCorners( aMaxCorners ), m_maxCorners( aMaxCorners ),

View File

@ -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 ) ) if( !aItem || !m_iface->IsItemVisible( aItem ) )
{ {

View File

@ -54,7 +54,7 @@ public:
protected: protected:
bool checkSnap( ITEM* aItem ); 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, virtual ITEM* pickSingleItem( const VECTOR2I& aWhere, int aNet = -1, int aLayer = -1,
bool aIgnorePads = false, bool aIgnorePads = false,

View File

@ -594,10 +594,14 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
return 0; return 0;
} }
void PCB_POINT_EDITOR::editArcEndpointKeepTangent( PCB_SHAPE* aArc, VECTOR2I aCenter, void PCB_POINT_EDITOR::editArcEndpointKeepTangent( PCB_SHAPE* aArc, const VECTOR2I& aCenter,
VECTOR2I aStart, VECTOR2I aMid, VECTOR2I aEnd, const VECTOR2I& aStart, const VECTOR2I& aMid,
const VECTOR2I aCursor ) const const VECTOR2I& aEnd,
const VECTOR2I& aCursor ) const
{ {
VECTOR2I start = aStart;
VECTOR2I end = aEnd;
VECTOR2I center = aCenter;
VECTOR2D startLine = aStart - aCenter; VECTOR2D startLine = aStart - aCenter;
VECTOR2D endLine = aEnd - aCenter; VECTOR2D endLine = aEnd - aCenter;
double newAngle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() ); double newAngle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() );
@ -606,23 +610,23 @@ void PCB_POINT_EDITOR::editArcEndpointKeepTangent( PCB_SHAPE* aArc, VECTOR2I aCe
bool movingStart; bool movingStart;
bool arcValid = true; bool arcValid = true;
VECTOR2I *p1, *p2, *p3; VECTOR2I p1, p2, p3;
// p1 does not move, p2 does. // p1 does not move, p2 does.
if( aStart != aArc->GetArcStart() ) if( aStart != aArc->GetArcStart() )
{ {
aStart = aCursor; start = aCursor;
p1 = &aEnd; p1 = aEnd;
p2 = &aStart; p2 = aStart;
p3 = &aMid; p3 = aMid;
movingStart = true; movingStart = true;
} }
else if( aEnd != aArc->GetArcEnd() ) else if( aEnd != aArc->GetArcEnd() )
{ {
aEnd = aCursor; end = aCursor;
p1 = &aStart; p1 = aStart;
p2 = &aEnd; p2 = aEnd;
p3 = &aMid; p3 = aMid;
movingStart = false; movingStart = false;
} }
else else
@ -633,9 +637,9 @@ void PCB_POINT_EDITOR::editArcEndpointKeepTangent( PCB_SHAPE* aArc, VECTOR2I aCe
VECTOR2D v1, v2, v3, v4; VECTOR2D v1, v2, v3, v4;
// Move the coordinate system // Move the coordinate system
v1 = *p1 - aCenter; v1 = p1 - aCenter;
v2 = *p2 - aCenter; v2 = p2 - aCenter;
v3 = *p3 - aCenter; v3 = p3 - aCenter;
VECTOR2D u1, u2, u3; VECTOR2D u1, u2, u3;
@ -742,10 +746,10 @@ void PCB_POINT_EDITOR::editArcEndpointKeepTangent( PCB_SHAPE* aArc, VECTOR2I aCe
v4.x = tmpx; v4.x = tmpx;
v4.y = tmpy; v4.y = tmpy;
aCenter = v4 + aCenter; center = v4 + aCenter;
startLine = aStart - aCenter; startLine = start - center;
endLine = aEnd - aCenter; endLine = end - center;
newAngle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() ); newAngle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() );
if( clockwise && newAngle < 0.0 ) if( clockwise && newAngle < 0.0 )
@ -756,12 +760,12 @@ void PCB_POINT_EDITOR::editArcEndpointKeepTangent( PCB_SHAPE* aArc, VECTOR2I aCe
if( arcValid ) if( arcValid )
{ {
aArc->SetAngle( newAngle, false ); aArc->SetAngle( newAngle, false );
aArc->SetCenter( wxPoint( aCenter.x, aCenter.y ) ); aArc->SetCenter( ( wxPoint ) center );
if( movingStart ) if( movingStart )
aArc->SetArcStart( wxPoint( aStart.x, aStart.y ) ); aArc->SetArcStart( ( wxPoint ) start );
else 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, static void pinEditedCorner( int aEditedPointIndex, int aMinWidth, int aMinHeight,
VECTOR2I& aTopLeft, VECTOR2I& aTopRight, VECTOR2I& aBotLeft, VECTOR2I& aTopLeft, VECTOR2I& aTopRight, VECTOR2I& aBotLeft,
VECTOR2I& aBotRight, VECTOR2I aHole, VECTOR2I aHoleSize ) VECTOR2I& aBotRight, VECTOR2I& aHole, VECTOR2I& aHoleSize )
{ {
switch( aEditedPointIndex ) 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, void PCB_POINT_EDITOR::editArcEndpointKeepCenter( PCB_SHAPE* aArc, const VECTOR2I& aCenter,
VECTOR2I aStart, VECTOR2I aMid, VECTOR2I aEnd, const VECTOR2I& aStart, const VECTOR2I& aMid,
const VECTOR2I aCursor ) const const VECTOR2I& aEnd,
const VECTOR2I& aCursor ) const
{ {
bool clockwise; bool clockwise;
bool movingStart; bool movingStart;
VECTOR2I *p1, *p2; VECTOR2I p1, p2;
VECTOR2I target; VECTOR2I target;
// p1 does not move, p2 does. // p1 does not move, p2 does.
if( aStart != aArc->GetArcStart() ) if( aStart != aArc->GetArcStart() )
{ {
p1 = &aEnd; p1 = aEnd;
p2 = &aStart; p2 = aStart;
movingStart = true; movingStart = true;
} }
else else
{ {
p1 = &aStart; p1 = aStart;
p2 = &aEnd; p2 = aEnd;
movingStart = false; movingStart = false;
} }
target = *p2 - aCenter; target = p2 - aCenter;
double sqRadius = ( *p1 - aCenter ).SquaredEuclideanNorm(); double sqRadius = ( p1 - aCenter ).SquaredEuclideanNorm();
*p1 = *p1 - aCenter; p1 = p1 - aCenter;
*p2 = *p2 - aCenter; p2 = p2 - aCenter;
// Circle : x^2 + y^2 = R ^ 2 // Circle : x^2 + y^2 = R ^ 2
// In this coordinate system, the angular position of the cursor is (r, theta) // 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 ) if( target.x == 0 )
{ {
p2->x = 0; p2.x = 0;
p2->y = ( target.y > 0 ) ? sqrt( sqRadius ) : -sqrt( sqRadius ); p2.y = ( target.y > 0 ) ? sqrt( sqRadius ) : -sqrt( sqRadius );
} }
else else
{ {
@ -920,12 +925,12 @@ void PCB_POINT_EDITOR::editArcEndpointKeepCenter( PCB_SHAPE* aArc, VECTOR2I aCen
// Move to the correct quadrant // Move to the correct quadrant
tmp = target.x > 0 ? tmp : -tmp; tmp = target.x > 0 ? tmp : -tmp;
p2->y = target.y / static_cast<double>( target.x ) * tmp; p2.y = target.y / static_cast<double>( target.x ) * tmp;
p2->x = tmp; p2.x = tmp;
} }
*p1 = *p1 + aCenter; p1 = p1 + aCenter;
*p2 = *p2 + aCenter; p2 = p2 + aCenter;
clockwise = aArc->GetAngle() > 0; 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, void PCB_POINT_EDITOR::editArcMidKeepCenter( PCB_SHAPE* aArc, const VECTOR2I& aCenter,
VECTOR2I aMid, VECTOR2I aEnd, const VECTOR2I& aStart, const VECTOR2I& aMid,
const VECTOR2I aCursor ) const const VECTOR2I& aEnd, const VECTOR2I& aCursor ) const
{ {
// Now, update the edit point position // Now, update the edit point position
// Express the point in a circle-centered coordinate system. // Express the point in a circle-centered coordinate system.
aStart = aStart - aCenter; VECTOR2I start = aStart - aCenter;
aEnd = aEnd - aCenter; VECTOR2I end = aEnd - aCenter;
double sqRadius = ( aCursor - aCenter ).SquaredEuclideanNorm(); double sqRadius = ( aCursor - aCenter ).SquaredEuclideanNorm();
// Special case, because the tangent would lead to +/- infinity // 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 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 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 ) // The intersection fulfills : x^2 = R^2 / ( 1 + ( start.y / start.x ) ^ 2 )
double tan = aStart.y / static_cast<double>( aStart.x ); double tan = aStart.y / static_cast<double>( start.x );
double tmp = sqrt( sqRadius / ( 1.0 + tan * tan ) ); double tmp = sqrt( sqRadius / ( 1.0 + tan * tan ) );
// Move to the correct quadrant // Move to the correct quadrant
tmp = aStart.x > 0 ? tmp : -tmp; tmp = start.x > 0 ? tmp : -tmp;
aStart.y = aStart.y / static_cast<double>( aStart.x ) * tmp; start.y = start.y / static_cast<double>( start.x ) * tmp;
aStart.x = tmp; start.x = tmp;
} }
// Special case, because the tangent would lead to +/- infinity // 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 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 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 ) // The intersection fulfills : x^2 = R^2 / ( 1 + ( start.y / start.x ) ^ 2 )
double tan = aEnd.y / static_cast<double>( aEnd.x ); double tan = end.y / static_cast<double>( end.x );
double tmp = sqrt( sqRadius / ( 1.0 + tan * tan ) ); double tmp = sqrt( sqRadius / ( 1.0 + tan * tan ) );
// Move to the correct quadrant // Move to the correct quadrant
tmp = aEnd.x > 0 ? tmp : -tmp; tmp = end.x > 0 ? tmp : -tmp;
aEnd.y = aEnd.y / static_cast<double>( aEnd.x ) * tmp; end.y = end.y / static_cast<double>( end.x ) * tmp;
aEnd.x = tmp; end.x = tmp;
} }
aStart = aStart + aCenter; start = start + aCenter;
aEnd = aEnd + aCenter; end = end + aCenter;
aArc->SetArcStart( (wxPoint) aStart ); aArc->SetArcStart( (wxPoint) start );
aArc->SetArcEnd( (wxPoint) aEnd ); aArc->SetArcEnd( (wxPoint) end );
} }
void PCB_POINT_EDITOR::editArcMidKeepEndpoints( PCB_SHAPE* aArc, VECTOR2I aStart, VECTOR2I aEnd, void PCB_POINT_EDITOR::editArcMidKeepEndpoints( PCB_SHAPE* aArc, const VECTOR2I& aStart,
const VECTOR2I aCursor ) const const VECTOR2I& aEnd,
const VECTOR2I& aCursor ) const
{ {
// Let 'm' be the middle point of the chord between the start and end points // Let 'm' be the middle point of the chord between the start and end points
VECTOR2I m = ( aStart + aEnd ) / 2; 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 topRight = m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition();
VECTOR2I botLeft = m_editPoints->Point( RECT_BOT_LEFT ).GetPosition(); VECTOR2I botLeft = m_editPoints->Point( RECT_BOT_LEFT ).GetPosition();
VECTOR2I botRight = m_editPoints->Point( RECT_BOT_RIGHT ).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, 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 ) if( ( pad->GetOffset().x || pad->GetOffset().y )
|| ( pad->GetDrillSize().x && pad->GetDrillSize().y ) ) || ( pad->GetDrillSize().x && pad->GetDrillSize().y ) )
@ -1328,6 +1336,7 @@ void PCB_POINT_EDITOR::updateItem() const
validatePolygon( outline ); validatePolygon( outline );
zone->HatchBorder(); zone->HatchBorder();
// TODO Refill zone when KiCad supports auto re-fill // TODO Refill zone when KiCad supports auto re-fill
break; break;
} }
@ -1606,6 +1615,7 @@ void PCB_POINT_EDITOR::updatePoints()
for( unsigned i = 0; i < points.size(); i++ ) for( unsigned i = 0; i < points.size(); i++ )
m_editPoints->Point( i ).SetPosition( points[i] ); m_editPoints->Point( i ).SetPosition( points[i] );
} }
break; break;
} }
@ -2197,12 +2207,14 @@ int PCB_POINT_EDITOR::modifiedSelection( const TOOL_EVENT& aEvent )
return 0; return 0;
} }
int PCB_POINT_EDITOR::changeEditMethod( const TOOL_EVENT& aEvent ) int PCB_POINT_EDITOR::changeEditMethod( const TOOL_EVENT& aEvent )
{ {
m_altEditMethod = !m_altEditMethod; m_altEditMethod = !m_altEditMethod;
return 0; return 0;
} }
void PCB_POINT_EDITOR::setTransitions() void PCB_POINT_EDITOR::setTransitions()
{ {
Go( &PCB_POINT_EDITOR::OnSelectionChange, ACTIONS::activatePointEditor.MakeEvent() ); Go( &PCB_POINT_EDITOR::OnSelectionChange, ACTIONS::activatePointEditor.MakeEvent() );

View File

@ -134,26 +134,29 @@ private:
/** /**
* Move an end point of the arc, while keeping the tangent at the other endpoint. * Move an end point of the arc, while keeping the tangent at the other endpoint.
*/ */
void editArcEndpointKeepTangent( PCB_SHAPE* aArc, VECTOR2I aCenter, VECTOR2I aStart, void editArcEndpointKeepTangent( PCB_SHAPE* aArc, const VECTOR2I& aCenter,
VECTOR2I aMid, VECTOR2I aEnd, const VECTOR2I aCursor ) const; const VECTOR2I& aStart, const VECTOR2I& aMid,
const VECTOR2I& aEnd, const VECTOR2I& aCursor ) const;
/** /**
* Move an end point of the arc around the circumference. * Move an end point of the arc around the circumference.
*/ */
void editArcEndpointKeepCenter( PCB_SHAPE* aArc, VECTOR2I aCenter, VECTOR2I aStart, void editArcEndpointKeepCenter( PCB_SHAPE* aArc, const VECTOR2I& aCenter,
VECTOR2I aMid, VECTOR2I aEnd, const VECTOR2I aCursor ) const; 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. * Move the mid point of the arc, while keeping the two endpoints.
*/ */
void editArcMidKeepEndpoints( PCB_SHAPE* aArc, VECTOR2I aStart, VECTOR2I aEnd, void editArcMidKeepEndpoints( PCB_SHAPE* aArc, const VECTOR2I& aStart, const VECTOR2I& aEnd,
const VECTOR2I aCursor ) const; const VECTOR2I& aCursor ) const;
/** /**
* Move the mid point of the arc, while keeping the angle. * Move the mid point of the arc, while keeping the angle.
*/ */
void editArcMidKeepCenter( PCB_SHAPE* aArc, VECTOR2I aCenter, VECTOR2I aStart, VECTOR2I aMid, void editArcMidKeepCenter( PCB_SHAPE* aArc, const VECTOR2I& aCenter, const VECTOR2I& aStart,
VECTOR2I aEnd, const VECTOR2I aCursor ) const; const VECTOR2I& aMid, const VECTOR2I& aEnd,
const VECTOR2I& aCursor ) const;
///< Change the edit method to an alternative method ( currently, arcs only ) ///< Change the edit method to an alternative method ( currently, arcs only )
int changeEditMethod( const TOOL_EVENT& aEvent ); int changeEditMethod( const TOOL_EVENT& aEvent );