LibrePCB Developers Documentation
Loading...
Searching...
No Matches
realisticboardpainter.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_REALISTICBOARDPAINTER_H
21#define LIBREPCB_CORE_REALISTICBOARDPAINTER_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../export/graphicsexport.h"
27
28#include <polyclipping/clipper.hpp>
29
30#include <QtCore>
31#include <QtGui>
32
33#include <memory>
34#include <optional>
35
36/*******************************************************************************
37 * Namespace / Forward Declarations
38 ******************************************************************************/
39namespace librepcb {
40
41class SceneData3D;
42
43/*******************************************************************************
44 * Class RealisticBoardPainter
45 ******************************************************************************/
46
65public:
66 // Constructors / Destructor
68 explicit RealisticBoardPainter(std::shared_ptr<SceneData3D> data);
70 ~RealisticBoardPainter() noexcept;
71
72 // General Methods
73 void paint(QPainter& painter,
74 const GraphicsExportSettings& settings) const noexcept override;
75
76 // Operator Overloadings
77 RealisticBoardPainter& operator=(const RealisticBoardPainter& rhs) = delete;
78
79private: // Methods
80 QVector<std::pair<QColor, QPainterPath>> getContent(
81 const GraphicsExportSettings& settings) const noexcept;
82
83private: // Data
85 std::shared_ptr<SceneData3D> mData;
86
87 mutable QMutex mMutex;
88 mutable bool mDataPreprocessed;
89 mutable std::optional<ClipperLib::Paths> mCachedHoles;
90 mutable std::optional<ClipperLib::Paths> mCachedCopperHoles;
91 mutable std::optional<ClipperLib::Paths> mCachedBoardOutlines;
92 mutable std::optional<ClipperLib::Paths> mCachedBoardArea;
93 mutable std::optional<ClipperLib::Paths> mCachedSolderResistTop;
94 mutable std::optional<ClipperLib::Paths> mCachedSolderResistBot;
95 mutable QHash<QString, QPainterPath> mCachedContentPerLayer;
96};
97
98/*******************************************************************************
99 * End of File
100 ******************************************************************************/
101
102} // namespace librepcb
103
104#endif
Settings for librepcb::GraphicsExport.
Definition graphicsexportsettings.h:51
Base class for printing a page for librepcb::GraphicsExport.
Definition graphicsexport.h:56
Paints a librepcb::Board in realistic mode to a QPainter.
Definition realisticboardpainter.h:64
QMutex mMutex
Definition realisticboardpainter.h:87
QHash< QString, QPainterPath > mCachedContentPerLayer
Definition realisticboardpainter.h:95
RealisticBoardPainter(const RealisticBoardPainter &other)=delete
std::optional< ClipperLib::Paths > mCachedSolderResistTop
Definition realisticboardpainter.h:93
~RealisticBoardPainter() noexcept
Definition realisticboardpainter.cpp:51
std::optional< ClipperLib::Paths > mCachedBoardOutlines
Definition realisticboardpainter.h:91
QVector< std::pair< QColor, QPainterPath > > getContent(const GraphicsExportSettings &settings) const noexcept
Definition realisticboardpainter.cpp:73
std::optional< ClipperLib::Paths > mCachedCopperHoles
Definition realisticboardpainter.h:90
std::shared_ptr< SceneData3D > mData
Definition realisticboardpainter.h:85
std::optional< ClipperLib::Paths > mCachedSolderResistBot
Definition realisticboardpainter.h:94
void paint(QPainter &painter, const GraphicsExportSettings &settings) const noexcept override
Draw page content on a QPainter.
Definition realisticboardpainter.cpp:58
bool mDataPreprocessed
Definition realisticboardpainter.h:88
const PositiveLength mMaxArcTolerance
Definition realisticboardpainter.h:84
std::optional< ClipperLib::Paths > mCachedBoardArea
Definition realisticboardpainter.h:92
std::optional< ClipperLib::Paths > mCachedHoles
Definition realisticboardpainter.h:89
3D scene data representing a board with package models
Definition scenedata3d.h:52
Definition occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
Definition uuid.h:186