LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cmdholeedit.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_CMDHOLEEDIT_H
21 #define LIBREPCB_CMDHOLEEDIT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../../undocommand.h"
27 #include "../../units/all_length_units.h"
28 
29 #include <QtCore>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 class Hole;
37 
38 /*******************************************************************************
39  * Class CmdHoleEdit
40  ******************************************************************************/
41 
45 class CmdHoleEdit final : public UndoCommand {
46 public:
47  // Constructors / Destructor
48  CmdHoleEdit() = delete;
49  CmdHoleEdit(const CmdHoleEdit& other) = delete;
50  explicit CmdHoleEdit(Hole& hole) noexcept;
51  ~CmdHoleEdit() noexcept;
52 
53  // Setters
54  void setPosition(const Point& pos, bool immediate) noexcept;
55  void translate(const Point& deltaPos, bool immediate) noexcept;
56  void rotate(const Angle& angle, const Point& center, bool immediate) noexcept;
57  void setDiameter(const PositiveLength& diameter, bool immediate) noexcept;
58 
59  // Operator Overloadings
60  CmdHoleEdit& operator=(const CmdHoleEdit& rhs) = delete;
61 
62 private:
63  // Private Methods
64 
66  bool performExecute() override;
67 
69  void performUndo() override;
70 
72  void performRedo() override;
73 
74  // Private Member Variables
75 
76  // Attributes from the constructor
78 
79  // General Attributes
84 };
85 
86 /*******************************************************************************
87  * End of File
88  ******************************************************************************/
89 
90 } // namespace librepcb
91 
92 #endif // LIBREPCB_CMDHOLEEDIT_H
Hole & mHole
Definition: cmdholeedit.h:77
PositiveLength mNewDiameter
Definition: cmdholeedit.h:83
The Hole class.
Definition: hole.h:46
void translate(const Point &deltaPos, bool immediate) noexcept
Definition: cmdholeedit.cpp:63
PositiveLength mOldDiameter
Definition: cmdholeedit.h:82
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
void performUndo() override
Undo the command.
Definition: cmdholeedit.cpp:95
Point mNewPosition
Definition: cmdholeedit.h:81
void performRedo() override
Redo the command.
Definition: cmdholeedit.cpp:100
The UndoCommand class represents a command which you can undo/redo.
Definition: undocommand.h:47
void rotate(const Angle &angle, const Point &center, bool immediate) noexcept
Definition: cmdholeedit.cpp:69
The CmdHoleEdit class.
Definition: cmdholeedit.h:45
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:780
bool performExecute() override
Execute the command the first time.
Definition: cmdholeedit.cpp:87
~CmdHoleEdit() noexcept
Definition: cmdholeedit.cpp:47
void setDiameter(const PositiveLength &diameter, bool immediate) noexcept
Definition: cmdholeedit.cpp:76
void setPosition(const Point &pos, bool immediate) noexcept
Definition: cmdholeedit.cpp:57
Point mOldPosition
Definition: cmdholeedit.h:80
CmdHoleEdit & operator=(const CmdHoleEdit &rhs)=delete