GerbView code cleaning.

This commit is contained in:
Wayne Stambaugh 2021-07-28 13:52:07 -04:00
parent f233f4a0a9
commit de92aaab9a
3 changed files with 30 additions and 29 deletions

View File

@ -146,15 +146,15 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC, void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC,
COLOR4D aColor, const wxPoint& aShapePos, bool aFilledShape ) const COLOR4D& aColor, const wxPoint& aShapePos, bool aFilledShape )
{ {
int radius; int radius;
switch( m_Shape ) switch( m_Shape )
{ {
case APT_MACRO: case APT_MACRO:
GetMacro()->DrawApertureMacroShape( aParent, aClipBox, aDC, aColor, GetMacro()->DrawApertureMacroShape( aParent, aClipBox, aDC, aColor, aShapePos,
aShapePos, aFilledShape); aFilledShape );
break; break;
case APT_CIRCLE: case APT_CIRCLE:
@ -218,14 +218,14 @@ void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wx
if( m_Size.x > m_Size.y ) // horizontal oval if( m_Size.x > m_Size.y ) // horizontal oval
{ {
int delta = (m_Size.x - m_Size.y) / 2; int delta = ( m_Size.x - m_Size.y ) / 2;
start.x -= delta; start.x -= delta;
end.x += delta; end.x += delta;
radius = m_Size.y; // Width in fact radius = m_Size.y; // Width in fact
} }
else // vertical oval else // vertical oval
{ {
int delta = (m_Size.y - m_Size.x) / 2; int delta = ( m_Size.y - m_Size.x ) / 2;
start.y -= delta; start.y -= delta;
end.y += delta; end.y += delta;
radius = m_Size.x; // Width in fact radius = m_Size.x; // Width in fact
@ -264,7 +264,7 @@ void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wx
void D_CODE::DrawFlashedPolygon( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC, void D_CODE::DrawFlashedPolygon( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC,
COLOR4D aColor, bool aFilled, const wxPoint& aPosition ) const COLOR4D& aColor, bool aFilled, const wxPoint& aPosition )
{ {
if( m_Polygon.OutlineCount() == 0 ) if( m_Polygon.OutlineCount() == 0 )
return; return;

View File

@ -144,7 +144,7 @@ public:
* @param aFilledShape set to true to draw in filled mode, false to draw in sketch mode * @param aFilledShape set to true to draw in filled mode, false to draw in sketch mode
*/ */
void DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC, void DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC,
COLOR4D aColor, const wxPoint& aShapePos, bool aFilledShape ); const COLOR4D& aColor, const wxPoint& aShapePos, bool aFilledShape );
/** /**
* A helper function used to draw the polygon stored in m_PolyCorners. * A helper function used to draw the polygon stored in m_PolyCorners.
@ -161,7 +161,7 @@ public:
* @param aPosition is the actual shape position. * @param aPosition is the actual shape position.
*/ */
void DrawFlashedPolygon( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC, void DrawFlashedPolygon( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC,
COLOR4D aColor, bool aFilled, const wxPoint& aPosition ); const COLOR4D& aColor, bool aFilled, const wxPoint& aPosition );
/** /**
* Convert a shape to an equivalent polygon. * Convert a shape to an equivalent polygon.

View File

@ -41,8 +41,7 @@ namespace KIGFX
class GAL; class GAL;
/** /**
* GERBVIEW_RENDER_SETTINGS * Store GerbView specific render settings.
* Stores GerbView specific render settings.
*/ */
class GERBVIEW_RENDER_SETTINGS : public RENDER_SETTINGS class GERBVIEW_RENDER_SETTINGS : public RENDER_SETTINGS
{ {
@ -54,8 +53,8 @@ public:
void LoadColors( const COLOR_SETTINGS* aSettings ) override; void LoadColors( const COLOR_SETTINGS* aSettings ) override;
/** /**
* Function LoadDisplayOptions * Load settings related to display options.
* Loads settings related to display options *
* @param aOptions are settings that you want to use for displaying items. * @param aOptions are settings that you want to use for displaying items.
*/ */
void LoadDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions ); void LoadDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions );
@ -64,8 +63,8 @@ public:
virtual COLOR4D GetColor( const VIEW_ITEM* aItem, int aLayer ) const override; virtual COLOR4D GetColor( const VIEW_ITEM* aItem, int aLayer ) const override;
/** /**
* Function GetLayerColor * Return the color used to draw a layer.
* Returns the color used to draw a layer. *
* @param aLayer is the layer number. * @param aLayer is the layer number.
*/ */
inline const COLOR4D& GetLayerColor( int aLayer ) const inline const COLOR4D& GetLayerColor( int aLayer ) const
@ -74,8 +73,8 @@ public:
} }
/** /**
* Function SetLayerColor * Change the color used to draw a layer.
* Changes the color used to draw a layer. *
* @param aLayer is the layer number. * @param aLayer is the layer number.
* @param aColor is the new color. * @param aColor is the new color.
*/ */
@ -86,7 +85,10 @@ public:
update(); // recompute other shades of the color update(); // recompute other shades of the color
} }
const COLOR4D& GetBackgroundColor() override { return m_layerColors[ LAYER_GERBVIEW_BACKGROUND ]; } const COLOR4D& GetBackgroundColor() override
{
return m_layerColors[ LAYER_GERBVIEW_BACKGROUND ];
}
void SetBackgroundColor( const COLOR4D& aColor ) override void SetBackgroundColor( const COLOR4D& aColor ) override
{ {
@ -165,8 +167,7 @@ protected:
/** /**
* GERBVIEW_PAINTER * Methods for drawing GerbView specific items.
* Contains methods for drawing GerbView-specific items.
*/ */
class GERBVIEW_PAINTER : public PAINTER class GERBVIEW_PAINTER : public PAINTER
{ {
@ -189,11 +190,12 @@ protected:
void draw( /*const*/ GERBER_DRAW_ITEM* aVia, int aLayer ); void draw( /*const*/ GERBER_DRAW_ITEM* aVia, int aLayer );
/** /**
* Helper routine to draw a polygon * Helper routine to draw a polygon.
* @param aParent Pointer to the draw item for AB Position calculation *
* @param aPolygon the polygon to draw * @param aParent Pointer to the draw item for AB Position calculation.
* @param aFilled If true, draw the polygon as filled, otherwise only outline * @param aPolygon the polygon to draw.
* @param aShift If true, draw the polygon relative to the parent item position * @param aFilled If true, draw the polygon as filled, otherwise only outline.
* @param aShift If true, draw the polygon relative to the parent item position.
*/ */
void drawPolygon( GERBER_DRAW_ITEM* aParent, const SHAPE_POLY_SET& aPolygon, void drawPolygon( GERBER_DRAW_ITEM* aParent, const SHAPE_POLY_SET& aPolygon,
bool aFilled, bool aShift = false ); bool aFilled, bool aShift = false );
@ -205,11 +207,10 @@ protected:
void drawApertureMacro( GERBER_DRAW_ITEM* aParent, bool aFilled ); void drawApertureMacro( GERBER_DRAW_ITEM* aParent, bool aFilled );
/** /**
* Function getLineThickness() * Get the thickness to draw for a line (e.g. 0 thickness lines get a minimum value).
* Get the thickness to draw for a line (e.g. 0 thickness lines *
* get a minimum value). * @param aActualThickness line own thickness.
* @param aActualThickness line own thickness * @return the thickness to draw.
* @return the thickness to draw
*/ */
int getLineThickness( int aActualThickness ) const; int getLineThickness( int aActualThickness ) const;
}; };