LibrePCB Developers Documentation
cmdadddevicetoboard.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_PROJECT_CMDADDDEVICETOBOARD_H
21 #define LIBREPCB_PROJECT_CMDADDDEVICETOBOARD_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
28 #include <librepcb/common/uuid.h>
29 
30 #include <QtCore>
31 
32 /*******************************************************************************
33  * Namespace / Forward Declarations
34  ******************************************************************************/
35 namespace librepcb {
36 
37 namespace workspace {
38 class Workspace;
39 }
40 
41 namespace library {
42 class Device;
43 }
44 
45 namespace project {
46 
47 class Board;
48 class ComponentInstance;
49 class BI_Device;
50 
51 namespace editor {
52 
53 /*******************************************************************************
54  * Class CmdAddDeviceToBoard
55  ******************************************************************************/
56 
60 class CmdAddDeviceToBoard final : public UndoCommandGroup {
61 public:
62  // Constructors / Destructor
64  ComponentInstance& cmpInstance, const Uuid& deviceUuid,
65  const tl::optional<Uuid>& footprintUuid,
66  const Point& position = Point(),
67  const Angle& rotation = Angle(),
68  bool mirror = false) noexcept;
69  ~CmdAddDeviceToBoard() noexcept;
70 
71  // Getters
72  BI_Device* getDeviceInstance() const noexcept { return mDeviceInstance; }
73 
74 private:
75  // Private Methods
76 
78  bool performExecute() override;
79 
80  // Private Member Variables
81 
82  // Attributes from the constructor
87  tl::optional<Uuid> mFootprintUuid;
90  bool mMirror;
91 
92  // child commands
94 };
95 
96 /*******************************************************************************
97  * End of File
98  ******************************************************************************/
99 
100 } // namespace editor
101 } // namespace project
102 } // namespace librepcb
103 
104 #endif // LIBREPCB_PROJECT_CMDADDDEVICETOBOARD_H
Angle mRotation
Definition: cmdadddevicetoboard.h:89
workspace::Workspace & mWorkspace
Definition: cmdadddevicetoboard.h:83
ComponentInstance & mComponentInstance
Definition: cmdadddevicetoboard.h:85
The Workspace class represents a workspace with all its data (library, projects, settings, ...)
Definition: workspace.h:62
BI_Device * mDeviceInstance
Definition: cmdadddevicetoboard.h:93
Definition: airwiresbuilder.cpp:32
Board & mBoard
Definition: cmdadddevicetoboard.h:84
The UndoCommandGroup class makes it possible to pack multiple undo commands together (it acts as a pa...
Definition: undocommandgroup.h:43
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
BI_Device * getDeviceInstance() const noexcept
Definition: cmdadddevicetoboard.h:72
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
Uuid mDeviceUuid
Definition: cmdadddevicetoboard.h:86
The CmdAddDeviceToBoard class.
Definition: cmdadddevicetoboard.h:60
The BI_Device class.
Definition: bi_device.h:62
Point mPosition
Definition: cmdadddevicetoboard.h:88
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:83
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The ComponentInstance class.
Definition: componentinstance.h:64
tl::optional< Uuid > mFootprintUuid
Definition: cmdadddevicetoboard.h:87
bool mMirror
Definition: cmdadddevicetoboard.h:90