Browse Source

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

6.0.7
Tomasz Wlostowski 4 years ago
parent
commit
df47c1c4e9
  1. 8
      pcbnew/import_gfx/dxf_import_plugin.cpp
  2. 6
      pcbnew/import_gfx/dxf_import_plugin.h

8
pcbnew/import_gfx/dxf_import_plugin.cpp

@ -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 );
}
}

6
pcbnew/import_gfx/dxf_import_plugin.h

@ -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,

Loading…
Cancel
Save