7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 21:31:42 +00:00

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 );
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 );

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,
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:

View File

@ -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() ),

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 ) );

View File

@ -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 );

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)
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<SCH_GLOBALLABEL*>( 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;

View File

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

View File

@ -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()

View File

@ -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;
}

View File

@ -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,

View File

@ -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

View File

@ -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 )

View File

@ -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<void()> 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);

View File

@ -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.

View File

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

View File

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

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;

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 )
{
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;
}

View File

@ -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 );

View File

@ -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.

View File

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

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,
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 );
}
}

View File

@ -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 <chgans@gna.org>
*
* 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

View File

@ -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::SOLID> PNS_KICAD_IFACE_BASE::syncPad( PAD* aPad )
std::unique_ptr<PNS::SEGMENT> PNS_KICAD_IFACE_BASE::syncTrack( PCB_TRACK* aTrack )
{
auto segment = std::make_unique<PNS::SEGMENT>( SEG( aTrack->GetStart(), aTrack->GetEnd() ),
aTrack->GetNetCode() );
aTrack->GetNetCode() );
segment->SetWidth( aTrack->GetWidth() );
segment->SetLayers( LAYER_RANGE( aTrack->GetLayer() ) );

Some files were not shown because too many files have changed in this diff Show More