LibrePCB Developers Documentation
cmdboardzoneedit.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_CMDBOARDZONEEDIT_H
21#define LIBREPCB_EDITOR_CMDBOARDZONEEDIT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../undocommand.h"
27
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class Angle;
38class BI_Zone;
39
40namespace editor {
41
42/*******************************************************************************
43 * Class CmdBoardZoneEdit
44 ******************************************************************************/
45
49class CmdBoardZoneEdit final : public UndoCommand {
50public:
51 // Constructors / Destructor
52 CmdBoardZoneEdit() = delete;
53 CmdBoardZoneEdit(const CmdBoardZoneEdit& other) = delete;
54 explicit CmdBoardZoneEdit(BI_Zone& polygon) noexcept;
55 ~CmdBoardZoneEdit() noexcept;
56
57 // Setters
58 void setLayers(const QSet<const Layer*>& layers, bool immediate);
59 void setRules(Zone::Rules rules, bool immediate) noexcept;
60 void setOutline(const Path& path, bool immediate) noexcept;
61 void translate(const Point& deltaPos, bool immediate) noexcept;
62 void snapToGrid(const PositiveLength& gridInterval, bool immediate) noexcept;
63 void rotate(const Angle& angle, const Point& center, bool immediate) noexcept;
64 void mirrorGeometry(Qt::Orientation orientation, const Point& center,
65 bool immediate) noexcept;
66 void mirrorLayers(int innerLayers, bool immediate);
67 void setLocked(bool locked) noexcept;
68
69 // Operator Overloadings
70 CmdBoardZoneEdit& operator=(const CmdBoardZoneEdit& rhs) = delete;
71
72private: // Methods
74 bool performExecute() override;
75
77 void performUndo() override;
78
80 void performRedo() override;
81
82private: // Data
86};
87
88/*******************************************************************************
89 * End of File
90 ******************************************************************************/
91
92} // namespace editor
93} // namespace librepcb
94
95#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The BI_Zone class.
Definition: bi_zone.h:46
The BoardZoneData class.
Definition: boardzonedata.h:44
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 Zone class.
Definition: zone.h:43
The CmdBoardZoneEdit class.
Definition: cmdboardzoneedit.h:49
void performRedo() override
Redo the command.
Definition: cmdboardzoneedit.cpp:126
void translate(const Point &deltaPos, bool immediate) noexcept
Definition: cmdboardzoneedit.cpp:76
BoardZoneData mOldData
Definition: cmdboardzoneedit.h:84
void performUndo() override
Undo the command.
Definition: cmdboardzoneedit.cpp:119
void setOutline(const Path &path, bool immediate) noexcept
Definition: cmdboardzoneedit.cpp:70
void mirrorGeometry(Qt::Orientation orientation, const Point &center, bool immediate) noexcept
Definition: cmdboardzoneedit.cpp:91
void setRules(Zone::Rules rules, bool immediate) noexcept
Definition: cmdboardzoneedit.cpp:64
~CmdBoardZoneEdit() noexcept
Definition: cmdboardzoneedit.cpp:47
void snapToGrid(const PositiveLength &gridInterval, bool immediate) noexcept
Definition: cmdboardzoneedit.cpp:81
void mirrorLayers(int innerLayers, bool immediate)
Definition: cmdboardzoneedit.cpp:97
bool performExecute() override
Execute the command the first time.
Definition: cmdboardzoneedit.cpp:114
void setLocked(bool locked) noexcept
Definition: cmdboardzoneedit.cpp:105
void rotate(const Angle &angle, const Point &center, bool immediate) noexcept
Definition: cmdboardzoneedit.cpp:86
BI_Zone & mZone
Definition: cmdboardzoneedit.h:83
CmdBoardZoneEdit(const CmdBoardZoneEdit &other)=delete
void setLayers(const QSet< const Layer * > &layers, bool immediate)
Definition: cmdboardzoneedit.cpp:57
BoardZoneData mNewData
Definition: cmdboardzoneedit.h: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