LibrePCB Developers Documentation
Loading...
Searching...
No Matches
boardeditorstate_drawzone.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_BOARDEDITORSTATE_DRAWZONE_H
21#define LIBREPCB_EDITOR_BOARDEDITORSTATE_DRAWZONE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "boardeditorstate.h"
27
31
32#include <QtCore>
33
34#include <memory>
35
36/*******************************************************************************
37 * Namespace / Forward Declarations
38 ******************************************************************************/
39namespace librepcb {
40
41class BI_Zone;
42class Layer;
43
44namespace editor {
45
46class CmdBoardZoneEdit;
47
48/*******************************************************************************
49 * Class BoardEditorState_DrawZone
50 ******************************************************************************/
51
56 Q_OBJECT
57
58public:
59 // Constructors / Destructor
62 explicit BoardEditorState_DrawZone(const Context& context) noexcept;
63 virtual ~BoardEditorState_DrawZone() noexcept;
64
65 // General Methods
66 virtual bool entry() noexcept override;
67 virtual bool exit() noexcept override;
68
69 // Event Handlers
70 virtual bool processAbortCommand() noexcept override;
72 const GraphicsSceneMouseEvent& e) noexcept override;
74 const GraphicsSceneMouseEvent& e) noexcept override;
76 const GraphicsSceneMouseEvent& e) noexcept override;
77
78 // Connection to UI
79 QSet<const Layer*> getAvailableLayers() noexcept;
80 QSet<const Layer*> getLayers() const noexcept {
82 }
83 void setLayers(const QSet<const Layer*>& layers) noexcept;
84 Zone::Rules getRules() const noexcept {
86 }
87 void setRule(Zone::Rule rule, bool enable) noexcept;
88
89 // Operator Overloadings
91 delete;
92
93signals:
94 void layersChanged(const QSet<const Layer*>& layers);
95 void rulesChanged(Zone::Rules rules);
96
97private: // Methods
98 bool startAddZone(const Point& pos) noexcept;
99 bool addSegment(const Point& pos) noexcept;
100 bool updateLastVertexPosition(const Point& pos) noexcept;
101 bool abortCommand(bool showErrMsgBox) noexcept;
102
103private: // Data
104 // State
107
108 // Current tool settings
110
111 // Information about the current zone to place. Only valid if
112 // mIsUndoCmdActive == true.
114 std::unique_ptr<CmdBoardZoneEdit> mCurrentZoneEditCmd;
115};
116
117/*******************************************************************************
118 * End of File
119 ******************************************************************************/
120
121} // namespace editor
122} // namespace librepcb
123
124#endif
The BI_Zone class.
Definition bi_zone.h:46
The BoardZoneData class.
Definition boardzonedata.h:44
const QSet< const Layer * > & getLayers() const noexcept
Definition boardzonedata.h:57
Zone::Rules getRules() const noexcept
Definition boardzonedata.h:58
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:78
Rule
Definition zone.h:54
The "draw zone" state/tool of the board editor.
Definition boardeditorstate_drawzone.h:55
virtual ~BoardEditorState_DrawZone() noexcept
Definition boardeditorstate_drawzone.cpp:62
virtual bool processGraphicsSceneMouseMoved(const GraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_drawzone.cpp:100
BoardZoneData mCurrentProperties
Definition boardeditorstate_drawzone.h:109
Point mLastVertexPos
Definition boardeditorstate_drawzone.h:106
Zone::Rules getRules() const noexcept
Definition boardeditorstate_drawzone.h:84
QSet< const Layer * > getAvailableLayers() noexcept
Definition boardeditorstate_drawzone.cpp:127
virtual bool processGraphicsSceneLeftMouseButtonPressed(const GraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_drawzone.cpp:106
virtual bool processAbortCommand() noexcept override
Definition boardeditorstate_drawzone.cpp:90
BoardEditorState_DrawZone(const BoardEditorState_DrawZone &other)=delete
BI_Zone * mCurrentZone
Definition boardeditorstate_drawzone.h:113
std::unique_ptr< CmdBoardZoneEdit > mCurrentZoneEditCmd
Definition boardeditorstate_drawzone.h:114
QSet< const Layer * > getLayers() const noexcept
Definition boardeditorstate_drawzone.h:80
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked(const GraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_drawzone.cpp:118
bool abortCommand(bool showErrMsgBox) noexcept
Definition boardeditorstate_drawzone.cpp:249
BoardEditorState_DrawZone & operator=(const BoardEditorState_DrawZone &rhs)=delete
void layersChanged(const QSet< const Layer * > &layers)
bool mIsUndoCmdActive
Definition boardeditorstate_drawzone.h:105
virtual bool exit() noexcept override
Definition boardeditorstate_drawzone.cpp:77
bool addSegment(const Point &pos) noexcept
Definition boardeditorstate_drawzone.cpp:192
void setLayers(const QSet< const Layer * > &layers) noexcept
Definition boardeditorstate_drawzone.cpp:131
bool startAddZone(const Point &pos) noexcept
Definition boardeditorstate_drawzone.cpp:159
void setRule(Zone::Rule rule, bool enable) noexcept
Definition boardeditorstate_drawzone.cpp:142
bool updateLastVertexPosition(const Point &pos) noexcept
Definition boardeditorstate_drawzone.cpp:237
virtual bool entry() noexcept override
Definition boardeditorstate_drawzone.cpp:69
The board editor state base class.
Definition boardeditorstate.h:60
Definition occmodel.cpp:77
FSM Context.
Definition boardeditorfsm.h:88
Definition graphicsscene.h:45