LibrePCB Developers Documentation
cmdboardspecctraimport.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_EDITOR_CMDBOARDSPECCTRAIMPORT_H
21#define LIBREPCB_EDITOR_CMDBOARDSPECCTRAIMPORT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../undocommandgroup.h"
27
32#include <optional/tl/optional.hpp>
33
34#include <QtCore>
35
36#include <memory>
37
38/*******************************************************************************
39 * Namespace / Forward Declarations
40 ******************************************************************************/
41namespace librepcb {
42
43class Board;
44class Circuit;
45class Layer;
46class MessageLogger;
47class Project;
48class SExpression;
49
50namespace editor {
51
52/*******************************************************************************
53 * Class CmdBoardSpecctraImport
54 ******************************************************************************/
55
60public:
61 // Types
62 enum class Side { Front, Back };
63
64 struct ComponentOut {
65 QString name;
69 };
70
71 struct PadStackOut {
75 };
76
77 struct ViaOut {
78 QString padStackId;
80 };
81
82 struct WireOut {
83 const Layer* layer;
86 };
87
88 struct NetOut {
89 QString netName;
90 QList<ViaOut> vias;
91 QList<WireOut> wires;
92 };
93
94 // Constructors / Destructor
95 explicit CmdBoardSpecctraImport(Board& board, const SExpression& root,
96 std::shared_ptr<MessageLogger> logger);
97 ~CmdBoardSpecctraImport() noexcept;
98
99private: // Methods
101 bool performExecute() override;
102
103 static tl::optional<PositiveLength> extractViaDrillDiameter(
104 const QString& padStackId) noexcept;
105 static tl::optional<MaskConfig> extractViaExposureConfig(
106 const QString& padStackId) noexcept;
107
111 std::shared_ptr<MessageLogger> mLogger;
112 tl::optional<QList<ComponentOut>> mComponents;
113 QHash<QString, PadStackOut> mPadStacks;
114 QList<NetOut> mNets;
115};
116
117/*******************************************************************************
118 * End of File
119 ******************************************************************************/
120
121} // namespace editor
122} // namespace librepcb
123
124#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:73
The Circuit class represents all electrical connections in a project (drawn in the schematics)
Definition: circuit.h:70
The Layer class provides all supported geometry layers.
Definition: layer.h:42
The Length class is used to represent a length (for example 12.75 millimeters)
Definition: length.h:83
The MaskConfig class defines how to add automatic stop mask or solder paste.
Definition: maskconfig.h:45
Generic logger class to pass messages between objects.
Definition: messagelogger.h:43
The Path class represents a list of vertices connected by straight lines or circular arc segments.
Definition: path.h:58
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The Project class represents a whole (opened) project with all its content.
Definition: project.h:71
The SExpression class.
Definition: sexpression.h:69
Undo command to import a Specctra session (SES)
Definition: cmdboardspecctraimport.h:59
CmdBoardSpecctraImport(Board &board, const SExpression &root, std::shared_ptr< MessageLogger > logger)
Definition: cmdboardspecctraimport.cpp:112
QList< NetOut > mNets
Definition: cmdboardspecctraimport.h:114
static tl::optional< MaskConfig > extractViaExposureConfig(const QString &padStackId) noexcept
Definition: cmdboardspecctraimport.cpp:720
Circuit & mCircuit
Definition: cmdboardspecctraimport.h:109
Board & mBoard
Definition: cmdboardspecctraimport.h:110
Side
Definition: cmdboardspecctraimport.h:62
Project & mProject
Definition: cmdboardspecctraimport.h:108
std::shared_ptr< MessageLogger > mLogger
Definition: cmdboardspecctraimport.h:111
~CmdBoardSpecctraImport() noexcept
Definition: cmdboardspecctraimport.cpp:269
static tl::optional< PositiveLength > extractViaDrillDiameter(const QString &padStackId) noexcept
Definition: cmdboardspecctraimport.cpp:706
bool performExecute() override
Execute the command the first time.
Definition: cmdboardspecctraimport.cpp:276
QHash< QString, PadStackOut > mPadStacks
Definition: cmdboardspecctraimport.h:113
tl::optional< QList< ComponentOut > > mComponents
Definition: cmdboardspecctraimport.h:112
The UndoCommandGroup class makes it possible to pack multiple undo commands together (it acts as a pa...
Definition: undocommandgroup.h:44
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
Definition: uuid.h:183
Definition: cmdboardspecctraimport.h:64
Side side
Definition: cmdboardspecctraimport.h:67
QString name
Definition: cmdboardspecctraimport.h:65
Point pos
Definition: cmdboardspecctraimport.h:66
Angle rot
Definition: cmdboardspecctraimport.h:68
Definition: cmdboardspecctraimport.h:88
QString netName
Definition: cmdboardspecctraimport.h:89
QList< ViaOut > vias
Definition: cmdboardspecctraimport.h:90
QList< WireOut > wires
Definition: cmdboardspecctraimport.h:91
Definition: cmdboardspecctraimport.h:71
const Layer * endLayer
Definition: cmdboardspecctraimport.h:73
const Layer * startLayer
Definition: cmdboardspecctraimport.h:72
Length diameter
Definition: cmdboardspecctraimport.h:74
Definition: cmdboardspecctraimport.h:77
Point pos
Definition: cmdboardspecctraimport.h:79
QString padStackId
Definition: cmdboardspecctraimport.h:78
Definition: cmdboardspecctraimport.h:82
Length width
Definition: cmdboardspecctraimport.h:84
Path path
Definition: cmdboardspecctraimport.h:85
const Layer * layer
Definition: cmdboardspecctraimport.h:83