Naming conventions.

This commit is contained in:
Jeff Young 2022-06-28 12:21:00 -06:00
parent dbbdc9d2e6
commit b512d64148
3 changed files with 56 additions and 56 deletions

View File

@ -219,13 +219,13 @@ static const char hpgl_end_polygon_cmd[] = "PM 2; FP; EP;\n";
static const double PLUsPERDECIMIL = 0.1016;
HPGL_PLOTTER::HPGL_PLOTTER()
: arcTargetChordLength( 0 ),
arcMinChordDegrees( 5.0, DEGREES_T ),
m_lineStyle( PLOT_DASH_TYPE::SOLID ),
useUserCoords( false ),
fitUserCoords( false ),
m_current_item( nullptr )
HPGL_PLOTTER::HPGL_PLOTTER() :
m_arcTargetChordLength( 0 ),
m_arcMinChordDegrees( 5.0, DEGREES_T ),
m_lineStyle( PLOT_DASH_TYPE::SOLID ),
m_useUserCoords( false ),
m_fitUserCoords( false ),
m_current_item( nullptr )
{
SetPenSpeed( 40 ); // Default pen speed = 40 cm/s; Pen speed is *always* in cm
SetPenNumber( 1 ); // Default pen num = 1
@ -251,17 +251,17 @@ void HPGL_PLOTTER::SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
void HPGL_PLOTTER::SetTargetChordLength( double chord_len )
{
arcTargetChordLength = userToDeviceSize( chord_len );
m_arcTargetChordLength = userToDeviceSize( chord_len );
}
bool HPGL_PLOTTER::StartPlot()
{
wxASSERT( m_outputFile );
fprintf( m_outputFile, "IN;VS%d;PU;PA;SP%d;\n", penSpeed, penNumber );
fprintf( m_outputFile, "IN;VS%d;PU;PA;SP%d;\n", m_penSpeed, m_penNumber );
// Set HPGL Pen Thickness (in mm) (useful in polygon fill command)
double penThicknessMM = userToDeviceSize( penDiameter )/40;
double penThicknessMM = userToDeviceSize( m_penDiameter ) / 40;
fprintf( m_outputFile, "PT %.1f;\n", penThicknessMM );
return true;
@ -279,9 +279,9 @@ bool HPGL_PLOTTER::EndPlot()
if( m_items.size() > 0 )
{
if( useUserCoords )
if( m_useUserCoords )
{
if( fitUserCoords )
if( m_fitUserCoords )
{
BOX2D bbox = m_items.front().bbox;
@ -308,7 +308,7 @@ bool HPGL_PLOTTER::EndPlot()
VECTOR2I loc = m_items.begin()->loc_start;
bool pen_up = true;
PLOT_DASH_TYPE current_dash = PLOT_DASH_TYPE::SOLID;
int current_pen = penNumber;
int current_pen = m_penNumber;
for( HPGL_ITEM const& item : m_items )
{
@ -326,7 +326,7 @@ bool HPGL_PLOTTER::EndPlot()
if( item.dashType != current_dash )
{
current_dash = item.dashType;
fputs( lineTypeCommand( item.dashType ), m_outputFile );
fputs( lineStyleCommand( item.dashType ), m_outputFile );
}
if( item.pen != current_pen )
@ -383,7 +383,7 @@ bool HPGL_PLOTTER::EndPlot()
void HPGL_PLOTTER::SetPenDiameter( double diameter )
{
penDiameter = diameter;
m_penDiameter = diameter;
}
@ -421,10 +421,10 @@ void HPGL_PLOTTER::Circle( const VECTOR2I& aCenter, int aDiameter, FILL_T aFill,
SetCurrentLineWidth( aWidth );
double const circumf = 2.0 * M_PI * radius;
double const target_chord_length = arcTargetChordLength;
double const target_chord_length = m_arcTargetChordLength;
EDA_ANGLE chord_angle = ANGLE_360 * target_chord_length / circumf;
chord_angle = std::max( arcMinChordDegrees, std::min( chord_angle, ANGLE_45 ) );
chord_angle = std::max( m_arcMinChordDegrees, std::min( chord_angle, ANGLE_45 ) );
if( aFill == FILL_T::FILLED_SHAPE )
{
@ -555,7 +555,7 @@ void HPGL_PLOTTER::ThickSegment( const VECTOR2I& start, const VECTOR2I& end,
wxASSERT( m_outputFile );
// Suppress overlap if pen is too big
if( penDiameter >= width )
if( m_penDiameter >= width )
{
MoveTo( start );
FinishTo( end );
@ -575,10 +575,10 @@ void HPGL_PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
double const radius_device = userToDeviceSize( aRadius );
double const circumf_device = 2.0 * M_PI * radius_device;
double const target_chord_length = arcTargetChordLength;
double const target_chord_length = m_arcTargetChordLength;
EDA_ANGLE chord_angle = ANGLE_360 * target_chord_length / circumf_device;
chord_angle = std::max( arcMinChordDegrees, std::min( chord_angle, ANGLE_45 ) );
chord_angle = std::max( m_arcMinChordDegrees, std::min( chord_angle, ANGLE_45 ) );
VECTOR2D centre_device = userToDeviceCoordinates( aCenter );
EDA_ANGLE angle;
@ -640,7 +640,7 @@ void HPGL_PLOTTER::FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize,
{
int deltaxy = size.y - size.x; // distance between centers of the oval
FlashPadRect( aPos, VECTOR2I( size.x, deltaxy + KiROUND( penDiameter ) ), orient,
FlashPadRect( aPos, VECTOR2I( size.x, deltaxy + KiROUND( m_penDiameter ) ), orient,
aTraceMode, aData );
VECTOR2I pt( 0, deltaxy / 2 );
@ -653,7 +653,7 @@ void HPGL_PLOTTER::FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize,
}
else // Plot in outline mode.
{
sketchOval( aPos, size, orient, KiROUND( penDiameter ) );
sketchOval( aPos, size, orient, KiROUND( m_penDiameter ) );
}
}
@ -669,7 +669,7 @@ void HPGL_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre,
{
// if filled mode, the pen diameter is removed from diameter
// to keep the pad size
radius -= KiROUND( penDiameter ) / 2;
radius -= KiROUND( m_penDiameter ) / 2;
if( radius < 0 )
radius = 0;
@ -715,9 +715,9 @@ void HPGL_PLOTTER::FlashPadRect( const VECTOR2I& aPos, const VECTOR2I& aPadSize,
{
// in filled mode, the pen diameter is removed from size
// to compensate the extra size due to this pen size
dx -= KiROUND( penDiameter ) / 2;
dx -= KiROUND( m_penDiameter ) / 2;
dx = std::max( dx, 0);
dy -= KiROUND( penDiameter ) / 2;
dy -= KiROUND( m_penDiameter ) / 2;
dy = std::max( dy, 0);
}
@ -751,9 +751,9 @@ void HPGL_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& a
if( aTraceMode == FILLED )
{
// In filled mode, the pen diameter is removed from size to keep the pad size.
size.x -= KiROUND( penDiameter ) / 2;
size.x -= KiROUND( m_penDiameter ) / 2;
size.x = std::max( size.x, 0);
size.y -= KiROUND( penDiameter ) / 2;
size.y -= KiROUND( m_penDiameter ) / 2;
size.y = std::max( size.y, 0);
// keep aCornerRadius to a value < min size x,y < 2:
@ -853,7 +853,7 @@ bool HPGL_PLOTTER::startOrAppendItem( const VECTOR2D& location, wxString const&
item.loc_start = location;
item.loc_end = location;
item.bbox = BOX2D( location );
item.pen = penNumber;
item.pen = m_penNumber;
item.dashType = m_lineStyle;
item.content = content;
m_items.push_back( item );
@ -931,9 +931,9 @@ void HPGL_PLOTTER::sortItems( std::list<HPGL_ITEM>& items )
}
const char* HPGL_PLOTTER::lineTypeCommand( PLOT_DASH_TYPE linetype )
const char* HPGL_PLOTTER::lineStyleCommand( PLOT_DASH_TYPE aLineStyle )
{
switch( linetype )
switch( aLineStyle )
{
case PLOT_DASH_TYPE::DASH: return "LT 2 4 1;";
case PLOT_DASH_TYPE::DOT: return "LT 1 1 1;";

View File

@ -154,19 +154,19 @@ public:
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;
virtual void Text( const VECTOR2I& aPos,
const COLOR4D& aColor,
const wxString& aText,
const EDA_ANGLE& aOrient,
const VECTOR2I& aSize,
enum GR_TEXT_H_ALIGN_T aH_justify,
enum GR_TEXT_V_ALIGN_T aV_justify,
int aWidth,
bool aItalic,
bool aBold,
bool aMultilineAllowed = false,
KIFONT::FONT* aFont = nullptr,
void* aData = nullptr ) override;
virtual void Text( const VECTOR2I& aPos,
const COLOR4D& aColor,
const wxString& aText,
const EDA_ANGLE& aOrient,
const VECTOR2I& aSize,
enum GR_TEXT_H_ALIGN_T aH_justify,
enum GR_TEXT_V_ALIGN_T aV_justify,
int aWidth,
bool aItalic,
bool aBold,
bool aMultilineAllowed = false,
KIFONT::FONT* aFont = nullptr,
void* aData = nullptr ) override;
/**

View File

@ -53,10 +53,10 @@ public:
void SetTargetChordLength( double chord_len );
/// Switch to the user coordinate system
void SetUserCoords( bool user_coords ) { useUserCoords = user_coords; }
void SetUserCoords( bool user_coords ) { m_useUserCoords = user_coords; }
/// Set whether the user coordinate system is fit to content
void SetUserCoordsFit( bool user_coords_fit ) { fitUserCoords = user_coords_fit; }
void SetUserCoordsFit( bool user_coords_fit ) { m_fitUserCoords = user_coords_fit; }
/**
* At the start of the HPGL plot pen speed and number are requested.
@ -72,7 +72,7 @@ public:
virtual void SetCurrentLineWidth( int width, void* aData = nullptr ) override
{
// This is the truth
m_currentPenWidth = userToDeviceSize( penDiameter );
m_currentPenWidth = userToDeviceSize( m_penDiameter );
}
/**
@ -84,12 +84,12 @@ public:
virtual void SetPenSpeed( int speed )
{
penSpeed = speed;
m_penSpeed = speed;
}
virtual void SetPenNumber( int number )
{
penNumber = number;
m_penNumber = number;
}
virtual void SetPenDiameter( double diameter );
@ -212,17 +212,17 @@ protected:
static void sortItems( std::list<HPGL_ITEM>& items );
/// Return the plot command corresponding to a line type
static const char* lineTypeCommand( PLOT_DASH_TYPE linetype );
static const char* lineStyleCommand( PLOT_DASH_TYPE aLineStyle );
protected:
int penSpeed;
int penNumber;
double penDiameter;
double arcTargetChordLength;
EDA_ANGLE arcMinChordDegrees;
int m_penSpeed;
int m_penNumber;
double m_penDiameter;
double m_arcTargetChordLength;
EDA_ANGLE m_arcMinChordDegrees;
PLOT_DASH_TYPE m_lineStyle;
bool useUserCoords;
bool fitUserCoords;
bool m_useUserCoords;
bool m_fitUserCoords;
std::list<HPGL_ITEM> m_items;
HPGL_ITEM* m_current_item;