LibrePCB Developers Documentation
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
30
31#include <QtCore>
32#include <QtWidgets>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38
39class BI_Zone;
40class Layer;
41
42namespace editor {
43
44class CmdBoardZoneEdit;
45
46/*******************************************************************************
47 * Class BoardEditorState_DrawZone
48 ******************************************************************************/
49
54 Q_OBJECT
55
56public:
57 // Constructors / Destructor
60 explicit BoardEditorState_DrawZone(const Context& context) noexcept;
61 virtual ~BoardEditorState_DrawZone() noexcept;
62
63 // General Methods
64 virtual bool entry() noexcept override;
65 virtual bool exit() noexcept override;
66
67 // Event Handlers
68 virtual bool processAbortCommand() noexcept override;
70 QGraphicsSceneMouseEvent& e) noexcept override;
72 QGraphicsSceneMouseEvent& e) noexcept override;
74 QGraphicsSceneMouseEvent& e) noexcept override;
75 virtual bool processSwitchToBoard(int index) noexcept override;
76
77 // Operator Overloadings
79 delete;
80
81private: // Methods
82 bool startAddZone(const Point& pos) noexcept;
83 bool addSegment(const Point& pos) noexcept;
84 bool updateLastVertexPosition(const Point& pos) noexcept;
85 bool abortCommand(bool showErrMsgBox) noexcept;
86
87private: // Data
88 // State
93
94 // Information about the current zone to place. Only valid if
95 // mIsUndoCmdActive == true.
98};
99
100/*******************************************************************************
101 * End of File
102 ******************************************************************************/
103
104} // namespace editor
105} // namespace librepcb
106
107#endif
The BI_Zone class.
Definition: bi_zone.h:46
The Layer class provides all supported geometry layers.
Definition: layer.h:40
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 "draw zone" state/tool of the board editor.
Definition: boardeditorstate_drawzone.h:53
virtual bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition: boardeditorstate_drawzone.cpp:170
virtual ~BoardEditorState_DrawZone() noexcept
Definition: boardeditorstate_drawzone.cpp:62
const Layer * mLastLayer
Definition: boardeditorstate_drawzone.h:90
Point mLastVertexPos
Definition: boardeditorstate_drawzone.h:92
virtual bool processSwitchToBoard(int index) noexcept override
Definition: boardeditorstate_drawzone.cpp:193
virtual bool processAbortCommand() noexcept override
Definition: boardeditorstate_drawzone.cpp:160
BoardEditorState_DrawZone(const BoardEditorState_DrawZone &other)=delete
BI_Zone * mCurrentZone
Definition: boardeditorstate_drawzone.h:96
bool abortCommand(bool showErrMsgBox) noexcept
Definition: boardeditorstate_drawzone.cpp:292
bool mIsUndoCmdActive
Definition: boardeditorstate_drawzone.h:89
virtual bool exit() noexcept override
Definition: boardeditorstate_drawzone.cpp:145
bool addSegment(const Point &pos) noexcept
Definition: boardeditorstate_drawzone.cpp:235
QScopedPointer< CmdBoardZoneEdit > mCurrentZoneEditCmd
Definition: boardeditorstate_drawzone.h:97
bool startAddZone(const Point &pos) noexcept
Definition: boardeditorstate_drawzone.cpp:202
Zone::Rules mLastRules
Definition: boardeditorstate_drawzone.h:91
virtual bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition: boardeditorstate_drawzone.cpp:176
bool updateLastVertexPosition(const Point &pos) noexcept
Definition: boardeditorstate_drawzone.cpp:280
virtual bool entry() noexcept override
Definition: boardeditorstate_drawzone.cpp:69
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked(QGraphicsSceneMouseEvent &e) noexcept override
Definition: boardeditorstate_drawzone.cpp:188
The board editor state base class.
Definition: boardeditorstate.h:59
The CmdBoardZoneEdit class.
Definition: cmdboardzoneedit.h:49
Definition: occmodel.cpp:77
FSM Context.
Definition: boardeditorfsm.h:88