pcbnew: use doubles to pass line widths in the DXF importer as they are expressed in DXF's units and can case severe rounding errors when passed as ints

This commit is contained in:
Tomasz Wlostowski 2021-10-25 17:36:04 +02:00
parent 88e6c0c16b
commit df47c1c4e9
2 changed files with 7 additions and 7 deletions

View File

@ -1201,7 +1201,7 @@ void DXF_IMPORT_PLUGIN::addPoint( const DL_PointData& aData )
void DXF_IMPORT_PLUGIN::insertLine( const VECTOR2D& aSegStart,
const VECTOR2D& aSegEnd, int aWidth )
const VECTOR2D& aSegEnd, double aWidth )
{
VECTOR2D origin( SCALE_FACTOR( aSegStart.x ), SCALE_FACTOR( aSegStart.y ) );
VECTOR2D end( SCALE_FACTOR( aSegEnd.x ), SCALE_FACTOR( aSegEnd.y ) );
@ -1216,7 +1216,7 @@ void DXF_IMPORT_PLUGIN::insertLine( const VECTOR2D& aSegStart,
void DXF_IMPORT_PLUGIN::insertArc( const VECTOR2D& aSegStart, const VECTOR2D& aSegEnd,
double aBulge, int aWidth )
double aBulge, double aWidth )
{
VECTOR2D segment_startpoint( SCALE_FACTOR( aSegStart.x ), SCALE_FACTOR( aSegStart.y ) );
VECTOR2D segment_endpoint( SCALE_FACTOR( aSegEnd.x ), SCALE_FACTOR( aSegEnd.y ) );
@ -1297,7 +1297,7 @@ void DXF_IMPORT_PLUGIN::insertArc( const VECTOR2D& aSegStart, const VECTOR2D& aS
#include "tinysplinecpp.h"
void DXF_IMPORT_PLUGIN::insertSpline( int aWidth )
void DXF_IMPORT_PLUGIN::insertSpline( double aWidth )
{
#if 0 // Debug only
wxLogMessage("spl deg %d kn %d ctr %d fit %d",
@ -1450,4 +1450,4 @@ VECTOR3D DXF_IMPORT_PLUGIN::ocsToWcs( const DXF_ARBITRARY_AXIS& arbitraryAxis, V
z = point.x * worldZ.x + point.y * worldZ.y + point.z * worldZ.z;
return VECTOR3D( x, y, z );
}
}

View File

@ -373,12 +373,12 @@ private:
DXF_IMPORT_STYLE* getImportStyle( const std::string& aStyleName );
// Functions to aid in the creation of a Polyline.
void insertLine( const VECTOR2D& aSegStart, const VECTOR2D& aSegEnd, int aWidth );
void insertLine( const VECTOR2D& aSegStart, const VECTOR2D& aSegEnd, double aWidth );
void insertArc( const VECTOR2D& aSegStart, const VECTOR2D& aSegEnd,
double aBulge, int aWidth );
double aBulge, double aWidth );
// Add a dxf spline (stored in m_curr_entity) to the board, after conversion to segments.
void insertSpline( int aWidth );
void insertSpline( double aWidth );
// Methods from DL_CreationAdapter:
// They are something like"call back" functions,