LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cmdpolygonedit.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_CMDPOLYGONEDIT_H
21 #define LIBREPCB_CMDPOLYGONEDIT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../../undocommand.h"
27 #include "../polygon.h"
28 
29 #include <QtCore>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 /*******************************************************************************
37  * Class CmdPolygonEdit
38  ******************************************************************************/
39 
43 class CmdPolygonEdit final : public UndoCommand {
44 public:
45  // Constructors / Destructor
46  CmdPolygonEdit() = delete;
47  CmdPolygonEdit(const CmdPolygonEdit& other) = delete;
48  explicit CmdPolygonEdit(Polygon& polygon) noexcept;
49  ~CmdPolygonEdit() 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 setPath(const Path& path, bool immediate) noexcept;
57  void translate(const Point& deltaPos, bool immediate) noexcept;
58  void rotate(const Angle& angle, const Point& center, bool immediate) noexcept;
59  void mirror(const Point& center, Qt::Orientation orientation,
60  bool immediate) noexcept;
61 
62  // Operator Overloadings
63  CmdPolygonEdit& operator=(const CmdPolygonEdit& rhs) = delete;
64 
65 private:
66  // Private Methods
67 
69  bool performExecute() override;
70 
72  void performUndo() override;
73 
75  void performRedo() override;
76 
77  // Private Member Variables
78 
79  // Attributes from the constructor
81 
82  // General Attributes
93 };
94 
95 /*******************************************************************************
96  * End of File
97  ******************************************************************************/
98 
99 } // namespace librepcb
100 
101 #endif // LIBREPCB_CMDPOLYGONEDIT_H
void setPath(const Path &path, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:89
void setLineWidth(const UnsignedLength &width, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:70
void setIsGrabArea(bool grabArea, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:83
void performUndo() override
Undo the command.
Definition: cmdpolygonedit.cpp:127
type_safe::constrained_type< QString, GraphicsLayerNameConstraint, GraphicsLayerNameVerifier > GraphicsLayerName
Definition: graphicslayername.h:78
void rotate(const Angle &angle, const Point &center, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:99
~CmdPolygonEdit() noexcept
Definition: cmdpolygonedit.cpp:53
The CmdPolygonEdit class.
Definition: cmdpolygonedit.h:43
GraphicsLayerName mNewLayerName
Definition: cmdpolygonedit.h:84
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
void performRedo() override
Redo the command.
Definition: cmdpolygonedit.cpp:135
bool mNewIsGrabArea
Definition: cmdpolygonedit.h:90
Path mNewPath
Definition: cmdpolygonedit.h:92
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
bool mOldIsGrabArea
Definition: cmdpolygonedit.h:89
UnsignedLength mOldLineWidth
Definition: cmdpolygonedit.h:85
Polygon & mPolygon
Definition: cmdpolygonedit.h:80
bool performExecute() override
Execute the command the first time.
Definition: cmdpolygonedit.cpp:116
void translate(const Point &deltaPos, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:95
CmdPolygonEdit & operator=(const CmdPolygonEdit &rhs)=delete
void mirror(const Point &center, Qt::Orientation orientation, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:104
The Path class represents a list of vertices connected by straight lines or circular arc segments...
Definition: path.h:53
The UndoCommand class represents a command which you can undo/redo.
Definition: undocommand.h:47
void setIsFilled(bool filled, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:77
UnsignedLength mNewLineWidth
Definition: cmdpolygonedit.h:86
bool mOldIsFilled
Definition: cmdpolygonedit.h:87
bool mNewIsFilled
Definition: cmdpolygonedit.h:88
The Polygon class.
Definition: polygon.h:49
Path mOldPath
Definition: cmdpolygonedit.h:91
void setLayerName(const GraphicsLayerName &name, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:63
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:659
GraphicsLayerName mOldLayerName
Definition: cmdpolygonedit.h:83