LibrePCB Developers Documentation
boardspecctraexport.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_BOARDSPECCTRAEXPORT_H
21#define LIBREPCB_CORE_BOARDSPECCTRAEXPORT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../types/point.h"
27
28#include <QtCore>
29
30#include <map>
31#include <memory>
32#include <vector>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38
39class BI_Device;
40class BI_FootprintPad;
41class BI_NetSegment;
42class BI_Via;
43class Board;
44class Hole;
45class Layer;
46class Path;
47class Point;
48class SExpression;
49
50/*******************************************************************************
51 * Class BoardSpecctraExport
52 ******************************************************************************/
53
57class BoardSpecctraExport final : public QObject {
58 Q_OBJECT
59
60public:
61 // Constructors / Destructor
64 explicit BoardSpecctraExport(const Board& board) noexcept;
65 ~BoardSpecctraExport() noexcept;
66
67 // General Methods
68 QByteArray generate() const;
69
70 // Operator Overloadings
71 BoardSpecctraExport& operator=(const BoardSpecctraExport& rhs) = delete;
72
73private:
74 std::unique_ptr<SExpression> genParser() const;
75 std::unique_ptr<SExpression> genResolution() const;
76 std::unique_ptr<SExpression> genStructure(
77 std::vector<std::unique_ptr<SExpression>>& viaPadStacks) const;
78 std::unique_ptr<SExpression> genStructureRule() const;
79 std::unique_ptr<SExpression> genPlacement() const;
80 std::unique_ptr<SExpression> genLibrary(
81 std::vector<std::unique_ptr<SExpression>>& fptPadStacks,
82 std::vector<std::unique_ptr<SExpression>>& viaPadStacks) const;
83 std::unique_ptr<SExpression> genLibraryImage(
84 const BI_Device& dev,
85 std::vector<std::unique_ptr<SExpression>>& fptPadStacks) const;
86 std::unique_ptr<SExpression> genLibraryPadStack(
87 const BI_FootprintPad& pad) const;
88 std::unique_ptr<SExpression> genNetwork() const;
89 std::unique_ptr<SExpression> genWiring() const;
90 std::unique_ptr<SExpression> genWiringPadStack(const BI_Via& via) const;
91 QString getWiringPadStackId(const BI_Via& via) const;
92
93 template <typename THole>
94 std::unique_ptr<SExpression> toKeepout(const QString& id,
95 const THole& hole) const;
96 std::unique_ptr<SExpression> toKeepout(
97 const QString& id, const Path& path,
98 const QSet<const Layer*>& layers) const;
99 std::unique_ptr<SExpression> toPolygon(const QString& layer,
100 const UnsignedLength& width,
101 const Path& path,
102 bool multiline) const;
103 std::unique_ptr<SExpression> toPath(const QString& layer,
104 const UnsignedLength& width,
105 const Path& path, bool multiline) const;
106 std::unique_ptr<SExpression> toCircle(const QString& layer,
107 const PositiveLength& diameter,
108 const Point& pos = Point()) const;
109 std::unique_ptr<SExpression> toToken(const Length& length) const;
110 static QString getNetName(const BI_NetSegment& ns) noexcept;
111 static std::size_t addToPadStacks(
112 std::vector<std::unique_ptr<SExpression>>& padStacks,
113 std::unique_ptr<SExpression> padStack);
114
118 static PositiveLength maxArcTolerance() noexcept {
119 return PositiveLength(5000);
120 }
121
122 // Private Member Variables
123 const Board& mBoard;
124};
125
126/*******************************************************************************
127 * End of File
128 ******************************************************************************/
129
130} // namespace librepcb
131
132#endif
The BI_Device class.
Definition: bi_device.h:57
The BI_FootprintPad class.
Definition: bi_footprintpad.h:48
The BI_NetSegment class.
Definition: bi_netsegment.h:52
The BI_Via class.
Definition: bi_via.h:44
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:73
Specctra DSN Export.
Definition: boardspecctraexport.h:57
std::unique_ptr< SExpression > genPlacement() const
Definition: boardspecctraexport.cpp:260
BoardSpecctraExport(const BoardSpecctraExport &other)=delete
std::unique_ptr< SExpression > genLibraryImage(const BI_Device &dev, std::vector< std::unique_ptr< SExpression > > &fptPadStacks) const
Definition: boardspecctraexport.cpp:311
std::unique_ptr< SExpression > genWiring() const
Definition: boardspecctraexport.cpp:521
const Board & mBoard
Definition: boardspecctraexport.h:123
std::unique_ptr< SExpression > genLibraryPadStack(const BI_FootprintPad &pad) const
Definition: boardspecctraexport.cpp:380
std::unique_ptr< SExpression > genNetwork() const
Definition: boardspecctraexport.cpp:488
std::unique_ptr< SExpression > genStructureRule() const
Definition: boardspecctraexport.cpp:235
std::unique_ptr< SExpression > toPolygon(const QString &layer, const UnsignedLength &width, const Path &path, bool multiline) const
Definition: boardspecctraexport.cpp:658
std::unique_ptr< SExpression > toKeepout(const QString &id, const THole &hole) const
Definition: boardspecctraexport.cpp:605
std::unique_ptr< SExpression > genParser() const
Definition: boardspecctraexport.cpp:130
std::unique_ptr< SExpression > toCircle(const QString &layer, const PositiveLength &diameter, const Point &pos=Point()) const
Definition: boardspecctraexport.cpp:682
static std::size_t addToPadStacks(std::vector< std::unique_ptr< SExpression > > &padStacks, std::unique_ptr< SExpression > padStack)
Definition: boardspecctraexport.cpp:709
QByteArray generate() const
Definition: boardspecctraexport.cpp:75
static PositiveLength maxArcTolerance() noexcept
Definition: boardspecctraexport.h:118
std::unique_ptr< SExpression > genWiringPadStack(const BI_Via &via) const
Definition: boardspecctraexport.cpp:552
std::unique_ptr< SExpression > toToken(const Length &length) const
Definition: boardspecctraexport.cpp:695
std::unique_ptr< SExpression > genStructure(std::vector< std::unique_ptr< SExpression > > &viaPadStacks) const
Definition: boardspecctraexport.cpp:151
std::unique_ptr< SExpression > toPath(const QString &layer, const UnsignedLength &width, const Path &path, bool multiline) const
Definition: boardspecctraexport.cpp:666
~BoardSpecctraExport() noexcept
Definition: boardspecctraexport.cpp:68
std::unique_ptr< SExpression > genResolution() const
Definition: boardspecctraexport.cpp:144
static QString getNetName(const BI_NetSegment &ns) noexcept
Definition: boardspecctraexport.cpp:700
std::unique_ptr< SExpression > genLibrary(std::vector< std::unique_ptr< SExpression > > &fptPadStacks, std::vector< std::unique_ptr< SExpression > > &viaPadStacks) const
Definition: boardspecctraexport.cpp:286
QString getWiringPadStackId(const BI_Via &via) const
Definition: boardspecctraexport.cpp:573
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 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 SExpression class.
Definition: sexpression.h:69
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696