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

View File

@ -132,9 +132,9 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
setupPainter( *painter );
setupViewLayers( *view, m_settings.m_LayerSet );
wxSize sheetSizeMils = m_settings.m_pageInfo.GetSizeMils();
VECTOR2I sheetSizeIU( milsToIU( sheetSizeMils.GetWidth() ),
milsToIU( sheetSizeMils.GetHeight() ) );
VECTOR2I sheetSizeMils = m_settings.m_pageInfo.GetSizeMils();
VECTOR2I sheetSizeIU( milsToIU( sheetSizeMils.x ),
milsToIU( sheetSizeMils.y ) );
BOX2I bBox;
// Determine printout bounding box

View File

@ -746,7 +746,8 @@ void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog()
wxASSERT( i != arrayDim(papers) ); // dialog UI match the above list?
m_layout_size = pageInfo.GetSizeMils();
VECTOR2I sz = pageInfo.GetSizeMils();
m_layout_size = wxSize( sz.x, sz.y );
// swap sizes to match orientation
bool isPortrait = (bool) m_orientationComboBox->GetSelection();

View File

@ -81,7 +81,7 @@ float Clamp_Text_PenSize( float aPenSize, int aSize, bool aBold )
}
int Clamp_Text_PenSize( int aPenSize, const wxSize& aSize, bool aBold )
int Clamp_Text_PenSize( int aPenSize, const VECTOR2I& aSize, bool aBold )
{
int size = std::min( std::abs( aSize.x ), std::abs( aSize.y ) );
@ -89,7 +89,7 @@ int Clamp_Text_PenSize( int aPenSize, const wxSize& aSize, bool aBold )
}
int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool aItalic, bool aBold )
int GraphicTextWidth( const wxString& aText, const VECTOR2I& aSize, bool aItalic, bool aBold )
{
basic_gal.SetFontItalic( aItalic );
basic_gal.SetFontBold( aBold );
@ -126,8 +126,8 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool aItalic,
* @param aPlotter is a PLOTTER instance, when this function is used to plot
* the text. NULL to draw this text.
*/
void GRText( wxDC* aDC, const wxPoint& aPos, const COLOR4D& aColor, const wxString& aText,
const EDA_ANGLE& aOrient, const wxSize& aSize, enum GR_TEXT_H_ALIGN_T aH_justify,
void GRText( wxDC* aDC, 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,
KIFONT::FONT* aFont, void (* aCallback)( int x0, int y0, int xf, int yf, void* aData ),
void* aCallbackData, PLOTTER* aPlotter )
@ -152,7 +152,7 @@ void GRText( wxDC* aDC, const wxPoint& aPos, const COLOR4D& aColor, const wxStri
dummy.SetHorizJustify( aH_justify );
dummy.SetVertJustify( aV_justify );
wxSize size = aSize;
wxSize size = wxSize( aSize.x, aSize.y );
dummy.SetMirrored( size.x < 0 );
if( size.x < 0 )

View File

@ -141,7 +141,7 @@ void DXF_PLOTTER::SetUnits( DXF_UNITS aUnit )
}
void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
void DXF_PLOTTER::SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
m_plotOffset = aOffset;
@ -409,18 +409,18 @@ void DXF_PLOTTER::SetColor( const COLOR4D& color )
}
void DXF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
void DXF_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width )
{
wxASSERT( m_outputFile );
MoveTo( p1 );
LineTo( wxPoint( p1.x, p2.y ) );
LineTo( wxPoint( p2.x, p2.y ) );
LineTo( wxPoint( p2.x, p1.y ) );
FinishTo( wxPoint( p1.x, p1.y ) );
LineTo( VECTOR2I( p1.x, p2.y ) );
LineTo( VECTOR2I( p2.x, p2.y ) );
LineTo( VECTOR2I( p2.x, p1.y ) );
FinishTo( VECTOR2I( p1.x, p1.y ) );
}
void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int width )
void DXF_PLOTTER::Circle( const VECTOR2I& centre, int diameter, FILL_T fill, int width )
{
wxASSERT( m_outputFile );
double radius = userToDeviceSize( diameter / 2 );
@ -454,7 +454,7 @@ void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int
}
void DXF_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList, FILL_T aFill, int aWidth,
void DXF_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill, int aWidth,
void* aData )
{
if( aCornerList.size() <= 1 )
@ -534,18 +534,18 @@ void DXF_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList, FILL_T aFil
last = path.PointCount() - 1;
VECTOR2I point = path.CPoint( 0 );
wxPoint startPoint( point.x, point.y );
VECTOR2I startPoint( point.x, point.y );
MoveTo( startPoint );
for( int ii = 1; ii < path.PointCount(); ii++ )
{
point = path.CPoint( ii );
LineTo( wxPoint( point.x, point.y ) );
LineTo( VECTOR2I( point.x, point.y ) );
}
// Close polygon, if needed
point = path.CPoint( last );
wxPoint endPoint( point.x, point.y );
VECTOR2I endPoint( point.x, point.y );
if( endPoint != startPoint )
LineTo( startPoint );
@ -554,7 +554,7 @@ void DXF_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList, FILL_T aFil
}
void DXF_PLOTTER::PenTo( const wxPoint& pos, char plume )
void DXF_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
{
wxASSERT( m_outputFile );
@ -589,12 +589,12 @@ void DXF_PLOTTER::SetDash( PLOT_DASH_TYPE aDashed )
}
void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int aWidth,
void DXF_PLOTTER::ThickSegment( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aWidth,
OUTLINE_MODE aPlotMode, void* aData )
{
if( aPlotMode == SKETCH )
{
std::vector<wxPoint> cornerList;
std::vector<VECTOR2I> cornerList;
SHAPE_POLY_SET outlineBuffer;
TransformOvalToPolygon( outlineBuffer, aStart, aEnd, aWidth, GetPlotterArcHighDef(),
ERROR_INSIDE );
@ -619,7 +619,7 @@ void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int
}
void DXF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
void DXF_PLOTTER::Arc( const VECTOR2I& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width )
{
wxASSERT( m_outputFile );
@ -648,11 +648,11 @@ void DXF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
}
void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
void DXF_PLOTTER::FlashPadOval( const VECTOR2I& pos, const VECTOR2I& aSize, double orient,
OUTLINE_MODE trace_mode, void* aData )
{
wxASSERT( m_outputFile );
wxSize size( aSize );
VECTOR2I size( aSize );
/* The chip is reduced to an oval tablet with size.y > size.x
* (Oval vertical orientation 0) */
@ -666,7 +666,7 @@ void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double
}
void DXF_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
void DXF_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre,
OUTLINE_MODE trace_mode, void* aData )
{
wxASSERT( m_outputFile );
@ -674,11 +674,11 @@ void DXF_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
}
void DXF_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
void DXF_PLOTTER::FlashPadRect( const VECTOR2I& pos, const VECTOR2I& padsize,
double orient, OUTLINE_MODE trace_mode, void* aData )
{
wxASSERT( m_outputFile );
wxSize size;
VECTOR2I size;
int ox, oy, fx, fy;
size.x = padsize.x / 2;
@ -699,8 +699,8 @@ void DXF_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
fx = pos.x;
fy = pos.y + size.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
MoveTo( wxPoint( ox, oy ) );
FinishTo( wxPoint( fx, fy ) );
MoveTo( VECTOR2I( ox, oy ) );
FinishTo( VECTOR2I( fx, fy ) );
return;
}
@ -712,36 +712,36 @@ void DXF_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
fx = pos.x + size.x;
fy = pos.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
MoveTo( wxPoint( ox, oy ) );
FinishTo( wxPoint( fx, fy ) );
MoveTo( VECTOR2I( ox, oy ) );
FinishTo( VECTOR2I( fx, fy ) );
return;
}
ox = pos.x - size.x;
oy = pos.y - size.y;
RotatePoint( &ox, &oy, pos.x, pos.y, orient );
MoveTo( wxPoint( ox, oy ) );
MoveTo( VECTOR2I( ox, oy ) );
fx = pos.x - size.x;
fy = pos.y + size.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
LineTo( wxPoint( fx, fy ) );
LineTo( VECTOR2I( fx, fy ) );
fx = pos.x + size.x;
fy = pos.y + size.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
LineTo( wxPoint( fx, fy ) );
LineTo( VECTOR2I( fx, fy ) );
fx = pos.x + size.x;
fy = pos.y - size.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
LineTo( wxPoint( fx, fy ) );
LineTo( VECTOR2I( fx, fy ) );
FinishTo( wxPoint( ox, oy ) );
FinishTo( VECTOR2I( ox, oy ) );
}
void DXF_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
void DXF_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, double aOrient,
OUTLINE_MODE aTraceMode, void* aData )
{
@ -752,15 +752,15 @@ void DXF_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize
// TransformRoundRectToPolygon creates only one convex polygon
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
MoveTo( wxPoint( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
MoveTo( VECTOR2I( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
for( int ii = 1; ii < poly.PointCount(); ++ii )
LineTo( wxPoint( poly.CPoint( ii ).x, poly.CPoint( ii ).y ) );
LineTo( VECTOR2I( poly.CPoint( ii ).x, poly.CPoint( ii ).y ) );
FinishTo( wxPoint( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
FinishTo( VECTOR2I( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
}
void DXF_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
void DXF_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
double aOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData )
{
@ -768,26 +768,26 @@ void DXF_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
{
SHAPE_LINE_CHAIN& poly = aPolygons->Outline( cnt );
MoveTo( wxPoint( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
MoveTo( VECTOR2I( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
for( int ii = 1; ii < poly.PointCount(); ++ii )
LineTo( wxPoint( poly.CPoint( ii ).x, poly.CPoint( ii ).y ) );
LineTo( VECTOR2I( poly.CPoint( ii ).x, poly.CPoint( ii ).y ) );
FinishTo( wxPoint( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
FinishTo( VECTOR2I( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
}
}
void DXF_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
void DXF_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
double aPadOrient, OUTLINE_MODE aTrace_Mode, void* aData )
{
wxASSERT( m_outputFile );
wxPoint coord[4]; /* coord actual corners of a trapezoidal trace */
VECTOR2I coord[4]; /* coord actual corners of a trapezoidal trace */
for( int ii = 0; ii < 4; ii++ )
{
coord[ii] = aCorners[ii];
RotatePoint( &coord[ii], aPadOrient );
RotatePoint( coord[ii], aPadOrient );
coord[ii] += aPadPos;
}
@ -800,7 +800,7 @@ void DXF_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorner
}
void DXF_PLOTTER::FlashRegularPolygon( const wxPoint& aShapePos, int aRadius, int aCornerCount,
void DXF_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aRadius, int aCornerCount,
double aOrient, OUTLINE_MODE aTraceMode, void* aData )
{
// Do nothing
@ -828,19 +828,19 @@ bool containsNonAsciiChars( const wxString& string )
}
void DXF_PLOTTER::Text( const wxPoint& aPos,
const COLOR4D& aColor,
const wxString& aText,
const EDA_ANGLE& aOrient,
const wxSize& 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,
KIFONT::FONT* aFont,
void* aData )
void DXF_PLOTTER::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,
KIFONT::FONT* aFont,
void* aData )
{
// Fix me: see how to use DXF text mode for multiline texts
if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) )

View File

@ -68,8 +68,8 @@
// number of vertices and each vertex coordinate are similar, i.e. if the difference
// between coordinates is small ( <= margin to accept rounding issues coming from polygon
// geometric transforms like rotation
static bool polyCompare( const std::vector<wxPoint>& aPolygon,
const std::vector<wxPoint>& aTestPolygon )
static bool polyCompare( const std::vector<VECTOR2I>& aPolygon,
const std::vector<VECTOR2I>& aTestPolygon )
{
// fast test: polygon sizes must be the same:
if( aTestPolygon.size() != aPolygon.size() )
@ -118,7 +118,7 @@ GERBER_PLOTTER::GERBER_PLOTTER()
}
void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
void GERBER_PLOTTER::SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
wxASSERT( aMirror == false );
@ -407,12 +407,12 @@ void GERBER_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
int aperture_attribute = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
selectAperture( wxSize( aWidth, aWidth ), 0, 0.0, APERTURE::AT_PLOTTING, aperture_attribute );
selectAperture( VECTOR2I( aWidth, aWidth ), 0, 0.0, APERTURE::AT_PLOTTING, aperture_attribute );
m_currentPenWidth = aWidth;
}
int GERBER_PLOTTER::GetOrCreateAperture( const wxSize& aSize, int aRadius, double aRotDegree,
int GERBER_PLOTTER::GetOrCreateAperture( const VECTOR2I& aSize, int aRadius, double aRotDegree,
APERTURE::APERTURE_TYPE aType, int aApertureAttribute )
{
int last_D_code = 9;
@ -444,7 +444,7 @@ int GERBER_PLOTTER::GetOrCreateAperture( const wxSize& aSize, int aRadius, doubl
}
int GERBER_PLOTTER::GetOrCreateAperture( const std::vector<wxPoint>& aCorners, double aRotDegree,
int GERBER_PLOTTER::GetOrCreateAperture( const std::vector<VECTOR2I>& aCorners, double aRotDegree,
APERTURE::APERTURE_TYPE aType, int aApertureAttribute )
{
int last_D_code = 9;
@ -484,7 +484,7 @@ int GERBER_PLOTTER::GetOrCreateAperture( const std::vector<wxPoint>& aCorners, d
APERTURE new_tool;
new_tool.m_Corners = aCorners;
new_tool.m_Size = wxSize( 0, 0 ); // Not used
new_tool.m_Size = VECTOR2I( 0, 0 ); // Not used
new_tool.m_Type = aType;
new_tool.m_Radius = 0; // Not used
new_tool.m_Rotation = aRotDegree;
@ -497,7 +497,7 @@ int GERBER_PLOTTER::GetOrCreateAperture( const std::vector<wxPoint>& aCorners, d
}
void GERBER_PLOTTER::selectAperture( const wxSize& aSize, int aRadius, double aRotDegree,
void GERBER_PLOTTER::selectAperture( const VECTOR2I& aSize, int aRadius, double aRotDegree,
APERTURE::APERTURE_TYPE aType, int aApertureAttribute )
{
bool change = ( m_currentApertureIdx < 0 ) ||
@ -519,7 +519,7 @@ void GERBER_PLOTTER::selectAperture( const wxSize& aSize, int aRadius, double aR
}
void GERBER_PLOTTER::selectAperture( const std::vector<wxPoint>& aCorners, double aRotDegree,
void GERBER_PLOTTER::selectAperture( const std::vector<VECTOR2I>& aCorners, double aRotDegree,
APERTURE::APERTURE_TYPE aType, int aApertureAttribute )
{
bool change = ( m_currentApertureIdx < 0 ) ||
@ -562,8 +562,8 @@ void GERBER_PLOTTER::selectAperture( int aDiameter, double aPolygonRotation,
wxASSERT( aType>= APERTURE::APERTURE_TYPE::AT_REGULAR_POLY3 &&
aType <= APERTURE::APERTURE_TYPE::AT_REGULAR_POLY12 );
wxSize size( aDiameter, (int)( aPolygonRotation * 1000.0 ) );
selectAperture( wxSize( 0, 0), aDiameter/2, aPolygonRotation, aType, aApertureAttribute );
VECTOR2I size( aDiameter, (int) ( aPolygonRotation * 1000.0 ) );
selectAperture( VECTOR2I( 0, 0 ), aDiameter / 2, aPolygonRotation, aType, aApertureAttribute );
}
void GERBER_PLOTTER::writeApertureList()
@ -645,7 +645,7 @@ void GERBER_PLOTTER::writeApertureList()
{
// The aperture macro needs coordinates of the centers of the 4 corners
std::vector<VECTOR2I> corners;
wxSize half_size( tool.m_Size.x/2-tool.m_Radius, tool.m_Size.y/2-tool.m_Radius );
VECTOR2I half_size( tool.m_Size.x/2-tool.m_Radius, tool.m_Size.y/2-tool.m_Radius );
corners.emplace_back( -half_size.x, -half_size.y );
corners.emplace_back( half_size.x, -half_size.y );
@ -771,7 +771,7 @@ void GERBER_PLOTTER::writeApertureList()
}
void GERBER_PLOTTER::PenTo( const wxPoint& aPos, char plume )
void GERBER_PLOTTER::PenTo( const VECTOR2I& aPos, char plume )
{
wxASSERT( m_outputFile );
DPOINT pos_dev = userToDeviceCoordinates( aPos );
@ -793,13 +793,14 @@ void GERBER_PLOTTER::PenTo( const wxPoint& aPos, char plume )
}
void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
void GERBER_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width )
{
std::vector< wxPoint > cornerList;
std::vector<VECTOR2I> cornerList;
// Build corners list
cornerList.push_back( p1 );
wxPoint corner(p1.x, p2.y);
VECTOR2I corner( p1.x, p2.y );
cornerList.push_back( corner );
cornerList.push_back( p2 );
corner.x = p2.x;
@ -811,14 +812,14 @@ void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, in
}
void GERBER_PLOTTER::Circle( const wxPoint& aCenter, int aDiameter, FILL_T aFill, int aWidth )
void GERBER_PLOTTER::Circle( const VECTOR2I& aCenter, int aDiameter, FILL_T aFill, int aWidth )
{
Arc( aCenter, 0, 3600, aDiameter / 2, aFill, aWidth );
}
void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle, int aRadius,
void GERBER_PLOTTER::Arc( const VECTOR2I& aCenter, double aStAngle, double aEndAngle, int aRadius,
FILL_T aFill, int aWidth )
{
SetCurrentLineWidth( aWidth );
@ -839,9 +840,9 @@ void GERBER_PLOTTER::Arc( const SHAPE_ARC& aArc )
void GERBER_PLOTTER::plotArc( const SHAPE_ARC& aArc, bool aPlotInRegion )
{
wxPoint start( aArc.GetP0() );
wxPoint end( aArc.GetP1() );
wxPoint center( aArc.GetCenter() );
VECTOR2I start( aArc.GetP0() );
VECTOR2I end( aArc.GetP1() );
VECTOR2I center( aArc.GetCenter() );
double start_angle = aArc.GetStartAngle();
double end_angle = aArc.GetEndAngle();
@ -868,10 +869,10 @@ void GERBER_PLOTTER::plotArc( const SHAPE_ARC& aArc, bool aPlotInRegion )
}
void GERBER_PLOTTER::plotArc( const wxPoint& aCenter, double aStAngle, double aEndAngle,
void GERBER_PLOTTER::plotArc( const VECTOR2I& aCenter, double aStAngle, double aEndAngle,
int aRadius, bool aPlotInRegion )
{
wxPoint start, end;
VECTOR2I start, end;
start.x = aCenter.x + KiROUND( cosdecideg( aRadius, aStAngle ) );
start.y = aCenter.y - KiROUND( sindecideg( aRadius, aStAngle ) );
@ -937,7 +938,7 @@ void GERBER_PLOTTER::PlotGerberRegion( const SHAPE_LINE_CHAIN& aPoly, void* aDat
}
void GERBER_PLOTTER::PlotGerberRegion( const std::vector< wxPoint >& aCornerList, void* aData )
void GERBER_PLOTTER::PlotGerberRegion( const std::vector<VECTOR2I>& aCornerList, void* aData )
{
if( aCornerList.size() <= 2 )
return;
@ -992,7 +993,7 @@ void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int
{
fputs( "G36*\n", m_outputFile );
MoveTo( wxPoint( aPoly.CPoint( 0 ) ) );
MoveTo( VECTOR2I( aPoly.CPoint( 0 ) ) );
fputs( "G01*\n", m_outputFile ); // Set linear interpolation.
@ -1003,7 +1004,7 @@ void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int
if( arcindex < 0 )
{
/// Plain point
LineTo( wxPoint( aPoly.CPoint( ii ) ) );
LineTo( VECTOR2I( aPoly.CPoint( ii ) ) );
}
else
{
@ -1015,7 +1016,7 @@ void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int
// If the polygon is not closed, close it:
if( aPoly.CPoint( 0 ) != aPoly.CPoint( -1 ) )
FinishTo( wxPoint( aPoly.CPoint( 0 ) ) );
FinishTo( VECTOR2I( aPoly.CPoint( 0 ) ) );
fputs( "G37*\n", m_outputFile );
}
@ -1024,7 +1025,7 @@ void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int
{
SetCurrentLineWidth( aWidth, gbr_metadata );
MoveTo( wxPoint( aPoly.CPoint( 0 ) ) );
MoveTo( VECTOR2I( aPoly.CPoint( 0 ) ) );
for( int ii = 1; ii < aPoly.PointCount(); ii++ )
{
@ -1033,7 +1034,7 @@ void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int
if( arcindex < 0 )
{
/// Plain point
LineTo( wxPoint( aPoly.CPoint( ii ) ) );
LineTo( VECTOR2I( aPoly.CPoint( ii ) ) );
}
else
{
@ -1046,13 +1047,13 @@ void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int
// Ensure the thick outline is closed for filled polygons
// (if not filled, could be only a polyline)
if( aFill != FILL_T::NO_FILL && ( aPoly.CPoint( 0 ) != aPoly.CPoint( -1 ) ) )
LineTo( wxPoint( aPoly.CPoint( 0 ) ) );
LineTo( VECTOR2I( aPoly.CPoint( 0 ) ) );
PenFinish();
}
}
void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth,
void GERBER_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill, int aWidth,
void * aData )
{
if( aCornerList.size() <= 1 )
@ -1102,7 +1103,7 @@ void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T
}
void GERBER_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width,
void GERBER_PLOTTER::ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width,
OUTLINE_MODE tracemode, void* aData )
{
if( tracemode == FILLED )
@ -1123,7 +1124,7 @@ void GERBER_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int
}
}
void GERBER_PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
void GERBER_PLOTTER::ThickArc( const VECTOR2I& centre, double StAngle, double EndAngle,
int radius, int width, OUTLINE_MODE tracemode, void* aData )
{
GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
@ -1147,7 +1148,7 @@ void GERBER_PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double End
}
void GERBER_PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
void GERBER_PLOTTER::ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width,
OUTLINE_MODE tracemode, void* aData )
{
GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
@ -1163,10 +1164,10 @@ void GERBER_PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
else
{
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
wxPoint offsetp1( p1.x - (width - m_currentPenWidth) / 2,
p1.y - (width - m_currentPenWidth) / 2 );
wxPoint offsetp2( p2.x + (width - m_currentPenWidth) / 2,
p2.y + (width - m_currentPenWidth) / 2 );
VECTOR2I offsetp1( p1.x - ( width - m_currentPenWidth ) / 2,
p1.y - (width - m_currentPenWidth) / 2 );
VECTOR2I offsetp2( p2.x + ( width - m_currentPenWidth ) / 2,
p2.y + (width - m_currentPenWidth) / 2 );
Rect( offsetp1, offsetp2, FILL_T::NO_FILL, -1 );
offsetp1.x += (width - m_currentPenWidth);
offsetp1.y += (width - m_currentPenWidth);
@ -1177,7 +1178,7 @@ void GERBER_PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
}
void GERBER_PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width,
void GERBER_PLOTTER::ThickCircle( const VECTOR2I& pos, int diametre, int width,
OUTLINE_MODE tracemode, void* aData )
{
GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
@ -1201,7 +1202,7 @@ void GERBER_PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width,
}
void GERBER_PLOTTER::FilledCircle( const wxPoint& pos, int diametre,
void GERBER_PLOTTER::FilledCircle( const VECTOR2I& pos, int diametre,
OUTLINE_MODE tracemode, void* aData )
{
// A filled circle is a graphic item, not a pad.
@ -1226,10 +1227,10 @@ void GERBER_PLOTTER::FilledCircle( const wxPoint& pos, int diametre,
}
void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, OUTLINE_MODE trace_mode,
void GERBER_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre, OUTLINE_MODE trace_mode,
void* aData )
{
wxSize size( diametre, diametre );
VECTOR2I size( diametre, diametre );
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
if( trace_mode == SKETCH )
@ -1256,11 +1257,11 @@ void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, OUTLINE_M
}
void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
void GERBER_PLOTTER::FlashPadOval( const VECTOR2I& pos, const VECTOR2I& aSize, double orient,
OUTLINE_MODE trace_mode, void* aData )
{
wxASSERT( m_outputFile );
wxSize size( aSize );
VECTOR2I size( aSize );
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
// Flash a vertical or horizontal shape (this is a basic aperture).
@ -1335,12 +1336,12 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, doub
}
void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
void GERBER_PLOTTER::FlashPadRect( const VECTOR2I& pos, const VECTOR2I& aSize,
double orient, OUTLINE_MODE trace_mode, void* aData )
{
wxASSERT( m_outputFile );
wxSize size( aSize );
VECTOR2I size( aSize );
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
// Plot as an aperture flash
@ -1359,10 +1360,10 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
Rect( wxPoint( pos.x - (size.x - GetCurrentLineWidth()) / 2,
pos.y - (size.y - GetCurrentLineWidth()) / 2 ),
wxPoint( pos.x + (size.x - GetCurrentLineWidth()) / 2,
pos.y + (size.y - GetCurrentLineWidth()) / 2 ),
Rect( VECTOR2I( pos.x - ( size.x - GetCurrentLineWidth() ) / 2,
pos.y - (size.y - GetCurrentLineWidth()) / 2 ),
VECTOR2I( pos.x + ( size.x - GetCurrentLineWidth() ) / 2,
pos.y + (size.y - GetCurrentLineWidth()) / 2 ),
FILL_T::NO_FILL, GetCurrentLineWidth() );
}
else
@ -1397,7 +1398,7 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
#endif
{
// plot pad shape as Gerber region
wxPoint coord[4];
VECTOR2I coord[4];
// coord[0] is assumed the lower left
// coord[1] is assumed the upper left
// coord[2] is assumed the upper right
@ -1418,7 +1419,7 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
}
}
void GERBER_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
void GERBER_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, double aOrient,
OUTLINE_MODE aTraceMode, void* aData )
@ -1434,7 +1435,7 @@ void GERBER_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, &gbr_metadata );
outline.Inflate( -GetCurrentLineWidth()/2, 16 );
std::vector< wxPoint > cornerList;
std::vector<VECTOR2I> cornerList;
// TransformRoundRectToPolygon creates only one convex polygon
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
cornerList.reserve( poly.PointCount() + 1 );
@ -1499,7 +1500,7 @@ void GERBER_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
}
void GERBER_PLOTTER::plotRoundRectAsRegion( const wxPoint& aRectCenter, const wxSize& aSize,
void GERBER_PLOTTER::plotRoundRectAsRegion( const VECTOR2I& aRectCenter, const VECTOR2I& aSize,
int aCornerRadius, double aOrient )
{
// The region outline is generated by 4 sides and 4 90 deg arcs
@ -1514,9 +1515,9 @@ void GERBER_PLOTTER::plotRoundRectAsRegion( const wxPoint& aRectCenter, const wx
// in user coordinates
struct RR_EDGE
{
wxPoint m_start;
wxPoint m_end;
wxPoint m_center;
VECTOR2I m_start;
VECTOR2I m_end;
VECTOR2I m_center;
// in decidegrees: angle start. angle end = m_arc_angle_start+arc_angle
double m_arc_angle_start;
};
@ -1575,14 +1576,14 @@ void GERBER_PLOTTER::plotRoundRectAsRegion( const wxPoint& aRectCenter, const wx
rr_outline.push_back( curr_edge );
// Move relative coordinates to the actual location and rotation:
wxPoint arc_last_center;
VECTOR2I arc_last_center;
int arc_last_angle = curr_edge.m_arc_angle_start+arc_angle;
for( RR_EDGE& rr_edge: rr_outline )
{
RotatePoint( &rr_edge.m_start, aOrient );
RotatePoint( &rr_edge.m_end, aOrient );
RotatePoint( &rr_edge.m_center, aOrient );
RotatePoint( rr_edge.m_start, aOrient );
RotatePoint( rr_edge.m_end, aOrient );
RotatePoint( rr_edge.m_center, aOrient );
rr_edge.m_start += aRectCenter;
rr_edge.m_end += aRectCenter;
rr_edge.m_center += aRectCenter;
@ -1593,11 +1594,11 @@ void GERBER_PLOTTER::plotRoundRectAsRegion( const wxPoint& aRectCenter, const wx
// (end of arc) is the same as the first point. Rounding issues can create a
// small difference, mainly for rotated pads.
// calculate last point (end of last arc):
wxPoint last_pt;
VECTOR2I last_pt;
last_pt.x = arc_last_center.x + KiROUND( cosdecideg( aCornerRadius, arc_last_angle ) );
last_pt.y = arc_last_center.y - KiROUND( sindecideg( aCornerRadius, arc_last_angle ) );
wxPoint first_pt = rr_outline[0].m_start;
VECTOR2I first_pt = rr_outline[0].m_start;
#if 0 // For test only:
if( last_pt != first_pt )
@ -1628,7 +1629,7 @@ void GERBER_PLOTTER::plotRoundRectAsRegion( const wxPoint& aRectCenter, const wx
}
void GERBER_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
void GERBER_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
double aOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData )
@ -1647,7 +1648,7 @@ void GERBER_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize
polyshape.Inflate( -GetCurrentLineWidth()/2, 16 );
}
std::vector< wxPoint > cornerList;
std::vector<VECTOR2I> cornerList;
for( int cnt = 0; cnt < polyshape.OutlineCount(); ++cnt )
{
@ -1678,7 +1679,7 @@ void GERBER_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize
for( size_t ii = 0; ii < cornerList.size(); ii++ )
{
cornerList[ii] -= aPadPos;
RotatePoint( &cornerList[ii], -aOrient );
RotatePoint( cornerList[ii], -aOrient );
}
DPOINT pos_dev = userToDeviceCoordinates( aPadPos );
@ -1696,7 +1697,7 @@ void GERBER_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize
}
void GERBER_PLOTTER::FlashPadChamferRoundRect( const wxPoint& aShapePos, const wxSize& aPadSize,
void GERBER_PLOTTER::FlashPadChamferRoundRect( const VECTOR2I& aShapePos, const VECTOR2I& aPadSize,
int aCornerRadius, double aChamferRatio,
int aChamferPositions, double aPadOrient,
OUTLINE_MODE aPlotMode, void* aData )
@ -1711,7 +1712,7 @@ void GERBER_PLOTTER::FlashPadChamferRoundRect( const wxPoint& aShapePos, const w
SHAPE_POLY_SET outline;
// polygon corners list
std::vector<wxPoint> cornerList;
std::vector<VECTOR2I> cornerList;
bool hasRoundedCorner = aCornerRadius != 0 && aChamferPositions != 15;
@ -1749,7 +1750,7 @@ void GERBER_PLOTTER::FlashPadChamferRoundRect( const wxPoint& aShapePos, const w
for( size_t ii = 0; ii < cornerList.size(); ii++ )
{
cornerList[ii] -= aShapePos;
RotatePoint( &cornerList[ii], -aPadOrient );
RotatePoint( cornerList[ii], -aPadOrient );
}
selectAperture( cornerList, aPadOrient/10.0,
@ -1767,7 +1768,7 @@ void GERBER_PLOTTER::FlashPadChamferRoundRect( const wxPoint& aShapePos, const w
}
// Build the chamfered polygon (4 to 8 corners )
TransformRoundChamferedRectToPolygon( outline, wxPoint( 0, 0 ), aPadSize, 0.0, 0,
TransformRoundChamferedRectToPolygon( outline, VECTOR2I( 0, 0 ), aPadSize, 0.0, 0,
aChamferRatio, aChamferPositions, 0,
GetPlotterArcHighDef(), ERROR_INSIDE );
@ -1822,17 +1823,17 @@ void GERBER_PLOTTER::FlashPadChamferRoundRect( const wxPoint& aShapePos, const w
}
void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorners,
void GERBER_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
double aPadOrient, OUTLINE_MODE aTrace_Mode, void* aData )
{
// polygon corners list
std::vector<wxPoint> cornerList = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] };
std::vector<VECTOR2I> cornerList = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] };
// Draw the polygon and fill the interior as required
for( unsigned ii = 0; ii < 4; ii++ )
{
RotatePoint( &cornerList[ii], aPadOrient );
RotatePoint( cornerList[ii], aPadOrient );
cornerList[ii] += aPadPos;
}
@ -1859,7 +1860,7 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo
m_hasApertureOutline4P = true;
DPOINT pos_dev = userToDeviceCoordinates( aPadPos );
// polygon corners list
std::vector<wxPoint> corners = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] };
std::vector<VECTOR2I> corners = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] };
int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
selectAperture( corners, aPadOrient/10.0, APERTURE::APER_MACRO_OUTLINE4P, aperture_attrib );
@ -1874,7 +1875,7 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo
}
void GERBER_PLOTTER::FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter,
void GERBER_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter,
int aCornerCount, double aOrient,
OUTLINE_MODE aTraceMode, void* aData )
{
@ -1888,15 +1889,15 @@ void GERBER_PLOTTER::FlashRegularPolygon( const wxPoint& aShapePos, int aDiamete
if( aTraceMode == SKETCH )
{
// Build the polygon:
std::vector< wxPoint > cornerList;
std::vector<VECTOR2I> cornerList;
double angle_delta = 3600.0 / aCornerCount; // in 0.1 degree
for( int ii = 0; ii < aCornerCount; ii++ )
{
double rot = aOrient + (angle_delta*ii);
wxPoint vertice( aDiameter/2, 0 );
RotatePoint( &vertice, rot );
VECTOR2I vertice( aDiameter / 2, 0 );
RotatePoint( vertice, rot );
vertice += aShapePos;
cornerList.push_back( vertice );
}
@ -1923,19 +1924,19 @@ void GERBER_PLOTTER::FlashRegularPolygon( const wxPoint& aShapePos, int aDiamete
}
void GERBER_PLOTTER::Text( const wxPoint& aPos,
const COLOR4D& aColor,
const wxString& aText,
const EDA_ANGLE& aOrient,
const wxSize& 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,
KIFONT::FONT* aFont,
void* aData )
void GERBER_PLOTTER::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,
KIFONT::FONT* aFont,
void* aData )
{
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
@ -1956,7 +1957,7 @@ void GERBER_PLOTTER::SetLayerPolarity( bool aPositive )
}
bool APER_MACRO_FREEPOLY::IsSamePoly( const std::vector<wxPoint>& aPolygon ) const
bool APER_MACRO_FREEPOLY::IsSamePoly( const std::vector<VECTOR2I>& aPolygon ) const
{
return polyCompare( m_Corners, aPolygon );
}
@ -2002,13 +2003,13 @@ void APER_MACRO_FREEPOLY_LIST::Format( FILE * aOutput, double aIu2GbrMacroUnit )
}
void APER_MACRO_FREEPOLY_LIST::Append( const std::vector<wxPoint>& aPolygon )
void APER_MACRO_FREEPOLY_LIST::Append( const std::vector<VECTOR2I>& aPolygon )
{
m_AMList.emplace_back( aPolygon, AmCount() );
}
int APER_MACRO_FREEPOLY_LIST::FindAm( const std::vector<wxPoint>& aPolygon ) const
int APER_MACRO_FREEPOLY_LIST::FindAm( const std::vector<VECTOR2I>& aPolygon ) const
{
for( int idx = 0; idx < AmCount(); idx++ )
{

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

View File

@ -122,7 +122,7 @@ bool PDF_PLOTTER::OpenFile( const wxString& aFullFilename )
}
void PDF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
void PDF_PLOTTER::SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
m_plotMirror = aMirror;
@ -196,7 +196,7 @@ void PDF_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
}
void PDF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
void PDF_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width )
{
wxASSERT( workFile );
DPOINT p1_dev = userToDeviceCoordinates( p1 );
@ -208,7 +208,7 @@ void PDF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int w
}
void PDF_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T aFill, int width )
void PDF_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T aFill, int width )
{
wxASSERT( workFile );
DPOINT pos_dev = userToDeviceCoordinates( pos );
@ -261,7 +261,7 @@ void PDF_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T aFill, int wi
}
void PDF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
void PDF_PLOTTER::Arc( const VECTOR2I& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width )
{
wxASSERT( workFile );
@ -274,7 +274,7 @@ void PDF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
/* Arcs are not so easily approximated by beziers (in the general case),
so we approximate them in the old way */
wxPoint start, end;
VECTOR2I start, end;
const int delta = 50; // increment (in 0.1 degrees) to draw circles
if( StAngle > EndAngle )
@ -315,7 +315,7 @@ void PDF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
}
void PDF_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth,
void PDF_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill, int aWidth,
void* aData )
{
wxASSERT( workFile );
@ -339,7 +339,7 @@ void PDF_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aF
}
void PDF_PLOTTER::PenTo( const wxPoint& pos, char plume )
void PDF_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
{
wxASSERT( workFile );
@ -369,16 +369,16 @@ void PDF_PLOTTER::PenTo( const wxPoint& pos, char plume )
}
void PDF_PLOTTER::PlotImage( const wxImage& aImage, const wxPoint& aPos, double aScaleFactor )
void PDF_PLOTTER::PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double aScaleFactor )
{
wxASSERT( workFile );
wxSize pix_size( aImage.GetWidth(), aImage.GetHeight() );
VECTOR2I pix_size( aImage.GetWidth(), aImage.GetHeight() );
// Requested size (in IUs)
DPOINT drawsize( aScaleFactor * pix_size.x, aScaleFactor * pix_size.y );
// calculate the bitmap start position
wxPoint start( aPos.x - drawsize.x / 2, aPos.y + drawsize.y / 2);
VECTOR2I start( aPos.x - drawsize.x / 2, aPos.y + drawsize.y / 2 );
DPOINT dev_start = userToDeviceCoordinates( start );
@ -632,7 +632,7 @@ void PDF_PLOTTER::ClosePage()
to use */
const double BIGPTsPERMIL = 0.072;
wxSize psPaperSize = m_pageInfo.GetSizeMils();
VECTOR2I psPaperSize = m_pageInfo.GetSizeMils();
fprintf( m_outputFile,
"<<\n"
@ -822,19 +822,19 @@ bool PDF_PLOTTER::EndPlot()
}
void PDF_PLOTTER::Text( const wxPoint& aPos,
const COLOR4D& aColor,
const wxString& aText,
const EDA_ANGLE& aOrient,
const wxSize& 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,
KIFONT::FONT* aFont,
void* aData )
void PDF_PLOTTER::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,
KIFONT::FONT* aFont,
void* aData )
{
// PDF files do not like 0 sized texts which create broken files.
if( aSize.x == 0 || aSize.y == 0 )

View File

@ -87,12 +87,12 @@ void PSLIKE_PLOTTER::SetColor( const COLOR4D& color )
}
void PSLIKE_PLOTTER::FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize,
void PSLIKE_PLOTTER::FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
double aPadOrient, OUTLINE_MODE aTraceMode, void* aData )
{
wxASSERT( m_outputFile );
int x0, y0, x1, y1, delta;
wxSize size( aSize );
VECTOR2I size( aSize );
// The pad is reduced to an oval by dy > dx
if( size.x > size.y )
@ -110,14 +110,14 @@ void PSLIKE_PLOTTER::FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize,
RotatePoint( &x1, &y1, aPadOrient );
if( aTraceMode == FILLED )
ThickSegment( wxPoint( aPadPos.x + x0, aPadPos.y + y0 ),
wxPoint( aPadPos.x + x1, aPadPos.y + y1 ), size.x, aTraceMode, nullptr );
ThickSegment( VECTOR2I( aPadPos.x + x0, aPadPos.y + y0 ),
VECTOR2I( aPadPos.x + x1, aPadPos.y + y1 ), size.x, aTraceMode, nullptr );
else
sketchOval( aPadPos, size, aPadOrient, -1 );
}
void PSLIKE_PLOTTER::FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
void PSLIKE_PLOTTER::FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter,
OUTLINE_MODE aTraceMode, void* aData )
{
if( aTraceMode == FILLED )
@ -140,11 +140,11 @@ void PSLIKE_PLOTTER::FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
}
void PSLIKE_PLOTTER::FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
void PSLIKE_PLOTTER::FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
double aPadOrient, OUTLINE_MODE aTraceMode, void* aData )
{
static std::vector< wxPoint > cornerList;
wxSize size( aSize );
static std::vector<VECTOR2I> cornerList;
VECTOR2I size( aSize );
cornerList.clear();
if( aTraceMode == FILLED )
@ -164,7 +164,7 @@ void PSLIKE_PLOTTER::FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
int dx = size.x / 2;
int dy = size.y / 2;
wxPoint corner;
VECTOR2I corner;
corner.x = aPadPos.x - dx;
corner.y = aPadPos.y + dy;
cornerList.push_back( corner );
@ -180,7 +180,7 @@ void PSLIKE_PLOTTER::FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
for( unsigned ii = 0; ii < cornerList.size(); ii++ )
{
RotatePoint( &cornerList[ii], aPadPos, aPadOrient );
RotatePoint( cornerList[ii], aPadPos, aPadOrient );
}
cornerList.push_back( cornerList[0] );
@ -190,11 +190,11 @@ void PSLIKE_PLOTTER::FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
}
void PSLIKE_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
void PSLIKE_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, double aOrient,
OUTLINE_MODE aTraceMode, void* aData )
{
wxSize size( aSize );
VECTOR2I size( aSize );
if( aTraceMode == FILLED )
{
@ -213,7 +213,7 @@ void PSLIKE_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
TransformRoundChamferedRectToPolygon( outline, aPadPos, size, aOrient, aCornerRadius,
0.0, 0, 0, GetPlotterArcHighDef(), ERROR_INSIDE );
std::vector< wxPoint > cornerList;
std::vector<VECTOR2I> cornerList;
// TransformRoundRectToPolygon creates only one convex polygon
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
@ -230,11 +230,11 @@ void PSLIKE_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
}
void PSLIKE_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
void PSLIKE_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
double aOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData )
{
wxSize size( aSize );
VECTOR2I size( aSize );
if( aTraceMode == FILLED )
{
@ -248,7 +248,7 @@ void PSLIKE_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize
}
std::vector< wxPoint > cornerList;
std::vector<VECTOR2I> cornerList;
for( int cnt = 0; cnt < aPolygons->OutlineCount(); ++cnt )
{
@ -267,10 +267,10 @@ void PSLIKE_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize
}
void PSLIKE_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
void PSLIKE_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
double aPadOrient, OUTLINE_MODE aTraceMode, void* aData )
{
static std::vector< wxPoint > cornerList;
static std::vector<VECTOR2I> cornerList;
cornerList.clear();
for( int ii = 0; ii < 4; ii++ )
@ -304,7 +304,7 @@ void PSLIKE_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCor
for( int ii = 0; ii < 4; ii++ )
{
RotatePoint( &cornerList[ii], aPadOrient );
RotatePoint( cornerList[ii], aPadOrient );
cornerList[ii] += aPadPos;
}
@ -314,7 +314,7 @@ void PSLIKE_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCor
}
void PSLIKE_PLOTTER::FlashRegularPolygon( const wxPoint& aShapePos, int aRadius, int aCornerCount,
void PSLIKE_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aRadius, int aCornerCount,
double aOrient, OUTLINE_MODE aTraceMode, void* aData )
{
// Do nothing
@ -417,7 +417,7 @@ void PSLIKE_PLOTTER::postscriptOverlinePositions( const wxString& aText, int aXS
}
void PS_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
void PS_PLOTTER::SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
wxASSERT( !m_outputFile );
@ -434,10 +434,10 @@ void PS_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
}
void PSLIKE_PLOTTER::computeTextParameters( const wxPoint& aPos,
void PSLIKE_PLOTTER::computeTextParameters( const VECTOR2I& aPos,
const wxString& aText,
const EDA_ANGLE& aOrient,
const wxSize& aSize,
const VECTOR2I& aSize,
bool aMirror,
enum GR_TEXT_H_ALIGN_T aH_justify,
enum GR_TEXT_V_ALIGN_T aV_justify,
@ -454,7 +454,7 @@ void PSLIKE_PLOTTER::computeTextParameters( const wxPoint& aPos,
double *heightFactor )
{
// Compute the starting position (compensated for alignment)
wxPoint start_pos = aPos;
VECTOR2I start_pos = aPos;
// This is an approximation of the text bounds (in IUs)
int tw = returnPostscriptTextWidth( aText, aSize.x, aItalic, aWidth );
@ -564,7 +564,7 @@ void PS_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
}
void PS_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
void PS_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width )
{
DPOINT p1_dev = userToDeviceCoordinates( p1 );
DPOINT p2_dev = userToDeviceCoordinates( p2 );
@ -575,7 +575,7 @@ void PS_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int wi
}
void PS_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int width )
void PS_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width )
{
wxASSERT( m_outputFile );
DPOINT pos_dev = userToDeviceCoordinates( pos );
@ -586,7 +586,7 @@ void PS_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int widt
}
void PS_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
void PS_PLOTTER::Arc( const VECTOR2I& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width )
{
wxASSERT( m_outputFile );
@ -623,7 +623,7 @@ void PS_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, in
}
void PS_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill,
void PS_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
int aWidth, void * aData )
{
if( aCornerList.size() <= 1 )
@ -645,21 +645,21 @@ void PS_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFi
}
void PS_PLOTTER::PlotImage( const wxImage& aImage, const wxPoint& aPos, double aScaleFactor )
void PS_PLOTTER::PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double aScaleFactor )
{
wxSize pix_size; // size of the bitmap in pixels
VECTOR2I pix_size; // size of the bitmap in pixels
pix_size.x = aImage.GetWidth();
pix_size.y = aImage.GetHeight();
DPOINT drawsize( aScaleFactor * pix_size.x,
aScaleFactor * pix_size.y ); // requested size of image
// calculate the bottom left corner position of bitmap
wxPoint start = aPos;
VECTOR2I start = aPos;
start.x -= drawsize.x / 2; // left
start.y += drawsize.y / 2; // bottom (Y axis reversed)
// calculate the top right corner position of bitmap
wxPoint end;
VECTOR2I end;
end.x = start.x + drawsize.x;
end.y = start.y - drawsize.y;
@ -752,7 +752,7 @@ void PS_PLOTTER::PlotImage( const wxImage& aImage, const wxPoint& aPos, double a
}
void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
void PS_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
{
wxASSERT( m_outputFile );
@ -864,10 +864,13 @@ bool PS_PLOTTER::StartPlot()
/* The coordinates of the lower left corner of the boundary
box need to be "rounded down", but the coordinates of its
upper right corner need to be "rounded up" instead. */
wxSize psPaperSize = m_pageInfo.GetSizeMils();
VECTOR2I psPaperSize = m_pageInfo.GetSizeMils();
if( !m_pageInfo.IsPortrait() )
psPaperSize.Set( m_pageInfo.GetHeightMils(), m_pageInfo.GetWidthMils() );
{
psPaperSize.x = m_pageInfo.GetHeightMils();
psPaperSize.y = m_pageInfo.GetWidthMils();
}
fprintf( m_outputFile, "%%%%BoundingBox: 0 0 %d %d\n",
(int) ceil( psPaperSize.x * BIGPTsPERMIL ),
@ -958,19 +961,19 @@ bool PS_PLOTTER::EndPlot()
void PS_PLOTTER::Text( const wxPoint& aPos,
const COLOR4D& aColor,
const wxString& aText,
const EDA_ANGLE& aOrient,
const wxSize& 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,
KIFONT::FONT* aFont,
void* aData )
void PS_PLOTTER::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,
KIFONT::FONT* aFont,
void* aData )
{
SetCurrentLineWidth( aWidth );
SetColor( aColor );

View File

@ -173,7 +173,7 @@ SVG_PLOTTER::SVG_PLOTTER()
}
void SVG_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
void SVG_PLOTTER::SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
m_plotMirror = aMirror;
@ -371,9 +371,9 @@ void SVG_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
}
void SVG_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
void SVG_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width )
{
EDA_RECT rect( p1, wxSize( p2.x -p1.x, p2.y -p1.y ) );
EDA_RECT rect( p1, VECTOR2I( p2.x - p1.x, p2.y - p1.y ) );
rect.Normalize();
DPOINT org_dev = userToDeviceCoordinates( rect.GetOrigin() );
DPOINT end_dev = userToDeviceCoordinates( rect.GetEnd() );
@ -408,7 +408,7 @@ void SVG_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int w
}
void SVG_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int width )
void SVG_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width )
{
DPOINT pos_dev = userToDeviceCoordinates( pos );
double radius = userToDeviceSize( diametre / 2.0 );
@ -431,7 +431,7 @@ void SVG_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int wid
}
void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
void SVG_PLOTTER::Arc( const VECTOR2I& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width )
{
/* Draws an arc of a circle, centered on (xc,yc), with starting point
@ -533,8 +533,8 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
}
void SVG_PLOTTER::BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
const wxPoint& aControl2, const wxPoint& aEnd,
void SVG_PLOTTER::BezierCurve( const VECTOR2I& aStart, const VECTOR2I& aControl1,
const VECTOR2I& aControl2, const VECTOR2I& aEnd,
int aTolerance, int aLineThickness )
{
#if 1
@ -556,7 +556,7 @@ void SVG_PLOTTER::BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
}
void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList, FILL_T aFill,
void SVG_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
int aWidth, void* aData )
{
if( aCornerList.size() <= 1 )
@ -601,15 +601,15 @@ void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList, FILL_T aFil
}
void SVG_PLOTTER::PlotImage( const wxImage& aImage, const wxPoint& aPos, double aScaleFactor )
void SVG_PLOTTER::PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double aScaleFactor )
{
wxSize pix_size( aImage.GetWidth(), aImage.GetHeight() );
VECTOR2I pix_size( aImage.GetWidth(), aImage.GetHeight() );
// Requested size (in IUs)
DPOINT drawsize( aScaleFactor * pix_size.x, aScaleFactor * pix_size.y );
// calculate the bitmap start position
wxPoint start( aPos.x - drawsize.x / 2, aPos.y - drawsize.y / 2);
VECTOR2I start( aPos.x - drawsize.x / 2, aPos.y - drawsize.y / 2 );
// Rectangles having a 0 size value for height or width are just not drawn on Inkscape,
// so use a line when happens.
@ -647,7 +647,7 @@ void SVG_PLOTTER::PlotImage( const wxImage& aImage, const wxPoint& aPos, double
}
void SVG_PLOTTER::PenTo( const wxPoint& pos, char plume )
void SVG_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
{
if( plume == 'Z' )
{
@ -712,7 +712,7 @@ bool SVG_PLOTTER::StartPlot()
}
// Write viewport pos and size
wxPoint origin; // TODO set to actual value
VECTOR2I origin; // TODO set to actual value
fprintf( m_outputFile, " width=\"%fcm\" height=\"%fcm\" viewBox=\"%d %d %d %d\">\n",
(double) m_paperSize.x / m_IUsPerDecimil * 2.54 / 10000,
(double) m_paperSize.y / m_IUsPerDecimil * 2.54 / 10000, origin.x, origin.y,
@ -755,26 +755,26 @@ bool SVG_PLOTTER::EndPlot()
}
void SVG_PLOTTER::Text( const wxPoint& aPos,
const COLOR4D& aColor,
const wxString& aText,
const EDA_ANGLE& aOrient,
const wxSize& 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,
KIFONT::FONT* aFont,
void* aData )
void SVG_PLOTTER::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,
KIFONT::FONT* aFont,
void* aData )
{
setFillMode( FILL_T::NO_FILL );
SetColor( aColor );
SetCurrentLineWidth( aWidth );
wxPoint text_pos = aPos;
const char *hjust = "start";
VECTOR2I text_pos = aPos;
const char* hjust = "start";
switch( aH_justify )
{
@ -790,7 +790,7 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
case GR_TEXT_V_ALIGN_BOTTOM: break;
}
wxSize text_size;
VECTOR2I text_size;
// aSize.x or aSize.y is < 0 for mirrored texts.
// The actual text size value is the absolute value

View File

@ -88,9 +88,9 @@ bool PLOTTER::OpenFile( const wxString& aFullFilename )
}
DPOINT PLOTTER::userToDeviceCoordinates( const wxPoint& aCoordinate )
DPOINT PLOTTER::userToDeviceCoordinates( const VECTOR2I& aCoordinate )
{
wxPoint pos = aCoordinate - m_plotOffset;
VECTOR2I pos = aCoordinate - m_plotOffset;
// Don't allow overflows; they can cause rendering failures in some file viewers
// (such as Acrobat)
@ -119,7 +119,7 @@ DPOINT PLOTTER::userToDeviceCoordinates( const wxPoint& aCoordinate )
}
DPOINT PLOTTER::userToDeviceSize( const wxSize& size )
DPOINT PLOTTER::userToDeviceSize( const VECTOR2I& size )
{
return DPOINT( size.x * m_plotScale * m_iuPerDeviceUnit,
size.y * m_plotScale * m_iuPerDeviceUnit );
@ -155,15 +155,15 @@ double PLOTTER::GetDashGapLenIU() const
void PLOTTER::Arc( const SHAPE_ARC& aArc )
{
Arc( wxPoint( aArc.GetCenter() ), aArc.GetStartAngle(), aArc.GetEndAngle(), aArc.GetRadius(),
Arc( VECTOR2I( aArc.GetCenter() ), aArc.GetStartAngle(), aArc.GetEndAngle(), aArc.GetRadius(),
FILL_T::NO_FILL, aArc.GetWidth() );
}
void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
void PLOTTER::Arc( const VECTOR2I& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width )
{
wxPoint start, end;
VECTOR2I start, end;
const int delta = 50; // increment (in 0.1 degrees) to draw circles
if( StAngle > EndAngle )
@ -207,14 +207,14 @@ void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int r
}
void PLOTTER::BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
const wxPoint& aControl2, const wxPoint& aEnd,
void PLOTTER::BezierCurve( const VECTOR2I& aStart, const VECTOR2I& aControl1,
const VECTOR2I& aControl2, const VECTOR2I& aEnd,
int aTolerance, int aLineThickness )
{
// Generic fallback: Quadratic Bezier curve plotted as a polyline
int minSegLen = aLineThickness; // The segment min length to approximate a bezier curve
std::vector<wxPoint> ctrlPoints;
std::vector<VECTOR2I> ctrlPoints;
ctrlPoints.push_back( aStart );
ctrlPoints.push_back( aControl1 );
ctrlPoints.push_back( aControl2 );
@ -222,7 +222,7 @@ void PLOTTER::BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
BEZIER_POLY bezier_converter( ctrlPoints );
std::vector<wxPoint> approxPoints;
std::vector<VECTOR2I> approxPoints;
bezier_converter.GetPoly( approxPoints, minSegLen );
SetCurrentLineWidth( aLineThickness );
@ -235,15 +235,15 @@ void PLOTTER::BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
}
void PLOTTER::PlotImage(const wxImage& aImage, const wxPoint& aPos, double aScaleFactor )
void PLOTTER::PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double aScaleFactor )
{
wxSize size( aImage.GetWidth() * aScaleFactor, aImage.GetHeight() * aScaleFactor );
VECTOR2I size( aImage.GetWidth() * aScaleFactor, aImage.GetHeight() * aScaleFactor );
wxPoint start = aPos;
VECTOR2I start = aPos;
start.x -= size.x / 2;
start.y -= size.y / 2;
wxPoint end = start;
VECTOR2I end = start;
end.x += size.x;
end.y += size.y;
@ -251,11 +251,12 @@ void PLOTTER::PlotImage(const wxImage& aImage, const wxPoint& aPos, double aScal
}
void PLOTTER::markerSquare( const wxPoint& position, int radius )
void PLOTTER::markerSquare( const VECTOR2I& position, int radius )
{
double r = KiROUND( radius / 1.4142 );
std::vector< wxPoint > corner_list;
wxPoint corner;
double r = KiROUND( radius / 1.4142 );
std::vector<VECTOR2I> corner_list;
VECTOR2I corner;
corner.x = position.x + r;
corner.y = position.y + r;
corner_list.push_back( corner );
@ -276,16 +277,17 @@ void PLOTTER::markerSquare( const wxPoint& position, int radius )
}
void PLOTTER::markerCircle( const wxPoint& position, int radius )
void PLOTTER::markerCircle( const VECTOR2I& position, int radius )
{
Circle( position, radius * 2, FILL_T::NO_FILL, GetCurrentLineWidth() );
}
void PLOTTER::markerLozenge( const wxPoint& position, int radius )
void PLOTTER::markerLozenge( const VECTOR2I& position, int radius )
{
std::vector< wxPoint > corner_list;
wxPoint corner;
std::vector<VECTOR2I> corner_list;
VECTOR2I corner;
corner.x = position.x;
corner.y = position.y + radius;
corner_list.push_back( corner );
@ -306,35 +308,35 @@ void PLOTTER::markerLozenge( const wxPoint& position, int radius )
}
void PLOTTER::markerHBar( const wxPoint& pos, int radius )
void PLOTTER::markerHBar( const VECTOR2I& pos, int radius )
{
MoveTo( wxPoint( pos.x - radius, pos.y ) );
FinishTo( wxPoint( pos.x + radius, pos.y ) );
MoveTo( VECTOR2I( pos.x - radius, pos.y ) );
FinishTo( VECTOR2I( pos.x + radius, pos.y ) );
}
void PLOTTER::markerSlash( const wxPoint& pos, int radius )
void PLOTTER::markerSlash( const VECTOR2I& pos, int radius )
{
MoveTo( wxPoint( pos.x - radius, pos.y - radius ) );
FinishTo( wxPoint( pos.x + radius, pos.y + radius ) );
MoveTo( VECTOR2I( pos.x - radius, pos.y - radius ) );
FinishTo( VECTOR2I( pos.x + radius, pos.y + radius ) );
}
void PLOTTER::markerBackSlash( const wxPoint& pos, int radius )
void PLOTTER::markerBackSlash( const VECTOR2I& pos, int radius )
{
MoveTo( wxPoint( pos.x + radius, pos.y - radius ) );
FinishTo( wxPoint( pos.x - radius, pos.y + radius ) );
MoveTo( VECTOR2I( pos.x + radius, pos.y - radius ) );
FinishTo( VECTOR2I( pos.x - radius, pos.y + radius ) );
}
void PLOTTER::markerVBar( const wxPoint& pos, int radius )
void PLOTTER::markerVBar( const VECTOR2I& pos, int radius )
{
MoveTo( wxPoint( pos.x, pos.y - radius ) );
FinishTo( wxPoint( pos.x, pos.y + radius ) );
MoveTo( VECTOR2I( pos.x, pos.y - radius ) );
FinishTo( VECTOR2I( pos.x, pos.y + radius ) );
}
void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId )
void PLOTTER::Marker( const VECTOR2I& position, int diametre, unsigned aShapeId )
{
int radius = diametre / 2;
@ -456,11 +458,11 @@ void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId )
}
void PLOTTER::segmentAsOval( const wxPoint& start, const wxPoint& end, int width,
void PLOTTER::segmentAsOval( const VECTOR2I& start, const VECTOR2I& end, int width,
OUTLINE_MODE tracemode )
{
wxPoint center( (start.x + end.x) / 2, (start.y + end.y) / 2 );
wxSize size( end.x - start.x, end.y - start.y );
VECTOR2I center( ( start.x + end.x ) / 2, ( start.y + end.y ) / 2 );
VECTOR2I size( end.x - start.x, end.y - start.y );
double orient;
if( size.y == 0 )
@ -477,12 +479,12 @@ void PLOTTER::segmentAsOval( const wxPoint& start, const wxPoint& end, int width
}
void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, double orient, int width )
void PLOTTER::sketchOval( const VECTOR2I& pos, const VECTOR2I& aSize, double orient, int width )
{
SetCurrentLineWidth( width );
width = m_currentPenWidth;
int radius, deltaxy, cx, cy;
wxSize size( aSize );
VECTOR2I size( aSize );
if( size.x > size.y )
{
@ -495,33 +497,34 @@ void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, double orient
cx = -radius;
cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
MoveTo( wxPoint( cx + pos.x, cy + pos.y ) );
MoveTo( VECTOR2I( cx + pos.x, cy + pos.y ) );
cx = -radius;
cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
FinishTo( wxPoint( cx + pos.x, cy + pos.y ) );
FinishTo( VECTOR2I( cx + pos.x, cy + pos.y ) );
cx = radius;
cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
MoveTo( wxPoint( cx + pos.x, cy + pos.y ) );
MoveTo( VECTOR2I( cx + pos.x, cy + pos.y ) );
cx = radius;
cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
FinishTo( wxPoint( cx + pos.x, cy + pos.y ) );
FinishTo( VECTOR2I( cx + pos.x, cy + pos.y ) );
cx = 0;
cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
Arc( wxPoint( cx + pos.x, cy + pos.y ), orient + 1800, orient + 3600, radius, FILL_T::NO_FILL );
Arc( VECTOR2I( cx + pos.x, cy + pos.y ), orient + 1800, orient + 3600, radius,
FILL_T::NO_FILL );
cx = 0;
cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
Arc( wxPoint( cx + pos.x, cy + pos.y ), orient, orient + 1800, radius, FILL_T::NO_FILL );
Arc( VECTOR2I( cx + pos.x, cy + pos.y ), orient, orient + 1800, radius, FILL_T::NO_FILL );
}
void PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width,
void PLOTTER::ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width,
OUTLINE_MODE tracemode, void* aData )
{
if( tracemode == FILLED )
@ -545,7 +548,7 @@ void PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width,
}
void PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
void PLOTTER::ThickArc( const VECTOR2I& centre, double StAngle, double EndAngle,
int radius, int width, OUTLINE_MODE tracemode, void* aData )
{
if( tracemode == FILLED )
@ -563,7 +566,7 @@ void PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
}
void PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
void PLOTTER::ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width,
OUTLINE_MODE tracemode, void* aData )
{
if( tracemode == FILLED )
@ -573,10 +576,10 @@ void PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
else
{
SetCurrentLineWidth( -1 );
wxPoint offsetp1( p1.x - (width - m_currentPenWidth) / 2,
p1.y - (width - m_currentPenWidth) / 2 );
wxPoint offsetp2( p2.x + (width - m_currentPenWidth) / 2,
p2.y + (width - m_currentPenWidth) / 2 );
VECTOR2I offsetp1( p1.x - ( width - m_currentPenWidth ) / 2,
p1.y - (width - m_currentPenWidth) / 2 );
VECTOR2I offsetp2( p2.x + ( width - m_currentPenWidth ) / 2,
p2.y + (width - m_currentPenWidth) / 2 );
Rect( offsetp1, offsetp2, FILL_T::NO_FILL, -1 );
offsetp1.x += ( width - m_currentPenWidth );
offsetp1.y += ( width - m_currentPenWidth );
@ -587,7 +590,7 @@ void PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
}
void PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width, OUTLINE_MODE tracemode,
void PLOTTER::ThickCircle( const VECTOR2I& pos, int diametre, int width, OUTLINE_MODE tracemode,
void* aData )
{
if( tracemode == FILLED )
@ -603,7 +606,7 @@ void PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width, OUTLINE_
}
void PLOTTER::FilledCircle( const wxPoint& pos, int diametre, OUTLINE_MODE tracemode, void* aData )
void PLOTTER::FilledCircle( const VECTOR2I& pos, int diametre, OUTLINE_MODE tracemode, void* aData )
{
if( tracemode == FILLED )
{
@ -619,7 +622,7 @@ void PLOTTER::FilledCircle( const wxPoint& pos, int diametre, OUTLINE_MODE trace
void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill, int aWidth, void* aData )
{
std::vector<wxPoint> cornerList;
std::vector<VECTOR2I> cornerList;
cornerList.reserve( aCornerList.PointCount() );
for( int ii = 0; ii < aCornerList.PointCount(); ii++ )
@ -649,19 +652,19 @@ void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill, int a
* @param aData is a parameter used by some plotters in SetCurrentLineWidth(),
* not directly used here.
*/
void PLOTTER::Text( const wxPoint& aPos,
const COLOR4D& aColor,
const wxString& aText,
const EDA_ANGLE& aOrient,
const wxSize& aSize,
enum GR_TEXT_H_ALIGN_T aH_justify,
enum GR_TEXT_V_ALIGN_T aV_justify,
int aPenWidth,
bool aItalic,
bool aBold,
bool aMultilineAllowed,
KIFONT::FONT* aFont,
void* aData )
void PLOTTER::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 aPenWidth,
bool aItalic,
bool aBold,
bool aMultilineAllowed,
KIFONT::FONT* aFont,
void* aData )
{
SetColor( aColor );
SetCurrentLineWidth( aPenWidth, aData );

View File

@ -15,7 +15,6 @@ class WX_HTML_REPORT_PANEL;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>

View File

@ -17,7 +17,6 @@
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/menu.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>

View File

@ -50,6 +50,10 @@ public:
m_init( true )
{ }
EDA_RECT( const VECTOR2I& aPos, const VECTOR2I& aSize ) :
EDA_RECT( wxPoint( aPos.x, aPos.y ), wxSize( aSize.x, aSize.y ) )
{ }
template<class T>
EDA_RECT( const BOX2<T> aBox )
{

View File

@ -63,7 +63,7 @@ class PLOTTER;
*/
int Clamp_Text_PenSize( int aPenSize, int aSize, bool aBold = true );
float Clamp_Text_PenSize( float aPenSize, int aSize, bool aBold = true );
int Clamp_Text_PenSize( int aPenSize, const wxSize& aSize, bool aBold = true );
int Clamp_Text_PenSize( int aPenSize, const VECTOR2I& aSize, bool aBold = true );
/**
* @param aTextSize the char size (height or width).
@ -82,7 +82,7 @@ int GetPenSizeForNormal( int aTextSize );
*
* @return the X size of the graphic text.
*/
int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, bool bold );
int GraphicTextWidth( const wxString& aText, const VECTOR2I& aSize, bool italic, bool bold );
/**
* Draw a graphic text (like footprint text)
@ -110,8 +110,8 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, b
* @param aPlotter = a pointer to a PLOTTER instance, when this function is used to plot
* the text. NULL to draw this text.
*/
void GRText( wxDC* aDC, const wxPoint& aPos, const KIGFX::COLOR4D& aColor, const wxString& aText,
const EDA_ANGLE& aOrient, const wxSize& aSize, enum GR_TEXT_H_ALIGN_T aH_justify,
void GRText( wxDC* aDC, const VECTOR2I& aPos, const KIGFX::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,
KIFONT::FONT* aFont,
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,

View File

@ -132,7 +132,7 @@ public:
void SetHeightMils( int aHeightInMils );
int GetHeightMils() const { return m_size.y; }
const wxSize& GetSizeMils() const { return m_size; }
const VECTOR2I& GetSizeMils() const { return m_size; }
// Accessors returning "Internal Units (IU)". IUs are mils in EESCHEMA,
// and either deci-mils or nanometers in PCBNew.
@ -202,7 +202,7 @@ private:
// all dimensions here are in mils
wxString m_type; ///< paper type: A4, A3, etc.
wxSize m_size; ///< mils
VECTOR2I m_size; ///< mils
bool m_portrait; ///< true if portrait, false if landscape

View File

@ -78,7 +78,7 @@ public:
m_Size = aSize;
}
const wxSize GetSize()
const VECTOR2I GetSize()
{
return m_Size;
}
@ -130,10 +130,10 @@ public:
APERTURE_TYPE m_Type;
// horiz and Vert size
wxSize m_Size;
VECTOR2I m_Size;
// list of corners for polygon shape
std::vector<wxPoint> m_Corners;
std::vector<VECTOR2I> m_Corners;
// Radius for polygon and round rect shape
int m_Radius;
@ -159,7 +159,7 @@ public:
class APER_MACRO_FREEPOLY
{
public:
APER_MACRO_FREEPOLY( const std::vector<wxPoint>& aPolygon, int aId )
APER_MACRO_FREEPOLY( const std::vector<VECTOR2I>& aPolygon, int aId )
{
m_Corners = aPolygon;
m_Id = aId;
@ -170,7 +170,7 @@ public:
* aPolygon is the same as m_Corners
* @param aOther is the candidate to compare
*/
bool IsSamePoly( const std::vector<wxPoint>& aPolygon ) const;
bool IsSamePoly( const std::vector<VECTOR2I>& aPolygon ) const;
/**
* print the aperture macro definition to aOutput
@ -182,7 +182,7 @@ public:
int CornersCount() const { return (int)m_Corners.size(); }
std::vector<wxPoint> m_Corners;
std::vector<VECTOR2I> m_Corners;
int m_Id;
};
@ -199,14 +199,14 @@ public:
/**
* append a new APER_MACRO_FREEPOLY containing the polygon aPolygon to the current list
*/
void Append( const std::vector<wxPoint>& aPolygon );
void Append( const std::vector<VECTOR2I>& aPolygon );
/**
* @return the index in m_AMList of the APER_MACRO_FREEPOLY having the
* same polygon as aPolygon, or -1
* @param aCandidate is the polygon candidate to compare
*/
int FindAm( const std::vector<wxPoint>& aPolygon ) const;
int FindAm( const std::vector<VECTOR2I>& aPolygon ) const;
/**
* print the aperture macro list to aOutput

View File

@ -187,7 +187,7 @@ public:
* @param aMirror flips the plot in the Y direction (useful for toner
* transfers or some kind of film).
*/
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) = 0;
/**
@ -212,15 +212,15 @@ public:
int GetPlotterArcHighDef() const { return m_IUsPerDecimil * 2; }
// Low level primitives
virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) = 0;
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) = 0;
/**
* Generic fallback: arc rendered as a polyline.
*/
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, int rayon,
virtual void Arc( const VECTOR2I& centre, double StAngle, double EndAngle, int rayon,
FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH );
virtual void Arc( const SHAPE_ARC& aArc );
@ -229,8 +229,8 @@ public:
* In KiCad the bezier curves have 4 control points:
* start ctrl1 ctrl2 end
*/
virtual void BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
const wxPoint& aControl2, const wxPoint& aEnd,
virtual void BezierCurve( const VECTOR2I& aStart, const VECTOR2I& aControl1,
const VECTOR2I& aControl2, const VECTOR2I& aEnd,
int aTolerance, int aLineThickness = USE_DEFAULT_LINE_WIDTH );
/**
@ -241,20 +241,20 @@ public:
* 'D' draw a line from the current position and 'Z' finish
* the drawing and returns the 'pen' to rest (flushes the trace).
*/
virtual void PenTo( const wxPoint& pos, char plume ) = 0;
virtual void PenTo( const VECTOR2I& pos, char plume ) = 0;
// Convenience functions for PenTo
void MoveTo( const wxPoint& pos )
void MoveTo( const VECTOR2I& pos )
{
PenTo( pos, 'U' );
}
void LineTo( const wxPoint& pos )
void LineTo( const VECTOR2I& pos )
{
PenTo( pos, 'D' );
}
void FinishTo( const wxPoint& pos )
void FinishTo( const VECTOR2I& pos )
{
PenTo( pos, 'D' );
PenTo( pos, 'Z' );
@ -263,18 +263,18 @@ public:
void PenFinish()
{
// The point is not important with Z motion
PenTo( wxPoint( 0, 0 ), 'Z' );
PenTo( VECTOR2I( 0, 0 ), 'Z' );
}
/**
* Draw a polygon ( filled or not ).
*
* @param aCornerList is the corners list (a std::vector< wxPoint >).
* @param aCornerList is the corners list (a std::vector< VECTOR2I >).
* @param aFill is the type of fill.
* @param aWidth is the line width.
* @param aData is an auxiliary info (mainly for gerber format).
*/
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill,
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) = 0;
/**
@ -298,18 +298,18 @@ public:
* @param aScaleFactor is the scale factor to apply to the bitmap size
* (this is not the plot scale factor).
*/
virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos, double aScaleFactor );
virtual void PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double aScaleFactor );
// Higher level primitives -- can be drawn as line, sketch or 'filled'
virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
virtual void ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width,
OUTLINE_MODE tracemode, void* aData );
virtual void ThickArc( const wxPoint& centre, double StAngle, double EndAngle, int rayon,
virtual void ThickArc( const VECTOR2I& centre, double StAngle, double EndAngle, int rayon,
int width, OUTLINE_MODE tracemode, void* aData );
virtual void ThickRect( const wxPoint& p1, const wxPoint& p2, int width, OUTLINE_MODE tracemode,
virtual void ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width, OUTLINE_MODE tracemode,
void* aData );
virtual void ThickCircle( const wxPoint& pos, int diametre, int width, OUTLINE_MODE tracemode,
virtual void ThickCircle( const VECTOR2I& pos, int diametre, int width, OUTLINE_MODE tracemode,
void* aData );
virtual void FilledCircle( const wxPoint& pos, int diametre, OUTLINE_MODE tracemode,
virtual void FilledCircle( const VECTOR2I& pos, int diametre, OUTLINE_MODE tracemode,
void* aData );
@ -321,7 +321,7 @@ public:
* @param aTraceMode is the drawing mode, FILLED or SKETCH.
* @param aData is an auxiliary info (mainly for gerber format attributes).
*/
virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter, OUTLINE_MODE aTraceMode,
virtual void FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter, OUTLINE_MODE aTraceMode,
void* aData ) = 0;
/**
@ -331,7 +331,7 @@ public:
* @param aTraceMode is the drawing mode, FILLED or SKETCH.
* @param aData an auxiliary info (mainly for gerber format attributes).
*/
virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize, double aPadOrient,
OUTLINE_MODE aTraceMode, void* aData ) = 0;
/**
@ -341,7 +341,7 @@ public:
* @param aTraceMode is the drawing mode, FILLED or SKETCH.
* @param aData an auxiliary info (mainly for gerber format attributes).
*/
virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize, double aPadOrient,
OUTLINE_MODE aTraceMode, void* aData ) = 0;
/**
@ -352,7 +352,7 @@ public:
* @param aTraceMode is the drawing mode, FILLED or SKETCH.
* @param aData an auxiliary info (mainly for gerber format attributes).
*/
virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize, int aCornerRadius,
virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize, int aCornerRadius,
double aOrient, OUTLINE_MODE aTraceMode, void* aData ) = 0;
/**
@ -363,7 +363,7 @@ public:
* @param aTraceMode is the drawing mode, FILLED or SKETCH.
* @param aData an auxiliary info (mainly for gerber format attributes).
*/
virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize, double aPadOrient,
SHAPE_POLY_SET* aPolygons, OUTLINE_MODE aTraceMode,
void* aData ) = 0;
@ -377,7 +377,7 @@ public:
* @param aTraceMode is the drawing mode, FILLED or SKETCH.
* @param aData an auxiliary info (mainly for gerber format attributes).
*/
virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorners, double aPadOrient,
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners, double aPadOrient,
OUTLINE_MODE aTraceMode, void* aData ) = 0;
/**
@ -390,7 +390,7 @@ public:
* @param aData is a auxiliary parameter used (if needed) to handle extra info
* specific to the plotter.
*/
virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
double aOrient, OUTLINE_MODE aTraceMode, void* aData ) = 0;
/**
@ -399,19 +399,19 @@ public:
* For convenience it accept the color to use for specific plotters (GERBER) aData is used
* to pass extra parameters.
*/
virtual void Text( const wxPoint& aPos,
const COLOR4D& aColor,
const wxString& aText,
const EDA_ANGLE& aOrient,
const wxSize& 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 );
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 );
/**
* Draw a marker (used for the drill map).
@ -425,7 +425,7 @@ public:
* @param aDiameter is the diameter of the marker.
* @param aShapeId is the index (used to generate forms characters).
*/
void Marker( const wxPoint& position, int diametre, unsigned aShapeId );
void Marker( const VECTOR2I& position, int diametre, unsigned aShapeId );
/**
* Set the current Gerber layer polarity to positive or negative
@ -484,61 +484,61 @@ protected:
/**
* Plot a circle centered on the position. Building block for markers
*/
void markerCircle( const wxPoint& pos, int radius );
void markerCircle( const VECTOR2I& pos, int radius );
/**
* Plot a - bar centered on the position. Building block for markers
*/
void markerHBar( const wxPoint& pos, int radius );
void markerHBar( const VECTOR2I& pos, int radius );
/**
* Plot a / bar centered on the position. Building block for markers
*/
void markerSlash( const wxPoint& pos, int radius );
void markerSlash( const VECTOR2I& pos, int radius );
/**
* Plot a \ bar centered on the position. Building block for markers
*/
void markerBackSlash( const wxPoint& pos, int radius );
void markerBackSlash( const VECTOR2I& pos, int radius );
/**
* Plot a | bar centered on the position. Building block for markers
*/
void markerVBar( const wxPoint& pos, int radius );
void markerVBar( const VECTOR2I& pos, int radius );
/**
* Plot a square centered on the position. Building block for markers
*/
void markerSquare( const wxPoint& position, int radius );
void markerSquare( const VECTOR2I& position, int radius );
/**
* Plot a lozenge centered on the position. Building block for markers
*/
void markerLozenge( const wxPoint& position, int radius );
void markerLozenge( const VECTOR2I& position, int radius );
// Helper function for sketched filler segment
/**
* Convert a thick segment and plot it as an oval
*/
void segmentAsOval( const wxPoint& start, const wxPoint& end, int width,
void segmentAsOval( const VECTOR2I& start, const VECTOR2I& end, int width,
OUTLINE_MODE tracemode );
void sketchOval( const wxPoint& pos, const wxSize& size, double orient, int width );
void sketchOval( const VECTOR2I& pos, const VECTOR2I& size, double orient, int width );
// Coordinate and scaling conversion functions
/**
* Modify coordinates according to the orientation, scale factor, and offsets trace. Also
* convert from a wxPoint to DPOINT, since some output engines needs floating point
* convert from a VECTOR2I to DPOINT, since some output engines needs floating point
* coordinates.
*/
virtual DPOINT userToDeviceCoordinates( const wxPoint& aCoordinate );
virtual DPOINT userToDeviceCoordinates( const VECTOR2I& aCoordinate );
/**
* Modify size according to the plotter scale factors (wxSize version, returns a DPOINT).
* Modify size according to the plotter scale factors (VECTOR2I version, returns a DPOINT).
*/
virtual DPOINT userToDeviceSize( const wxSize& size );
virtual DPOINT userToDeviceSize( const VECTOR2I& size );
/**
* Modify size according to the plotter scale factors (simple double version).
@ -563,7 +563,7 @@ protected: // variables used in most of plotters:
double m_iuPerDeviceUnit; // Device scale (from IUs to plotter device units;
// usually decimils)
wxPoint m_plotOffset; // Plot offset (in IUs)
VECTOR2I m_plotOffset; // Plot offset (in IUs)
bool m_plotMirror; // X axis orientation (SVG)
// and plot mirrored (only for PS, PDF HPGL and SVG)
bool m_mirrorIsHorizontal; // true to mirror horizontally (else vertically)
@ -577,13 +577,13 @@ protected: // variables used in most of plotters:
bool m_negativeMode; // true to generate a negative image (PS mode mainly)
int m_currentPenWidth;
char m_penState; // current pen state: 'U', 'D' or 'Z' (see PenTo)
wxPoint m_penLastpos; // last pen position; -1,-1 when pen is at rest
VECTOR2I m_penLastpos; // last pen position; -1,-1 when pen is at rest
wxString m_creator;
wxString m_filename;
wxString m_title;
PAGE_INFO m_pageInfo;
wxSize m_paperSize; // Paper size in IU - not in mils
VECTOR2I m_paperSize; // Paper size in IU - not in mils
wxArrayString m_headerExtraLines; // a set of string to print in header file

View File

@ -83,13 +83,13 @@ public:
* The DXF engine doesn't support line widths and mirroring. The output
* coordinate system is in the first quadrant (in mm).
*/
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override;
/**
* DXF rectangle: fill not supported.
*/
virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
/**
@ -98,7 +98,7 @@ public:
*
* I could use this trick to do other filled primitives.
*/
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
/**
@ -108,60 +108,60 @@ public:
* It does not know thick segments, therefore filled polygons with thick outline
* are converted to inflated polygon by aWidth/2.
*/
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill,
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override;
virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
virtual void ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width,
OUTLINE_MODE tracemode, void* aData ) override;
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
virtual void Arc( const VECTOR2I& centre, double StAngle, double EndAngle,
int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void PenTo( const wxPoint& pos, char plume ) override;
virtual void PenTo( const VECTOR2I& pos, char plume ) override;
/**
* DXF round pad: always done in sketch mode; it could be filled but it isn't
* pretty if other kinds of pad aren't...
*/
virtual void FlashPadCircle( const wxPoint& pos, int diametre,
virtual void FlashPadCircle( const VECTOR2I& pos, int diametre,
OUTLINE_MODE trace_mode, void* aData ) override;
/**
* DXF oval pad: always done in sketch mode.
*/
virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient,
virtual void FlashPadOval( const VECTOR2I& pos, const VECTOR2I& size, double orient,
OUTLINE_MODE trace_mode, void* aData ) override;
/**
* DXF rectangular pad: always done in sketch mode.
*/
virtual void FlashPadRect( const wxPoint& pos, const wxSize& size,
virtual void FlashPadRect( const VECTOR2I& pos, const VECTOR2I& size,
double orient, OUTLINE_MODE trace_mode, void* aData ) override;
virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, double aOrient,
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize, double aOrient,
virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize, double aOrient,
SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData ) override;
/**
* DXF trapezoidal pad: only sketch mode is supported.
*/
virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
double aPadOrient, OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
double aOrient, OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void Text( const wxPoint& aPos,
const COLOR4D& aColor,
const wxString& aText,
const EDA_ANGLE& aOrient,
const wxSize& 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,
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;
void* aData = nullptr ) override;
/**

View File

@ -61,81 +61,81 @@ public:
virtual void SetColor( const COLOR4D& color ) override {}
// Currently, aScale and aMirror are not used in gerber plotter
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override;
// Basic plot primitives
virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle, int aRadius,
virtual void Arc( const VECTOR2I& aCenter, double aStAngle, double aEndAngle, int aRadius,
FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Arc( const SHAPE_ARC& aArc ) override;
// These functions plot an item and manage X2 gerber attributes
virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
virtual void ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width,
OUTLINE_MODE tracemode, void* aData ) override;
virtual void ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
virtual void ThickArc( const VECTOR2I& centre, double StAngle, double EndAngle,
int rayon, int width, OUTLINE_MODE tracemode, void* aData ) override;
virtual void ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
virtual void ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width,
OUTLINE_MODE tracemode, void* aData ) override;
virtual void ThickCircle( const wxPoint& pos, int diametre, int width,
virtual void ThickCircle( const VECTOR2I& pos, int diametre, int width,
OUTLINE_MODE tracemode, void* aData ) override;
virtual void FilledCircle( const wxPoint& pos, int diametre,
virtual void FilledCircle( const VECTOR2I& pos, int diametre,
OUTLINE_MODE tracemode, void* aData ) override;
/**
* Gerber polygon: they can (and *should*) be filled with the
* appropriate G36/G37 sequence
*/
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill,
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override;
virtual void PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override;
virtual void PenTo( const wxPoint& pos, char plume ) override;
virtual void PenTo( const VECTOR2I& pos, char plume ) override;
virtual void Text( const wxPoint& aPos,
const COLOR4D& aColor,
const wxString& aText,
const EDA_ANGLE& aOrient,
const wxSize& 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;
/**
* Filled circular flashes are stored as apertures
*/
virtual void FlashPadCircle( const wxPoint& pos, int diametre,
virtual void FlashPadCircle( const VECTOR2I& pos, int diametre,
OUTLINE_MODE trace_mode, void* aData ) override;
virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& size, double orient,
virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& size, double orient,
OUTLINE_MODE trace_mode, void* aData ) override;
virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& size,
virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& size,
double orient, OUTLINE_MODE trace_mode, void* aData ) override;
virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, double aOrient,
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
double aPadOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
double aPadOrient, OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
double aOrient, OUTLINE_MODE aTraceMode, void* aData ) override;
/**
@ -155,7 +155,7 @@ public:
* @param aPlotMode is the drawing mode, FILLED or SKETCH.
* @param aData is the a reference to Gerber attributes descr.
*/
void FlashPadChamferRoundRect( const wxPoint& aShapePos, const wxSize& aPadSize,
void FlashPadChamferRoundRect( const VECTOR2I& aShapePos, const VECTOR2I& aPadSize,
int aCornerRadius, double aChamferRatio,
int aChamferPositions, double aPadOrient,
OUTLINE_MODE aPlotMode, void* aData );
@ -165,7 +165,7 @@ public:
* and add the TA.AperFunction if aData contains this attribute, and clear it
* after plotting.
*/
void PlotGerberRegion( const std::vector< wxPoint >& aCornerList, void* aData = nullptr );
void PlotGerberRegion( const std::vector<VECTOR2I>& aCornerList, void* aData = nullptr );
void PlotGerberRegion( const SHAPE_LINE_CHAIN& aPoly, void* aData = nullptr );
@ -233,7 +233,7 @@ public:
* @return an index to the aperture in aperture list which meets the size and type of tool
* if the aperture does not exist, it is created and entered in aperture list.
*/
int GetOrCreateAperture( const wxSize& aSize, int aRadius, double aRotDegree,
int GetOrCreateAperture( const VECTOR2I& aSize, int aRadius, double aRotDegree,
APERTURE::APERTURE_TYPE aType, int aApertureAttribute );
/**
@ -245,7 +245,7 @@ public:
* @return an index to the aperture in aperture list which meets the data and type of tool
* if the aperture does not exist, it is created and entered in aperture list.
*/
int GetOrCreateAperture( const std::vector<wxPoint>& aCorners, double aRotDegree,
int GetOrCreateAperture( const std::vector<VECTOR2I>& aCorners, double aRotDegree,
APERTURE::APERTURE_TYPE aType, int aApertureAttribute );
protected:
@ -260,7 +260,7 @@ protected:
* @param aCornerRadius is the radius of the corners.
* @param aOrient is the rotation of the rectangle.
*/
void plotRoundRectAsRegion( const wxPoint& aRectCenter, const wxSize& aSize,
void plotRoundRectAsRegion( const VECTOR2I& aRectCenter, const VECTOR2I& aSize,
int aCornerRadius, double aOrient );
/**
* Plot a Gerber arc.
@ -272,7 +272,7 @@ protected:
* plot an usual arc item. The line thickness is not initialized in plotArc, and must
* be initialized before calling it if needed.
*/
void plotArc( const wxPoint& aCenter, double aStAngle, double aEndAngle,
void plotArc( const VECTOR2I& aCenter, double aStAngle, double aEndAngle,
int aRadius, bool aPlotInRegion );
void plotArc( const SHAPE_ARC& aArc, bool aPlotInRegion );
@ -281,7 +281,7 @@ protected:
*
* Write the DCode selection on gerber file.
*/
void selectAperture( const wxSize& aSize, int aRadius, double aRotDegree,
void selectAperture( const VECTOR2I& aSize, int aRadius, double aRotDegree,
APERTURE::APERTURE_TYPE aType, int aApertureAttribute );
/**
* Pick an existing aperture or create a new one, matching the aDiameter, aPolygonRotation,
@ -290,7 +290,7 @@ protected:
* It apply only to apertures with type = AT_REGULAR_POLY3 to AT_REGULAR_POLY12
* write the DCode selection on gerber file
*/
void selectAperture( const std::vector<wxPoint>& aCorners, double aPolygonRotation,
void selectAperture( const std::vector<VECTOR2I>& aCorners, double aPolygonRotation,
APERTURE::APERTURE_TYPE aType, int aApertureAttribute );
/**

View File

@ -94,16 +94,16 @@ public:
virtual void SetPenDiameter( double diameter );
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override;
virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill,
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override;
virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
virtual void ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width,
OUTLINE_MODE tracemode, void* aData ) override;
/**
@ -118,25 +118,25 @@ public:
* EndAngle is end angle the arc.
* Radius is the radius of the arc.
*/
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, int rayon,
virtual void Arc( const VECTOR2I& centre, double StAngle, double EndAngle, int rayon,
FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void PenTo( const wxPoint& pos, char plume ) override;
virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
virtual void PenTo( const VECTOR2I& pos, char plume ) override;
virtual void FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter,
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize, double aPadOrient,
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
double aOrient, OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, double aOrient,
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize, double aOrient,
virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize, double aOrient,
SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
double aPadOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;
virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
double aOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;

View File

@ -61,21 +61,21 @@ public:
}
// Pad routines are handled with lower level primitives
virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
virtual void FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter,
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize, double aPadOrient,
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize, double aPadOrient,
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, double aOrient,
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize, double aOrient,
virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize, double aOrient,
SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
double aPadOrient, OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
double aOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;
@ -95,10 +95,10 @@ protected:
* operator to simplify PDF generation (concat is everything PDF
* has to modify the CTM. Lots of parameters, both in and out.
*/
void computeTextParameters( const wxPoint& aPos,
void computeTextParameters( const VECTOR2I& aPos,
const wxString& aText,
const EDA_ANGLE& aOrient,
const wxSize& aSize,
const VECTOR2I& aSize,
bool aMirror,
enum GR_TEXT_H_ALIGN_T aH_justify,
enum GR_TEXT_V_ALIGN_T aV_justify,
@ -195,38 +195,38 @@ public:
*/
virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override;
virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, int rayon,
virtual void Arc( const VECTOR2I& centre, double StAngle, double EndAngle, int rayon,
FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill,
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override;
/**
* PostScript-likes at the moment are the only plot engines supporting bitmaps.
*/
virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
virtual void PlotImage( const wxImage& aImage, const VECTOR2I& aPos,
double aScaleFactor ) override;
virtual void PenTo( const wxPoint& pos, char plume ) override;
virtual void Text( const wxPoint& aPos,
const COLOR4D& aColor,
const wxString& aText,
const EDA_ANGLE& aOrient,
const wxSize& 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 PenTo( const VECTOR2I& pos, char plume ) 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;
protected:
virtual void emitSetRGBColor( double r, double g, double b ) override;
@ -302,54 +302,54 @@ public:
* PDF can have multiple pages, so SetPageSettings can be called
* with the outputFile open (but not inside a page stream!)
*/
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override;
/**
* Rectangles in PDF. Supported by the native operator.
*/
virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
/**
* Circle drawing for PDF. They're approximated by curves, but fill is supported
*/
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
/**
* The PDF engine can't directly plot arcs, it uses the base emulation.
* So no filled arcs (not a great loss... )
*/
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, int rayon,
virtual void Arc( const VECTOR2I& centre, double StAngle, double EndAngle, int rayon,
FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
/**
* Polygon plotting for PDF. Everything is supported
*/
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill,
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override;
virtual void PenTo( const wxPoint& pos, char plume ) override;
virtual void PenTo( const VECTOR2I& pos, char plume ) override;
virtual void Text( const wxPoint& aPos,
const COLOR4D& aColor,
const wxString& aText,
const EDA_ANGLE& aOrient,
const wxSize& 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;
/**
* PDF images are handles as inline, not XObject streams...
*/
virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
virtual void PlotImage( const wxImage& aImage, const VECTOR2I& aPos,
double aScaleFactor ) override;
@ -444,30 +444,30 @@ public:
*/
virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override;
virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, int rayon,
virtual void Arc( const VECTOR2I& centre, double StAngle, double EndAngle, int rayon,
FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
const wxPoint& aControl2, const wxPoint& aEnd,
virtual void BezierCurve( const VECTOR2I& aStart, const VECTOR2I& aControl1,
const VECTOR2I& aControl2, const VECTOR2I& aEnd,
int aTolerance,
int aLineThickness = USE_DEFAULT_LINE_WIDTH ) override;
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill,
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = nullptr ) override;
/**
* PostScript-likes at the moment are the only plot engines supporting bitmaps.
*/
virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
virtual void PlotImage( const wxImage& aImage, const VECTOR2I& aPos,
double aScaleFactor ) override;
virtual void PenTo( const wxPoint& pos, char plume ) override;
virtual void PenTo( const VECTOR2I& pos, char plume ) override;
/**
* Select SVG step size (number of digits needed for 1 mm or 1 inch )
@ -496,19 +496,19 @@ public:
*/
virtual void EndBlock( void* aData ) override;
virtual void Text( const wxPoint& aPos,
const COLOR4D& aColor,
const wxString& aText,
const EDA_ANGLE& aOrient,
const wxSize& 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;
protected:
/**

View File

@ -38,6 +38,8 @@ class BEZIER_POLY
public:
BEZIER_POLY( const std::vector<wxPoint>& aControlPoints );
BEZIER_POLY( const std::vector<VECTOR2I>& aControlPoints );
BEZIER_POLY( const std::vector<VECTOR2D>& aControlPoints )
: m_ctrlPts( aControlPoints )
{
@ -53,6 +55,7 @@ public:
* (the last point is always generated)
*/
void GetPoly( std::vector<wxPoint>& aOutput, int aMinSegLen = 0 );
void GetPoly( std::vector<VECTOR2I>& aOutput, int aMinSegLen = 0 );
void GetPoly( std::vector<VECTOR2D>& aOutput, double aMinSegLen = 0.0 );
private:

View File

@ -110,8 +110,8 @@ void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCe
* @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, const wxPoint& aStart,
const wxPoint& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc,
void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aStart,
const VECTOR2I& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc,
int aMinSegCount = 0 );
/**
@ -157,7 +157,7 @@ void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer,
* @param aErrorLoc determines if the approximation error be placed outside or inside the polygon.
*/
void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer,
const wxPoint& aPosition, const wxSize& aSize,
const VECTOR2I& aPosition, const VECTOR2I& aSize,
double aRotation, int aCornerRadius,
double aChamferRatio, int aChamferCorners, int aInflate,
int aError, ERROR_LOC aErrorLoc );

View File

@ -167,6 +167,12 @@ inline double EuclideanNorm( const wxSize &vector )
return hypot( vector.x, vector.y );
}
inline double EuclideanNorm( const VECTOR2I& vector )
{
// this is working with doubles
return hypot( vector.x, vector.y );
}
//! @brief Compute the distance between a line and a reference point
//! Reference: http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html
//! @param linePointA Point on line

View File

@ -40,6 +40,15 @@ BEZIER_POLY::BEZIER_POLY( const std::vector<wxPoint>& aControlPoints )
}
BEZIER_POLY::BEZIER_POLY( const std::vector<VECTOR2I>& aControlPoints )
{
for( unsigned ii = 0; ii < aControlPoints.size(); ++ii )
m_ctrlPts.emplace_back( VECTOR2I( aControlPoints[ii] ) );
m_minSegLen = 0.0;
}
void BEZIER_POLY::GetPoly( std::vector<wxPoint>& aOutput, int aMinSegLen )
{
aOutput.clear();
@ -51,6 +60,17 @@ void BEZIER_POLY::GetPoly( std::vector<wxPoint>& aOutput, int aMinSegLen )
}
void BEZIER_POLY::GetPoly( std::vector<VECTOR2I>& aOutput, int aMinSegLen )
{
aOutput.clear();
std::vector<VECTOR2I> buffer;
GetPoly( buffer, double( aMinSegLen ) );
for( unsigned ii = 0; ii < buffer.size(); ++ii )
aOutput.emplace_back( VECTOR2I( int( buffer[ii].x ), int( buffer[ii].y ) ) );
}
void BEZIER_POLY::GetPoly( std::vector<VECTOR2D>& aOutput, double aMinSegLen )
{
wxASSERT( m_ctrlPts.size() == 4 );

View File

@ -123,8 +123,8 @@ void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCe
}
void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart,
const wxPoint& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc,
void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aStart,
const VECTOR2I& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc,
int aMinSegCount )
{
// To build the polygonal shape outside the actual shape, we use a bigger
@ -149,8 +149,8 @@ void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStar
}
// end point is the coordinate relative to aStart
wxPoint endp = aEnd - aStart;
wxPoint startp = aStart;
VECTOR2I endp = aEnd - aStart;
VECTOR2I startp = aStart;
wxPoint corner;
SHAPE_POLY_SET polyshape;
@ -434,13 +434,13 @@ void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint&
}
void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aPosition,
const wxSize& aSize, double aRotation, int aCornerRadius,
void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aPosition,
const VECTOR2I& aSize, double aRotation, int aCornerRadius,
double aChamferRatio, int aChamferCorners, int aInflate,
int aError, ERROR_LOC aErrorLoc )
{
SHAPE_POLY_SET outline;
wxSize size( aSize / 2 );
VECTOR2I size( aSize / 2 );
int chamferCnt = std::bitset<8>( aChamferCorners ).count();
double chamferDeduct = 0;

View File

@ -15,7 +15,6 @@ class WX_HTML_REPORT_PANEL;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>

View File

@ -62,7 +62,6 @@
#include <zone.h>
#include <wx/debug.h> // for wxASSERT_MSG
#include <wx/gdicmn.h>
COLOR4D BRDITEMS_PLOTTER::getColor( int aLayer ) const
@ -244,16 +243,16 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_
// Build the pad polygon in coordinates relative to the pad
// (i.e. for a pad at pos 0,0, rot 0.0). Needed to use aperture macros,
// to be able to create a pattern common to all trapezoid pads having the same shape
wxPoint coord[4];
VECTOR2I coord[4];
// Order is lower left, lower right, upper right, upper left.
wxSize half_size = aPad->GetSize()/2;
wxSize trap_delta = aPad->GetDelta()/2;
VECTOR2I half_size = aPad->GetSize() / 2;
VECTOR2I trap_delta = aPad->GetDelta() / 2;
coord[0] = wxPoint( -half_size.x - trap_delta.y, half_size.y + trap_delta.x );
coord[1] = wxPoint( half_size.x + trap_delta.y, half_size.y - trap_delta.x );
coord[2] = wxPoint( half_size.x - trap_delta.y, -half_size.y + trap_delta.x );
coord[3] = wxPoint( -half_size.x + trap_delta.y, -half_size.y - trap_delta.x );
coord[0] = VECTOR2I( -half_size.x - trap_delta.y, half_size.y + trap_delta.x );
coord[1] = VECTOR2I( half_size.x + trap_delta.y, half_size.y - trap_delta.x );
coord[2] = VECTOR2I( half_size.x - trap_delta.y, -half_size.y + trap_delta.x );
coord[3] = VECTOR2I( -half_size.x + trap_delta.y, -half_size.y - trap_delta.x );
m_plotter->FlashPadTrapez( shape_pos, coord, aPad->GetOrientation(), aPlotMode,
&gbr_metadata );