Retire DPOINT and DSIZE.

This commit is contained in:
Jeff Young 2022-01-20 00:17:44 +00:00
parent 67eb3116ce
commit fbab335128
16 changed files with 97 additions and 109 deletions

View File

@ -699,7 +699,7 @@ void DS_DATA_ITEM_TEXT::SetConstrainedTextSize()
dummy.SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) );
EDA_RECT rect = dummy.GetTextBox();
DSIZE size;
VECTOR2D size;
size.x = rect.GetWidth() / FSCALE;
size.y = rect.GetHeight() / FSCALE;

View File

@ -428,8 +428,8 @@ void DXF_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
void DXF_PLOTTER::Circle( const VECTOR2I& centre, int diameter, FILL_T fill, int width )
{
wxASSERT( m_outputFile );
double radius = userToDeviceSize( diameter / 2 );
DPOINT centre_dev = userToDeviceCoordinates( centre );
double radius = userToDeviceSize( diameter / 2 );
VECTOR2D centre_dev = userToDeviceCoordinates( centre );
if( radius > 0 )
{
@ -568,8 +568,8 @@ void DXF_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
return;
}
DPOINT pos_dev = userToDeviceCoordinates( pos );
DPOINT pen_lastpos_dev = userToDeviceCoordinates( m_penLastpos );
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
VECTOR2D pen_lastpos_dev = userToDeviceCoordinates( m_penLastpos );
if( m_penLastpos != pos && plume == 'D' )
{
@ -861,10 +861,10 @@ void DXF_PLOTTER::Text( const VECTOR2I& aPos,
{
/* Emit text as a text entity. This loses formatting and shape but it's
more useful as a CAD object */
DPOINT origin_dev = userToDeviceCoordinates( aPos );
VECTOR2D origin_dev = userToDeviceCoordinates( aPos );
SetColor( aColor );
wxString cname = getDXFColorName( m_currentColor );
DPOINT size_dev = userToDeviceSize( aSize );
VECTOR2D size_dev = userToDeviceSize( aSize );
int h_code = 0, v_code = 0;
switch( aH_justify )

View File

@ -152,7 +152,7 @@ void GERBER_PLOTTER::SetGerberCoordinatesFormat( int aResolution, bool aUseInche
}
void GERBER_PLOTTER::emitDcode( const DPOINT& pt, int dcode )
void GERBER_PLOTTER::emitDcode( const VECTOR2D& pt, int dcode )
{
fprintf( m_outputFile, "X%dY%dD%02d*\n", KiROUND( pt.x ), KiROUND( pt.y ), dcode );
@ -781,7 +781,7 @@ void GERBER_PLOTTER::writeApertureList()
void GERBER_PLOTTER::PenTo( const VECTOR2I& aPos, char plume )
{
wxASSERT( m_outputFile );
DPOINT pos_dev = userToDeviceCoordinates( aPos );
VECTOR2D pos_dev = userToDeviceCoordinates( aPos );
switch( plume )
{
@ -849,8 +849,8 @@ void GERBER_PLOTTER::plotArc( const SHAPE_ARC& aArc, bool aPlotInRegion )
else
LineTo( start );
DPOINT devEnd = userToDeviceCoordinates( end );
DPOINT devCenter = userToDeviceCoordinates( center ) - userToDeviceCoordinates( start );
VECTOR2D devEnd = userToDeviceCoordinates( end );
VECTOR2D devCenter = userToDeviceCoordinates( center ) - userToDeviceCoordinates( start );
fprintf( m_outputFile, "G75*\n" ); // Multiquadrant (360 degrees) mode
@ -881,8 +881,8 @@ void GERBER_PLOTTER::plotArc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAn
end.x = aCenter.x + KiROUND( aRadius * aEndAngle.Cos() );
end.y = aCenter.y - KiROUND( aRadius * aEndAngle.Sin() );
DPOINT devEnd = userToDeviceCoordinates( end );
DPOINT devCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );
VECTOR2D devEnd = userToDeviceCoordinates( end );
VECTOR2D devCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );
fprintf( m_outputFile, "G75*\n" ); // Multiquadrant (360 degrees) mode
@ -1243,7 +1243,7 @@ void GERBER_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre, OUTLINE_
}
else
{
DPOINT pos_dev = userToDeviceCoordinates( pos );
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
selectAperture( size, 0, ANGLE_0, APERTURE::AT_CIRCLE, aperture_attrib );
@ -1453,8 +1453,8 @@ void GERBER_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I&
{
m_hasApertureRoundRect = true;
DPOINT pos_dev = userToDeviceCoordinates( aPadPos );
int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
VECTOR2D pos_dev = userToDeviceCoordinates( aPadPos );
int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
selectAperture( aSize, aCornerRadius, aOrient, APERTURE::AM_ROUND_RECT,
aperture_attrib );
@ -1678,7 +1678,7 @@ void GERBER_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aS
RotatePoint( cornerList[ii], -aOrient );
}
DPOINT pos_dev = userToDeviceCoordinates( aPadPos );
VECTOR2D pos_dev = userToDeviceCoordinates( aPadPos );
selectAperture( cornerList, aOrient, APERTURE::AM_FREE_POLYGON,
gbr_metadata.GetApertureAttrib() );
formatNetAttribute( &gbr_metadata.m_NetlistMetadata );
@ -1853,7 +1853,7 @@ void GERBER_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aC
#endif
{
m_hasApertureOutline4P = true;
DPOINT pos_dev = userToDeviceCoordinates( aPadPos );
VECTOR2D pos_dev = userToDeviceCoordinates( aPadPos );
// polygon corners list
std::vector<VECTOR2I> corners = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] };
int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
@ -1904,9 +1904,8 @@ void GERBER_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiamet
}
else
{
DPOINT pos_dev = userToDeviceCoordinates( aShapePos );
int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
VECTOR2D pos_dev = userToDeviceCoordinates( aShapePos );
int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
APERTURE::APERTURE_TYPE apert_type =
(APERTURE::APERTURE_TYPE)(APERTURE::AT_REGULAR_POLY3 + aCornerCount - 3);

View File

@ -203,8 +203,8 @@
#include <plotters/plotter_hpgl.h>
/// Compute the distance between two DPOINT points.
static double dpoint_dist( const DPOINT& a, const DPOINT& b );
/// Compute the distance between two VECTOR2D points.
static double dpoint_dist( const VECTOR2D& a, const VECTOR2D& b );
// The hpgl command to close a polygon def, fill it and plot outline:
@ -652,9 +652,8 @@ void HPGL_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre,
OUTLINE_MODE trace_mode, void* aData )
{
wxASSERT( m_outputFile );
DPOINT pos_dev = userToDeviceCoordinates( pos );
int radius = diametre / 2;
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
int radius = diametre / 2;
if( trace_mode == FILLED )
{
@ -824,7 +823,7 @@ void HPGL_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aRadius,
}
bool HPGL_PLOTTER::startItem( const DPOINT& location )
bool HPGL_PLOTTER::startItem( const VECTOR2D& location )
{
return startOrAppendItem( location, wxEmptyString );
}
@ -836,7 +835,7 @@ void HPGL_PLOTTER::flushItem()
}
bool HPGL_PLOTTER::startOrAppendItem( const DPOINT& location, wxString const& content )
bool HPGL_PLOTTER::startOrAppendItem( const VECTOR2D& location, wxString const& content )
{
if( m_current_item == nullptr )
{
@ -935,8 +934,8 @@ const char* HPGL_PLOTTER::lineTypeCommand( PLOT_DASH_TYPE linetype )
}
static double dpoint_dist( const DPOINT& a, const DPOINT& b )
static double dpoint_dist( const VECTOR2D& a, const VECTOR2D& b )
{
DPOINT diff = a - b;
VECTOR2D diff = a - b;
return sqrt( diff.x * diff.x + diff.y * diff.y );
}

View File

@ -199,8 +199,8 @@ void PDF_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
void PDF_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width )
{
wxASSERT( workFile );
DPOINT p1_dev = userToDeviceCoordinates( p1 );
DPOINT p2_dev = userToDeviceCoordinates( p2 );
VECTOR2D p1_dev = userToDeviceCoordinates( p1 );
VECTOR2D p2_dev = userToDeviceCoordinates( p2 );
SetCurrentLineWidth( width );
fprintf( workFile, "%g %g %g %g re %c\n", p1_dev.x, p1_dev.y,
@ -211,8 +211,8 @@ void PDF_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
void PDF_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T aFill, int width )
{
wxASSERT( workFile );
DPOINT pos_dev = userToDeviceCoordinates( pos );
double radius = userToDeviceSize( diametre / 2.0 );
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
double radius = userToDeviceSize( diametre / 2.0 );
/* OK. Here's a trick. PDF doesn't support circles or circular angles, that's
a fact. You'll have to do with cubic beziers. These *can't* represent
@ -290,7 +290,7 @@ void PDF_PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
// Usual trig arc plotting routine...
start.x = aCenter.x + KiROUND( aRadius * -startAngle.Cos() );
start.y = aCenter.y + KiROUND( aRadius * -startAngle.Sin() );
DPOINT pos_dev = userToDeviceCoordinates( start );
VECTOR2D pos_dev = userToDeviceCoordinates( start );
fprintf( workFile, "%g %g m ", pos_dev.x, pos_dev.y );
for( EDA_ANGLE ii = startAngle + delta; ii < endAngle; ii += delta )
@ -330,7 +330,7 @@ void PDF_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFi
SetCurrentLineWidth( aWidth );
DPOINT pos = userToDeviceCoordinates( aCornerList[0] );
VECTOR2D pos = userToDeviceCoordinates( aCornerList[0] );
fprintf( workFile, "%g %g m\n", pos.x, pos.y );
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
@ -363,7 +363,7 @@ void PDF_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
if( m_penState != plume || pos != m_penLastpos )
{
DPOINT pos_dev = userToDeviceCoordinates( pos );
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
fprintf( workFile, "%g %g %c\n",
pos_dev.x, pos_dev.y,
( plume=='D' ) ? 'l' : 'm' );
@ -380,12 +380,11 @@ void PDF_PLOTTER::PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double
VECTOR2I pix_size( aImage.GetWidth(), aImage.GetHeight() );
// Requested size (in IUs)
DPOINT drawsize( aScaleFactor * pix_size.x, aScaleFactor * pix_size.y );
VECTOR2D drawsize( aScaleFactor * pix_size.x, aScaleFactor * pix_size.y );
// calculate the bitmap start position
VECTOR2I start( aPos.x - drawsize.x / 2, aPos.y + drawsize.y / 2 );
DPOINT dev_start = userToDeviceCoordinates( start );
VECTOR2D dev_start = userToDeviceCoordinates( start );
/* PDF has an uhm... simplified coordinate system handling. There is
*one* operator to do everything (the PS concat equivalent). At least

View File

@ -480,8 +480,8 @@ void PSLIKE_PLOTTER::computeTextParameters( const VECTOR2I& aPos,
RotatePoint( &tw, &th, aOrient );
start_pos.x += dx;
start_pos.y += dy;
DPOINT pos_dev = userToDeviceCoordinates( start_pos );
DPOINT sz_dev = userToDeviceSize( aSize );
VECTOR2D pos_dev = userToDeviceCoordinates( start_pos );
VECTOR2D sz_dev = userToDeviceSize( aSize );
// Now returns the final values... the widening factor
*wideningFactor = sz_dev.x / sz_dev.y;
@ -567,8 +567,8 @@ void PS_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
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 );
VECTOR2D p1_dev = userToDeviceCoordinates( p1 );
VECTOR2D p2_dev = userToDeviceCoordinates( p2 );
SetCurrentLineWidth( width );
fprintf( m_outputFile, "%g %g %g %g rect%d\n", p1_dev.x, p1_dev.y,
@ -579,8 +579,8 @@ void PS_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
void PS_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width )
{
wxASSERT( m_outputFile );
DPOINT pos_dev = userToDeviceCoordinates( pos );
double radius = userToDeviceSize( diametre / 2.0 );
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
double radius = userToDeviceSize( diametre / 2.0 );
SetCurrentLineWidth( width );
fprintf( m_outputFile, "%g %g %g cir%d\n", pos_dev.x, pos_dev.y, radius, getFillId( fill ) );
@ -604,8 +604,8 @@ void PS_PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
SetCurrentLineWidth( aWidth );
// Calculate start point.
DPOINT centre_dev = userToDeviceCoordinates( aCenter );
double radius_dev = userToDeviceSize( aRadius );
VECTOR2D centre_dev = userToDeviceCoordinates( aCenter );
double radius_dev = userToDeviceSize( aRadius );
if( m_plotMirror )
{
@ -635,7 +635,7 @@ void PS_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFil
SetCurrentLineWidth( aWidth );
DPOINT pos = userToDeviceCoordinates( aCornerList[0] );
VECTOR2D pos = userToDeviceCoordinates( aCornerList[0] );
fprintf( m_outputFile, "newpath\n%g %g moveto\n", pos.x, pos.y );
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
@ -654,8 +654,8 @@ void PS_PLOTTER::PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double
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
VECTOR2D drawsize( aScaleFactor * pix_size.x,
aScaleFactor * pix_size.y ); // requested size of image
// calculate the bottom left corner position of bitmap
VECTOR2I start = aPos;
@ -671,13 +671,14 @@ void PS_PLOTTER::PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double
fprintf( m_outputFile, "/pix %d string def\n", pix_size.x );
// Locate lower-left corner of image
DPOINT start_dev = userToDeviceCoordinates( start );
VECTOR2D start_dev = userToDeviceCoordinates( start );
fprintf( m_outputFile, "%g %g translate\n", start_dev.x, start_dev.y );
// Map image size to device
DPOINT end_dev = userToDeviceCoordinates( end );
VECTOR2D end_dev = userToDeviceCoordinates( end );
fprintf( m_outputFile, "%g %g scale\n",
std::abs(end_dev.x - start_dev.x), std::abs(end_dev.y - start_dev.y));
std::abs( end_dev.x - start_dev.x ),
std::abs( end_dev.y - start_dev.y ) );
// Dimensions of source image (in pixels
fprintf( m_outputFile, "%d %d 8", pix_size.x, pix_size.y );
@ -780,7 +781,7 @@ void PS_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
if( m_penState != plume || pos != m_penLastpos )
{
DPOINT pos_dev = userToDeviceCoordinates( pos );
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
fprintf( m_outputFile, "%g %g %sto\n",
pos_dev.x, pos_dev.y,
( plume=='D' ) ? "line" : "move" );
@ -986,7 +987,7 @@ void PS_PLOTTER::Text( const VECTOR2I& aPos,
if( m_textMode == PLOT_TEXT_MODE::PHANTOM )
{
std::string ps_test = encodeStringForPlotter( aText );
DPOINT pos_dev = userToDeviceCoordinates( aPos );
VECTOR2D pos_dev = userToDeviceCoordinates( aPos );
fprintf( m_outputFile, "%s %g %g phantomshow\n", ps_test.c_str(), pos_dev.x, pos_dev.y );
}

View File

@ -371,9 +371,9 @@ void SVG_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
{
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() );
DSIZE size_dev = end_dev - org_dev;
VECTOR2D org_dev = userToDeviceCoordinates( rect.GetOrigin() );
VECTOR2D end_dev = userToDeviceCoordinates( rect.GetEnd() );
VECTOR2D size_dev = end_dev - org_dev;
// Ensure size of rect in device coordinates is > 0
// I don't know if this is a SVG issue or a Inkscape issue, but
@ -406,8 +406,8 @@ void SVG_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
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 );
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
double radius = userToDeviceSize( diametre / 2.0 );
setFillMode( fill );
SetCurrentLineWidth( width );
@ -450,8 +450,8 @@ void SVG_PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
std::swap( startAngle, endAngle );
// Calculate start point.
DPOINT centre_device = userToDeviceCoordinates( aCenter );
double radius_device = userToDeviceSize( aRadius );
VECTOR2D centre_device = userToDeviceCoordinates( aCenter );
double radius_device = userToDeviceSize( aRadius );
if( !m_yaxisReversed ) // Should be never the case
{
@ -475,10 +475,10 @@ void SVG_PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
}
}
DPOINT start;
VECTOR2D start;
start.x = radius_device;
RotatePoint( start, startAngle );
DPOINT end;
VECTOR2D end;
end.x = radius_device;
RotatePoint( end, endAngle );
start += centre_device;
@ -539,10 +539,10 @@ void SVG_PLOTTER::BezierCurve( const VECTOR2I& aStart, const VECTOR2I& aControl1
setFillMode( FILL_T::NO_FILL );
SetCurrentLineWidth( aLineThickness );
DPOINT start = userToDeviceCoordinates( aStart );
DPOINT ctrl1 = userToDeviceCoordinates( aControl1 );
DPOINT ctrl2 = userToDeviceCoordinates( aControl2 );
DPOINT end = userToDeviceCoordinates( aEnd );
VECTOR2D start = userToDeviceCoordinates( aStart );
VECTOR2D ctrl1 = userToDeviceCoordinates( aControl1 );
VECTOR2D ctrl2 = userToDeviceCoordinates( aControl2 );
VECTOR2D end = userToDeviceCoordinates( aEnd );
// Generate a cubic curve: start point and 3 other control points.
fprintf( m_outputFile, "<path d=\"M%f,%f C%f,%f %f,%f %f,%f\" />\n",
@ -577,7 +577,7 @@ void SVG_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFi
break;
}
DPOINT pos = userToDeviceCoordinates( aCornerList[0] );
VECTOR2D pos = userToDeviceCoordinates( aCornerList[0] );
fprintf( m_outputFile, "d=\"M %f,%f\n", pos.x, pos.y );
for( unsigned ii = 1; ii < aCornerList.size() - 1; ii++ )
@ -604,7 +604,7 @@ void SVG_PLOTTER::PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double
VECTOR2I pix_size( aImage.GetWidth(), aImage.GetHeight() );
// Requested size (in IUs)
DPOINT drawsize( aScaleFactor * pix_size.x, aScaleFactor * pix_size.y );
VECTOR2D drawsize( aScaleFactor * pix_size.x, aScaleFactor * pix_size.y );
// calculate the bitmap start position
VECTOR2I start( aPos.x - drawsize.x / 2, aPos.y - drawsize.y / 2 );
@ -662,7 +662,7 @@ void SVG_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
if( m_penState == 'Z' ) // here plume = 'D' or 'U'
{
DPOINT pos_dev = userToDeviceCoordinates( pos );
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
// Ensure we do not use a fill mode when moving the pen,
// in SVG mode (i;e. we are plotting only basic lines, not a filled area
@ -676,7 +676,7 @@ void SVG_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
}
else if( m_penState != plume || pos != m_penLastpos )
{
DPOINT pos_dev = userToDeviceCoordinates( pos );
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
fprintf( m_outputFile, "L%d %d\n", (int) pos_dev.x, (int) pos_dev.y );
}
@ -794,9 +794,9 @@ void SVG_PLOTTER::Text( const VECTOR2I& aPos,
// The actual text size value is the absolute value
text_size.x = std::abs( GraphicTextWidth( aText, aFont, aSize, aWidth, aBold, aItalic ) );
text_size.y = std::abs( aSize.x * 4/3 ); // Hershey font height to em size conversion
DPOINT anchor_pos_dev = userToDeviceCoordinates( aPos );
DPOINT text_pos_dev = userToDeviceCoordinates( text_pos );
DPOINT sz_dev = userToDeviceSize( text_size );
VECTOR2D anchor_pos_dev = userToDeviceCoordinates( aPos );
VECTOR2D text_pos_dev = userToDeviceCoordinates( text_pos );
VECTOR2D sz_dev = userToDeviceSize( text_size );
if( !aOrient.IsZero() )
{

View File

@ -89,7 +89,7 @@ bool PLOTTER::OpenFile( const wxString& aFullFilename )
}
DPOINT PLOTTER::userToDeviceCoordinates( const VECTOR2I& aCoordinate )
VECTOR2D PLOTTER::userToDeviceCoordinates( const VECTOR2I& aCoordinate )
{
VECTOR2I pos = aCoordinate - m_plotOffset;
@ -116,14 +116,14 @@ DPOINT PLOTTER::userToDeviceCoordinates( const VECTOR2I& aCoordinate )
x *= m_iuPerDeviceUnit;
y *= m_iuPerDeviceUnit;
return DPOINT( x, y );
return VECTOR2D( x, y );
}
DPOINT PLOTTER::userToDeviceSize( const VECTOR2I& size )
VECTOR2D PLOTTER::userToDeviceSize( const VECTOR2I& size )
{
return DPOINT( size.x * m_plotScale * m_iuPerDeviceUnit,
size.y * m_plotScale * m_iuPerDeviceUnit );
return VECTOR2D( size.x * m_plotScale * m_iuPerDeviceUnit,
size.y * m_plotScale * m_iuPerDeviceUnit );
}

View File

@ -339,11 +339,11 @@ public:
GR_TEXT_V_ALIGN_T m_Vjustify;
bool m_Italic;
bool m_Bold;
DSIZE m_TextSize;
DSIZE m_BoundingBoxSize; // When not null, this is the max size of the
VECTOR2D m_TextSize;
VECTOR2D m_BoundingBoxSize; // When not null, this is the max size of the
// full text. The text size will be modified
// to keep the full text inside this bound.
DSIZE m_ConstrainedTextSize; // Actual text size, if constrained by
VECTOR2D m_ConstrainedTextSize; // Actual text size, if constrained by
// the m_BoundingBoxSize constraint
};

View File

@ -179,7 +179,7 @@ public:
VECTOR2D m_RB_Corner; // coordinates of the right bottom corner (in mm)
VECTOR2D m_LT_Corner; // coordinates of the left top corner (in mm)
double m_DefaultLineWidth; // Used when object line width is 0
DSIZE m_DefaultTextSize; // Used when object text size is 0
VECTOR2D m_DefaultTextSize; // Used when object text size is 0
double m_DefaultTextThickness; // Used when object text stroke width is 0
bool m_EditMode; // Used in drawing sheet editor to toggle variable substitution
// In normal mode (m_EditMode = false) the %format is

View File

@ -537,15 +537,15 @@ protected:
/**
* Modify coordinates according to the orientation, scale factor, and offsets trace. Also
* convert from a VECTOR2I to DPOINT, since some output engines needs floating point
* convert from a VECTOR2I to VECTOR2D, since some output engines needs floating point
* coordinates.
*/
virtual DPOINT userToDeviceCoordinates( const VECTOR2I& aCoordinate );
virtual VECTOR2D userToDeviceCoordinates( const VECTOR2I& aCoordinate );
/**
* Modify size according to the plotter scale factors (VECTOR2I version, returns a DPOINT).
* Modify size according to the plotter scale factors (VECTOR2I version, returns a VECTOR2D).
*/
virtual DPOINT userToDeviceSize( const VECTOR2I& size );
virtual VECTOR2D userToDeviceSize( const VECTOR2I& size );
/**
* Modify size according to the plotter scale factors (simple double version).

View File

@ -314,7 +314,7 @@ protected:
*
* For n decimal positions, see header generation in start_plot.
*/
void emitDcode( const DPOINT& pt, int dcode );
void emitDcode( const VECTOR2D& pt, int dcode );
/**
* Print a Gerber net attribute object record.

View File

@ -150,7 +150,7 @@ protected:
* @param location is the location of the item.
* @return whether a new item was made.
*/
bool startItem( const DPOINT& location );
bool startItem( const VECTOR2D& location );
/// Flush the current HPGL_ITEM and clear out the current item pointer.
void flushItem();
@ -163,7 +163,7 @@ protected:
* @param content is the content substring.
* @return whether a new item was made.
*/
bool startOrAppendItem( const DPOINT& location, const wxString& content );
bool startOrAppendItem( const VECTOR2D& location, const wxString& content );
int penSpeed;
int penNumber;
@ -184,11 +184,11 @@ protected:
dashType( PLOT_DASH_TYPE::SOLID ) {}
/// Location the pen should start at
DPOINT loc_start;
VECTOR2D loc_start;
/// Location the pen will be at when it finishes. If this is not known,
/// leave it equal to loc_start and set lift_after.
DPOINT loc_end;
VECTOR2D loc_end;
/// Bounding box of this item
BOX2D bbox;
@ -205,14 +205,9 @@ protected:
/// the pen is assumed to be down following the command.
bool pen_returns;
/// Pen number for this command
int pen;
/// Line style for this command
PLOT_DASH_TYPE dashType;
/// Text of the command
wxString content;
int pen; /// Pen number for this command
PLOT_DASH_TYPE dashType; /// Line style for this command
wxString content; /// Text of the command
};
/// Sort a list of HPGL items to improve plotting speed on mechanical plotters.

View File

@ -662,9 +662,4 @@ namespace std
};
}
/* Compatibility typedefs */
// FIXME should be removed to avoid multiple typedefs for the same type
typedef VECTOR2<double> DPOINT;
typedef DPOINT DSIZE;
#endif // VECTOR2D_H_

View File

@ -390,7 +390,7 @@ void PROPERTIES_FRAME::OnSetDefaultValues( wxCommandEvent& event )
{
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
model.m_DefaultTextSize = DSIZE( TB_DEFAULT_TEXTSIZE, TB_DEFAULT_TEXTSIZE );
model.m_DefaultTextSize = VECTOR2D( TB_DEFAULT_TEXTSIZE, TB_DEFAULT_TEXTSIZE );
model.m_DefaultLineWidth = 0.15;
model.m_DefaultTextThickness = 0.15;

View File

@ -57,7 +57,7 @@ EDA_RECT PL_EDITOR_LAYOUT::ComputeBoundingBox()
void PL_EDITOR_LAYOUT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
DSIZE size = GetPageSettings().GetSizeIU();
VECTOR2D size = GetPageSettings().GetSizeIU();
aList.emplace_back( _( "Page Width" ), MessageTextFromValue( aFrame->GetUserUnits(), size.x ) );