LibrePCB Developers Documentation
cmdzoneedit.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_CMDZONEEDIT_H
21#define LIBREPCB_EDITOR_CMDZONEEDIT_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 {
39namespace editor {
40
41/*******************************************************************************
42 * Class CmdZoneEdit
43 ******************************************************************************/
44
48class CmdZoneEdit final : public UndoCommand {
49public:
50 // Constructors / Destructor
51 CmdZoneEdit() = delete;
52 CmdZoneEdit(const CmdZoneEdit& other) = delete;
53 explicit CmdZoneEdit(Zone& zone) noexcept;
54 ~CmdZoneEdit() noexcept;
55
56 // Setters
57 void setLayers(Zone::Layers layers, bool immediate) noexcept;
58 void setRules(Zone::Rules rules, bool immediate) noexcept;
59 void setOutline(const Path& path, bool immediate) noexcept;
60 void translate(const Point& deltaPos, bool immediate) noexcept;
61 void snapToGrid(const PositiveLength& gridInterval, bool immediate) noexcept;
62 void rotate(const Angle& angle, const Point& center, bool immediate) noexcept;
63 void mirrorGeometry(Qt::Orientation orientation, const Point& center,
64 bool immediate) noexcept;
65 void mirrorLayers(bool immediate) noexcept;
66
67 // Operator Overloadings
68 CmdZoneEdit& operator=(const CmdZoneEdit& rhs) = delete;
69
70private:
71 // Private Methods
72
74 bool performExecute() override;
75
77 void performUndo() override;
78
80 void performRedo() override;
81
82 // Private Member Variables
83
84 // Attributes from the constructor
86
87 // General Attributes
94};
95
96/*******************************************************************************
97 * Undo Commands
98 ******************************************************************************/
99
106
107/*******************************************************************************
108 * End of File
109 ******************************************************************************/
110
111} // namespace editor
112} // namespace librepcb
113
114#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
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 Zone class.
Definition: zone.h:43
The CmdListElementInsert class.
Definition: cmdlistelementinsert.h:46
The CmdListElementRemove class.
Definition: cmdlistelementremove.h:46
The CmdListElementsSwap class.
Definition: cmdlistelementsswap.h:46
The CmdZoneEdit class.
Definition: cmdzoneedit.h:48
void performRedo() override
Redo the command.
Definition: cmdzoneedit.cpp:121
void mirrorLayers(bool immediate) noexcept
Definition: cmdzoneedit.cpp:95
CmdZoneEdit(const CmdZoneEdit &other)=delete
void translate(const Point &deltaPos, bool immediate) noexcept
Definition: cmdzoneedit.cpp:76
void setLayers(Zone::Layers layers, bool immediate) noexcept
Definition: cmdzoneedit.cpp:58
Zone::Layers mNewLayers
Definition: cmdzoneedit.h:89
void performUndo() override
Undo the command.
Definition: cmdzoneedit.cpp:115
void setOutline(const Path &path, bool immediate) noexcept
Definition: cmdzoneedit.cpp:70
void mirrorGeometry(Qt::Orientation orientation, const Point &center, bool immediate) noexcept
Definition: cmdzoneedit.cpp:90
void setRules(Zone::Rules rules, bool immediate) noexcept
Definition: cmdzoneedit.cpp:64
~CmdZoneEdit() noexcept
Definition: cmdzoneedit.cpp:48
Path mOldOutline
Definition: cmdzoneedit.h:92
Zone::Rules mNewRules
Definition: cmdzoneedit.h:91
void snapToGrid(const PositiveLength &gridInterval, bool immediate) noexcept
Definition: cmdzoneedit.cpp:80
Zone::Layers mOldLayers
Definition: cmdzoneedit.h:88
Zone & mZone
Definition: cmdzoneedit.h:85
Path mNewOutline
Definition: cmdzoneedit.h:93
bool performExecute() override
Execute the command the first time.
Definition: cmdzoneedit.cpp:106
Zone::Rules mOldRules
Definition: cmdzoneedit.h:90
void rotate(const Angle &angle, const Point &center, bool immediate) noexcept
Definition: cmdzoneedit.cpp:85
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
Definition: zone.h:118