LibrePCB Developers Documentation
dxfreader.h
Go to the documentation of this file.
1 /*
2  * LibrePCB - Professional EDA for everyone!
3  * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4  * https://librepcb.org/
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef LIBREPCB_DXFREADER_H
21 #define LIBREPCB_DXFREADER_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../geometry/path.h"
27 
28 #include <QtCore>
29 
30 /*******************************************************************************
31  * Namespace / Forward Declarations
32  ******************************************************************************/
33 namespace librepcb {
34 
35 class DxfReaderImpl;
36 class FilePath;
37 
38 /*******************************************************************************
39  * Class DxfReader
40  ******************************************************************************/
41 
60 class DxfReader {
61  Q_DECLARE_TR_FUNCTIONS(DxfReader)
62 
63 public:
64  struct Circle {
67  };
68 
69  // Constructors / Destructor
70 
74  DxfReader() noexcept;
75 
76  DxfReader(const DxfReader& other) = delete;
77 
81  virtual ~DxfReader() noexcept;
82 
83  // Setters
84 
92  void setScaleFactor(qreal scaleFactor) noexcept {
93  mScaleFactor = scaleFactor;
94  }
95 
96  // Getters
97 
103  const QList<Point>& getPoints() const noexcept { return mPoints; }
104 
110  const QList<Circle>& getCircles() const noexcept { return mCircles; }
111 
117  const QList<Path>& getPolygons() const noexcept { return mPolygons; }
118 
119  // General Methods
120 
128  void parse(const FilePath& dxfFile);
129 
130  // Operator Overloadings
131  DxfReader& operator=(const DxfReader& rhs) = delete;
132 
133 private:
135 
136  QList<Point> mPoints;
137  QList<Circle> mCircles;
138  QList<Path> mPolygons;
139 
144  friend class DxfReaderImpl;
145 };
146 
147 /*******************************************************************************
148  * End of File
149  ******************************************************************************/
150 
151 } // namespace librepcb
152 
153 #endif
void setScaleFactor(qreal scaleFactor) noexcept
Set a custom scale factor.
Definition: dxfreader.h:92
Definition: dxfreader.h:64
DxfReader() noexcept
Default constructor.
Definition: dxfreader.cpp:171
Definition: airwiresbuilder.cpp:32
const QList< Path > & getPolygons() const noexcept
Get all imported lines, arcs and polylines (converted to polygons)
Definition: dxfreader.h:117
DxfReader & operator=(const DxfReader &rhs)=delete
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
qreal mScaleFactor
Definition: dxfreader.h:134
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:127
QList< Circle > mCircles
Definition: dxfreader.h:137
Read DXF files into LibrePCB data structures.
Definition: dxfreader.h:60
QList< Point > mPoints
Definition: dxfreader.h:136
const QList< Point > & getPoints() const noexcept
Get all imported points.
Definition: dxfreader.h:103
QList< Path > mPolygons
Definition: dxfreader.h:138
Point position
Definition: dxfreader.h:65
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:792
void parse(const FilePath &dxfFile)
Parse a DXF file.
Definition: dxfreader.cpp:181
const QList< Circle > & getCircles() const noexcept
Get all imported circles.
Definition: dxfreader.h:110
Private helper class to break dependency to dxflib.
Definition: dxfreader.cpp:47
PositiveLength diameter
Definition: dxfreader.h:66