LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
footprintclipboarddata.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_LIBRARY_EDITOR_FOOTPRINTCLIPBOARDDATA_H
21 #define LIBREPCB_LIBRARY_EDITOR_FOOTPRINTCLIPBOARDDATA_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 
34 
35 #include <QtCore>
36 #include <QtWidgets>
37 
38 #include <memory>
39 
40 /*******************************************************************************
41  * Namespace / Forward Declarations
42  ******************************************************************************/
43 namespace librepcb {
44 
45 class IF_GraphicsLayerProvider;
46 
47 namespace library {
48 namespace editor {
49 
50 /*******************************************************************************
51  * Class FootprintClipboardData
52  ******************************************************************************/
53 
58 public:
59  // Constructors / Destructor
60  FootprintClipboardData() = delete;
61  FootprintClipboardData(const FootprintClipboardData& other) = delete;
62  FootprintClipboardData(const Uuid& footprintUuid,
63  const PackagePadList& packagePads,
64  const Point& cursorPos) noexcept;
65  explicit FootprintClipboardData(const SExpression& node);
66  ~FootprintClipboardData() noexcept;
67 
68  // Getters
69  bool getItemCount() const noexcept {
72  }
73  const Uuid& getFootprintUuid() const noexcept { return mFootprintUuid; }
74  const Point& getCursorPos() const noexcept { return mCursorPos; }
75  PackagePadList& getPackagePads() noexcept { return mPackagePads; }
76  const PackagePadList& getPackagePads() const noexcept { return mPackagePads; }
78  const FootprintPadList& getFootprintPads() const noexcept {
79  return mFootprintPads;
80  }
81  PolygonList& getPolygons() noexcept { return mPolygons; }
82  const PolygonList& getPolygons() const noexcept { return mPolygons; }
83  CircleList& getCircles() noexcept { return mCircles; }
84  const CircleList& getCircles() const noexcept { return mCircles; }
85  StrokeTextList& getStrokeTexts() noexcept { return mStrokeTexts; }
86  const StrokeTextList& getStrokeTexts() const noexcept { return mStrokeTexts; }
87  HoleList& getHoles() noexcept { return mHoles; }
88  const HoleList& getHoles() const noexcept { return mHoles; }
89 
90  // General Methods
91  std::unique_ptr<QMimeData> toMimeData(const IF_GraphicsLayerProvider& lp);
92  static std::unique_ptr<FootprintClipboardData> fromMimeData(
93  const QMimeData* mime);
94 
95  // Operator Overloadings
97 
98 private: // Methods
100  void serialize(SExpression& root) const override;
101 
102  QPixmap generatePixmap(const IF_GraphicsLayerProvider& lp) noexcept;
103  static QString getMimeType() noexcept;
104 
105 private: // Data
114 };
115 
116 /*******************************************************************************
117  * End of File
118  ******************************************************************************/
119 
120 } // namespace editor
121 } // namespace library
122 } // namespace librepcb
123 
124 #endif // LIBREPCB_LIBRARY_EDITOR_FOOTPRINTCLIPBOARDDATA_H
~FootprintClipboardData() noexcept
Definition: footprintclipboarddata.cpp:66
const StrokeTextList & getStrokeTexts() const noexcept
Definition: footprintclipboarddata.h:86
int count() const noexcept
Definition: serializableobjectlist.h:184
FootprintPadList & getFootprintPads() noexcept
Definition: footprintclipboarddata.h:77
FootprintPadList mFootprintPads
Definition: footprintclipboarddata.h:109
StrokeTextList mStrokeTexts
Definition: footprintclipboarddata.h:112
PackagePadList & getPackagePads() noexcept
Definition: footprintclipboarddata.h:75
const PackagePadList & getPackagePads() const noexcept
Definition: footprintclipboarddata.h:76
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers...
Definition: graphicslayer.h:227
Uuid mFootprintUuid
Definition: footprintclipboarddata.h:106
const CircleList & getCircles() const noexcept
Definition: footprintclipboarddata.h:84
const Point & getCursorPos() const noexcept
Definition: footprintclipboarddata.h:74
The SerializableObject class is the base class for all classes which need to be serializable/deserial...
Definition: serializableobject.h:43
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
StrokeTextList & getStrokeTexts() noexcept
Definition: footprintclipboarddata.h:85
HoleList mHoles
Definition: footprintclipboarddata.h:113
PolygonList & getPolygons() noexcept
Definition: footprintclipboarddata.h:81
bool getItemCount() const noexcept
Definition: footprintclipboarddata.h:69
PackagePadList mPackagePads
Definition: footprintclipboarddata.h:107
const FootprintPadList & getFootprintPads() const noexcept
Definition: footprintclipboarddata.h:78
QPixmap generatePixmap(const IF_GraphicsLayerProvider &lp) noexcept
Definition: footprintclipboarddata.cpp:112
HoleList & getHoles() noexcept
Definition: footprintclipboarddata.h:87
const PolygonList & getPolygons() const noexcept
Definition: footprintclipboarddata.h:82
The FootprintClipboardData class.
Definition: footprintclipboarddata.h:57
CircleList & getCircles() noexcept
Definition: footprintclipboarddata.h:83
void serialize(SExpression &root) const override
Serialize the object into an existing S-Expression node.
Definition: footprintclipboarddata.cpp:100
const HoleList & getHoles() const noexcept
Definition: footprintclipboarddata.h:88
const Uuid & getFootprintUuid() const noexcept
Definition: footprintclipboarddata.h:73
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
FootprintClipboardData & operator=(const FootprintClipboardData &rhs)=delete
static std::unique_ptr< FootprintClipboardData > fromMimeData(const QMimeData *mime)
Definition: footprintclipboarddata.cpp:84
PolygonList mPolygons
Definition: footprintclipboarddata.h:110
static QString getMimeType() noexcept
Definition: footprintclipboarddata.cpp:137
CircleList mCircles
Definition: footprintclipboarddata.h:111
The SExpression class.
Definition: sexpression.h:57
Point mCursorPos
Definition: footprintclipboarddata.h:108
std::unique_ptr< QMimeData > toMimeData(const IF_GraphicsLayerProvider &lp)
Definition: footprintclipboarddata.cpp:73