LibrePCB Developers Documentation
DxfReader Class Reference

Read DXF files into LibrePCB data structures. More...

#include <dxfreader.h>

+ Collaboration diagram for DxfReader:

Classes

struct  Circle
 

Public Member Functions

 DxfReader () noexcept
 Default constructor. More...
 
 DxfReader (const DxfReader &other)=delete
 
virtual ~DxfReader () noexcept
 Destructor. More...
 
void setScaleFactor (qreal scaleFactor) noexcept
 Set a custom scale factor. More...
 
const QList< Point > & getPoints () const noexcept
 Get all imported points. More...
 
const QList< Circle > & getCircles () const noexcept
 Get all imported circles. More...
 
const QList< Path > & getPolygons () const noexcept
 Get all imported lines, arcs and polylines (converted to polygons) More...
 
void parse (const FilePath &dxfFile)
 Parse a DXF file. More...
 
DxfReaderoperator= (const DxfReader &rhs)=delete
 

Private Attributes

qreal mScaleFactor
 
QList< PointmPoints
 
QList< CirclemCircles
 
QList< PathmPolygons
 

Friends

class DxfReaderImpl
 

Detailed Description

Read DXF files into LibrePCB data structures.

Basically this is a wrapper around the third-party library "dxflib" to read DXF files and return the DXF objects as LibrePCB data structures. See documentation of dxflib about the exact capabilities of the reader itself.

Our wrapper currently supports the following data structures:

  • Points
  • Circles
  • Lines (converted to polygons)
  • Arcs (converted to polygons)
  • Polylines (containing straight segments and arc segments)

Note that this class tries to read and apply the length unit defined in the DXF file. However, a DXF file is not required to specify the unit. If it is missing, the unit millimeters is assumed.

Constructor & Destructor Documentation

◆ DxfReader() [1/2]

DxfReader ( )
noexcept

Default constructor.

◆ DxfReader() [2/2]

DxfReader ( const DxfReader other)
delete

◆ ~DxfReader()

~DxfReader ( )
virtualnoexcept

Destructor.

Member Function Documentation

◆ setScaleFactor()

void setScaleFactor ( qreal  scaleFactor)
inlinenoexcept

Set a custom scale factor.

All imported objects will be scaled with this factor (default is 1.0).

Parameters
scaleFactorScale factor.
+ Here is the caller graph for this function:

◆ getPoints()

const QList< Point > & getPoints ( ) const
inlinenoexcept

Get all imported points.

Returns
List of point objects

◆ getCircles()

const QList< Circle > & getCircles ( ) const
inlinenoexcept

Get all imported circles.

Returns
List of circle objects

◆ getPolygons()

const QList< Path > & getPolygons ( ) const
inlinenoexcept

Get all imported lines, arcs and polylines (converted to polygons)

Returns
List of polygons

◆ parse()

void parse ( const FilePath dxfFile)

Parse a DXF file.

Parameters
dxfFileFile path to the DXF to import.
Exceptions
Exceptionif anything went wrong (e.g. file does not exist).
+ Here is the call graph for this function:

◆ operator=()

DxfReader & operator= ( const DxfReader rhs)
delete

Friends And Related Function Documentation

◆ DxfReaderImpl

friend class DxfReaderImpl
friend

The actual implementation is in the *.cpp file and should have access to this class members.

Member Data Documentation

◆ mScaleFactor

qreal mScaleFactor
private

◆ mPoints

QList<Point> mPoints
private

◆ mCircles

QList<Circle> mCircles
private

◆ mPolygons

QList<Path> mPolygons
private

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