LibrePCB Developers Documentation
stepexport.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_CORE_STEPEXPORT_H
21#define LIBREPCB_CORE_STEPEXPORT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <QtCore>
27
28#include <memory>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34
35class FilePath;
36class SceneData3D;
37
38/*******************************************************************************
39 * Class StepExport
40 ******************************************************************************/
41
45class StepExport final : public QObject {
46 Q_OBJECT
47
48public:
49 // Types
50 typedef std::tuple<qreal, qreal, qreal> Color;
51 typedef QMap<Color, QVector<QVector3D>> StepModel;
52
53 // Constructors / Destructor
54 StepExport(QObject* parent = nullptr) noexcept;
55 StepExport(const StepExport& other) = delete;
56 ~StepExport() noexcept;
57
58 // General Methods
59
63 void start(std::shared_ptr<SceneData3D> data, const FilePath& fp,
64 int finishDelayMs = 0) noexcept;
65
72 bool isBusy() const noexcept;
73
79 QString waitForFinished() noexcept;
80
84 void cancel() noexcept;
85
86 // Operator Overloadings
87 StepExport& operator=(const StepExport& rhs) = delete;
88
89signals:
90 void started();
91 void progressStatus(QString status);
92 void progressPercent(int percent);
93 void succeeded();
94 void failed(QString errorMsg);
95 void finished();
96
97private: // Methods
98 QString run(std::shared_ptr<SceneData3D> data, FilePath fp,
99 int finishDelayMs) noexcept;
100
101private: // Data
102 QFuture<QString> mFuture;
103 bool mAbort;
104};
105
106/*******************************************************************************
107 * End of File
108 ******************************************************************************/
109
110} // namespace librepcb
111
112#endif
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:129
3D scene data representing a board with package models
Definition: scenedata3d.h:53
Asynchronously generates an assembly STEP file of a PCB.
Definition: stepexport.h:45
void progressStatus(QString status)
void cancel() noexcept
Cancel the build.
Definition: stepexport.cpp:77
bool isBusy() const noexcept
Check if there is currently a build in progress.
Definition: stepexport.cpp:67
bool mAbort
Definition: stepexport.h:103
QFuture< QString > mFuture
Definition: stepexport.h:102
QMap< Color, QVector< QVector3D > > StepModel
Definition: stepexport.h:51
StepExport(QObject *parent=nullptr) noexcept
Definition: stepexport.cpp:45
QString run(std::shared_ptr< SceneData3D > data, FilePath fp, int finishDelayMs) noexcept
Definition: stepexport.cpp:87
void progressPercent(int percent)
void failed(QString errorMsg)
void start(std::shared_ptr< SceneData3D > data, const FilePath &fp, int finishDelayMs=0) noexcept
Start building scene asynchronously.
Definition: stepexport.cpp:57
QString waitForFinished() noexcept
Wait (block) until the build is finished.
Definition: stepexport.cpp:72
std::tuple< qreal, qreal, qreal > Color
Definition: stepexport.h:50
Definition: occmodel.cpp:77