LibrePCB Developers Documentation
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_EDITOR_CMDCIRCLEEDIT_H
21#define LIBREPCB_EDITOR_CMDCIRCLEEDIT_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 CmdCircleEdit
46 ******************************************************************************/
47
51class CmdCircleEdit final : public UndoCommand {
52public:
53 // Constructors / Destructor
54 CmdCircleEdit() = delete;
55 CmdCircleEdit(const CmdCircleEdit& other) = delete;
56 explicit CmdCircleEdit(Circle& circle) noexcept;
57 ~CmdCircleEdit() 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 setDiameter(const PositiveLength& dia, bool immediate) noexcept;
65 void setCenter(const Point& pos, bool immediate) noexcept;
66 void translate(const Point& deltaPos, bool immediate) noexcept;
67 void snapToGrid(const PositiveLength& gridInterval, bool immediate) noexcept;
68 void rotate(const Angle& angle, const Point& center, bool immediate) noexcept;
69 void mirrorGeometry(Qt::Orientation orientation, const Point& center,
70 bool immediate) noexcept;
71 void mirrorLayer(bool immediate) noexcept;
72
73 // Operator Overloadings
74 CmdCircleEdit& operator=(const CmdCircleEdit& rhs) = delete;
75
76private:
77 // Private Methods
78
80 bool performExecute() override;
81
83 void performUndo() override;
84
86 void performRedo() override;
87
88 // Private Member Variables
89
90 // Attributes from the constructor
92
93 // General Attributes
106};
107
108/*******************************************************************************
109 * Undo Commands
110 ******************************************************************************/
111
118
119/*******************************************************************************
120 * End of File
121 ******************************************************************************/
122
123} // namespace editor
124} // namespace librepcb
125
126#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The Circle class.
Definition: circle.h:46
The Layer class provides all supported geometry layers.
Definition: layer.h:42
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The CmdCircleEdit class.
Definition: cmdcircleedit.h:51
void performRedo() override
Redo the command.
Definition: cmdcircleedit.cpp:163
bool mNewIsFilled
Definition: cmdcircleedit.h:99
void setDiameter(const PositiveLength &dia, bool immediate) noexcept
Definition: cmdcircleedit.cpp:91
CmdCircleEdit(const CmdCircleEdit &other)=delete
void setLayer(const Layer &layer, bool immediate) noexcept
Definition: cmdcircleedit.cpp:66
Point mNewCenter
Definition: cmdcircleedit.h:105
void translate(const Point &deltaPos, bool immediate) noexcept
Definition: cmdcircleedit.cpp:104
void setIsGrabArea(bool grabArea, bool immediate) noexcept
Definition: cmdcircleedit.cpp:85
void setIsFilled(bool filled, bool immediate) noexcept
Definition: cmdcircleedit.cpp:79
void setCenter(const Point &pos, bool immediate) noexcept
Definition: cmdcircleedit.cpp:98
void performUndo() override
Undo the command.
Definition: cmdcircleedit.cpp:154
void setLineWidth(const UnsignedLength &width, bool immediate) noexcept
Definition: cmdcircleedit.cpp:72
bool mOldIsGrabArea
Definition: cmdcircleedit.h:100
void mirrorGeometry(Qt::Orientation orientation, const Point &center, bool immediate) noexcept
Definition: cmdcircleedit.cpp:124
bool mNewIsGrabArea
Definition: cmdcircleedit.h:101
PositiveLength mNewDiameter
Definition: cmdcircleedit.h:103
Circle & mCircle
Definition: cmdcircleedit.h:91
PositiveLength mOldDiameter
Definition: cmdcircleedit.h:102
UnsignedLength mOldLineWidth
Definition: cmdcircleedit.h:96
void snapToGrid(const PositiveLength &gridInterval, bool immediate) noexcept
Definition: cmdcircleedit.cpp:110
const Layer * mNewLayer
Definition: cmdcircleedit.h:95
~CmdCircleEdit() noexcept
Definition: cmdcircleedit.cpp:56
void mirrorLayer(bool immediate) noexcept
Definition: cmdcircleedit.cpp:134
UnsignedLength mNewLineWidth
Definition: cmdcircleedit.h:97
bool mOldIsFilled
Definition: cmdcircleedit.h:98
bool performExecute() override
Execute the command the first time.
Definition: cmdcircleedit.cpp:142
void rotate(const Angle &angle, const Point &center, bool immediate) noexcept
Definition: cmdcircleedit.cpp:115
const Layer * mOldLayer
Definition: cmdcircleedit.h:94
Point mOldCenter
Definition: cmdcircleedit.h:104
The CmdListElementInsert class.
Definition: cmdlistelementinsert.h:46
The CmdListElementRemove class.
Definition: cmdlistelementremove.h:46
The CmdListElementsSwap class.
Definition: cmdlistelementsswap.h:46
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: circle.h:118