7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 10:20:11 +00:00

Pass wxPoint objects by reference instead of on the stack.

This commit is contained in:
Wayne Stambaugh 2021-07-26 15:35:12 -04:00
parent f6cac49802
commit 8fd83cbb95
39 changed files with 218 additions and 183 deletions

View File

@ -684,7 +684,7 @@ void DIALOG_COLOR_PICKER::OnColorValueText( wxCommandEvent& event )
}
bool DIALOG_COLOR_PICKER::setHSvaluesFromCursor( wxPoint aMouseCursor )
bool DIALOG_COLOR_PICKER::setHSvaluesFromCursor( const wxPoint& aMouseCursor )
{
wxPoint mousePos = aMouseCursor;
wxSize bmsize = m_bitmapHSV->GetSize();

View File

@ -219,7 +219,7 @@ void GRLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int wi
}
void GRLine( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth,
void GRLine( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth,
const COLOR4D& aColor, wxPenStyle aStyle )
{
GRLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, aColor, aStyle );
@ -359,7 +359,7 @@ void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int w
}
void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth,
void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth,
const COLOR4D& aColor )
{
GRCSegm( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, 0, aColor );
@ -374,7 +374,7 @@ void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
}
void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd,
int aWidth, const COLOR4D& aColor )
{
GRSetColorPen( aDC, aColor, aWidth );
@ -565,7 +565,7 @@ void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, const COLOR4D&
}
void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aWidth,
void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius, int aWidth,
const COLOR4D& aColor )
{
GRCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, aWidth, aColor );
@ -584,7 +584,7 @@ void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width
}
void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius,
void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius,
const COLOR4D& aColor )
{
GRFilledCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, 0, aColor, aColor );
@ -630,8 +630,8 @@ void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int xc
}
void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, wxPoint aCenter,
int aWidth, const COLOR4D& aColor )
void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd,
const wxPoint& aCenter, int aWidth, const COLOR4D& aColor )
{
GRArc1( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aCenter.x, aCenter.y,
aWidth, aColor );

View File

@ -539,7 +539,7 @@ void DIALOG_PLOT_SCHEMATIC::createDxfFile( bool aPlotAll, bool aPlotDrawingSheet
bool DIALOG_PLOT_SCHEMATIC::plotOneSheetDxf( const wxString& aFileName,
SCH_SCREEN* aScreen,
RENDER_SETTINGS* aRenderSettings,
wxPoint aPlotOffset,
const wxPoint& aPlotOffset,
double aScale,
bool aPlotFrameRef )
{
@ -707,7 +707,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetHpgl( const wxString& aFileName,
SCH_SCREEN* aScreen,
const PAGE_INFO& aPageInfo,
RENDER_SETTINGS* aRenderSettings,
wxPoint aPlot0ffset,
const wxPoint& aPlot0ffset,
double aScale,
bool aPlotFrameRef,
HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits )
@ -1061,7 +1061,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
SCH_SCREEN* aScreen,
RENDER_SETTINGS* aRenderSettings,
const PAGE_INFO& aPageInfo,
wxPoint aPlot0ffset,
const wxPoint& aPlot0ffset,
double aScale,
bool aPlotFrameRef )
{

View File

@ -112,8 +112,8 @@ private:
// DXF
void createDxfFile( bool aPlotAll, bool aPlotDrawingSheet, RENDER_SETTINGS* aRenderSettings );
bool plotOneSheetDxf( const wxString& aFileName, SCH_SCREEN* aScreen,
RENDER_SETTINGS* aRenderSettings, wxPoint aPlotOffset, double aScale,
bool aPlotFrameRef );
RENDER_SETTINGS* aRenderSettings, const wxPoint& aPlotOffset,
double aScale, bool aPlotFrameRef );
// HPGLGetPlotOriginAndUnits
HPGL_PLOT_ORIGIN_AND_UNITS getPlotOriginAndUnits()
@ -155,14 +155,14 @@ private:
void setHpglPenWidth();
bool plotOneSheetHpgl( const wxString& aFileName, SCH_SCREEN* aScreen,
const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings,
wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef,
const wxPoint& aPlot0ffset, double aScale, bool aPlotFrameRef,
HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits );
// PS
void createPSFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings );
bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo,
wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
const wxPoint& aPlot0ffset, double aScale, bool aPlotFrameRef );
// SVG
void createSVGFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings );

View File

@ -2000,7 +2000,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadFigure( const FIGURE& aCadstarFigure,
void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(
LAYER_ID aCadstarSheetID, wxPoint aPosition, wxSize aSheetSize,
LAYER_ID aCadstarSheetID, const wxPoint& aPosition, wxSize aSheetSize,
const SCH_SHEET_PATH& aParentSheet )
{
wxCHECK_MSG( m_sheetMap.find( aCadstarSheetID ) == m_sheetMap.end(), ,
@ -2855,7 +2855,7 @@ std::pair<wxPoint, wxSize> CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad(
}
wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadPoint( wxPoint aCadstarPoint )
wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadPoint( const wxPoint& aCadstarPoint )
{
wxPoint retval;
@ -2866,8 +2866,8 @@ wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadPoint( wxPoint aCadstarPoint )
}
wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadLibraryPoint( wxPoint aCadstarPoint,
wxPoint aCadstarCentre )
wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadLibraryPoint( const wxPoint& aCadstarPoint,
const wxPoint& aCadstarCentre )
{
wxPoint retval;
@ -2912,13 +2912,13 @@ wxPoint CADSTAR_SCH_ARCHIVE_LOADER::applyTransform( const wxPoint& aPoint,
}
double CADSTAR_SCH_ARCHIVE_LOADER::getPolarAngle( wxPoint aPoint )
double CADSTAR_SCH_ARCHIVE_LOADER::getPolarAngle( const wxPoint& aPoint )
{
return NormalizeAnglePos( ArcTangente( aPoint.y, aPoint.x ) );
}
double CADSTAR_SCH_ARCHIVE_LOADER::getPolarRadius( wxPoint aPoint )
double CADSTAR_SCH_ARCHIVE_LOADER::getPolarRadius( const wxPoint& aPoint )
{
return sqrt(
( (double) aPoint.x * (double) aPoint.x ) + ( (double) aPoint.y * (double) aPoint.y ) );

View File

@ -121,8 +121,8 @@ private:
void loadTextVariables();
//Helper Functions for loading sheets
void loadSheetAndChildSheets( LAYER_ID aCadstarSheetID, wxPoint aPosition, wxSize aSheetSize,
const SCH_SHEET_PATH& aParentSheet );
void loadSheetAndChildSheets( LAYER_ID aCadstarSheetID, const wxPoint& aPosition,
wxSize aSheetSize, const SCH_SHEET_PATH& aParentSheet );
void loadChildSheets( LAYER_ID aCadstarSheetID, const SCH_SHEET_PATH& aSheet );
@ -218,9 +218,9 @@ private:
std::pair<wxPoint, wxSize> getFigureExtentsKiCad( const FIGURE& aCadstarFigure );
wxPoint getKiCadPoint( wxPoint aCadstarPoint );
wxPoint getKiCadPoint( const wxPoint& aCadstarPoint );
wxPoint getKiCadLibraryPoint( wxPoint aCadstarPoint, wxPoint aCadstarCentre );
wxPoint getKiCadLibraryPoint( const wxPoint& aCadstarPoint, const wxPoint& aCadstarCentre );
wxPoint applyTransform( const wxPoint& aPoint, const wxPoint& aMoveVector = { 0, 0 },
const double& aRotationAngleDeciDeg = 0.0, const double& aScalingFactor = 1.0,
@ -281,14 +281,14 @@ private:
* @param aPoint
* @return Angle in decidegrees of the polar representation of the point, scaled 0..360
*/
double getPolarAngle( wxPoint aPoint );
double getPolarAngle( const wxPoint& aPoint );
/**
* @brief
* @param aPoint
* @return Radius of polar representation of the point
*/
double getPolarRadius( wxPoint aPoint );
double getPolarRadius( const wxPoint& aPoint );
}; // CADSTAR_SCH_ARCHIVE_LOADER

View File

@ -358,16 +358,18 @@ int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent )
}
SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, wxPoint aPos )
SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, const wxPoint& aPos )
{
SCHEMATIC_SETTINGS& cfg = getModel<SCHEMATIC>()->Settings();
wxPoint pos = aPos;
if( aPos == wxDefaultPosition )
aPos = static_cast<wxPoint>( getViewControls()->GetCursorPosition() );
pos = static_cast<wxPoint>( getViewControls()->GetCursorPosition() );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
m_busUnfold.entry = new SCH_BUS_WIRE_ENTRY( aPos );
m_busUnfold.entry = new SCH_BUS_WIRE_ENTRY( pos );
m_busUnfold.entry->SetParent( m_frame->GetScreen() );
m_frame->AddToScreen( m_busUnfold.entry, m_frame->GetScreen() );
@ -378,7 +380,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, wxPoint aPo
m_busUnfold.label->SetFlags( IS_NEW | IS_MOVING );
m_busUnfold.in_progress = true;
m_busUnfold.origin = aPos;
m_busUnfold.origin = pos;
m_busUnfold.net_name = aNet;
getViewControls()->SetCrossHairCursorPosition( m_busUnfold.entry->GetEnd(), false );

View File

@ -96,7 +96,7 @@ public:
private:
int doDrawSegments( const std::string& aTool, int aType, bool aQuitOnDraw );
SCH_LINE* startSegments( int aType, const VECTOR2D& aPos );
SCH_LINE* doUnfoldBus( const wxString& aNet, wxPoint aPos = wxDefaultPosition );
SCH_LINE* doUnfoldBus( const wxString& aNet, const wxPoint& aPos = wxDefaultPosition );
void finishSegments();
/**

View File

@ -525,7 +525,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
}
void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoint,
void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoint& aPoint,
EDA_ITEMS& aList )
{
EE_RTREE& items = m_frame->GetScreen()->Items();

View File

@ -68,7 +68,7 @@ private:
///< Find additional items for a drag operation.
///< Connected items with no wire are included (as there is no wire to adjust for the drag).
///< Connected wires are included with any un-connected ends flagged (STARTPOINT or ENDPOINT).
void getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoint, EDA_ITEMS& aList );
void getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoint& aPoint, EDA_ITEMS& aList );
///< Set up handlers for various events.
void setTransitions() override;

View File

@ -95,15 +95,17 @@ const int seg_per_circle = 64; // Number of segments to approximate a circle
void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_SET& aShapeBuffer,
wxPoint aShapePos )
const wxPoint& aShapePos )
{
#define TO_POLY_SHAPE \
{ \
if( polybuffer.size() > 1 ) \
{ \
aShapeBuffer.NewOutline(); \
\
for( unsigned jj = 0; jj < polybuffer.size(); jj++ ) \
aShapeBuffer.Append( polybuffer[jj].x, polybuffer[jj].y ); \
\
aShapeBuffer.Append( polybuffer[0].x, polybuffer[0].y ); \
} \
}
@ -809,7 +811,7 @@ int AM_PRIMITIVE::GetShapeDim( const GERBER_DRAW_ITEM* aParent )
SHAPE_POLY_SET* APERTURE_MACRO::GetApertureMacroShape( const GERBER_DRAW_ITEM* aParent,
wxPoint aShapePos )
const wxPoint& aShapePos )
{
SHAPE_POLY_SET holeBuffer;
bool hasHole = false;
@ -858,8 +860,8 @@ SHAPE_POLY_SET* APERTURE_MACRO::GetApertureMacroShape( const GERBER_DRAW_ITEM* a
void APERTURE_MACRO::DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox,
wxDC* aDC, const COLOR4D& aColor, wxPoint aShapePos,
bool aFilledShape )
wxDC* aDC, const COLOR4D& aColor,
const wxPoint& aShapePos, bool aFilledShape )
{
SHAPE_POLY_SET* shapeBuffer = GetApertureMacroShape( aParent, aShapePos );

View File

@ -142,7 +142,7 @@ public:
*/
void DrawBasicShape( const GERBER_DRAW_ITEM* aParent,
SHAPE_POLY_SET& aShapeBuffer,
wxPoint aShapePos );
const wxPoint& aShapePos );
private:
/**
@ -189,7 +189,8 @@ struct APERTURE_MACRO
* @param aParent is the parent #GERBER_DRAW_ITEM which is actually drawn.
* @return the shape of the item.
*/
SHAPE_POLY_SET* GetApertureMacroShape( const GERBER_DRAW_ITEM* aParent, wxPoint aShapePos );
SHAPE_POLY_SET* GetApertureMacroShape( const GERBER_DRAW_ITEM* aParent,
const wxPoint& aShapePos );
/**
* Draw the primitive shape for flashed items.
@ -204,7 +205,8 @@ struct APERTURE_MACRO
* @param aFilledShape set to true to draw in filled mode, false to draw in sketch mode.
*/
void DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC,
const COLOR4D& aColor, wxPoint aShapePos, bool aFilledShape );
const COLOR4D& aColor, const wxPoint& aShapePos,
bool aFilledShape );
/**
* Calculate a value that can be used to evaluate the size of text when displaying the

View File

@ -172,7 +172,7 @@ private:
* if Saturation value computed from aMouseCursor is <= 1.0,
* and false if aMouseCursor is outside this area.
*/
bool setHSvaluesFromCursor( wxPoint aMouseCursor );
bool setHSvaluesFromCursor( const wxPoint& aMouseCursor );
///< Event handler for defined color buttons
void buttColorClick( wxMouseEvent& event );

View File

@ -104,7 +104,7 @@ void GRForceBlackPen( bool flagforce );
*/
bool GetGRForceBlackPenState( void );
void GRLine( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth,
void GRLine( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth,
const COLOR4D& aColor, wxPenStyle aStyle = wxPENSTYLE_SOLID );
void GRLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width,
const COLOR4D& Color, wxPenStyle aStyle = wxPENSTYLE_SOLID );
@ -171,9 +171,9 @@ void GRCircle( EDA_RECT* ClipBox, wxDC* aDC, int x, int y, int aRadius, const CO
void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width, const COLOR4D& Color );
void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width,
const COLOR4D& Color, const COLOR4D& BgColor );
void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius,
void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius,
const COLOR4D& aColor );
void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aWidth,
void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius, int aWidth,
const COLOR4D& aColor );
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle,
@ -184,8 +184,8 @@ void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int xc, int yc, const COLOR4D& Color );
void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int xc, int yc, int width, const COLOR4D& Color );
void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
wxPoint aCenter, int aWidth, const COLOR4D& aColor );
void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd,
const wxPoint& aCenter, int aWidth, const COLOR4D& aColor );
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, double EndAngle,
int r, const COLOR4D& Color, const COLOR4D& BgColor );
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle,
@ -195,12 +195,12 @@ void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int w
void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int width, const COLOR4D& Color );
void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd,
int aWidth, const COLOR4D& aColor );
void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int width, int aPenSize, const COLOR4D& Color );
void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd,
int aWidth, const COLOR4D& aColor );
void GRSetColor( const COLOR4D& Color );

View File

@ -75,7 +75,7 @@ int ConvertArcToPolyline( SHAPE_LINE_CHAIN& aPolyline, VECTOR2I aCenter, int aRa
* @param aMinSegCount is the min count of segments to approximate.
* Default = 0 to do not force a min count.
*/
void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, wxPoint aCenter, int aRadius,
void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const wxPoint& aCenter, int aRadius,
int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 );
/**
@ -89,7 +89,7 @@ void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, wxPoint aCenter,
* @param aMinSegCount is the min count of segments to approximate.
* Default = 0 to do not force a min count.
*/
void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aCenter, int aRadius,
void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCenter, int aRadius,
int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 );
@ -110,8 +110,9 @@ void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aCenter, i
* @param aMinSegCount is the min count of segments to approximate.
* Default = 0 to do not force a min count.
*/
void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aStart, wxPoint aEnd,
int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 );
void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart,
const wxPoint& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc,
int aMinSegCount = 0 );
/**
* Convert a rectangle or trapezoid to a polygon.
@ -172,8 +173,9 @@ void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer,
* @param aError is the internal units allowed for error in approximation.
* @param aErrorLoc determines if the approximation error be placed outside or inside the polygon.
*/
void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aStart, wxPoint aMid,
wxPoint aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc );
void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart,
const wxPoint& aMid, const wxPoint& aEnd, int aWidth, int aError,
ERROR_LOC aErrorLoc );
/**
* Convert arcs to multiple straight segments.
@ -185,7 +187,7 @@ void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aStart, wxPoi
* @param aError is the internal units allowed for error in approximation.
* @param aErrorLoc determines if the approximation error be placed outside or inside the polygon.
*/
void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aCentre, int aRadius,
void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCentre, int aRadius,
int aWidth, int aError, ERROR_LOC aErrorLoc );
#endif // CONVERT_BASIC_SHAPES_TO_POLYGON_H

View File

@ -57,6 +57,6 @@ void BuildConvexHull( std::vector<wxPoint>& aResult, const SHAPE_POLY_SET& aPoly
* @param aRotation is the rotation of the convex hull.
*/
void BuildConvexHull( std::vector<wxPoint>& aResult, const SHAPE_POLY_SET& aPolygons,
wxPoint aPosition, double aRotation );
const wxPoint& aPosition, double aRotation );
#endif // __CONVEX_HULL_H

View File

@ -58,8 +58,8 @@ bool IsPointOnSegment( const wxPoint& aSegStart, const wxPoint& aSegEnd,
* @return bool - true if the two segments defined by four points intersect.
* (i.e. if the 2 segments have at least a common point)
*/
bool SegmentIntersectsSegment( const wxPoint &a_p1_l1, const wxPoint &a_p2_l1,
const wxPoint &a_p1_l2, const wxPoint &a_p2_l2,
bool SegmentIntersectsSegment( const wxPoint& a_p1_l1, const wxPoint& a_p2_l1,
const wxPoint& a_p1_l2, const wxPoint& a_p2_l2,
wxPoint* aIntersectionPoint = nullptr );
/*
@ -75,8 +75,7 @@ void RotatePoint( int *pX, int *pY, double angle );
void RotatePoint( int *pX, int *pY, int cx, int cy, double angle );
/*
* Calculates the new coord point point
* for a rotation angle in (1 / 10 degree)
* Calculate the new coord point point for a rotation angle in (1 / 10 degree).
*/
inline void RotatePoint( wxPoint* point, double angle )
{
@ -91,8 +90,7 @@ inline void RotatePoint( VECTOR2I& point, double angle )
void RotatePoint( VECTOR2I& point, const VECTOR2I& centre, double angle );
/*
* Calculates the new coord point point
* for a center rotation center and angle in (1 / 10 degree)
* Calculate the new coord point point for a center rotation center and angle in (1 / 10 degree).
*/
void RotatePoint( wxPoint *point, const wxPoint & centre, double angle );
@ -114,12 +112,12 @@ const wxPoint GetArcCenter( const wxPoint& aStart, const wxPoint& aMid, const wx
const wxPoint GetArcCenter( VECTOR2I aStart, VECTOR2I aEnd, double aAngle );
/**
* Returns the subtended angle for a given arc
* Return the subtended angle for a given arc.
*/
double GetArcAngle( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd );
/**
* Returns the middle point of an arc, half-way between aStart and aEnd. There are two possible
* Return the middle point of an arc, half-way between aStart and aEnd. There are two possible
* solutions which can be found by toggling aMinArcAngle. The behaviour is undefined for
* semicircles (i.e. 180 degree arcs).
*
@ -162,9 +160,9 @@ inline double EuclideanNorm( const wxSize &vector )
//! @param linePointA Point on line
//! @param linePointB Point on line
//! @param referencePoint Reference point
inline double DistanceLinePoint( const wxPoint &linePointA,
const wxPoint &linePointB,
const wxPoint &referencePoint )
inline double DistanceLinePoint( const wxPoint& linePointA,
const wxPoint& linePointB,
const wxPoint& referencePoint )
{
// Some of the multiple double casts are redundant. However in the previous
// definition the cast was (implicitly) done too late, just before
@ -183,7 +181,7 @@ inline double DistanceLinePoint( const wxPoint &linePointA,
//! @param pointB Second point
//! @param threshold The maximum distance
//! @return True or false
inline bool HitTestPoints( const wxPoint &pointA, const wxPoint &pointB, double threshold )
inline bool HitTestPoints( const wxPoint& pointA, const wxPoint& pointB, double threshold )
{
wxPoint vectorAB = pointB - pointA;
@ -197,7 +195,7 @@ inline bool HitTestPoints( const wxPoint &pointA, const wxPoint &pointB, double
//! @brief Determine the cross product
//! @param vectorA Two-dimensional vector
//! @param vectorB Two-dimensional vector
inline double CrossProduct( const wxPoint &vectorA, const wxPoint &vectorB )
inline double CrossProduct( const wxPoint& vectorA, const wxPoint& vectorB )
{
// As before the cast is to avoid int overflow
return (double)vectorA.x * vectorB.y - (double)vectorA.y * vectorB.x;
@ -211,7 +209,8 @@ inline double CrossProduct( const wxPoint &vectorA, const wxPoint &vectorB )
* @param aEnd is the second end-point of the line segment
* @param aDist = maximum distance for hit
*/
bool TestSegmentHit( const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist );
bool TestSegmentHit( const wxPoint& aRefPoint, const wxPoint& aStart, const wxPoint& aEnd,
int aDist );
/**
* Return the length of a line segment defined by \a aPointA and \a aPointB.
@ -223,8 +222,7 @@ bool TestSegmentHit( const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int
inline double GetLineLength( const wxPoint& aPointA, const wxPoint& aPointB )
{
// Implicitly casted to double
return hypot( aPointA.x - aPointB.x,
aPointA.y - aPointB.y );
return hypot( aPointA.x - aPointB.x, aPointA.y - aPointB.y );
}
// These are the usual degrees <-> radians conversion routines
@ -244,8 +242,10 @@ template <class T> inline T NormalizeAngle360Max( T Angle )
{
while( Angle < -3600 )
Angle += 3600;
while( Angle > 3600 )
Angle -= 3600;
return Angle;
}
@ -255,27 +255,29 @@ template <class T> inline T NormalizeAngle360Min( T Angle )
{
while( Angle <= -3600 )
Angle += 3600;
while( Angle >= 3600 )
Angle -= 3600;
return Angle;
}
/// Normalize angle to be in the 0.0 .. -360.0 range:
/// angle is in 1/10 degrees
/// Normalize angle to be in the 0.0 .. -360.0 range: angle is in 1/10 degrees.
template <class T>
inline T NormalizeAngleNeg( T Angle )
{
while( Angle <= -3600 )
Angle += 3600;
while( Angle > 0 )
Angle -= 3600;
return Angle;
}
/// Normalize angle to be in the 0.0 .. 360.0 range:
/// angle is in 1/10 degrees
/// Normalize angle to be in the 0.0 .. 360.0 range: angle is in 1/10 degrees.
template <class T> inline T NormalizeAnglePos( T Angle )
{
while( Angle < 0 )
@ -291,14 +293,15 @@ template <class T> inline void NORMALIZE_ANGLE_POS( T& Angle )
}
/// Normalize angle to be in the 0.0 .. 360.0 range:
/// angle is in degrees
/// Normalize angle to be in the 0.0 .. 360.0 range: angle is in degrees.
inline double NormalizeAngleDegreesPos( double Angle )
{
while( Angle < 0 )
Angle += 360.0;
while( Angle >= 360.0 )
Angle -= 360.0;
return Angle;
}
@ -313,19 +316,22 @@ inline double NormalizeAngleRadiansPos( double Angle )
{
while( Angle < 0 )
Angle += (2 * M_PI );
while( Angle >= ( 2 * M_PI ) )
Angle -= ( 2 * M_PI );
return Angle;
}
/// Normalize angle to be aMin < angle <= aMax
/// angle is in degrees
/// Normalize angle to be aMin < angle <= aMax angle is in degrees.
inline double NormalizeAngleDegrees( double Angle, double aMin, double aMax )
{
while( Angle < aMin )
Angle += 360.0;
while( Angle >= aMax )
Angle -= 360.0;
return Angle;
}
@ -343,10 +349,13 @@ template <class T, class T2> inline T AddAngles( T a1, T2 a2 )
template <class T> inline T NegateAndNormalizeAnglePos( T Angle )
{
Angle = -Angle;
while( Angle < 0 )
Angle += 3600;
while( Angle >= 3600 )
Angle -= 3600;
return Angle;
}
@ -361,8 +370,10 @@ template <class T> inline T NormalizeAngle90( T Angle )
{
while( Angle < -900 )
Angle += 1800;
while( Angle > 900 )
Angle -= 1800;
return Angle;
}
@ -377,8 +388,10 @@ template <class T> inline T NormalizeAngle180( T Angle )
{
while( Angle <= -1800 )
Angle += 3600;
while( Angle > 1800 )
Angle -= 3600;
return Angle;
}

View File

@ -39,7 +39,7 @@
#include <trigo.h>
void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, wxPoint aCenter, int aRadius,
void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const wxPoint& aCenter, int aRadius,
int aError, ERROR_LOC aErrorLoc, int aMinSegCount )
{
wxPoint corner_position;
@ -78,7 +78,7 @@ void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, wxPoint aCenter,
}
void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aCenter, int aRadius,
void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCenter, int aRadius,
int aError, ERROR_LOC aErrorLoc, int aMinSegCount )
{
wxPoint corner_position;
@ -123,8 +123,9 @@ void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aCenter, i
}
void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aStart, wxPoint aEnd,
int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount )
void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart,
const wxPoint& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc,
int aMinSegCount )
{
// To build the polygonal shape outside the actual shape, we use a bigger
// radius to build rounded ends.
@ -479,8 +480,9 @@ int ConvertArcToPolyline( SHAPE_LINE_CHAIN& aPolyline, VECTOR2I aCenter, int aRa
}
void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aStart, wxPoint aMid,
wxPoint aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc )
void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart,
const wxPoint& aMid, const wxPoint& aEnd, int aWidth,
int aError, ERROR_LOC aErrorLoc )
{
SHAPE_ARC arc( aStart, aMid, aEnd, aWidth );
// Currentlye have currently 2 algos:
@ -611,7 +613,7 @@ void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aStart, wxPoi
}
void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aCentre, int aRadius,
void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCentre, int aRadius,
int aWidth, int aError, ERROR_LOC aErrorLoc )
{
int inner_radius = aRadius - ( aWidth / 2 );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -138,7 +138,7 @@ void BuildConvexHull( std::vector<wxPoint>& aResult, const SHAPE_POLY_SET& aPoly
void BuildConvexHull( std::vector<wxPoint>& aResult, const SHAPE_POLY_SET& aPolygons,
wxPoint aPosition, double aRotation )
const wxPoint& aPosition, double aRotation )
{
// Build the convex hull of the SHAPE_POLY_SET
std::vector<wxPoint> buf;

View File

@ -58,8 +58,8 @@ bool IsPointOnSegment( const wxPoint& aSegStart, const wxPoint& aSegEnd,
// Returns true if the segment 1 intersected the segment 2.
bool SegmentIntersectsSegment( const wxPoint &a_p1_l1, const wxPoint &a_p2_l1,
const wxPoint &a_p1_l2, const wxPoint &a_p2_l2,
bool SegmentIntersectsSegment( const wxPoint& a_p1_l1, const wxPoint& a_p2_l1,
const wxPoint& a_p1_l2, const wxPoint& a_p2_l2,
wxPoint* aIntersectionPoint )
{
@ -126,7 +126,8 @@ bool SegmentIntersectsSegment( const wxPoint &a_p1_l1, const wxPoint &a_p2_l1,
}
bool TestSegmentHit( const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist )
bool TestSegmentHit( const wxPoint& aRefPoint, const wxPoint& aStart, const wxPoint& aEnd,
int aDist )
{
int xmin = aStart.x;
int xmax = aEnd.x;

View File

@ -189,7 +189,6 @@ bool AR_AUTOPLACER::fillMatrix()
for( int v = 0; v < outline.PointCount(); v++ )
{
int seg_startX = outline.CPoint( v ).x;
int seg_startY = outline.CPoint( v ).y;
int seg_endX = outline.CPoint( v + 1 ).x;
@ -252,6 +251,7 @@ bool AR_AUTOPLACER::fillMatrix()
{
int seg_start_x = x_coordinates[ii] - coord_orgin.x;
int seg_end_x = x_coordinates[ii + 1] - coord_orgin.x;
// Fill cells at y coord = idy,
// and at x cood >= seg_start_x and <= seg_end_x
@ -263,7 +263,6 @@ bool AR_AUTOPLACER::fillMatrix()
if( idx * step >= seg_start_x )
m_matrix.SetCell( idy, idx, AR_SIDE_BOTTOM, CELL_IS_ZONE );
}
}
} // End examine segments in one area
@ -286,7 +285,7 @@ void AR_AUTOPLACER::rotateFootprint( FOOTPRINT* aFootprint, double angle, bool i
}
void AR_AUTOPLACER::addFpBody( wxPoint aStart, wxPoint aEnd, LSET aLayerMask )
void AR_AUTOPLACER::addFpBody( const wxPoint& aStart, const wxPoint& aEnd, LSET aLayerMask )
{
// Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack
if( aLayerMask[ F_Cu ] )
@ -308,6 +307,7 @@ void AR_AUTOPLACER::addFpBody( wxPoint aStart, wxPoint aEnd, LSET aLayerMask )
}
}
void AR_AUTOPLACER::addPad( PAD* aPad, int aClearance )
{
// Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack
@ -1022,7 +1022,6 @@ end_of_tst:
if( error == AR_ABORT_PLACEMENT )
break;
bestRotation += initialOrient;
if( bestRotation != footprint->GetOrientation() )

View File

@ -3,9 +3,9 @@
*
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
*
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -71,8 +71,7 @@ public:
}
/**
* a callback function to redraw on screen the view after changes,
* for instance after moving a footprint
* Callback to redraw on screen the view after changes, for instance after moving a footprint.
*/
void SetRefreshCallback( std::function<int( FOOTPRINT* aFootprint )> aCallback )
{
@ -89,8 +88,10 @@ private:
void rotateFootprint( FOOTPRINT* aFootprint, double angle, bool incremental );
int genPlacementRoutingMatrix();
/** fills m_matrix cells from m_boardShape.
* cells inside m_boardShape are set to CELL_IS_ZONE
/**
* Fill m_matrix cells from m_boardShape.
*
* Cells inside m_boardShape are set to CELL_IS_ZONE.
*/
bool fillMatrix();
void genModuleOnRoutingMatrix( FOOTPRINT* aFootprint );
@ -113,7 +114,7 @@ private:
const PAD* nearestPad( FOOTPRINT* aRefFP, PAD* aRefPad, const wxPoint& aOffset );
// Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack
void addFpBody( wxPoint aStart, wxPoint aEnd, LSET aLayerMask );
void addFpBody( const wxPoint& aStart, const wxPoint& aEnd, LSET aLayerMask );
// Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack
void addPad( PAD* aPad, int aClearance );
@ -126,8 +127,10 @@ private:
SHAPE_POLY_SET m_topFreeArea; // The polygonal description of the top side free areas;
SHAPE_POLY_SET m_bottomFreeArea; // The polygonal description of the bottom side free areas;
SHAPE_POLY_SET m_boardShape; // The polygonal description of the board;
SHAPE_POLY_SET m_fpAreaTop; // The polygonal description of the footprint to place, top side;
SHAPE_POLY_SET m_fpAreaBottom; // The polygonal description of the footprint to place, bottom side;
SHAPE_POLY_SET m_fpAreaTop; // The polygonal description of the footprint to place,
// top side;
SHAPE_POLY_SET m_fpAreaBottom; // The polygonal description of the footprint to place,
// bottom side;
BOARD* m_board;

View File

@ -145,7 +145,7 @@ static const std::vector<NUMBERING_LIST_DATA> numberingTypeData {
DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY( PCB_BASE_FRAME* aParent,
std::unique_ptr<ARRAY_OPTIONS>& aSettings,
bool enableNumbering, wxPoint aOrigPos ) :
bool enableNumbering, const wxPoint& aOrigPos ) :
DIALOG_CREATE_ARRAY_BASE( aParent ),
m_settings( aSettings ),
m_originalItemPosition( aOrigPos ),
@ -503,4 +503,4 @@ void DIALOG_CREATE_ARRAY::calculateCircularArrayProperties()
centre -= m_originalItemPosition;
m_circRadius.SetValue( int( centre.EuclideanNorm() ) );
}
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 John Beard, john.j.beard@gmail.com
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -49,7 +49,7 @@ public:
* @param aOrigPos original item position (used for computing the circular array radius)
*/
DIALOG_CREATE_ARRAY( PCB_BASE_FRAME* aParent, std::unique_ptr<ARRAY_OPTIONS>& aOptions,
bool enableNumbering, wxPoint aOrigPos );
bool enableNumbering, const wxPoint& aOrigPos );
private:
// Event callbacks

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2004-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2017-2020 KiCad Developers, see change_log.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
@ -189,7 +189,6 @@ void DRC_ENGINE::loadImplicitRules()
silkClearanceConstraint.Value().SetMin( bds.m_SilkClearance );
rule->AddConstraint( silkClearanceConstraint );
// 2) micro-via specific defaults (new DRC doesn't treat microvias in any special way)
DRC_RULE* uViaRule = createImplicitRule( _( "board setup micro-via constraints" ) );
@ -461,6 +460,7 @@ void DRC_ENGINE::loadImplicitRules()
(int) netclassClearanceRules.size() ) );
}
static wxString formatConstraint( const DRC_CONSTRAINT& constraint )
{
struct FORMATTER
@ -523,9 +523,6 @@ static wxString formatConstraint( const DRC_CONSTRAINT& constraint )
}
/**
* @throws PARSE_ERROR
*/
void DRC_ENGINE::loadRules( const wxFileName& aPath )
{
if( aPath.FileExists() )
@ -622,9 +619,6 @@ void DRC_ENGINE::compileRules()
}
/**
* @throws PARSE_ERROR
*/
void DRC_ENGINE::InitEngine( const wxFileName& aRulePath )
{
m_testProviders = DRC_TEST_PROVIDER_REGISTRY::Instance().GetTestProviders();
@ -1107,7 +1101,7 @@ bool DRC_ENGINE::IsErrorLimitExceeded( int error_code )
}
void DRC_ENGINE::ReportViolation( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
void DRC_ENGINE::ReportViolation( const std::shared_ptr<DRC_ITEM>& aItem, const wxPoint& aPos )
{
m_errorLimits[ aItem->GetErrorCode() ] -= 1;
@ -1136,6 +1130,7 @@ void DRC_ENGINE::ReportViolation( const std::shared_ptr<DRC_ITEM>& aItem, wxPoin
}
}
void DRC_ENGINE::ReportAux ( const wxString& aStr )
{
if( !m_reporter )
@ -1323,8 +1318,10 @@ bool DRC_ENGINE::IsNetTie( BOARD_ITEM* aItem )
DRC_TEST_PROVIDER* DRC_ENGINE::GetTestProvider( const wxString& name ) const
{
for( auto prov : m_testProviders )
{
if( name == prov->GetName() )
return prov;
}
return nullptr;
}

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