hpgl_plotter: correct formatting
This commit is contained in:
parent
f5b7595675
commit
6f228f9dea
|
@ -288,18 +288,20 @@ bool HPGL_PLOTTER::EndPlot()
|
|||
if( fitUserCoords )
|
||||
{
|
||||
BOX2D bbox = m_items.front().bbox;
|
||||
for( HPGL_ITEM const& item: m_items )
|
||||
for( HPGL_ITEM const& item : m_items )
|
||||
{
|
||||
bbox.Merge( item.bbox );
|
||||
}
|
||||
|
||||
fprintf( m_outputFile, "SC%.0f,%.0f,%.0f,%.0f;\n", bbox.GetX(), bbox.GetX() + bbox.GetWidth(),
|
||||
bbox.GetY(), bbox.GetY() + bbox.GetHeight() );
|
||||
fprintf( m_outputFile, "SC%.0f,%.0f,%.0f,%.0f;\n", bbox.GetX(),
|
||||
bbox.GetX() + bbox.GetWidth(), bbox.GetY(),
|
||||
bbox.GetY() + bbox.GetHeight() );
|
||||
}
|
||||
else
|
||||
{
|
||||
DPOINT pagesize_dev( m_paperSize * m_iuPerDeviceUnit );
|
||||
fprintf( m_outputFile, "SC%.0f,%.0f,%.0f,%.0f;\n", 0., pagesize_dev.x, 0., pagesize_dev.y );
|
||||
fprintf( m_outputFile, "SC%.0f,%.0f,%.0f,%.0f;\n", 0., pagesize_dev.x, 0.,
|
||||
pagesize_dev.y );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -435,8 +437,7 @@ void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_TYPE fill,
|
|||
m_current_item->lift_before = true;
|
||||
m_current_item->pen_returns = true;
|
||||
m_current_item->bbox.Merge(
|
||||
BOX2D( center_dev - radius, VECTOR2D( 2 * radius, 2 * radius ) )
|
||||
);
|
||||
BOX2D( center_dev - radius, VECTOR2D( 2 * radius, 2 * radius ) ) );
|
||||
PenFinish();
|
||||
}
|
||||
|
||||
|
@ -447,8 +448,7 @@ void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_TYPE fill,
|
|||
m_current_item->lift_before = true;
|
||||
m_current_item->pen_returns = true;
|
||||
m_current_item->bbox.Merge(
|
||||
BOX2D( center_dev - radius, VECTOR2D( 2 * radius, 2 * radius ) )
|
||||
);
|
||||
BOX2D( center_dev - radius, VECTOR2D( 2 * radius, 2 * radius ) ) );
|
||||
PenFinish();
|
||||
}
|
||||
}
|
||||
|
@ -630,9 +630,8 @@ void HPGL_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
|
|||
centre_dev.y, angle, chord_degrees ) );
|
||||
|
||||
// TODO We could compute the final position and full bounding box instead...
|
||||
m_current_item->bbox.Merge( BOX2D(
|
||||
centre_dev - radius_dev, VECTOR2D( radius_dev * 2, radius_dev * 2 )
|
||||
) );
|
||||
m_current_item->bbox.Merge(
|
||||
BOX2D( centre_dev - radius_dev, VECTOR2D( radius_dev * 2, radius_dev * 2 ) ) );
|
||||
m_current_item->lift_after = true;
|
||||
flushItem();
|
||||
}
|
||||
|
|
|
@ -55,16 +55,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 ) { 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 ) { fitUserCoords = user_coords_fit; }
|
||||
|
||||
virtual bool StartPlot() override;
|
||||
virtual bool EndPlot() override;
|
||||
|
@ -156,12 +150,7 @@ protected:
|
|||
|
||||
struct HPGL_ITEM
|
||||
{
|
||||
HPGL_ITEM()
|
||||
: lift_before( false ),
|
||||
lift_after( false ),
|
||||
pen_returns( false ),
|
||||
pen( 0 )
|
||||
{}
|
||||
HPGL_ITEM() : lift_before( false ), lift_after( false ), pen_returns( false ), pen( 0 ) {}
|
||||
|
||||
/// Location the pen should start at
|
||||
DPOINT loc_start;
|
||||
|
|
|
@ -40,7 +40,8 @@ enum PageFormatReq {
|
|||
PAGE_SIZE_A
|
||||
};
|
||||
|
||||
enum class HPGL_PLOT_ORIGIN_AND_UNITS {
|
||||
enum class HPGL_PLOT_ORIGIN_AND_UNITS
|
||||
{
|
||||
PLOTTER_BOT_LEFT,
|
||||
PLOTTER_CENTER,
|
||||
USER_FIT_PAGE,
|
||||
|
@ -119,39 +120,27 @@ private:
|
|||
wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
|
||||
|
||||
// HPGL
|
||||
HPGL_PLOT_ORIGIN_AND_UNITS GetPlotOriginAndUnits()
|
||||
HPGL_PLOT_ORIGIN_AND_UNITS GetPlotOriginAndUnits()
|
||||
{
|
||||
switch( m_plotOriginOpt->GetSelection() )
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
return HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT;
|
||||
case 1:
|
||||
return HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER;
|
||||
case 2:
|
||||
return HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE;
|
||||
case 3:
|
||||
return HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT;
|
||||
default: return HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT;
|
||||
case 1: return HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER;
|
||||
case 2: return HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE;
|
||||
case 3: return HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT;
|
||||
}
|
||||
}
|
||||
|
||||
void SetPlotOriginAndUnits( HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits )
|
||||
void SetPlotOriginAndUnits( HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits )
|
||||
{
|
||||
switch( aOriginAndUnits )
|
||||
{
|
||||
case HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT:
|
||||
default:
|
||||
m_plotOriginOpt->SetSelection( 0 );
|
||||
break;
|
||||
case HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER:
|
||||
m_plotOriginOpt->SetSelection( 1 );
|
||||
break;
|
||||
case HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE:
|
||||
m_plotOriginOpt->SetSelection( 2 );
|
||||
break;
|
||||
case HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT:
|
||||
m_plotOriginOpt->SetSelection( 3 );
|
||||
break;
|
||||
default: m_plotOriginOpt->SetSelection( 0 ); break;
|
||||
case HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER: m_plotOriginOpt->SetSelection( 1 ); break;
|
||||
case HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE: m_plotOriginOpt->SetSelection( 2 ); break;
|
||||
case HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT: m_plotOriginOpt->SetSelection( 3 ); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue