LibrePCB Developers Documentation
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_EDITOR_CMDPOLYGONEDIT_H
21#define LIBREPCB_EDITOR_CMDPOLYGONEDIT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../undocommand.h"
29#include "cmdlistelementsswap.h"
30
32
33#include <QtCore>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39
40class Layer;
41
42namespace editor {
43
44/*******************************************************************************
45 * Class CmdPolygonEdit
46 ******************************************************************************/
47
51class CmdPolygonEdit final : public UndoCommand {
52public:
53 // Constructors / Destructor
54 CmdPolygonEdit() = delete;
55 CmdPolygonEdit(const CmdPolygonEdit& other) = delete;
56 explicit CmdPolygonEdit(Polygon& polygon) noexcept;
57 ~CmdPolygonEdit() noexcept;
58
59 // Setters
60 void setLayer(const Layer& layer, bool immediate) noexcept;
61 void setLineWidth(const UnsignedLength& width, bool immediate) noexcept;
62 void setIsFilled(bool filled, bool immediate) noexcept;
63 void setIsGrabArea(bool grabArea, bool immediate) noexcept;
64 void setPath(const Path& path, bool immediate) noexcept;
65 void translate(const Point& deltaPos, bool immediate) noexcept;
66 void snapToGrid(const PositiveLength& gridInterval, bool immediate) noexcept;
67 void rotate(const Angle& angle, const Point& center, bool immediate) noexcept;
68 void mirrorGeometry(Qt::Orientation orientation, const Point& center,
69 bool immediate) noexcept;
70 void mirrorLayer(bool immediate) noexcept;
71
72 // Operator Overloadings
73 CmdPolygonEdit& operator=(const CmdPolygonEdit& rhs) = delete;
74
75private:
76 // Private Methods
77
79 bool performExecute() override;
80
82 void performUndo() override;
83
85 void performRedo() override;
86
87 // Private Member Variables
88
89 // Attributes from the constructor
91
92 // General Attributes
103};
104
105/*******************************************************************************
106 * Undo Commands
107 ******************************************************************************/
108
115
116/*******************************************************************************
117 * End of File
118 ******************************************************************************/
119
120} // namespace editor
121} // namespace librepcb
122
123#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The Layer class provides all supported geometry layers.
Definition: layer.h:42
The Path class represents a list of vertices connected by straight lines or circular arc segments.
Definition: path.h:58
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The Polygon class.
Definition: polygon.h:45
The CmdListElementInsert class.
Definition: cmdlistelementinsert.h:46
The CmdListElementRemove class.
Definition: cmdlistelementremove.h:46
The CmdListElementsSwap class.
Definition: cmdlistelementsswap.h:46
The CmdPolygonEdit class.
Definition: cmdpolygonedit.h:51
void performRedo() override
Redo the command.
Definition: cmdpolygonedit.cpp:142
bool mNewIsFilled
Definition: cmdpolygonedit.h:98
void setLayer(const Layer &layer, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:64
void translate(const Point &deltaPos, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:95
void setIsGrabArea(bool grabArea, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:83
void setIsFilled(bool filled, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:77
void performUndo() override
Undo the command.
Definition: cmdpolygonedit.cpp:134
void setLineWidth(const UnsignedLength &width, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:70
Path mNewPath
Definition: cmdpolygonedit.h:102
bool mOldIsGrabArea
Definition: cmdpolygonedit.h:99
void mirrorGeometry(Qt::Orientation orientation, const Point &center, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:109
bool mNewIsGrabArea
Definition: cmdpolygonedit.h:100
UnsignedLength mOldLineWidth
Definition: cmdpolygonedit.h:95
void snapToGrid(const PositiveLength &gridInterval, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:99
~CmdPolygonEdit() noexcept
Definition: cmdpolygonedit.cpp:54
const Layer * mNewLayer
Definition: cmdpolygonedit.h:94
Path mOldPath
Definition: cmdpolygonedit.h:101
Polygon & mPolygon
Definition: cmdpolygonedit.h:90
CmdPolygonEdit(const CmdPolygonEdit &other)=delete
void mirrorLayer(bool immediate) noexcept
Definition: cmdpolygonedit.cpp:115
UnsignedLength mNewLineWidth
Definition: cmdpolygonedit.h:96
bool mOldIsFilled
Definition: cmdpolygonedit.h:97
void setPath(const Path &path, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:89
bool performExecute() override
Execute the command the first time.
Definition: cmdpolygonedit.cpp:123
void rotate(const Angle &angle, const Point &center, bool immediate) noexcept
Definition: cmdpolygonedit.cpp:104
const Layer * mOldLayer
Definition: cmdpolygonedit.h:93
The UndoCommand class represents a command which you can undo/redo.
Definition: undocommand.h:46
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696
Definition: polygon.h:113