LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cmdcircleedit.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_CMDCIRCLEEDIT_H
21 #define LIBREPCB_CMDCIRCLEEDIT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../../undocommand.h"
27 #include "../circle.h"
28 
29 #include <QtCore>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 /*******************************************************************************
37  * Class CmdCircleEdit
38  ******************************************************************************/
39 
43 class CmdCircleEdit final : public UndoCommand {
44 public:
45  // Constructors / Destructor
46  CmdCircleEdit() = delete;
47  CmdCircleEdit(const CmdCircleEdit& other) = delete;
48  explicit CmdCircleEdit(Circle& circle) noexcept;
49  ~CmdCircleEdit() noexcept;
50 
51  // Setters
52  void setLayerName(const GraphicsLayerName& name, bool immediate) noexcept;
53  void setLineWidth(const UnsignedLength& width, bool immediate) noexcept;
54  void setIsFilled(bool filled, bool immediate) noexcept;
55  void setIsGrabArea(bool grabArea, bool immediate) noexcept;
56  void setDiameter(const PositiveLength& dia, bool immediate) noexcept;
57  void setCenter(const Point& pos, bool immediate) noexcept;
58  void translate(const Point& deltaPos, bool immediate) noexcept;
59  void rotate(const Angle& angle, const Point& center, bool immediate) noexcept;
60  void mirrorGeometry(Qt::Orientation orientation, const Point& center,
61  bool immediate) noexcept;
62  void mirrorLayer(bool immediate) noexcept;
63 
64  // Operator Overloadings
65  CmdCircleEdit& operator=(const CmdCircleEdit& rhs) = delete;
66 
67 private:
68  // Private Methods
69 
71  bool performExecute() override;
72 
74  void performUndo() override;
75 
77  void performRedo() override;
78 
79  // Private Member Variables
80 
81  // Attributes from the constructor
83 
84  // General Attributes
97 };
98 
99 /*******************************************************************************
100  * End of File
101  ******************************************************************************/
102 
103 } // namespace librepcb
104 
105 #endif // LIBREPCB_CMDCIRCLEEDIT_H
The CmdCircleEdit class.
Definition: cmdcircleedit.h:43
void setCenter(const Point &pos, bool immediate) noexcept
Definition: cmdcircleedit.cpp:98
UnsignedLength mOldLineWidth
Definition: cmdcircleedit.h:87
bool performExecute() override
Execute the command the first time.
Definition: cmdcircleedit.cpp:139
bool mOldIsFilled
Definition: cmdcircleedit.h:89
~CmdCircleEdit() noexcept
Definition: cmdcircleedit.cpp:55
void rotate(const Angle &angle, const Point &center, bool immediate) noexcept
Definition: cmdcircleedit.cpp:110
GraphicsLayerName mOldLayerName
Definition: cmdcircleedit.h:85
void mirrorGeometry(Qt::Orientation orientation, const Point &center, bool immediate) noexcept
Definition: cmdcircleedit.cpp:119
type_safe::constrained_type< QString, GraphicsLayerNameConstraint, GraphicsLayerNameVerifier > GraphicsLayerName
Definition: graphicslayername.h:78
void performUndo() override
Undo the command.
Definition: cmdcircleedit.cpp:151
void setDiameter(const PositiveLength &dia, bool immediate) noexcept
Definition: cmdcircleedit.cpp:91
GraphicsLayerName mNewLayerName
Definition: cmdcircleedit.h:86
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
CmdCircleEdit & operator=(const CmdCircleEdit &rhs)=delete
void mirrorLayer(bool immediate) noexcept
Definition: cmdcircleedit.cpp:129
bool mNewIsGrabArea
Definition: cmdcircleedit.h:92
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
void performRedo() override
Redo the command.
Definition: cmdcircleedit.cpp:160
void translate(const Point &deltaPos, bool immediate) noexcept
Definition: cmdcircleedit.cpp:104
void setLineWidth(const UnsignedLength &width, bool immediate) noexcept
Definition: cmdcircleedit.cpp:72
PositiveLength mNewDiameter
Definition: cmdcircleedit.h:94
The Circle class.
Definition: circle.h:47
void setIsGrabArea(bool grabArea, bool immediate) noexcept
Definition: cmdcircleedit.cpp:85
bool mOldIsGrabArea
Definition: cmdcircleedit.h:91
bool mNewIsFilled
Definition: cmdcircleedit.h:90
The UndoCommand class represents a command which you can undo/redo.
Definition: undocommand.h:47
Circle & mCircle
Definition: cmdcircleedit.h:82
Point mOldCenter
Definition: cmdcircleedit.h:95
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:780
Point mNewCenter
Definition: cmdcircleedit.h:96
void setLayerName(const GraphicsLayerName &name, bool immediate) noexcept
Definition: cmdcircleedit.cpp:65
void setIsFilled(bool filled, bool immediate) noexcept
Definition: cmdcircleedit.cpp:79
PositiveLength mOldDiameter
Definition: cmdcircleedit.h:93
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:659
UnsignedLength mNewLineWidth
Definition: cmdcircleedit.h:88