LibrePCB Developers Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
interactivehtmlbom.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_INTERACTIVEHTMLBOM_H
21#define LIBREPCB_CORE_INTERACTIVEHTMLBOM_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../geometry/padgeometry.h"
27#include "../geometry/padhole.h"
28#include "../geometry/path.h"
29#include "../utils/rusthandle.h"
30
31#include <QtCore>
32
33#include <optional>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39
40class FilePath;
41
42namespace rs {
44}
45
46/*******************************************************************************
47 * Class InteractiveHtmlBom
48 ******************************************************************************/
49
55class InteractiveHtmlBom final {
56public:
59 enum class Layer { Top, Bottom };
60 enum class Sides { Top, Bottom, Both };
69 struct Pad {
70 bool onTop;
75 QList<PadGeometry> geometries;
77 std::optional<QString> netName;
78 bool pin1;
79 };
80
82 InteractiveHtmlBom(const InteractiveHtmlBom& other) = delete;
84
95 InteractiveHtmlBom(const QString& title, const QString& company,
96 const QString& revision, const QString& date,
97 const Point& topLeft, const Point& bottomRight);
98
106 void setViewConfig(ViewMode mode, HighlightPin1Mode highlightPin1,
107 bool dark) noexcept;
108
115 void setBoardRotation(const Angle& angle, bool offsetBack) noexcept;
116
122 void setShowSilkscreen(bool show) noexcept;
123
129 void setShowFabrication(bool show) noexcept;
130
136 void setShowPads(bool show) noexcept;
137
143 void setCheckBoxes(const QStringList& names) noexcept;
144
150 void setFields(const QStringList& fields) noexcept;
151
161 void addDrawing(DrawingKind kind, DrawingLayer layer, const Path& path,
162 const UnsignedLength& width, bool filled) noexcept;
163
173 void addTrack(Layer layer, const Point& start, const Point& end,
174 const PositiveLength& width,
175 const std::optional<QString>& netName) noexcept;
176
186 void addVia(QSet<Layer> layers, const Point& pos,
187 const PositiveLength& diameter,
188 const PositiveLength& drillDiameter,
189 const std::optional<QString>& netName) noexcept;
190
198 void addPlaneFragment(Layer layer, const Path& outline,
199 const std::optional<QString>& netName) noexcept;
200
214 std::size_t addFootprint(Layer layer, const Point& pos, const Angle& rot,
215 const Point& topLeft, const Point& bottomRight,
216 bool mount, const QStringList& fields,
217 const QList<Pad>& pads) noexcept;
218
225 void addBomRow(Sides sides,
226 const QList<std::pair<QString, std::size_t>>& parts) noexcept;
227
235 QString generateHtml() const;
236
237private:
239};
240
241/*******************************************************************************
242 * End of File
243 ******************************************************************************/
244
245} // namespace librepcb
246
247#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
Zip file reader.
Definition interactivehtmlbom.h:55
void addTrack(Layer layer, const Point &start, const Point &end, const PositiveLength &width, const std::optional< QString > &netName) noexcept
Add a track.
Definition interactivehtmlbom.cpp:198
void setFields(const QStringList &fields) noexcept
Set the fields of BOM lines.
Definition interactivehtmlbom.cpp:166
void setShowSilkscreen(bool show) noexcept
Set silkscreen visibility.
Definition interactivehtmlbom.cpp:150
InteractiveHtmlBom(const InteractiveHtmlBom &other)=delete
void setViewConfig(ViewMode mode, HighlightPin1Mode highlightPin1, bool dark) noexcept
Set view configuration.
Definition interactivehtmlbom.cpp:124
ViewMode
Definition interactivehtmlbom.h:57
std::size_t addFootprint(Layer layer, const Point &pos, const Angle &rot, const Point &topLeft, const Point &bottomRight, bool mount, const QStringList &fields, const QList< Pad > &pads) noexcept
Add footprint.
Definition interactivehtmlbom.cpp:243
void setCheckBoxes(const QStringList &names) noexcept
Set the BOM checkbox columns.
Definition interactivehtmlbom.cpp:162
HighlightPin1Mode
Definition interactivehtmlbom.h:58
void addPlaneFragment(Layer layer, const Path &outline, const std::optional< QString > &netName) noexcept
Add plane fragment.
Definition interactivehtmlbom.cpp:231
QString generateHtml() const
Generate the HTML.
Definition interactivehtmlbom.cpp:340
RustHandle< rs::InteractiveHtmlBom > mHandle
Definition interactivehtmlbom.h:238
void setBoardRotation(const Angle &angle, bool offsetBack) noexcept
Set board rotation.
Definition interactivehtmlbom.cpp:145
Layer
Definition interactivehtmlbom.h:59
Sides
Definition interactivehtmlbom.h:60
void setShowFabrication(bool show) noexcept
Set fabrication visibility.
Definition interactivehtmlbom.cpp:154
void addDrawing(DrawingKind kind, DrawingLayer layer, const Path &path, const UnsignedLength &width, bool filled) noexcept
Add a PCB drawing.
Definition interactivehtmlbom.cpp:170
void addBomRow(Sides sides, const QList< std::pair< QString, std::size_t > > &parts) noexcept
Add a BOM row.
Definition interactivehtmlbom.cpp:324
InteractiveHtmlBom & operator=(const InteractiveHtmlBom &rhs)=delete
DrawingLayer
Definition interactivehtmlbom.h:62
void addVia(QSet< Layer > layers, const Point &pos, const PositiveLength &diameter, const PositiveLength &drillDiameter, const std::optional< QString > &netName) noexcept
Add via.
Definition interactivehtmlbom.cpp:212
DrawingKind
Definition interactivehtmlbom.h:61
void setShowPads(bool show) noexcept
Set pads visibility.
Definition interactivehtmlbom.cpp:158
The Path class represents a list of vertices connected by straight lines or circular arc segments.
Definition path.h:57
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
Definition occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694
Definition interactivehtmlbom.h:69
QList< PadGeometry > geometries
Definition interactivehtmlbom.h:75
bool onBottom
Definition interactivehtmlbom.h:71
PadHoleList holes
Definition interactivehtmlbom.h:76
Angle rotation
Definition interactivehtmlbom.h:73
std::optional< QString > netName
Definition interactivehtmlbom.h:77
bool onTop
Definition interactivehtmlbom.h:70
bool mirrorGeometry
Definition interactivehtmlbom.h:74
Point position
Definition interactivehtmlbom.h:72
bool pin1
Definition interactivehtmlbom.h:78
Scoped pointer for Rust objects.
Definition rusthandle.h:41