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