KiCad PCB EDA Suite
DXF_IMPORT_PLUGIN Class Reference

#include <dxf_import_plugin.h>

Inheritance diagram for DXF_IMPORT_PLUGIN:
GRAPHICS_IMPORT_PLUGIN

Public Member Functions

 DXF_IMPORT_PLUGIN ()
 
 ~DXF_IMPORT_PLUGIN ()
 
const wxString GetName () const override
 Return the plugin name. More...
 
const std::vector< std::string > GetFileExtensions () const override
 Return a vector of the file extensions handled by this plugin. More...
 
bool Load (const wxString &aFileName) override
 Load file for import. More...
 
bool Import () override
 Actually imports the file. More...
 
double GetImageWidth () const override
 Return image width from original imported file. More...
 
double GetImageHeight () const override
 Return image height from original imported file. More...
 
void updateImageLimits (const VECTOR2D &aPoint)
 
virtual void SetImporter (GRAPHICS_IMPORTER *aImporter) override
 Set the receiver of the imported shapes. More...
 
void ImportAsFootprintGraphic (bool aImportAsFootprintGraphic)
 Allow the import DXF items converted to board graphic items or footprint graphic items. More...
 
void SetUnit (DXF_IMPORT_UNITS aUnit)
 Set the default units when importing DXFs. More...
 
void SetDefaultLineWidthMM (double aWidth)
 Set the default line width when importing dxf items like lines to Pcbnew. More...
 
void SetLineWidthMM (double aWidth) override
 
void SetOffset (double aOffsetX, double aOffsetY)
 Set the coordinate offset between the imported dxf items and Pcbnew. More...
 
void SetBrdLayer (int aBrdLayer)
 Set the layer number to import dxf items. More...
 
bool ImportDxfFile (const wxString &aFile)
 Implementation of the method used for communicate with this filter. More...
 
const wxString & GetMessages () const override
 
wxString GetWildcards () const
 Return a list of wildcards that contains the file extensions handled by this plugin, separated with a semi-colon. More...
 

Protected Attributes

GRAPHICS_IMPORTERm_importer
 < Importer used to create objects representing the imported shapes. More...
 

Private Member Functions

void reportMsg (const wxString &aMessage)
 
double mapX (double aDxfCoordX)
 
double mapY (double aDxfCoordY)
 
double mapDim (double aDxfValue)
 
double lineWeightToWidth (int lw, DXF_IMPORT_LAYER *aLayer)
 
double getCurrentUnitScale ()
 
MATRIX3x3D getArbitraryAxis (DL_Extrusion *aData)
 
VECTOR3D wcsToOcs (const MATRIX3x3D &arbitraryAxis, VECTOR3D point)
 Converts a given world coordinate point to object coordinate using the given arbitrary axis vectors. More...
 
VECTOR3D ocsToWcs (const MATRIX3x3D &arbitraryAxis, VECTOR3D point)
 Converts a given object coordinate point to world coordinate using the given arbitrary axis vectors. More...
 
DXF_IMPORT_LAYERgetImportLayer (const std::string &aLayerName)
 Return the import layer data. More...
 
DXF_IMPORT_BLOCKgetImportBlock (const std::string &aBlockName)
 Return the import layer block. More...
 
DXF_IMPORT_STYLEgetImportStyle (const std::string &aStyleName)
 Return the import style. More...
 
void insertLine (const VECTOR2D &aSegStart, const VECTOR2D &aSegEnd, double aWidth)
 
void insertArc (const VECTOR2D &aSegStart, const VECTOR2D &aSegEnd, double aBulge, double aWidth)
 
void insertSpline (double aWidth)
 
virtual void setVariableString (const std::string &key, const std::string &value, int code) override
 Called for every string variable in the DXF file (e.g. More...
 
virtual void setVariableInt (const std::string &key, int value, int code) override
 Called for every int variable in the DXF file (e.g. More...
 
virtual void setVariableDouble (const std::string &key, double value, int code) override
 Called for every double variable in the DXF file (e.g. More...
 
virtual void addLayer (const DL_LayerData &aData) override
 
virtual void addLine (const DL_LineData &aData) override
 
virtual void addLinetype (const DL_LinetypeData &data) override
 
virtual void addBlock (const DL_BlockData &) override
 Called for each BLOCK in the DXF file. More...
 
virtual void endBlock () override
 
virtual void addTextStyle (const DL_StyleData &aData) override
 
virtual void addPoint (const DL_PointData &aData) override
 
virtual void addCircle (const DL_CircleData &aData) override
 
virtual void addArc (const DL_ArcData &aData) override
 
void addEllipse (const DL_EllipseData &aData) override
 
virtual void addText (const DL_TextData &aData) override
 
virtual void addPolyline (const DL_PolylineData &aData) override
 
virtual void addInsert (const DL_InsertData &aData) override
 
virtual void addVertex (const DL_VertexData &aData) override
 Called for every polyline vertex. More...
 
virtual void addMText (const DL_MTextData &aData) override
 
virtual void endEntity () override
 
virtual void addSpline (const DL_SplineData &aData) override
 Called for every spline. More...
 
virtual void addControlPoint (const DL_ControlPointData &aData) override
 Called for every spline control point. More...
 
virtual void addFitPoint (const DL_FitPointData &aData) override
 Called for every spline fit point. More...
 
virtual void addKnot (const DL_KnotData &aData) override
 Called for every spline knot value. More...
 
virtual void addXLine (const DL_XLineData &) override
 
virtual void addRay (const DL_RayData &) override
 
virtual void addArcAlignedText (const DL_ArcAlignedTextData &) override
 
virtual void addAttribute (const DL_AttributeData &) override
 
virtual void addDimAlign (const DL_DimensionData &, const DL_DimAlignedData &) override
 
virtual void addDimLinear (const DL_DimensionData &, const DL_DimLinearData &) override
 
virtual void addDimRadial (const DL_DimensionData &, const DL_DimRadialData &) override
 
virtual void addDimDiametric (const DL_DimensionData &, const DL_DimDiametricData &) override
 
virtual void addDimAngular (const DL_DimensionData &, const DL_DimAngular2LData &) override
 
virtual void addDimAngular3P (const DL_DimensionData &, const DL_DimAngular3PData &) override
 
virtual void addDimOrdinate (const DL_DimensionData &, const DL_DimOrdinateData &) override
 
virtual void addLeader (const DL_LeaderData &) override
 
virtual void addLeaderVertex (const DL_LeaderVertexData &) override
 
virtual void addHatch (const DL_HatchData &) override
 
virtual void addTrace (const DL_TraceData &) override
 
virtual void add3dFace (const DL_3dFaceData &) override
 
virtual void addSolid (const DL_SolidData &) override
 
virtual void addImage (const DL_ImageData &) override
 
virtual void linkImage (const DL_ImageDefData &) override
 
virtual void addHatchLoop (const DL_HatchLoopData &) override
 
virtual void addHatchEdge (const DL_HatchEdgeData &) override
 
virtual void addXRecord (const std::string &) override
 
virtual void addXRecordString (int, const std::string &) override
 
virtual void addXRecordReal (int, double) override
 
virtual void addXRecordInt (int, int) override
 
virtual void addXRecordBool (int, bool) override
 
virtual void addXDataApp (const std::string &) override
 
virtual void addXDataString (int, const std::string &) override
 
virtual void addXDataReal (int, double) override
 
virtual void addXDataInt (int, int) override
 
void writeLine ()
 
void writeMtext ()
 

Static Private Member Functions

static wxString toDxfString (const wxString &aStr)
 Convert a native Unicode string into a DXF encoded string. More...
 
static wxString toNativeString (const wxString &aData)
 Convert a DXF encoded string into a native Unicode string. More...
 

Private Attributes

double m_xOffset
 
double m_yOffset
 
double m_defaultThickness
 
int m_brdLayer
 
int m_version
 
std::string m_codePage
 
bool m_importAsFPShapes
 
wxString m_messages
 
DXF2BRD_ENTITY_DATA m_curr_entity
 
double m_minX
 
double m_maxX
 
double m_minY
 
double m_maxY
 
DXF_IMPORT_UNITS m_currentUnit
 
int m_importCoordinatePrecision
 
int m_importAnglePrecision
 
GRAPHICS_IMPORTER_BUFFER m_internalImporter
 
std::vector< std::unique_ptr< DXF_IMPORT_LAYER > > m_layers
 
std::vector< std::unique_ptr< DXF_IMPORT_BLOCK > > m_blocks
 
std::vector< std::unique_ptr< DXF_IMPORT_STYLE > > m_styles
 
DXF_IMPORT_BLOCKm_currentBlock
 

Detailed Description

Definition at line 216 of file dxf_import_plugin.h.

Constructor & Destructor Documentation

◆ DXF_IMPORT_PLUGIN()

DXF_IMPORT_PLUGIN::DXF_IMPORT_PLUGIN ( )

Definition at line 92 of file dxf_import_plugin.cpp.

92 : DL_CreationAdapter()
93{
94 m_xOffset = 0.0; // X coord offset for conversion (in mm)
95 m_yOffset = 0.0; // Y coord offset for conversion (in mm)
96 m_version = 0; // the dxf version, not yet used
97 m_defaultThickness = 0.2; // default thickness (in mm)
98 m_brdLayer = Dwgs_User; // The default import layer
99 m_importAsFPShapes = true;
100 m_minX = m_minY = std::numeric_limits<double>::max();
101 m_maxX = m_maxY = std::numeric_limits<double>::min();
103 m_importCoordinatePrecision = 4; // initial value per dxf spec
104 m_importAnglePrecision = 0; // initial value per dxf spec
105
106 // placeholder layer so we can fallback to something later
107 std::unique_ptr<DXF_IMPORT_LAYER> layer0 =
108 std::make_unique<DXF_IMPORT_LAYER>( "", DXF_IMPORT_LINEWEIGHT_BY_LW_DEFAULT );
109 m_layers.push_back( std::move( layer0 ) );
110
111 m_currentBlock = nullptr;
112}
DXF_IMPORT_UNITS m_currentUnit
std::vector< std::unique_ptr< DXF_IMPORT_LAYER > > m_layers
DXF_IMPORT_BLOCK * m_currentBlock
#define DXF_IMPORT_LINEWEIGHT_BY_LW_DEFAULT
@ Dwgs_User
Definition: layer_ids.h:109

References DEFAULT, Dwgs_User, DXF_IMPORT_LINEWEIGHT_BY_LW_DEFAULT, m_brdLayer, m_currentBlock, m_currentUnit, m_defaultThickness, m_importAnglePrecision, m_importAsFPShapes, m_importCoordinatePrecision, m_layers, m_maxX, m_maxY, m_minX, m_minY, m_version, m_xOffset, and m_yOffset.

◆ ~DXF_IMPORT_PLUGIN()

DXF_IMPORT_PLUGIN::~DXF_IMPORT_PLUGIN ( )

Definition at line 115 of file dxf_import_plugin.cpp.

116{
117}

Member Function Documentation

◆ add3dFace()

virtual void DXF_IMPORT_PLUGIN::add3dFace ( const DL_3dFaceData &  )
inlineoverrideprivatevirtual

Definition at line 484 of file dxf_import_plugin.h.

484{ ON_UNSUPPORTED( "add3dFace" ); }
#define ON_UNSUPPORTED(error_msg)
This class import DXF ASCII files and convert basic entities to board entities.

References ON_UNSUPPORTED.

◆ addArc()

void DXF_IMPORT_PLUGIN::addArc ( const DL_ArcData &  aData)
overrideprivatevirtual

Definition at line 534 of file dxf_import_plugin.cpp.

535{
536 MATRIX3x3D arbAxis = getArbitraryAxis( getExtrusion() );
537 VECTOR3D centerCoords = ocsToWcs( arbAxis, VECTOR3D( aData.cx, aData.cy, aData.cz ) );
538
539 // Init arc centre:
540 VECTOR2D center( mapX( centerCoords.x ), mapY( centerCoords.y ) );
541
542 // aData.anglex is in degrees.
543 EDA_ANGLE startangle( aData.angle1, DEGREES_T );
544 EDA_ANGLE endangle( aData.angle2, DEGREES_T );
545
546 // Init arc start point
547 VECTOR2D startPoint( aData.radius, 0.0 );
548 RotatePoint( startPoint, -startangle );
549 VECTOR2D arcStart( mapX( startPoint.x + centerCoords.x ),
550 mapY( startPoint.y + centerCoords.y ) );
551
552 // calculate arc angle (arcs are CCW, and should be < 0 in Pcbnew)
553 EDA_ANGLE angle = -( endangle - startangle );
554
555 if( angle > ANGLE_0 )
556 angle -= ANGLE_360;
557
558 DXF_IMPORT_LAYER* layer = getImportLayer( attributes.getLayer() );
559 double lineWidth = lineWeightToWidth( attributes.getWidth(), layer );
560
563 bufferToUse->AddArc( center, arcStart, angle, lineWidth );
564
565 VECTOR2D radiusDelta( mapDim( aData.radius ), mapDim( aData.radius ) );
566
567 updateImageLimits( center + radiusDelta );
568 updateImageLimits( center - radiusDelta );
569}
GRAPHICS_IMPORTER_BUFFER m_buffer
A helper class to hold layer settings temporarily during import.
double mapY(double aDxfCoordY)
VECTOR3D ocsToWcs(const MATRIX3x3D &arbitraryAxis, VECTOR3D point)
Converts a given object coordinate point to world coordinate using the given arbitrary axis vectors.
DXF_IMPORT_LAYER * getImportLayer(const std::string &aLayerName)
Return the import layer data.
MATRIX3x3D getArbitraryAxis(DL_Extrusion *aData)
void updateImageLimits(const VECTOR2D &aPoint)
double mapDim(double aDxfValue)
double mapX(double aDxfCoordX)
double lineWeightToWidth(int lw, DXF_IMPORT_LAYER *aLayer)
GRAPHICS_IMPORTER_BUFFER m_internalImporter
void AddArc(const VECTOR2D &aCenter, const VECTOR2D &aStart, const EDA_ANGLE &aAngle, double aWidth) override
Create an object representing an arc.
T y
Definition: vector3.h:62
T x
Definition: vector3.h:61
@ DEGREES_T
Definition: eda_angle.h:31
static constexpr EDA_ANGLE & ANGLE_360
Definition: eda_angle.h:429
static constexpr EDA_ANGLE & ANGLE_0
Definition: eda_angle.h:423
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183
VECTOR3< double > VECTOR3D
Definition: vector3.h:204

References GRAPHICS_IMPORTER_BUFFER::AddArc(), PNS::angle(), ANGLE_0, ANGLE_360, DEGREES_T, getArbitraryAxis(), getImportLayer(), lineWeightToWidth(), DXF_IMPORT_BLOCK::m_buffer, m_currentBlock, m_internalImporter, mapDim(), mapX(), mapY(), ocsToWcs(), RotatePoint(), updateImageLimits(), VECTOR2< T >::x, VECTOR3< T >::x, VECTOR2< T >::y, and VECTOR3< T >::y.

Referenced by addEllipse().

◆ addArcAlignedText()

virtual void DXF_IMPORT_PLUGIN::addArcAlignedText ( const DL_ArcAlignedTextData &  )
inlineoverrideprivatevirtual

Definition at line 454 of file dxf_import_plugin.h.

455 { ON_UNSUPPORTED( "addArcAlignedText" ); }

References ON_UNSUPPORTED.

◆ addAttribute()

virtual void DXF_IMPORT_PLUGIN::addAttribute ( const DL_AttributeData &  )
inlineoverrideprivatevirtual

Definition at line 457 of file dxf_import_plugin.h.

458 { ON_UNSUPPORTED( "addAttribute" ); }

References ON_UNSUPPORTED.

◆ addBlock()

void DXF_IMPORT_PLUGIN::addBlock ( const DL_BlockData &  aData)
overrideprivatevirtual

Called for each BLOCK in the DXF file.

These are re-usable elements that may be placed into the model space. The elements are dereferenced to the model, so we just need to skip the re-parsing for the block elements.

Definition at line 464 of file dxf_import_plugin.cpp.

465{
466 wxString name = wxString::FromUTF8( aData.name.c_str() );
467
468 std::unique_ptr<DXF_IMPORT_BLOCK> block =
469 std::make_unique<DXF_IMPORT_BLOCK>( name, aData.bpx, aData.bpy );
470
471 m_blocks.push_back( std::move( block ) );
472
473 m_currentBlock = m_blocks.back().get();
474}
const char * name
Definition: DXF_plotter.cpp:56
std::vector< std::unique_ptr< DXF_IMPORT_BLOCK > > m_blocks

References m_blocks, m_currentBlock, and name.

◆ addCircle()

void DXF_IMPORT_PLUGIN::addCircle ( const DL_CircleData &  aData)
overrideprivatevirtual

Definition at line 514 of file dxf_import_plugin.cpp.

515{
516 MATRIX3x3D arbAxis = getArbitraryAxis( getExtrusion() );
517 VECTOR3D centerCoords = ocsToWcs( arbAxis, VECTOR3D( aData.cx, aData.cy, aData.cz ) );
518
519 VECTOR2D center( mapX( centerCoords.x ), mapY( centerCoords.y ) );
520 DXF_IMPORT_LAYER* layer = getImportLayer( attributes.getLayer() );
521 double lineWidth = lineWeightToWidth( attributes.getWidth(), layer );
522
523 GRAPHICS_IMPORTER_BUFFER* bufferToUse =
525 bufferToUse->AddCircle( center, mapDim( aData.radius ), lineWidth, false );
526
527 VECTOR2D radiusDelta( mapDim( aData.radius ), mapDim( aData.radius ) );
528
529 updateImageLimits( center + radiusDelta );
530 updateImageLimits( center - radiusDelta );
531}
void AddCircle(const VECTOR2D &aCenter, double aRadius, double aWidth, bool aFilled) override
Create an object representing a circle.

References GRAPHICS_IMPORTER_BUFFER::AddCircle(), getArbitraryAxis(), getImportLayer(), lineWeightToWidth(), DXF_IMPORT_BLOCK::m_buffer, m_currentBlock, m_internalImporter, mapDim(), mapX(), mapY(), ocsToWcs(), updateImageLimits(), VECTOR3< T >::x, and VECTOR3< T >::y.

Referenced by addEllipse().

◆ addControlPoint()

void DXF_IMPORT_PLUGIN::addControlPoint ( const DL_ControlPointData &  aData)
overrideprivatevirtual

Called for every spline control point.

Definition at line 232 of file dxf_import_plugin.cpp.

233{
234 // Called for every spline control point, when reading a spline entity
235 m_curr_entity.m_SplineControlPointList.emplace_back( aData.x , aData.y,
236 aData.w );
237}
std::vector< SPLINE_CTRL_POINT > m_SplineControlPointList
DXF2BRD_ENTITY_DATA m_curr_entity

References m_curr_entity, and DXF2BRD_ENTITY_DATA::m_SplineControlPointList.

◆ addDimAlign()

virtual void DXF_IMPORT_PLUGIN::addDimAlign ( const DL_DimensionData &  ,
const DL_DimAlignedData &   
)
inlineoverrideprivatevirtual

Definition at line 460 of file dxf_import_plugin.h.

461 { ON_UNSUPPORTED( "addDimAlign" ); }

References ON_UNSUPPORTED.

◆ addDimAngular()

virtual void DXF_IMPORT_PLUGIN::addDimAngular ( const DL_DimensionData &  ,
const DL_DimAngular2LData &   
)
inlineoverrideprivatevirtual

Definition at line 468 of file dxf_import_plugin.h.

469 { ON_UNSUPPORTED( "addDimAngular" ); }

References ON_UNSUPPORTED.

◆ addDimAngular3P()

virtual void DXF_IMPORT_PLUGIN::addDimAngular3P ( const DL_DimensionData &  ,
const DL_DimAngular3PData &   
)
inlineoverrideprivatevirtual

Definition at line 470 of file dxf_import_plugin.h.

471 { ON_UNSUPPORTED( "addDimAngular3P" ); }

References ON_UNSUPPORTED.

◆ addDimDiametric()

virtual void DXF_IMPORT_PLUGIN::addDimDiametric ( const DL_DimensionData &  ,
const DL_DimDiametricData &   
)
inlineoverrideprivatevirtual

Definition at line 466 of file dxf_import_plugin.h.

467 { ON_UNSUPPORTED( "addDimDiametric" ); }

References ON_UNSUPPORTED.

◆ addDimLinear()

virtual void DXF_IMPORT_PLUGIN::addDimLinear ( const DL_DimensionData &  ,
const DL_DimLinearData &   
)
inlineoverrideprivatevirtual

Definition at line 462 of file dxf_import_plugin.h.

463 { ON_UNSUPPORTED( "addDimLinear" ); }

References ON_UNSUPPORTED.

◆ addDimOrdinate()

virtual void DXF_IMPORT_PLUGIN::addDimOrdinate ( const DL_DimensionData &  ,
const DL_DimOrdinateData &   
)
inlineoverrideprivatevirtual

Definition at line 472 of file dxf_import_plugin.h.

473 { ON_UNSUPPORTED( "addDimOrdinate" ); }

References ON_UNSUPPORTED.

◆ addDimRadial()

virtual void DXF_IMPORT_PLUGIN::addDimRadial ( const DL_DimensionData &  ,
const DL_DimRadialData &   
)
inlineoverrideprivatevirtual

Definition at line 464 of file dxf_import_plugin.h.

465 { ON_UNSUPPORTED( "addDimRadial" ); }

References ON_UNSUPPORTED.

◆ addEllipse()

void DXF_IMPORT_PLUGIN::addEllipse ( const DL_EllipseData &  aData)
overrideprivate

Definition at line 572 of file dxf_import_plugin.cpp.

573{
574 MATRIX3x3D arbAxis = getArbitraryAxis( getExtrusion() );
575 VECTOR3D centerCoords = ocsToWcs( arbAxis, VECTOR3D( aData.cx, aData.cy, aData.cz ) );
576 VECTOR3D majorCoords = ocsToWcs( arbAxis, VECTOR3D( aData.mx, aData.my, aData.mz ) );
577
578 // DXF ellipses store the minor axis length as a ratio to the major axis.
579 // The major coords are relative to the center point.
580 // For now, we assume ellipses in the XY plane.
581
582 VECTOR2D center( mapX( centerCoords.x ), mapY( centerCoords.y ) );
583 VECTOR2D major( mapX( majorCoords.x ), mapY( majorCoords.y ) );
584
585 // DXF elliptical arcs store their angles in radians (unlike circular arcs which use degrees)
586 // The arcs wind CCW as in KiCad. The end angle must be greater than the start angle, and if
587 // the extrusion direction is negative, the arc winding is CW instead! Note that this is a
588 // simplification that assumes the DXF is representing a 2D drawing, and would need to be
589 // revisited if we want to import true 3D drawings and "flatten" them to the 2D KiCad plane
590 // internally.
591 EDA_ANGLE startAngle( aData.angle1, RADIANS_T );
592 EDA_ANGLE endAngle( aData.angle2, RADIANS_T );
593
594 if( startAngle > endAngle )
595 endAngle += ANGLE_360;
596
597 // TODO: testcases for negative extrusion vector; handle it here
598
599 if( aData.ratio == 1.0 )
600 {
601 double radius = major.EuclideanNorm();
602
603 if( startAngle == endAngle )
604 {
605 DL_CircleData circle( aData.cx, aData.cy, aData.cz, radius );
606 addCircle( circle );
607 return;
608 }
609 else
610 {
611 DL_ArcData arc( aData.cx, aData.cy, aData.cz, radius,
612 startAngle.AsDegrees(), endAngle.AsDegrees() );
613 addArc( arc );
614 return;
615 }
616 }
617
618 std::vector<BEZIER<double>> splines;
619 ELLIPSE<double> ellipse( center, major, aData.ratio, startAngle, endAngle );
620
621 TransformEllipseToBeziers( ellipse, splines );
622
623 DXF_IMPORT_LAYER* layer = getImportLayer( attributes.getLayer() );
624 double lineWidth = lineWeightToWidth( attributes.getWidth(), layer );
625
628
629 for( const BEZIER<double>& b : splines )
630 bufferToUse->AddSpline( b.Start, b.C1, b.C2, b.End, lineWidth );
631
632 // Naive bounding
633 updateImageLimits( center + major );
634 updateImageLimits( center - major );
635}
void TransformEllipseToBeziers(const ELLIPSE< T > &aEllipse, std::vector< BEZIER< T > > &aBeziers)
Transforms an ellipse or elliptical arc into a set of quadratic Bezier curves that approximate it.
Generic cubic Bezier representation.
Definition: bezier_curves.h:78
virtual void addCircle(const DL_CircleData &aData) override
virtual void addArc(const DL_ArcData &aData) override
void AddSpline(const VECTOR2D &aStart, const VECTOR2D &BezierControl1, const VECTOR2D &BezierControl2, const VECTOR2D &aEnd, double aWidth) override
Create an object representing an arc.
@ RADIANS_T
Definition: eda_angle.h:32

References addArc(), addCircle(), GRAPHICS_IMPORTER_BUFFER::AddSpline(), ANGLE_360, EDA_ANGLE::AsDegrees(), VECTOR2< T >::EuclideanNorm(), getArbitraryAxis(), getImportLayer(), lineWeightToWidth(), DXF_IMPORT_BLOCK::m_buffer, m_currentBlock, m_internalImporter, mapX(), mapY(), ocsToWcs(), RADIANS_T, TransformEllipseToBeziers(), updateImageLimits(), VECTOR3< T >::x, and VECTOR3< T >::y.

◆ addFitPoint()

void DXF_IMPORT_PLUGIN::addFitPoint ( const DL_FitPointData &  aData)
overrideprivatevirtual

Called for every spline fit point.

Definition at line 240 of file dxf_import_plugin.cpp.

241{
242 // Called for every spline fit point, when reading a spline entity
243 // we store only the X,Y coord values in a VECTOR2D
244 m_curr_entity.m_SplineFitPointList.emplace_back( aData.x, aData.y );
245}
std::vector< VECTOR2D > m_SplineFitPointList

References m_curr_entity, and DXF2BRD_ENTITY_DATA::m_SplineFitPointList.

◆ addHatch()

virtual void DXF_IMPORT_PLUGIN::addHatch ( const DL_HatchData &  )
inlineoverrideprivatevirtual

Definition at line 481 of file dxf_import_plugin.h.

481{ ON_UNSUPPORTED( "addHatch" ); }

References ON_UNSUPPORTED.

◆ addHatchEdge()

virtual void DXF_IMPORT_PLUGIN::addHatchEdge ( const DL_HatchEdgeData &  )
inlineoverrideprivatevirtual

Definition at line 496 of file dxf_import_plugin.h.

497 {
498 ON_UNSUPPORTED( "addHatchEdge" );
499 }

References ON_UNSUPPORTED.

◆ addHatchLoop()

virtual void DXF_IMPORT_PLUGIN::addHatchLoop ( const DL_HatchLoopData &  )
inlineoverrideprivatevirtual

Definition at line 491 of file dxf_import_plugin.h.

492 {
493 ON_UNSUPPORTED( "addHatchLoop" );
494 }

References ON_UNSUPPORTED.

◆ addImage()

virtual void DXF_IMPORT_PLUGIN::addImage ( const DL_ImageData &  )
inlineoverrideprivatevirtual

Definition at line 488 of file dxf_import_plugin.h.

488{ ON_UNSUPPORTED( "addImage" ); }

References ON_UNSUPPORTED.

◆ addInsert()

void DXF_IMPORT_PLUGIN::addInsert ( const DL_InsertData &  aData)
overrideprivatevirtual

Definition at line 482 of file dxf_import_plugin.cpp.

483{
484 DXF_IMPORT_BLOCK* block = getImportBlock( aData.name );
485
486 if( block == nullptr )
487 return;
488
489 MATRIX3x3D arbAxis = getArbitraryAxis( getExtrusion() );
490
491 MATRIX3x3D rot;
492 rot.SetRotation( aData.angle );
493
495 scale.SetScale( VECTOR2D( aData.sx, aData.sy ) );
496
497 MATRIX3x3D trans = ( arbAxis * rot ) * scale;
498 VECTOR3D insertCoords = ocsToWcs( arbAxis, VECTOR3D( aData.ipx, aData.ipy, aData.ipz ) );
499
500 VECTOR2D translation( mapX( insertCoords.x ), mapY( insertCoords.y ) );
501 translation -= VECTOR2D( mapX( block->m_baseX ), mapY( block->m_baseY ) );
502
503 for( auto& shape : block->m_buffer.GetShapes() )
504 {
505 std::unique_ptr<IMPORTED_SHAPE> newShape = shape->clone();
506
507 newShape->Transform( trans, translation );
508
509 m_internalImporter.AddShape( newShape );
510 }
511}
A helper class to hold layer settings temporarily during import.
DXF_IMPORT_BLOCK * getImportBlock(const std::string &aBlockName)
Return the import layer block.
std::list< std::unique_ptr< IMPORTED_SHAPE > > & GetShapes()
void AddShape(std::unique_ptr< IMPORTED_SHAPE > &aShape)
void SetRotation(T aAngle)
Set the rotation components of the matrix.
Definition: matrix3x3.h:275
const int scale
VECTOR2< double > VECTOR2D
Definition: vector2d.h:617

References GRAPHICS_IMPORTER_BUFFER::AddShape(), getArbitraryAxis(), getImportBlock(), GRAPHICS_IMPORTER_BUFFER::GetShapes(), DXF_IMPORT_BLOCK::m_baseX, DXF_IMPORT_BLOCK::m_baseY, DXF_IMPORT_BLOCK::m_buffer, m_internalImporter, mapX(), mapY(), ocsToWcs(), scale, MATRIX3x3< T >::SetRotation(), VECTOR3< T >::x, and VECTOR3< T >::y.

◆ addKnot()

void DXF_IMPORT_PLUGIN::addKnot ( const DL_KnotData &  aData)
overrideprivatevirtual

Called for every spline knot value.

Definition at line 248 of file dxf_import_plugin.cpp.

249{
250 // Called for every spline knot value, when reading a spline entity
251 m_curr_entity.m_SplineKnotsList.push_back( aData.k );
252}
std::vector< double > m_SplineKnotsList

References m_curr_entity, and DXF2BRD_ENTITY_DATA::m_SplineKnotsList.

◆ addLayer()

void DXF_IMPORT_PLUGIN::addLayer ( const DL_LayerData &  aData)
overrideprivatevirtual

Definition at line 255 of file dxf_import_plugin.cpp.

256{
257 wxString name = wxString::FromUTF8( aData.name.c_str() );
258
259 int lw = attributes.getWidth();
260
262 {
264 }
265
266 std::unique_ptr<DXF_IMPORT_LAYER> layer = std::make_unique<DXF_IMPORT_LAYER>( name, lw );
267
268 m_layers.push_back( std::move( layer ) );
269}
#define DXF_IMPORT_LINEWEIGHT_BY_LAYER

References DXF_IMPORT_LINEWEIGHT_BY_LAYER, DXF_IMPORT_LINEWEIGHT_BY_LW_DEFAULT, m_layers, and name.

◆ addLeader()

virtual void DXF_IMPORT_PLUGIN::addLeader ( const DL_LeaderData &  )
inlineoverrideprivatevirtual

Definition at line 475 of file dxf_import_plugin.h.

476 { ON_UNSUPPORTED( "addLeader" ); }

References ON_UNSUPPORTED.

◆ addLeaderVertex()

virtual void DXF_IMPORT_PLUGIN::addLeaderVertex ( const DL_LeaderVertexData &  )
inlineoverrideprivatevirtual

Definition at line 478 of file dxf_import_plugin.h.

479 { ON_UNSUPPORTED( "addLeaderVertex" ); }

References ON_UNSUPPORTED.

◆ addLine()

void DXF_IMPORT_PLUGIN::addLine ( const DL_LineData &  aData)
overrideprivatevirtual

Definition at line 360 of file dxf_import_plugin.cpp.

361{
362 DXF_IMPORT_LAYER* layer = getImportLayer( attributes.getLayer() );
363 double lineWidth = lineWeightToWidth( attributes.getWidth(), layer );
364
365 VECTOR2D start( mapX( aData.x1 ), mapY( aData.y1 ) );
366 VECTOR2D end( mapX( aData.x2 ), mapY( aData.y2 ) );
367
368 GRAPHICS_IMPORTER_BUFFER* bufferToUse =
370 bufferToUse->AddLine( start, end, lineWidth );
371
372 updateImageLimits( start );
373 updateImageLimits( end );
374}
void AddLine(const VECTOR2D &aStart, const VECTOR2D &aEnd, double aWidth) override
Create an object representing a line segment.

References GRAPHICS_IMPORTER_BUFFER::AddLine(), getImportLayer(), lineWeightToWidth(), DXF_IMPORT_BLOCK::m_buffer, m_currentBlock, m_internalImporter, mapX(), mapY(), and updateImageLimits().

◆ addLinetype()

void DXF_IMPORT_PLUGIN::addLinetype ( const DL_LinetypeData &  data)
overrideprivatevirtual

Definition at line 272 of file dxf_import_plugin.cpp.

273{
274#if 0
275 wxString name = FROM_UTF8( data.name.c_str() );
276 wxString description = FROM_UTF8( data.description.c_str() );
277#endif
278}
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110

References FROM_UTF8(), and name.

◆ addMText()

void DXF_IMPORT_PLUGIN::addMText ( const DL_MTextData &  aData)
overrideprivatevirtual

Definition at line 792 of file dxf_import_plugin.cpp.

793{
794 wxString text = toNativeString( wxString::FromUTF8( aData.text.c_str() ) );
795 wxString attrib, tmp;
796
797 DXF_IMPORT_STYLE* style = getImportStyle( aData.style.c_str() );
798
799 double textHeight = mapDim( aData.height );
800
801 // The 0.9 factor gives a better height/width base ratio with our font
802 double charWidth = textHeight * 0.9;
803 if( style != nullptr )
804 charWidth *= style->m_widthFactor;
805
806 double textWidth = charWidth * text.length(); // Rough approximation
807 double textThickness = textHeight/8.0; // Use a reasonable line thickness for this text
808
809 VECTOR2D bottomLeft(0.0, 0.0);
810 VECTOR2D bottomRight(0.0, 0.0);
811 VECTOR2D topLeft(0.0, 0.0);
812 VECTOR2D topRight(0.0, 0.0);
813
814 /* Some texts start by '\' and have formatting chars (font name, font option...)
815 * ending with ';'
816 * Here are some mtext formatting codes:
817 * Format code Purpose
818 * \0...\o Turns overline on and off
819 * \L...\l Turns underline on and off
820 * \~ Inserts a nonbreaking space
821 \\ Inserts a backslash
822 \\\{...\} Inserts an opening and closing brace
823 \\ \File name; Changes to the specified font file
824 \\ \Hvalue; Changes to the text height specified in drawing units
825 \\ \Hvaluex; Changes the text height to a multiple of the current text height
826 \\ \S...^...; Stacks the subsequent text at the \, #, or ^ symbol
827 \\ \Tvalue; Adjusts the space between characters, from.75 to 4 times
828 \\ \Qangle; Changes oblique angle
829 \\ \Wvalue; Changes width factor to produce wide text
830 \\ \A Sets the alignment value; valid values: 0, 1, 2 (bottom, center, top) while( text.StartsWith( wxT("\\") ) )
831 */
832 while( text.StartsWith( wxT( "\\" ) ) )
833 {
834 attrib << text.BeforeFirst( ';' );
835 tmp = text.AfterFirst( ';' );
836 text = tmp;
837 }
838
839 MATRIX3x3D arbAxis = getArbitraryAxis( getExtrusion() );
840 VECTOR3D textposCoords = ocsToWcs( arbAxis, VECTOR3D( aData.ipx, aData.ipy, aData.ipz ) );
841
842 VECTOR2D textpos( mapX( textposCoords.x ), mapY( textposCoords.y ) );
843
844 // Initialize text justifications:
847
848 if( aData.attachmentPoint <= 3 )
849 {
850 vJustify = GR_TEXT_V_ALIGN_TOP;
851
852 bottomLeft.y = -textHeight;
853 bottomRight.y = -textHeight;
854 }
855 else if( aData.attachmentPoint <= 6 )
856 {
857 vJustify = GR_TEXT_V_ALIGN_CENTER;
858
859 bottomRight.y = -textHeight / 2.0;
860 bottomLeft.y = -textHeight / 2.0;
861 topLeft.y = textHeight / 2.0;
862 topRight.y = textHeight / 2.0;
863 }
864 else
865 {
866 vJustify = GR_TEXT_V_ALIGN_BOTTOM;
867
868 topLeft.y = textHeight;
869 topRight.y = textHeight;
870 }
871
872 if( aData.attachmentPoint % 3 == 1 )
873 {
874 hJustify = GR_TEXT_H_ALIGN_LEFT;
875
876 bottomRight.x = textWidth;
877 topRight.x = textWidth;
878 }
879 else if( aData.attachmentPoint % 3 == 2 )
880 {
881 hJustify = GR_TEXT_H_ALIGN_CENTER;
882
883 bottomLeft.x = -textWidth / 2.0;
884 topLeft.x = -textWidth / 2.0;
885 bottomRight.x = textWidth / 2.0;
886 topRight.x = textWidth / 2.0;
887 }
888 else
889 {
890 hJustify = GR_TEXT_H_ALIGN_RIGHT;
891
892 bottomLeft.x = -textWidth;
893 topLeft.x = -textWidth;
894 }
895
896#if 0 // These setting have no meaning in Pcbnew
897 if( data.alignH == 1 )
898 {
899 // Text is left to right;
900 }
901 else if( data.alignH == 3 )
902 {
903 // Text is top to bottom;
904 }
905 else
906 {
907 // use ByStyle;
908 }
909
910 if( aData.alignV == 1 )
911 {
912 // use AtLeast;
913 }
914 else
915 {
916 // useExact;
917 }
918#endif
919
920 // dxf_lib imports text angle in radians (although there are no comment about that.
921 // So, for the moment, convert this angle to degrees
922 double angle_degree = aData.angle * 180/M_PI;
923 // We also need the angle in radians. so convert angle_degree to radians
924 // regardless the aData.angle unit
925 double angleInRads = angle_degree * M_PI / 180.0;
926 double cosine = cos(angleInRads);
927 double sine = sin(angleInRads);
928
929
930 GRAPHICS_IMPORTER_BUFFER* bufferToUse =
932 bufferToUse->AddText( textpos, text, textHeight, charWidth,
933 textThickness, angle_degree, hJustify, vJustify );
934
935 bottomLeft.x = bottomLeft.x * cosine - bottomLeft.y * sine;
936 bottomLeft.y = bottomLeft.x * sine + bottomLeft.y * cosine;
937
938 bottomRight.x = bottomRight.x * cosine - bottomRight.y * sine;
939 bottomRight.y = bottomRight.x * sine + bottomRight.y * cosine;
940
941 topLeft.x = topLeft.x * cosine - topLeft.y * sine;
942 topLeft.y = topLeft.x * sine + topLeft.y * cosine;
943
944 topRight.x = topRight.x * cosine - topRight.y * sine;
945 topRight.y = topRight.x * sine + topRight.y * cosine;
946
947 bottomLeft += textpos;
948 bottomRight += textpos;
949 topLeft += textpos;
950 topRight += textpos;
951
952 updateImageLimits( bottomLeft );
953 updateImageLimits( bottomRight );
954 updateImageLimits( topLeft );
955 updateImageLimits( topRight );
956
957}
static wxString toNativeString(const wxString &aData)
Convert a DXF encoded string into a native Unicode string.
DXF_IMPORT_STYLE * getImportStyle(const std::string &aStyleName)
Return the import style.
A helper class to hold style settings temporarily during import.
void AddText(const VECTOR2D &aOrigin, const wxString &aText, double aHeight, double aWidth, double aThickness, double aOrientation, GR_TEXT_H_ALIGN_T aHJustify, GR_TEXT_V_ALIGN_T aVJustify) override
Create an object representing a text.
GR_TEXT_H_ALIGN_T
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_H_ALIGN_RIGHT
@ GR_TEXT_H_ALIGN_LEFT
GR_TEXT_V_ALIGN_T
@ GR_TEXT_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_TOP

References GRAPHICS_IMPORTER_BUFFER::AddText(), getArbitraryAxis(), getImportStyle(), GR_TEXT_H_ALIGN_CENTER, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_BOTTOM, GR_TEXT_V_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, DXF_IMPORT_BLOCK::m_buffer, m_currentBlock, m_internalImporter, DXF_IMPORT_STYLE::m_widthFactor, mapDim(), mapX(), mapY(), ocsToWcs(), text, toNativeString(), updateImageLimits(), VECTOR2< T >::x, VECTOR3< T >::x, VECTOR2< T >::y, and VECTOR3< T >::y.

◆ addPoint()

void DXF_IMPORT_PLUGIN::addPoint ( const DL_PointData &  aData)
overrideprivatevirtual

Definition at line 1273 of file dxf_import_plugin.cpp.

1274{
1275 MATRIX3x3D arbAxis = getArbitraryAxis( getExtrusion() );
1276 VECTOR3D centerCoords = ocsToWcs( arbAxis, VECTOR3D( aData.x, aData.y, aData.z ) );
1277
1278 VECTOR2D center( mapX( centerCoords.x ), mapY( centerCoords.y ) );
1279
1280 // we emulate points with filled circles
1281 // set the linewidth to something that even small circles look good with
1282 // thickness is optional for dxf points
1283 // note: we had to modify the dxf library to grab the attribute for thickness
1284 double lineWidth = 0.0001;
1285 double thickness = mapDim( std::max( aData.thickness, 0.01 ) );
1286
1287 GRAPHICS_IMPORTER_BUFFER* bufferToUse =
1289 bufferToUse->AddCircle( center, thickness, lineWidth, true );
1290
1291 VECTOR2D radiusDelta( SCALE_FACTOR( thickness ), SCALE_FACTOR( thickness ) );
1292
1293 updateImageLimits( center + radiusDelta );
1294 updateImageLimits( center - radiusDelta );
1295}
#define SCALE_FACTOR(x)

References GRAPHICS_IMPORTER_BUFFER::AddCircle(), getArbitraryAxis(), DXF_IMPORT_BLOCK::m_buffer, m_currentBlock, m_internalImporter, mapDim(), mapX(), mapY(), ocsToWcs(), SCALE_FACTOR, updateImageLimits(), VECTOR3< T >::x, and VECTOR3< T >::y.

◆ addPolyline()

void DXF_IMPORT_PLUGIN::addPolyline ( const DL_PolylineData &  aData)
overrideprivatevirtual

Definition at line 377 of file dxf_import_plugin.cpp.

378{
379 // Convert DXF Polylines into a series of KiCad Lines and Arcs.
380 // A Polyline (as opposed to a LWPolyline) may be a 3D line or
381 // even a 3D Mesh. The only type of Polyline which is guaranteed
382 // to import correctly is a 2D Polyline in X and Y, which is what
383 // we assume of all Polylines. The width used is the width of the Polyline.
384 // per-vertex line widths, if present, are ignored.
387 m_curr_entity.m_EntityFlag = aData.flags;
388 m_curr_entity.m_EntityType = DL_ENTITY_POLYLINE;
389}

References DXF2BRD_ENTITY_DATA::Clear(), m_curr_entity, DXF2BRD_ENTITY_DATA::m_EntityFlag, DXF2BRD_ENTITY_DATA::m_EntityParseStatus, and DXF2BRD_ENTITY_DATA::m_EntityType.

◆ addRay()

virtual void DXF_IMPORT_PLUGIN::addRay ( const DL_RayData &  )
inlineoverrideprivatevirtual

Definition at line 452 of file dxf_import_plugin.h.

452{ ON_UNSUPPORTED( "addRay" ); }

References ON_UNSUPPORTED.

◆ addSolid()

virtual void DXF_IMPORT_PLUGIN::addSolid ( const DL_SolidData &  )
inlineoverrideprivatevirtual

Definition at line 486 of file dxf_import_plugin.h.

486{ ON_UNSUPPORTED( "addSolid" ); }

References ON_UNSUPPORTED.

◆ addSpline()

void DXF_IMPORT_PLUGIN::addSpline ( const DL_SplineData &  aData)
overrideprivatevirtual

Called for every spline.

Definition at line 214 of file dxf_import_plugin.cpp.

215{
216 // Called when starting reading a spline
219 m_curr_entity.m_EntityFlag = aData.flags;
220 m_curr_entity.m_EntityType = DL_ENTITY_SPLINE;
221 m_curr_entity.m_SplineDegree = aData.degree;
222 m_curr_entity.m_SplineTangentStartX = aData.tangentStartX;
223 m_curr_entity.m_SplineTangentStartY = aData.tangentStartY;
224 m_curr_entity.m_SplineTangentEndX = aData.tangentEndX;
225 m_curr_entity.m_SplineTangentEndY = aData.tangentEndY;
226 m_curr_entity.m_SplineKnotsCount = aData.nKnots;
227 m_curr_entity.m_SplineControlCount = aData.nControl;
228 m_curr_entity.m_SplineFitCount = aData.nFit;
229}
unsigned int m_SplineDegree
unsigned int m_SplineFitCount
unsigned int m_SplineKnotsCount
unsigned int m_SplineControlCount

References DXF2BRD_ENTITY_DATA::Clear(), m_curr_entity, DXF2BRD_ENTITY_DATA::m_EntityFlag, DXF2BRD_ENTITY_DATA::m_EntityParseStatus, DXF2BRD_ENTITY_DATA::m_EntityType, DXF2BRD_ENTITY_DATA::m_SplineControlCount, DXF2BRD_ENTITY_DATA::m_SplineDegree, DXF2BRD_ENTITY_DATA::m_SplineFitCount, DXF2BRD_ENTITY_DATA::m_SplineKnotsCount, DXF2BRD_ENTITY_DATA::m_SplineTangentEndX, DXF2BRD_ENTITY_DATA::m_SplineTangentEndY, DXF2BRD_ENTITY_DATA::m_SplineTangentStartX, and DXF2BRD_ENTITY_DATA::m_SplineTangentStartY.

◆ addText()

void DXF_IMPORT_PLUGIN::addText ( const DL_TextData &  aData)
overrideprivatevirtual

Definition at line 638 of file dxf_import_plugin.cpp.

639{
640 MATRIX3x3D arbAxis = getArbitraryAxis( getExtrusion() );
641 VECTOR3D refPointCoords = ocsToWcs( arbAxis, VECTOR3D( aData.ipx, aData.ipy, aData.ipz ) );
642 VECTOR3D secPointCoords = ocsToWcs( arbAxis, VECTOR3D( std::isnan( aData.apx ) ? 0 : aData.apx,
643 std::isnan( aData.apy ) ? 0 : aData.apy,
644 std::isnan( aData.apz ) ? 0 : aData.apz ) );
645
646 VECTOR2D refPoint( mapX( refPointCoords.x ), mapY( refPointCoords.y ) );
647 VECTOR2D secPoint( mapX( secPointCoords.x ), mapY( secPointCoords.y ) );
648
649 if( aData.vJustification != 0 || aData.hJustification != 0 || aData.hJustification == 4 )
650 {
651 if( aData.hJustification != 3 && aData.hJustification != 5 )
652 {
653 VECTOR2D tmp = secPoint;
654 secPoint = refPoint;
655 refPoint = tmp;
656 }
657 }
658
659 wxString text = toNativeString( wxString::FromUTF8( aData.text.c_str() ) );
660
661 DXF_IMPORT_STYLE* style = getImportStyle( aData.style.c_str() );
662
663 double textHeight = mapDim( aData.height );
664 // The 0.9 factor gives a better height/width base ratio with our font
665 double charWidth = textHeight * 0.9;
666
667 if( style != nullptr )
668 charWidth *= style->m_widthFactor;
669
670 double textWidth = charWidth * text.length(); // Rough approximation
671 double textThickness = textHeight/8.0; // Use a reasonable line thickness for this text
672
673 VECTOR2D bottomLeft(0.0, 0.0);
674 VECTOR2D bottomRight(0.0, 0.0);
675 VECTOR2D topLeft(0.0, 0.0);
676 VECTOR2D topRight(0.0, 0.0);
677
680
681 switch( aData.vJustification )
682 {
683 case 0: //DRW_Text::VBaseLine:
684 case 1: //DRW_Text::VBottom:
685 vJustify = GR_TEXT_V_ALIGN_BOTTOM;
686
687 topLeft.y = textHeight;
688 topRight.y = textHeight;
689 break;
690
691 case 2: //DRW_Text::VMiddle:
692 vJustify = GR_TEXT_V_ALIGN_CENTER;
693
694 bottomRight.y = -textHeight / 2.0;
695 bottomLeft.y = -textHeight / 2.0;
696 topLeft.y = textHeight / 2.0;
697 topRight.y = textHeight / 2.0;
698 break;
699
700 case 3: //DRW_Text::VTop:
701 vJustify = GR_TEXT_V_ALIGN_TOP;
702
703 bottomLeft.y = -textHeight;
704 bottomRight.y = -textHeight;
705 break;
706 }
707
708 switch( aData.hJustification )
709 {
710 case 0: //DRW_Text::HLeft:
711 case 3: //DRW_Text::HAligned: // no equivalent options in text pcb.
712 case 5: //DRW_Text::HFit: // no equivalent options in text pcb.
713 hJustify = GR_TEXT_H_ALIGN_LEFT;
714
715 bottomRight.x = textWidth;
716 topRight.x = textWidth;
717 break;
718
719 case 1: //DRW_Text::HCenter:
720 case 4: //DRW_Text::HMiddle: // no equivalent options in text pcb.
721 hJustify = GR_TEXT_H_ALIGN_CENTER;
722
723 bottomLeft.x = -textWidth / 2.0;
724 topLeft.x = -textWidth / 2.0;
725 bottomRight.x = textWidth / 2.0;
726 topRight.x = textWidth / 2.0;
727 break;
728
729 case 2: //DRW_Text::HRight:
730 hJustify = GR_TEXT_H_ALIGN_RIGHT;
731
732 bottomLeft.x = -textWidth;
733 topLeft.x = -textWidth;
734 break;
735 }
736
737#if 0
738 wxString sty = wxString::FromUTF8( aData.style.c_str() );
739 sty = sty.ToLower();
740
741 if( aData.textgen == 2 )
742 {
743 // Text dir = left to right;
744 } else if( aData.textgen == 4 )
745 {
746 // Text dir = top to bottom;
747 } else
748 {
749 }
750#endif
751
752 // dxf_lib imports text angle in radians (although there are no comment about that.
753 // So, for the moment, convert this angle to degrees
754 double angle_degree = aData.angle * 180 / M_PI;
755 // We also need the angle in radians. so convert angle_degree to radians
756 // regardless the aData.angle unit
757 double angleInRads = angle_degree * M_PI / 180.0;
758 double cosine = cos(angleInRads);
759 double sine = sin(angleInRads);
760
761 GRAPHICS_IMPORTER_BUFFER* bufferToUse =
763 bufferToUse->AddText( refPoint, text, textHeight, charWidth, textThickness, angle_degree,
764 hJustify, vJustify );
765
766 // Calculate the boundary box and update the image limits:
767 bottomLeft.x = bottomLeft.x * cosine - bottomLeft.y * sine;
768 bottomLeft.y = bottomLeft.x * sine + bottomLeft.y * cosine;
769
770 bottomRight.x = bottomRight.x * cosine - bottomRight.y * sine;
771 bottomRight.y = bottomRight.x * sine + bottomRight.y * cosine;
772
773 topLeft.x = topLeft.x * cosine - topLeft.y * sine;
774 topLeft.y = topLeft.x * sine + topLeft.y * cosine;
775
776 topRight.x = topRight.x * cosine - topRight.y * sine;
777 topRight.y = topRight.x * sine + topRight.y * cosine;
778
779 bottomLeft += refPoint;
780 bottomRight += refPoint;
781 topLeft += refPoint;
782 topRight += refPoint;
783
784 updateImageLimits( bottomLeft );
785 updateImageLimits( bottomRight );
786 updateImageLimits( topLeft );
787 updateImageLimits( topRight );
788
789}

References GRAPHICS_IMPORTER_BUFFER::AddText(), getArbitraryAxis(), getImportStyle(), GR_TEXT_H_ALIGN_CENTER, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_BOTTOM, GR_TEXT_V_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, DXF_IMPORT_BLOCK::m_buffer, m_currentBlock, m_internalImporter, DXF_IMPORT_STYLE::m_widthFactor, mapDim(), mapX(), mapY(), ocsToWcs(), text, toNativeString(), updateImageLimits(), VECTOR2< T >::x, VECTOR3< T >::x, VECTOR2< T >::y, and VECTOR3< T >::y.

◆ addTextStyle()

void DXF_IMPORT_PLUGIN::addTextStyle ( const DL_StyleData &  aData)
overrideprivatevirtual

Definition at line 1262 of file dxf_import_plugin.cpp.

1263{
1264 wxString name = wxString::FromUTF8( aData.name.c_str() );
1265
1266 std::unique_ptr<DXF_IMPORT_STYLE> style =
1267 std::make_unique<DXF_IMPORT_STYLE>( name, aData.fixedTextHeight, aData.widthFactor, aData.bold, aData.italic );
1268
1269 m_styles.push_back( std::move( style ) );
1270}
std::vector< std::unique_ptr< DXF_IMPORT_STYLE > > m_styles

References m_styles, and name.

◆ addTrace()

virtual void DXF_IMPORT_PLUGIN::addTrace ( const DL_TraceData &  )
inlineoverrideprivatevirtual

Definition at line 483 of file dxf_import_plugin.h.

483{ ON_UNSUPPORTED( "addTrace" ); }

References ON_UNSUPPORTED.

◆ addVertex()

void DXF_IMPORT_PLUGIN::addVertex ( const DL_VertexData &  aData)
overrideprivatevirtual

Called for every polyline vertex.

Definition at line 392 of file dxf_import_plugin.cpp.

393{
395 return; // Error
396
397 DXF_IMPORT_LAYER* layer = getImportLayer( attributes.getLayer() );
398 double lineWidth = lineWeightToWidth( attributes.getWidth(), layer );
399
400 /* support for per-vertex-encoded linewidth (Cadence uses it) */
401 /* linewidths are scaled by 100 in DXF */
402 if( aData.startWidth > 0.0 )
403 lineWidth = aData.startWidth / 100.0;
404 else if ( aData.endWidth > 0.0 )
405 lineWidth = aData.endWidth / 100.0;
406
407 const DL_VertexData* vertex = &aData;
408
409 MATRIX3x3D arbAxis = getArbitraryAxis( getExtrusion() );
410 VECTOR3D vertexCoords = ocsToWcs( arbAxis, VECTOR3D( vertex->x, vertex->y, vertex->z ) );
411
412 if( m_curr_entity.m_EntityParseStatus == 1 ) // This is the first vertex of an entity
413 {
414 m_curr_entity.m_LastCoordinate.x = mapX( vertexCoords.x );
415 m_curr_entity.m_LastCoordinate.y = mapY( vertexCoords.y );
417 m_curr_entity.m_BulgeVertex = vertex->bulge;
419 return;
420 }
421
422 VECTOR2D seg_end( mapX( vertexCoords.x ), mapY( vertexCoords.y ) );
423
425 insertLine( m_curr_entity.m_LastCoordinate, seg_end, lineWidth );
426 else
428 lineWidth );
429
431 m_curr_entity.m_BulgeVertex = vertex->bulge;
432}
void insertLine(const VECTOR2D &aSegStart, const VECTOR2D &aSegEnd, double aWidth)
void insertArc(const VECTOR2D &aSegStart, const VECTOR2D &aSegEnd, double aBulge, double aWidth)
#define MIN_BULGE
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:412

References std::abs(), getArbitraryAxis(), getImportLayer(), insertArc(), insertLine(), lineWeightToWidth(), DXF2BRD_ENTITY_DATA::m_BulgeVertex, m_curr_entity, DXF2BRD_ENTITY_DATA::m_EntityParseStatus, DXF2BRD_ENTITY_DATA::m_LastCoordinate, DXF2BRD_ENTITY_DATA::m_PolylineStart, mapX(), mapY(), MIN_BULGE, ocsToWcs(), VECTOR2< T >::x, VECTOR3< T >::x, VECTOR2< T >::y, and VECTOR3< T >::y.

◆ addXDataApp()

virtual void DXF_IMPORT_PLUGIN::addXDataApp ( const std::string &  )
inlineoverrideprivatevirtual

Definition at line 512 of file dxf_import_plugin.h.

512{ ON_UNSUPPORTED( "addXDataApp" ); }

References ON_UNSUPPORTED.

◆ addXDataInt()

virtual void DXF_IMPORT_PLUGIN::addXDataInt ( int  ,
int   
)
inlineoverrideprivatevirtual

Definition at line 519 of file dxf_import_plugin.h.

519{ ON_UNSUPPORTED( "addXDataInt" ); }

References ON_UNSUPPORTED.

◆ addXDataReal()

virtual void DXF_IMPORT_PLUGIN::addXDataReal ( int  ,
double   
)
inlineoverrideprivatevirtual

Definition at line 518 of file dxf_import_plugin.h.

518{ ON_UNSUPPORTED( "addXDataReal" ); }

References ON_UNSUPPORTED.

◆ addXDataString()

virtual void DXF_IMPORT_PLUGIN::addXDataString ( int  ,
const std::string &   
)
inlineoverrideprivatevirtual

Definition at line 513 of file dxf_import_plugin.h.

514 {
515 ON_UNSUPPORTED( "addXDataString" );
516 }

References ON_UNSUPPORTED.

◆ addXLine()

virtual void DXF_IMPORT_PLUGIN::addXLine ( const DL_XLineData &  )
inlineoverrideprivatevirtual

Definition at line 450 of file dxf_import_plugin.h.

450{ ON_UNSUPPORTED( "addXLine" ); }

References ON_UNSUPPORTED.

◆ addXRecord()

virtual void DXF_IMPORT_PLUGIN::addXRecord ( const std::string &  )
inlineoverrideprivatevirtual

Definition at line 501 of file dxf_import_plugin.h.

501{ ON_UNSUPPORTED( "addXRecord" ); }

References ON_UNSUPPORTED.

◆ addXRecordBool()

virtual void DXF_IMPORT_PLUGIN::addXRecordBool ( int  ,
bool   
)
inlineoverrideprivatevirtual

Definition at line 510 of file dxf_import_plugin.h.

510{ ON_UNSUPPORTED( "addXRecordBool" ); }

References ON_UNSUPPORTED.

◆ addXRecordInt()

virtual void DXF_IMPORT_PLUGIN::addXRecordInt ( int  ,
int   
)
inlineoverrideprivatevirtual

Definition at line 509 of file dxf_import_plugin.h.

509{ ON_UNSUPPORTED( "addXRecordInt" ); }

References ON_UNSUPPORTED.

◆ addXRecordReal()

virtual void DXF_IMPORT_PLUGIN::addXRecordReal ( int  ,
double   
)
inlineoverrideprivatevirtual

Definition at line 508 of file dxf_import_plugin.h.

508{ ON_UNSUPPORTED( "addXRecordReal" ); }

References ON_UNSUPPORTED.

◆ addXRecordString()

virtual void DXF_IMPORT_PLUGIN::addXRecordString ( int  ,
const std::string &   
)
inlineoverrideprivatevirtual

Definition at line 503 of file dxf_import_plugin.h.

504 {
505 ON_UNSUPPORTED( "addXRecordString" );
506 }

References ON_UNSUPPORTED.

◆ endBlock()

void DXF_IMPORT_PLUGIN::endBlock ( )
overrideprivatevirtual

Definition at line 477 of file dxf_import_plugin.cpp.

478{
479 m_currentBlock = nullptr;
480}

References m_currentBlock.

◆ endEntity()

void DXF_IMPORT_PLUGIN::endEntity ( )
overrideprivatevirtual

Definition at line 435 of file dxf_import_plugin.cpp.

436{
437 DXF_IMPORT_LAYER* layer = getImportLayer( attributes.getLayer() );
438 double lineWidth = lineWeightToWidth( attributes.getWidth(), layer );
439
440 if( m_curr_entity.m_EntityType == DL_ENTITY_POLYLINE ||
441 m_curr_entity.m_EntityType == DL_ENTITY_LWPOLYLINE )
442 {
443 // Polyline flags bit 0 indicates closed (1) or open (0) polyline
445 {
448 lineWidth );
449 else
451 m_curr_entity.m_BulgeVertex, lineWidth );
452 }
453 }
454
455 if( m_curr_entity.m_EntityType == DL_ENTITY_SPLINE )
456 {
457 insertSpline( lineWidth );
458 }
459
461}
void insertSpline(double aWidth)

References std::abs(), DXF2BRD_ENTITY_DATA::Clear(), getImportLayer(), insertArc(), insertLine(), insertSpline(), lineWeightToWidth(), DXF2BRD_ENTITY_DATA::m_BulgeVertex, m_curr_entity, DXF2BRD_ENTITY_DATA::m_EntityFlag, DXF2BRD_ENTITY_DATA::m_EntityType, DXF2BRD_ENTITY_DATA::m_LastCoordinate, DXF2BRD_ENTITY_DATA::m_PolylineStart, and MIN_BULGE.

◆ getArbitraryAxis()

MATRIX3x3D DXF_IMPORT_PLUGIN::getArbitraryAxis ( DL_Extrusion *  aData)
private

Definition at line 1508 of file dxf_import_plugin.cpp.

1509{
1510 VECTOR3D arbZ, arbX, arbY;
1511
1512 double direction[3];
1513 aData->getDirection( direction );
1514
1515 arbZ = VECTOR3D( direction[0], direction[1], direction[2] ).Normalize();
1516
1517 if( ( abs( arbZ.x ) < ( 1.0 / 64.0 ) ) && ( abs( arbZ.y ) < ( 1.0 / 64.0 ) ) )
1518 {
1519 arbX = VECTOR3D( 0, 1, 0 ).Cross( arbZ ).Normalize();
1520 }
1521 else
1522 {
1523 arbX = VECTOR3D( 0, 0, 1 ).Cross( arbZ ).Normalize();
1524 }
1525
1526 arbY = arbZ.Cross( arbX ).Normalize();
1527
1528 return MATRIX3x3D{ arbX, arbY, arbZ };
1529}
VECTOR3< T > Normalize()
Compute the normalized vector.
Definition: vector3.h:153
VECTOR3< T > Cross(const VECTOR3< T > &aVector) const
Compute cross product of self with aVector.
Definition: vector3.h:127

References std::abs(), VECTOR3< T >::Cross(), VECTOR3< T >::Normalize(), VECTOR3< T >::x, and VECTOR3< T >::y.

Referenced by addArc(), addCircle(), addEllipse(), addInsert(), addMText(), addPoint(), addText(), and addVertex().

◆ getCurrentUnitScale()

double DXF_IMPORT_PLUGIN::getCurrentUnitScale ( )
private

Definition at line 960 of file dxf_import_plugin.cpp.

961{
962 double scale = 1.0;
963 switch( m_currentUnit )
964 {
966 scale = 25.4;
967 break;
968
970 scale = 304.8;
971 break;
972
974 scale = 1.0;
975 break;
976
978 scale = 10.0;
979 break;
980
982 scale = 1000.0;
983 break;
984
986 scale = 2.54e-5;
987 break;
988
990 scale = 0.0254;
991 break;
992
994 scale = 914.4;
995 break;
996
998 scale = 1.0e-7;
999 break;
1000
1002 scale = 1.0e-6;
1003 break;
1004
1006 scale = 1.0e-3;
1007 break;
1008
1010 scale = 100.0;
1011 break;
1012
1013 default:
1014 // use the default of 1.0 for:
1015 // 0: Unspecified Units
1016 // 3: miles
1017 // 7: kilometers
1018 // 15: decameters
1019 // 16: hectometers
1020 // 17: gigameters
1021 // 18: AU
1022 // 19: lightyears
1023 // 20: parsecs
1024 scale = 1.0;
1025 break;
1026 }
1027
1028 return scale;
1029}

References ANGSTROMS, CENTIMETERS, DECIMETERS, FEET, INCHES, m_currentUnit, METERS, MICROINCHES, MICRONS, MILLIMETERS, MILS, NANOMETERS, scale, and YARDS.

Referenced by mapDim(), mapX(), and mapY().

◆ GetFileExtensions()

const std::vector< std::string > DXF_IMPORT_PLUGIN::GetFileExtensions ( ) const
inlineoverridevirtual

Return a vector of the file extensions handled by this plugin.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 227 of file dxf_import_plugin.h.

228 {
229 static std::vector<std::string> exts = { "dxf" };
230 return exts;
231 }

◆ GetImageHeight()

double DXF_IMPORT_PLUGIN::GetImageHeight ( ) const
overridevirtual

Return image height from original imported file.

Returns
Original Image height in mm.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 155 of file dxf_import_plugin.cpp.

156{
157 return m_maxY - m_minY;
158}

References m_maxY, and m_minY.

◆ GetImageWidth()

double DXF_IMPORT_PLUGIN::GetImageWidth ( ) const
overridevirtual

Return image width from original imported file.

Returns
Original Image width in mm.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 149 of file dxf_import_plugin.cpp.

150{
151 return m_maxX - m_minX;
152}

References m_maxX, and m_minX.

◆ getImportBlock()

DXF_IMPORT_BLOCK * DXF_IMPORT_PLUGIN::getImportBlock ( const std::string &  aBlockName)
private

Return the import layer block.

Parameters
aBlockNameis the raw string from dxflib.
Returns
The given block by name or nullptr if not found.

Definition at line 321 of file dxf_import_plugin.cpp.

322{
323 DXF_IMPORT_BLOCK* block = nullptr;
324 wxString blockName = wxString::FromUTF8( aBlockName.c_str() );
325
326 if( !blockName.IsEmpty() )
327 {
328 auto resultIt = std::find_if( m_blocks.begin(), m_blocks.end(),
329 [blockName]( const auto& it )
330 {
331 return it->m_name == blockName;
332 } );
333
334 if( resultIt != m_blocks.end() )
335 block = resultIt->get();
336 }
337
338 return block;
339}

References m_blocks.

Referenced by addInsert().

◆ getImportLayer()

DXF_IMPORT_LAYER * DXF_IMPORT_PLUGIN::getImportLayer ( const std::string &  aLayerName)
private

Return the import layer data.

Parameters
aLayerNameis the raw string from dxflib getLayer().
Returns
The given layer by name or the placeholder layer inserted in the constructor.

Definition at line 300 of file dxf_import_plugin.cpp.

301{
302 DXF_IMPORT_LAYER* layer = m_layers.front().get();
303 wxString layerName = wxString::FromUTF8( aLayerName.c_str() );
304
305 if( !layerName.IsEmpty() )
306 {
307 auto resultIt = std::find_if( m_layers.begin(), m_layers.end(),
308 [layerName]( const auto& it )
309 {
310 return it->m_layerName == layerName;
311 } );
312
313 if( resultIt != m_layers.end() )
314 layer = resultIt->get();
315 }
316
317 return layer;
318}

References m_layers.

Referenced by addArc(), addCircle(), addEllipse(), addLine(), addVertex(), and endEntity().

◆ getImportStyle()

DXF_IMPORT_STYLE * DXF_IMPORT_PLUGIN::getImportStyle ( const std::string &  aStyleName)
private

Return the import style.

Parameters
aStyleNameis the raw string from dxflib.
Returns
The given style by name or nullptr if not found.

Definition at line 342 of file dxf_import_plugin.cpp.

343{
344 DXF_IMPORT_STYLE* style = nullptr;
345 wxString styleName = wxString::FromUTF8( aStyleName.c_str() );
346
347 if( !styleName.IsEmpty() )
348 {
349 auto resultIt = std::find_if( m_styles.begin(), m_styles.end(),
350 [styleName]( const auto& it ) { return it->m_name == styleName; } );
351
352 if( resultIt != m_styles.end() )
353 style = resultIt->get();
354 }
355
356 return style;
357}

References m_styles.

Referenced by addMText(), and addText().

◆ GetMessages()

const wxString & DXF_IMPORT_PLUGIN::GetMessages ( ) const
inlineoverridevirtual
Returns
the list of messages in one string. Each message ends by '
'

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 313 of file dxf_import_plugin.h.

314 {
315 return m_messages;
316 }

References m_messages.

◆ GetName()

const wxString DXF_IMPORT_PLUGIN::GetName ( ) const
inlineoverridevirtual

Return the plugin name.

This string will be used as the description in the file dialog.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 222 of file dxf_import_plugin.h.

223 {
224 return "AutoCAD DXF";
225 }

◆ GetWildcards()

wxString GRAPHICS_IMPORT_PLUGIN::GetWildcards ( ) const
inlineinherited

Return a list of wildcards that contains the file extensions handled by this plugin, separated with a semi-colon.

Definition at line 69 of file graphics_import_plugin.h.

70 {
71 wxString ret;
72 bool first = true;
73
74 for( const auto& extension : GetFileExtensions() )
75 {
76 if( first )
77 first = false;
78 else
79 ret += wxT( ";" );
80
81 ret += wxT( "*." ) + formatWildcardExt( extension );
82 }
83
84 return ret;
85 }
virtual const std::vector< std::string > GetFileExtensions() const =0
Return a vector of the file extensions handled by this plugin.
wxString formatWildcardExt(const wxString &aWildcard)
Format wildcard extension to support case sensitive file dialogs.

References formatWildcardExt(), and GRAPHICS_IMPORT_PLUGIN::GetFileExtensions().

◆ Import()

bool DXF_IMPORT_PLUGIN::Import ( )
overridevirtual

Actually imports the file.

It is necessary to have loaded the file beforehand.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 140 of file dxf_import_plugin.cpp.

141{
142 wxCHECK( m_importer, false );
144
145 return true;
146}
void ImportTo(GRAPHICS_IMPORTER &aImporter)
GRAPHICS_IMPORTER * m_importer
< Importer used to create objects representing the imported shapes.

References GRAPHICS_IMPORTER_BUFFER::ImportTo(), GRAPHICS_IMPORT_PLUGIN::m_importer, and m_internalImporter.

◆ ImportAsFootprintGraphic()

void DXF_IMPORT_PLUGIN::ImportAsFootprintGraphic ( bool  aImportAsFootprintGraphic)
inline

Allow the import DXF items converted to board graphic items or footprint graphic items.

Parameters
aImportAsFootprintGraphicuse true to import in a footprint or false to import on a board.

Definition at line 249 of file dxf_import_plugin.h.

250 {
251 m_importAsFPShapes = aImportAsFootprintGraphic;
252 }

References m_importAsFPShapes.

◆ ImportDxfFile()

bool DXF_IMPORT_PLUGIN::ImportDxfFile ( const wxString &  aFile)

Implementation of the method used for communicate with this filter.

Parameters
aFileis the full filename.

Definition at line 188 of file dxf_import_plugin.cpp.

189{
190 DL_Dxf dxf_reader;
191
192 // wxFopen takes care of unicode filenames across platforms
193 FILE* fp = wxFopen( aFile, wxT( "rt" ) );
194
195 if( fp == nullptr )
196 return false;
197
198 // Note the dxf reader takes care of switching to "C" locale before reading the file
199 // and will close the file after reading
200 bool success = dxf_reader.in( fp, this );
201
202 return success;
203}

Referenced by Load().

◆ insertArc()

void DXF_IMPORT_PLUGIN::insertArc ( const VECTOR2D aSegStart,
const VECTOR2D aSegEnd,
double  aBulge,
double  aWidth 
)
private

Definition at line 1313 of file dxf_import_plugin.cpp.

1315{
1316 VECTOR2D segment_startpoint( SCALE_FACTOR( aSegStart.x ), SCALE_FACTOR( aSegStart.y ) );
1317 VECTOR2D segment_endpoint( SCALE_FACTOR( aSegEnd.x ), SCALE_FACTOR( aSegEnd.y ) );
1318
1319 // ensure aBulge represents an angle from +/- ( 0 .. approx 359.8 deg )
1320 if( aBulge < -2000.0 )
1321 aBulge = -2000.0;
1322 else if( aBulge > 2000.0 )
1323 aBulge = 2000.0;
1324
1325 double ang = 4.0 * atan( aBulge );
1326
1327 // reflect the Y values to put everything in a RHCS
1328 VECTOR2D sp( aSegStart.x, -aSegStart.y );
1329 VECTOR2D ep( aSegEnd.x, -aSegEnd.y );
1330 // angle from end->start
1331 double offAng = atan2( ep.y - sp.y, ep.x - sp.x );
1332 // length of subtended segment = 1/2 distance between the 2 points
1333 double d = 0.5 * sqrt( (sp.x - ep.x) * (sp.x - ep.x) + (sp.y - ep.y) * (sp.y - ep.y) );
1334 // midpoint of the subtended segment
1335 double xm = ( sp.x + ep.x ) * 0.5;
1336 double ym = ( sp.y + ep.y ) * 0.5;
1337 double radius = d / sin( ang * 0.5 );
1338
1339 if( radius < 0.0 )
1340 radius = -radius;
1341
1342 // calculate the height of the triangle with base d and hypotenuse r
1343 double dh2 = radius * radius - d * d;
1344
1345 // this should only ever happen due to rounding errors when r == d
1346 if( dh2 < 0.0 )
1347 dh2 = 0.0;
1348
1349 double h = sqrt( dh2 );
1350
1351 if( ang < 0.0 )
1352 offAng -= M_PI_2;
1353 else
1354 offAng += M_PI_2;
1355
1356 // for angles greater than 180 deg we need to flip the
1357 // direction in which the arc center is found relative
1358 // to the midpoint of the subtended segment.
1359 if( ang < -M_PI )
1360 offAng += M_PI;
1361 else if( ang > M_PI )
1362 offAng -= M_PI;
1363
1364 // center point
1365 double cx = h * cos( offAng ) + xm;
1366 double cy = h * sin( offAng ) + ym;
1367 VECTOR2D center( SCALE_FACTOR( cx ), SCALE_FACTOR( -cy ) );
1368 VECTOR2D arc_start;
1369 EDA_ANGLE angle( ang, RADIANS_T );
1370
1371 if( ang < 0.0 )
1372 {
1373 arc_start = VECTOR2D( SCALE_FACTOR( ep.x ), SCALE_FACTOR( -ep.y ) );
1374 }
1375 else
1376 {
1377 arc_start = VECTOR2D( SCALE_FACTOR( sp.x ), SCALE_FACTOR( -sp.y ) );
1378 angle = -angle;
1379 }
1380
1383 bufferToUse->AddArc( center, arc_start, angle, aWidth );
1384
1385 VECTOR2D radiusDelta( SCALE_FACTOR( radius ), SCALE_FACTOR( radius ) );
1386
1387 updateImageLimits( center + radiusDelta );
1388 updateImageLimits( center - radiusDelta );
1389 return;
1390}
#define M_PI_2
Definition: transline.cpp:40

References GRAPHICS_IMPORTER_BUFFER::AddArc(), PNS::angle(), DXF_IMPORT_BLOCK::m_buffer, m_currentBlock, m_internalImporter, M_PI_2, RADIANS_T, SCALE_FACTOR, updateImageLimits(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by addVertex(), and endEntity().

◆ insertLine()

void DXF_IMPORT_PLUGIN::insertLine ( const VECTOR2D aSegStart,
const VECTOR2D aSegEnd,
double  aWidth 
)
private

Definition at line 1298 of file dxf_import_plugin.cpp.

1300{
1301 VECTOR2D origin( SCALE_FACTOR( aSegStart.x ), SCALE_FACTOR( aSegStart.y ) );
1302 VECTOR2D end( SCALE_FACTOR( aSegEnd.x ), SCALE_FACTOR( aSegEnd.y ) );
1303
1304 GRAPHICS_IMPORTER_BUFFER* bufferToUse =
1306 bufferToUse->AddLine( origin, end, aWidth );
1307
1308 updateImageLimits( origin );
1309 updateImageLimits( end );
1310}

References GRAPHICS_IMPORTER_BUFFER::AddLine(), DXF_IMPORT_BLOCK::m_buffer, m_currentBlock, m_internalImporter, SCALE_FACTOR, updateImageLimits(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by addVertex(), and endEntity().

◆ insertSpline()

void DXF_IMPORT_PLUGIN::insertSpline ( double  aWidth)
private

Definition at line 1395 of file dxf_import_plugin.cpp.

1396{
1397 #if 0 // Debug only
1398 wxLogMessage("spl deg %d kn %d ctr %d fit %d",
1403 #endif
1404
1405 unsigned imax = m_curr_entity.m_SplineControlPointList.size();
1406
1407 if( imax < 2 ) // malformed spline
1408 return;
1409
1410#if 0 // set to 1 to approximate the spline by segments between 2 control points
1413
1414 for( unsigned int ii = 1; ii < imax; ++ii )
1415 {
1418
1419 if( startpoint != endpoint )
1420 {
1421 m_internalImporter.AddLine( startpoint, endpoint, aWidth );
1422
1423 updateImageLimits( startpoint );
1424 updateImageLimits( endpoint );
1425
1426 startpoint = endpoint;
1427 }
1428 }
1429#else // Use bezier curves, supported by pcbnew, to approximate the spline
1430 std::vector<double> ctrlp;
1431
1432 for( unsigned ii = 0; ii < imax; ++ii )
1433 {
1434 ctrlp.push_back( m_curr_entity.m_SplineControlPointList[ii].m_x );
1435 ctrlp.push_back( m_curr_entity.m_SplineControlPointList[ii].m_y );
1436 }
1437
1438 std::vector<double> coords;
1439 tinyspline::BSpline beziers;
1440 try
1441 {
1442 tinyspline::BSpline dxfspline( m_curr_entity.m_SplineControlPointList.size(),
1443 /* coord dim */ 2, m_curr_entity.m_SplineDegree );
1444
1445 dxfspline.setControlPoints( ctrlp );
1446 dxfspline.setKnots( m_curr_entity.m_SplineKnotsList );
1447 beziers = tinyspline::BSpline( dxfspline.toBeziers() );
1448
1449 coords = beziers.controlPoints();
1450 }
1451 catch( const std::runtime_error& ) //tinyspline throws everything including data validation as runtime errors
1452 {
1453 // invalid spline definition, drop this block
1454 reportMsg( _( "Invalid spline definition encountered" ) );
1455 return;
1456 }
1457
1458 size_t order = beziers.order();
1459 size_t dim = beziers.dimension();
1460 size_t numBeziers = ( coords.size() / dim ) / order;
1461
1462 for( size_t i = 0; i < numBeziers; i++ )
1463 {
1464 size_t ii = i * dim * order;
1465 VECTOR2D start( mapX( coords[ ii ] ), mapY( coords[ ii + 1 ] ) );
1466
1467 VECTOR2D bezierControl1( mapX( coords[ii + 2] ), mapY( coords[ii + 3] ) );
1468
1469 // not sure why this happens, but it seems to sometimes slip degree on the final bezier
1470 VECTOR2D bezierControl2;
1471 if( ii + 4 >= coords.size() )
1472 {
1473 bezierControl2 = bezierControl1;
1474 }
1475 else
1476 {
1477 bezierControl2 = VECTOR2D( mapX( coords[ii + 4] ), mapY( coords[ii + 5] ) );
1478 }
1479
1480 VECTOR2D end;
1481 if( ii + 6 >= coords.size() )
1482 {
1483 end = bezierControl2;
1484 }
1485 else
1486 {
1487 end = VECTOR2D( mapX( coords[ii + 6] ), mapY( coords[ii + 7] ) );
1488 }
1489
1490 GRAPHICS_IMPORTER_BUFFER* bufferToUse =
1492 bufferToUse->AddSpline( start, bezierControl1, bezierControl2, end, aWidth );
1493 }
1494#endif
1495}
void reportMsg(const wxString &aMessage)
#define _(s)

References _, GRAPHICS_IMPORTER_BUFFER::AddLine(), GRAPHICS_IMPORTER_BUFFER::AddSpline(), DXF_IMPORT_BLOCK::m_buffer, m_curr_entity, m_currentBlock, m_internalImporter, DXF2BRD_ENTITY_DATA::m_SplineControlPointList, DXF2BRD_ENTITY_DATA::m_SplineDegree, DXF2BRD_ENTITY_DATA::m_SplineFitPointList, DXF2BRD_ENTITY_DATA::m_SplineKnotsList, mapX(), mapY(), reportMsg(), and updateImageLimits().

Referenced by endEntity().

◆ lineWeightToWidth()

double DXF_IMPORT_PLUGIN::lineWeightToWidth ( int  lw,
DXF_IMPORT_LAYER aLayer 
)
private

Definition at line 281 of file dxf_import_plugin.cpp.

282{
283 if( lw == DXF_IMPORT_LINEWEIGHT_BY_LAYER && aLayer != nullptr )
284 {
285 lw = aLayer->m_lineWeight;
286 }
287
288 // All lineweights >= 0 are always in 100ths of mm
289 double mm = m_defaultThickness;
290
291 if( lw >= 0 )
292 {
293 mm = lw / 100.0;
294 }
295
296 return SCALE_FACTOR( mm );
297}

References DXF_IMPORT_LINEWEIGHT_BY_LAYER, m_defaultThickness, DXF_IMPORT_LAYER::m_lineWeight, and SCALE_FACTOR.

Referenced by addArc(), addCircle(), addEllipse(), addLine(), addVertex(), and endEntity().

◆ linkImage()

virtual void DXF_IMPORT_PLUGIN::linkImage ( const DL_ImageDefData &  )
inlineoverrideprivatevirtual

Definition at line 489 of file dxf_import_plugin.h.

489{}

◆ Load()

bool DXF_IMPORT_PLUGIN::Load ( const wxString &  aFileName)
overridevirtual

Load file for import.

It is necessary to have the GRAPHICS_IMPORTER object set before.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 120 of file dxf_import_plugin.cpp.

121{
122 try
123 {
124 return ImportDxfFile( aFileName );
125 }
126 catch( const std::bad_alloc& )
127 {
128 m_layers.clear();
129 m_blocks.clear();
130 m_styles.clear();
131
133
134 reportMsg( _( "Memory was exhausted trying to load the DXF, it may be too large." ) );
135 return false;
136 }
137}
bool ImportDxfFile(const wxString &aFile)
Implementation of the method used for communicate with this filter.

References _, GRAPHICS_IMPORTER_BUFFER::ClearShapes(), ImportDxfFile(), m_blocks, m_internalImporter, m_layers, m_styles, and reportMsg().

◆ mapDim()

double DXF_IMPORT_PLUGIN::mapDim ( double  aDxfValue)
private

Definition at line 182 of file dxf_import_plugin.cpp.

183{
184 return SCALE_FACTOR( aDxfValue * getCurrentUnitScale() );
185}

References getCurrentUnitScale(), and SCALE_FACTOR.

Referenced by addArc(), addCircle(), addMText(), addPoint(), and addText().

◆ mapX()

double DXF_IMPORT_PLUGIN::mapX ( double  aDxfCoordX)
private

◆ mapY()

double DXF_IMPORT_PLUGIN::mapY ( double  aDxfCoordY)
private

◆ ocsToWcs()

VECTOR3D DXF_IMPORT_PLUGIN::ocsToWcs ( const MATRIX3x3D arbitraryAxis,
VECTOR3D  point 
)
private

Converts a given object coordinate point to world coordinate using the given arbitrary axis vectors.

Definition at line 1538 of file dxf_import_plugin.cpp.

1539{
1540 VECTOR3D worldX = wcsToOcs( arbitraryAxis, VECTOR3D( 1, 0, 0 ) );
1541 VECTOR3D worldY = wcsToOcs( arbitraryAxis, VECTOR3D( 0, 1, 0 ) );
1542 VECTOR3D worldZ = wcsToOcs( arbitraryAxis, VECTOR3D( 0, 0, 1 ) );
1543
1544 MATRIX3x3 world( worldX, worldY, worldZ );
1545
1546 return world * point;
1547}
VECTOR3D wcsToOcs(const MATRIX3x3D &arbitraryAxis, VECTOR3D point)
Converts a given world coordinate point to object coordinate using the given arbitrary axis vectors.

References wcsToOcs().

Referenced by addArc(), addCircle(), addEllipse(), addInsert(), addMText(), addPoint(), addText(), and addVertex().

◆ reportMsg()

void DXF_IMPORT_PLUGIN::reportMsg ( const wxString &  aMessage)
private

Definition at line 206 of file dxf_import_plugin.cpp.

207{
208 // Add message to keep trace of not handled dxf entities
209 m_messages += aMessage;
210 m_messages += '\n';
211}

References m_messages.

Referenced by insertSpline(), and Load().

◆ SetBrdLayer()

void DXF_IMPORT_PLUGIN::SetBrdLayer ( int  aBrdLayer)
inline

Set the layer number to import dxf items.

The layer should be a technical layer, not a copper layer.

Definition at line 301 of file dxf_import_plugin.h.

301{ m_brdLayer = aBrdLayer; }

References m_brdLayer.

◆ SetDefaultLineWidthMM()

void DXF_IMPORT_PLUGIN::SetDefaultLineWidthMM ( double  aWidth)
inline

Set the default line width when importing dxf items like lines to Pcbnew.

DXF files have no line width explicit parameter, it will be most of time the line width of imported lines. f

Parameters
aWidthis the line width in mm.

Definition at line 274 of file dxf_import_plugin.h.

275 {
276 m_defaultThickness = aWidth;
277 }

References m_defaultThickness.

Referenced by SetImporter(), and SetLineWidthMM().

◆ SetImporter()

void DXF_IMPORT_PLUGIN::SetImporter ( GRAPHICS_IMPORTER aImporter)
overridevirtual

Set the receiver of the imported shapes.

Reimplemented from GRAPHICS_IMPORT_PLUGIN.

Definition at line 161 of file dxf_import_plugin.cpp.

162{
164
165 if( m_importer )
167}
void SetDefaultLineWidthMM(double aWidth)
Set the default line width when importing dxf items like lines to Pcbnew.
double GetLineWidthMM() const
Return the line width used for importing the outlines (in mm).
virtual void SetImporter(GRAPHICS_IMPORTER *aImporter)
Set the receiver of the imported shapes.

References GRAPHICS_IMPORTER::GetLineWidthMM(), GRAPHICS_IMPORT_PLUGIN::m_importer, SetDefaultLineWidthMM(), and GRAPHICS_IMPORT_PLUGIN::SetImporter().

◆ SetLineWidthMM()

void DXF_IMPORT_PLUGIN::SetLineWidthMM ( double  aWidth)
inlineoverridevirtual

Reimplemented from GRAPHICS_IMPORT_PLUGIN.

Definition at line 279 of file dxf_import_plugin.h.

279{ SetDefaultLineWidthMM( aWidth ); }

References SetDefaultLineWidthMM().

◆ SetOffset()

void DXF_IMPORT_PLUGIN::SetOffset ( double  aOffsetX,
double  aOffsetY 
)
inline

Set the coordinate offset between the imported dxf items and Pcbnew.

DXF files have the Y axis from bottom to top aOffsetX = 0, and aOffsetY = - vertical page size to import a full page.

Parameters
aOffsetXis the X offset in mm.
aOffsetYis the Y offset in mm.

Definition at line 290 of file dxf_import_plugin.h.

291 {
292 m_xOffset = aOffsetX;
293 m_yOffset = aOffsetY;
294 }

References m_xOffset, and m_yOffset.

◆ SetUnit()

void DXF_IMPORT_PLUGIN::SetUnit ( DXF_IMPORT_UNITS  aUnit)
inline

Set the default units when importing DXFs.

DXFs can lack units by design which requires the importing software to make the decision.

Parameters
aUnitsis the default unit of the DXF to assume.

Definition at line 261 of file dxf_import_plugin.h.

262 {
263 m_currentUnit = aUnit;
264 }

References m_currentUnit.

◆ setVariableDouble()

virtual void DXF_IMPORT_PLUGIN::setVariableDouble ( const std::string &  key,
double  value,
int  code 
)
inlineoverrideprivatevirtual

Called for every double variable in the DXF file (e.g.

"$DIMEXO").

Definition at line 393 of file dxf_import_plugin.h.

393{}

◆ setVariableInt()

void DXF_IMPORT_PLUGIN::setVariableInt ( const std::string &  key,
int  value,
int  code 
)
overrideprivatevirtual

Called for every int variable in the DXF file (e.g.

"$ACADMAINTVER").

Definition at line 1033 of file dxf_import_plugin.cpp.

1034{
1035 // Called for every int variable in the DXF file (e.g. "$INSUNITS").
1036
1037 if( key == "$DWGCODEPAGE" )
1038 {
1039 m_codePage = value;
1040 return;
1041 }
1042
1043 if( key == "$AUPREC" )
1044 {
1045 m_importAnglePrecision = value;
1046 return;
1047 }
1048
1049 if( key == "$LUPREC" )
1050 {
1052 return;
1053 }
1054
1055 if( key == "$INSUNITS" ) // Drawing units
1056 {
1057 switch( value )
1058 {
1059 case 1: // inches
1061 break;
1062
1063 case 2: // feet
1065 break;
1066
1067 case 4: // mm
1069 break;
1070
1071 case 5: // centimeters
1073 break;
1074
1075 case 6: // meters
1077 break;
1078
1079 case 8: // microinches
1081 break;
1082
1083 case 9: // mils
1085 break;
1086
1087 case 10: // yards
1089 break;
1090
1091 case 11: // Angstroms
1093 break;
1094
1095 case 12: // nanometers
1097 break;
1098
1099 case 13: // micrometers
1101 break;
1102
1103 case 14: // decimeters
1105 break;
1106
1107 default:
1108 // use the default of 1.0 for:
1109 // 0: Unspecified Units
1110 // 3: miles
1111 // 7: kilometers
1112 // 15: decameters
1113 // 16: hectometers
1114 // 17: gigameters
1115 // 18: AU
1116 // 19: lightyears
1117 // 20: parsecs
1119 break;
1120 }
1121
1122 return;
1123 }
1124}

References ANGSTROMS, CENTIMETERS, DECIMETERS, DEFAULT, FEET, INCHES, m_codePage, m_currentUnit, m_importAnglePrecision, m_importCoordinatePrecision, METERS, MICROINCHES, MICRONS, MILLIMETERS, MILS, NANOMETERS, and YARDS.

◆ setVariableString()

void DXF_IMPORT_PLUGIN::setVariableString ( const std::string &  key,
const std::string &  value,
int  code 
)
overrideprivatevirtual

Called for every string variable in the DXF file (e.g.

"$ACADVER").

Definition at line 1127 of file dxf_import_plugin.cpp.

1129{
1130 // Called for every string variable in the DXF file (e.g. "$ACADVER").
1131}

◆ toDxfString()

wxString DXF_IMPORT_PLUGIN::toDxfString ( const wxString &  aStr)
staticprivate

Convert a native Unicode string into a DXF encoded string.

DXF encoding includes the following special sequences:

  • %%c for a diameter sign
  • %%d for a degree sign
  • %%p for a plus/minus sign

Definition at line 1134 of file dxf_import_plugin.cpp.

1135{
1136 wxString res;
1137 int j = 0;
1138
1139 for( unsigned i = 0; i<aStr.length(); ++i )
1140 {
1141 int c = aStr[i];
1142
1143 if( c > 175 || c < 11 )
1144 {
1145 res.append( aStr.Mid( j, i - j ) );
1146 j = i;
1147
1148 switch( c )
1149 {
1150 case 0x0A:
1151 res += wxT( "\\P" );
1152 break;
1153
1154 // diameter:
1155#ifdef _WIN32
1156 // windows, as always, is special.
1157 case 0x00D8:
1158#else
1159 case 0x2205:
1160#endif
1161 res += wxT( "%%C" );
1162 break;
1163
1164 // degree:
1165 case 0x00B0:
1166 res += wxT( "%%D" );
1167 break;
1168
1169 // plus/minus
1170 case 0x00B1:
1171 res += wxT( "%%P" );
1172 break;
1173
1174 default:
1175 j--;
1176 break;
1177 }
1178
1179 j++;
1180 }
1181 }
1182
1183 res.append( aStr.Mid( j ) );
1184 return res;
1185}
VECTOR3I res

References res.

◆ toNativeString()

wxString DXF_IMPORT_PLUGIN::toNativeString ( const wxString &  aData)
staticprivate

Convert a DXF encoded string into a native Unicode string.

Definition at line 1188 of file dxf_import_plugin.cpp.

1189{
1190 wxString res;
1191
1192 // Ignore font tags:
1193 int j = 0;
1194
1195 for( unsigned i = 0; i < aData.length(); ++i )
1196 {
1197 if( aData[ i ] == 0x7B ) // is '{' ?
1198 {
1199 if( aData[ i + 1 ] == 0x5c && aData[ i + 2 ] == 0x66 ) // is "\f" ?
1200 {
1201 // found font tag, append parsed part
1202 res.append( aData.Mid( j, i - j ) );
1203
1204 // skip to ';'
1205 for( unsigned k = i + 3; k < aData.length(); ++k )
1206 {
1207 if( aData[ k ] == 0x3B )
1208 {
1209 i = j = ++k;
1210 break;
1211 }
1212 }
1213
1214 // add to '}'
1215 for( unsigned k = i; k < aData.length(); ++k )
1216 {
1217 if( aData[ k ] == 0x7D )
1218 {
1219 res.append( aData.Mid( i, k - i ) );
1220 i = j = ++k;
1221 break;
1222 }
1223 }
1224 }
1225 }
1226 }
1227
1228 res.append( aData.Mid( j ) );
1229
1230#if 1
1231 wxRegEx regexp;
1232 // Line feed:
1233 regexp.Compile( wxT( "\\\\P" ) );
1234 regexp.Replace( &res, wxT( "\n" ) );
1235
1236 // Space:
1237 regexp.Compile( wxT( "\\\\~" ) );
1238 regexp.Replace( &res, wxT( " " ) );
1239
1240 // diameter:
1241 regexp.Compile( wxT( "%%[cC]" ) );
1242#ifdef __WINDOWS__
1243 // windows, as always, is special.
1244 regexp.Replace( &res, wxChar( 0xD8 ) );
1245#else
1246 // Empty_set, diameter is 0x2300
1247 regexp.Replace( &res, wxChar( 0x2205 ) );
1248#endif
1249
1250 // degree:
1251 regexp.Compile( wxT( "%%[dD]" ) );
1252 regexp.Replace( &res, wxChar( 0x00B0 ) );
1253 // plus/minus
1254 regexp.Compile( wxT( "%%[pP]" ) );
1255 regexp.Replace( &res, wxChar( 0x00B1 ) );
1256#endif
1257
1258 return res;
1259}

References res.

Referenced by addMText(), and addText().

◆ updateImageLimits()

void DXF_IMPORT_PLUGIN::updateImageLimits ( const VECTOR2D aPoint)

Definition at line 1498 of file dxf_import_plugin.cpp.

1499{
1500 m_minX = std::min( aPoint.x, m_minX );
1501 m_maxX = std::max( aPoint.x, m_maxX );
1502
1503 m_minY = std::min( aPoint.y, m_minY );
1504 m_maxY = std::max( aPoint.y, m_maxY );
1505}

References m_maxX, m_maxY, m_minX, m_minY, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by addArc(), addCircle(), addEllipse(), addLine(), addMText(), addPoint(), addText(), insertArc(), insertLine(), and insertSpline().

◆ wcsToOcs()

VECTOR3D DXF_IMPORT_PLUGIN::wcsToOcs ( const MATRIX3x3D arbitraryAxis,
VECTOR3D  point 
)
private

Converts a given world coordinate point to object coordinate using the given arbitrary axis vectors.

Definition at line 1532 of file dxf_import_plugin.cpp.

1533{
1534 return arbitraryAxis * point;
1535}

Referenced by ocsToWcs().

◆ writeLine()

void DXF_IMPORT_PLUGIN::writeLine ( )
private

◆ writeMtext()

void DXF_IMPORT_PLUGIN::writeMtext ( )
private

Member Data Documentation

◆ m_blocks

std::vector<std::unique_ptr<DXF_IMPORT_BLOCK> > DXF_IMPORT_PLUGIN::m_blocks
private

Definition at line 563 of file dxf_import_plugin.h.

Referenced by addBlock(), getImportBlock(), and Load().

◆ m_brdLayer

int DXF_IMPORT_PLUGIN::m_brdLayer
private

Definition at line 543 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), and SetBrdLayer().

◆ m_codePage

std::string DXF_IMPORT_PLUGIN::m_codePage
private

Definition at line 545 of file dxf_import_plugin.h.

Referenced by setVariableInt().

◆ m_curr_entity

DXF2BRD_ENTITY_DATA DXF_IMPORT_PLUGIN::m_curr_entity
private

◆ m_currentBlock

◆ m_currentUnit

DXF_IMPORT_UNITS DXF_IMPORT_PLUGIN::m_currentUnit
private

◆ m_defaultThickness

double DXF_IMPORT_PLUGIN::m_defaultThickness
private

◆ m_importAnglePrecision

int DXF_IMPORT_PLUGIN::m_importAnglePrecision
private

Definition at line 557 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), and setVariableInt().

◆ m_importAsFPShapes

bool DXF_IMPORT_PLUGIN::m_importAsFPShapes
private

Definition at line 546 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), and ImportAsFootprintGraphic().

◆ m_importCoordinatePrecision

int DXF_IMPORT_PLUGIN::m_importCoordinatePrecision
private

Definition at line 556 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), and setVariableInt().

◆ m_importer

GRAPHICS_IMPORTER* GRAPHICS_IMPORT_PLUGIN::m_importer
protectedinherited

< Importer used to create objects representing the imported shapes.

Definition at line 126 of file graphics_import_plugin.h.

Referenced by Import(), SVG_IMPORT_PLUGIN::Import(), SVG_IMPORT_PLUGIN::Load(), GRAPHICS_IMPORT_PLUGIN::SetImporter(), and SetImporter().

◆ m_internalImporter

GRAPHICS_IMPORTER_BUFFER DXF_IMPORT_PLUGIN::m_internalImporter
private

◆ m_layers

std::vector<std::unique_ptr<DXF_IMPORT_LAYER> > DXF_IMPORT_PLUGIN::m_layers
private

Definition at line 562 of file dxf_import_plugin.h.

Referenced by addLayer(), DXF_IMPORT_PLUGIN(), getImportLayer(), and Load().

◆ m_maxX

double DXF_IMPORT_PLUGIN::m_maxX
private

Definition at line 552 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), GetImageWidth(), and updateImageLimits().

◆ m_maxY

double DXF_IMPORT_PLUGIN::m_maxY
private

Definition at line 553 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), GetImageHeight(), and updateImageLimits().

◆ m_messages

wxString DXF_IMPORT_PLUGIN::m_messages
private

Definition at line 548 of file dxf_import_plugin.h.

Referenced by GetMessages(), and reportMsg().

◆ m_minX

double DXF_IMPORT_PLUGIN::m_minX
private

Definition at line 552 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), GetImageWidth(), and updateImageLimits().

◆ m_minY

double DXF_IMPORT_PLUGIN::m_minY
private

Definition at line 553 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), GetImageHeight(), and updateImageLimits().

◆ m_styles

std::vector<std::unique_ptr<DXF_IMPORT_STYLE> > DXF_IMPORT_PLUGIN::m_styles
private

Definition at line 564 of file dxf_import_plugin.h.

Referenced by addTextStyle(), getImportStyle(), and Load().

◆ m_version

int DXF_IMPORT_PLUGIN::m_version
private

Definition at line 544 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN().

◆ m_xOffset

double DXF_IMPORT_PLUGIN::m_xOffset
private

Definition at line 540 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), mapX(), and SetOffset().

◆ m_yOffset

double DXF_IMPORT_PLUGIN::m_yOffset
private

Definition at line 541 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), mapY(), and SetOffset().


The documentation for this class was generated from the following files: