Yeet wxPoint/wxSize out of PLOTTER

This commit is contained in:
Mark Roszko
2021-12-29 19:02:50 +00:00
parent ccb94fd1a7
commit 44dc602d6b
28 changed files with 634 additions and 597 deletions
+29 -29
View File
@@ -233,7 +233,7 @@ HPGL_PLOTTER::HPGL_PLOTTER()
}
void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
void HPGL_PLOTTER::SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
m_plotOffset = aOffset;
@@ -383,7 +383,7 @@ void HPGL_PLOTTER::SetPenDiameter( double diameter )
}
void HPGL_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
void HPGL_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width )
{
wxASSERT( m_outputFile );
@@ -405,7 +405,7 @@ void HPGL_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int
}
void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int width )
void HPGL_PLOTTER::Circle( const VECTOR2I& centre, int diameter, FILL_T fill, int width )
{
wxASSERT( m_outputFile );
double radius = userToDeviceSize( diameter / 2 );
@@ -451,7 +451,7 @@ void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int
}
void HPGL_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList, FILL_T aFill, int aWidth,
void HPGL_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill, int aWidth,
void* aData )
{
if( aCornerList.size() <= 1 )
@@ -506,7 +506,7 @@ void HPGL_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList, FILL_T aFi
}
void HPGL_PLOTTER::PenTo( const wxPoint& pos, char plume )
void HPGL_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
{
wxASSERT( m_outputFile );
@@ -544,7 +544,7 @@ void HPGL_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
}
void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end,
void HPGL_PLOTTER::ThickSegment( const VECTOR2I& start, const VECTOR2I& end,
int width, OUTLINE_MODE tracemode, void* aData )
{
wxASSERT( m_outputFile );
@@ -562,7 +562,7 @@ void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end,
}
void HPGL_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
void HPGL_PLOTTER::Arc( const VECTOR2I& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width )
{
wxASSERT( m_outputFile );
@@ -596,7 +596,7 @@ void HPGL_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
angle /= 10;
// Calculate arc start point:
wxPoint cmap;
VECTOR2I cmap;
cmap.x = centre.x + KiROUND( cosdecideg( radius, StAngle ) );
cmap.y = centre.y - KiROUND( sindecideg( radius, StAngle ) );
DPOINT cmap_dev = userToDeviceCoordinates( cmap );
@@ -612,12 +612,12 @@ void HPGL_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
}
void HPGL_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
void HPGL_PLOTTER::FlashPadOval( const VECTOR2I& pos, const VECTOR2I& aSize, double orient,
OUTLINE_MODE trace_mode, void* aData )
{
wxASSERT( m_outputFile );
int deltaxy, cx, cy;
wxSize size( aSize );
VECTOR2I size( aSize );
// The pad will be drawn as an oblong shape with size.y > size.x (Oval vertical orientation 0).
if( size.x > size.y )
@@ -630,14 +630,14 @@ void HPGL_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double
if( trace_mode == FILLED )
{
FlashPadRect( pos, wxSize( size.x, deltaxy + KiROUND( penDiameter ) ),
FlashPadRect( pos, VECTOR2I( size.x, deltaxy + KiROUND( penDiameter ) ),
orient, trace_mode, aData );
cx = 0; cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
FlashPadCircle( wxPoint( cx + pos.x, cy + pos.y ), size.x, trace_mode, aData );
FlashPadCircle( VECTOR2I( cx + pos.x, cy + pos.y ), size.x, trace_mode, aData );
cx = 0; cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
FlashPadCircle( wxPoint( cx + pos.x, cy + pos.y ), size.x, trace_mode, aData );
FlashPadCircle( VECTOR2I( cx + pos.x, cy + pos.y ), size.x, trace_mode, aData );
}
else // Plot in outline mode.
{
@@ -646,7 +646,7 @@ void HPGL_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double
}
void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
void HPGL_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre,
OUTLINE_MODE trace_mode, void* aData )
{
wxASSERT( m_outputFile );
@@ -670,10 +670,10 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
{
// A filled polygon uses always the current point to start the polygon.
// Gives a correct current starting point for the circle
MoveTo( wxPoint( pos.x+radius, pos.y ) );
MoveTo( VECTOR2I( pos.x + radius, pos.y ) );
// Plot filled area and its outline
startOrAppendItem( userToDeviceCoordinates( wxPoint( pos.x + radius, pos.y ) ),
startOrAppendItem( userToDeviceCoordinates( VECTOR2I( pos.x + radius, pos.y ) ),
wxString::Format( "PM 0; PA %.0f,%.0f;CI %.0f;%s",
pos_dev.x, pos_dev.y, rsize, hpgl_end_polygon_cmd ) );
m_current_item->lift_before = true;
@@ -691,11 +691,11 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
}
void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
void HPGL_PLOTTER::FlashPadRect( const VECTOR2I& pos, const VECTOR2I& padsize,
double orient, OUTLINE_MODE trace_mode, void* aData )
{
// Build rect polygon:
std::vector<wxPoint> corners;
std::vector<VECTOR2I> corners;
int dx = padsize.x / 2;
int dy = padsize.y / 2;
@@ -721,7 +721,7 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
for( unsigned ii = 0; ii < corners.size(); ii++ )
{
RotatePoint( &corners[ii], orient );
RotatePoint( corners[ii], orient );
corners[ii] += pos;
}
@@ -729,13 +729,13 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
}
void HPGL_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
void HPGL_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, double aOrient,
OUTLINE_MODE aTraceMode, void* aData )
{
SHAPE_POLY_SET outline;
wxSize size = aSize;
VECTOR2I size = aSize;
if( aTraceMode == FILLED )
{
@@ -753,7 +753,7 @@ void HPGL_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSiz
0.0, 0, 0, GetPlotterArcHighDef(), ERROR_INSIDE );
// TransformRoundRectToPolygon creates only one convex polygon
std::vector<wxPoint> cornerList;
std::vector<VECTOR2I> cornerList;
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
cornerList.reserve( poly.PointCount() );
@@ -767,10 +767,10 @@ void HPGL_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSiz
}
void HPGL_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize, double aOrient,
void HPGL_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize, double aOrient,
SHAPE_POLY_SET* aPolygons, OUTLINE_MODE aTraceMode, void* aData )
{
std::vector< wxPoint > cornerList;
std::vector<VECTOR2I> cornerList;
for( int cnt = 0; cnt < aPolygons->OutlineCount(); ++cnt )
{
@@ -790,16 +790,16 @@ void HPGL_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
}
void HPGL_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorners,
void HPGL_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
double aPadOrient, OUTLINE_MODE aTraceMode, void* aData )
{
std::vector< wxPoint > cornerList;
std::vector<VECTOR2I> cornerList;
cornerList.reserve( 5 );
for( int ii = 0; ii < 4; ii++ )
{
wxPoint coord( aCorners[ii] );
RotatePoint( &coord, aPadOrient );
VECTOR2I coord( aCorners[ii] );
RotatePoint( coord, aPadOrient );
coord += aPadPos;
cornerList.push_back( coord );
}
@@ -811,7 +811,7 @@ void HPGL_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorne
}
void HPGL_PLOTTER::FlashRegularPolygon( const wxPoint& aShapePos, int aRadius, int aCornerCount,
void HPGL_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aRadius, int aCornerCount,
double aOrient, OUTLINE_MODE aTraceMode, void* aData )
{
// Do nothing