LibrePCB Developers Documentation
Loading...
Searching...
No Matches
boardeditorstate_drawplane.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_DRAWPLANE_H
21#define LIBREPCB_EDITOR_BOARDEDITORSTATE_DRAWPLANE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "boardeditorstate.h"
27
29
30#include <QtCore>
31
32#include <memory>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38
39class BI_Plane;
40class Layer;
41class NetSignal;
42
43namespace editor {
44
45class CmdBoardPlaneEdit;
46
47/*******************************************************************************
48 * Class BoardEditorState_DrawPlane
49 ******************************************************************************/
50
55 Q_OBJECT
56
57public:
58 // Constructors / Destructor
61 explicit BoardEditorState_DrawPlane(const Context& context) noexcept;
62 virtual ~BoardEditorState_DrawPlane() noexcept;
63
64 // General Methods
65 virtual bool entry() noexcept override;
66 virtual bool exit() noexcept override;
67
68 // Event Handlers
69 virtual bool processAbortCommand() noexcept override;
71 const GraphicsSceneMouseEvent& e) noexcept override;
73 const GraphicsSceneMouseEvent& e) noexcept override;
75 const GraphicsSceneMouseEvent& e) noexcept override;
76
77 // Connection to UI
78 QVector<std::pair<Uuid, QString>> getAvailableNets() const noexcept;
79 std::optional<Uuid> getNet() const noexcept;
80 void setNet(const std::optional<Uuid>& net) noexcept;
81 QSet<const Layer*> getAvailableLayers() noexcept;
82 const Layer& getLayer() const noexcept { return *mCurrentLayer; }
83 void setLayer(const Layer& layer) noexcept;
84
85 // Operator Overloadings
87 delete;
88
89signals:
90 void netChanged(const std::optional<Uuid>& net);
91
92private: // Methods
93 bool startAddPlane(const Point& pos) noexcept;
94 bool addSegment(const Point& pos) noexcept;
95 bool updateLastVertexPosition(const Point& pos) noexcept;
96 bool abortCommand(bool showErrMsgBox) noexcept;
97
98signals:
99 void layerChanged(const Layer& layer);
100
101private: // Data
102 // State
106
107 // Current tool settings
108 QPointer<NetSignal> mCurrentNetSignal;
110
111 // Information about the current text to place. Only valid if
112 // mIsUndoCmdActive == true.
114 std::unique_ptr<CmdBoardPlaneEdit> mCurrentPlaneEditCmd;
115};
116
117/*******************************************************************************
118 * End of File
119 ******************************************************************************/
120
121} // namespace editor
122} // namespace librepcb
123
124#endif
The BI_Plane class.
Definition bi_plane.h:52
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
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
The "draw plane" state/tool of the board editor.
Definition boardeditorstate_drawplane.h:54
virtual ~BoardEditorState_DrawPlane() noexcept
Definition boardeditorstate_drawplane.cpp:60
std::optional< Uuid > getNet() const noexcept
Definition boardeditorstate_drawplane.cpp:150
virtual bool processGraphicsSceneMouseMoved(const GraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_drawplane.cpp:106
const Layer * mCurrentLayer
Definition boardeditorstate_drawplane.h:109
QPointer< NetSignal > mCurrentNetSignal
Definition boardeditorstate_drawplane.h:108
QVector< std::pair< Uuid, QString > > getAvailableNets() const noexcept
Definition boardeditorstate_drawplane.cpp:133
bool mAutoNetSignal
Definition boardeditorstate_drawplane.h:104
Point mLastVertexPos
Definition boardeditorstate_drawplane.h:105
void setLayer(const Layer &layer) noexcept
Definition boardeditorstate_drawplane.cpp:174
QSet< const Layer * > getAvailableLayers() noexcept
Definition boardeditorstate_drawplane.cpp:170
virtual bool processGraphicsSceneLeftMouseButtonPressed(const GraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_drawplane.cpp:112
virtual bool processAbortCommand() noexcept override
Definition boardeditorstate_drawplane.cpp:96
const Layer & getLayer() const noexcept
Definition boardeditorstate_drawplane.h:82
void netChanged(const std::optional< Uuid > &net)
void setNet(const std::optional< Uuid > &net) noexcept
Definition boardeditorstate_drawplane.cpp:155
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked(const GraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_drawplane.cpp:124
bool abortCommand(bool showErrMsgBox) noexcept
Definition boardeditorstate_drawplane.cpp:271
BI_Plane * mCurrentPlane
Definition boardeditorstate_drawplane.h:113
bool mIsUndoCmdActive
Definition boardeditorstate_drawplane.h:103
std::unique_ptr< CmdBoardPlaneEdit > mCurrentPlaneEditCmd
Definition boardeditorstate_drawplane.h:114
virtual bool exit() noexcept override
Definition boardeditorstate_drawplane.cpp:83
bool startAddPlane(const Point &pos) noexcept
Definition boardeditorstate_drawplane.cpp:190
bool addSegment(const Point &pos) noexcept
Definition boardeditorstate_drawplane.cpp:220
BoardEditorState_DrawPlane(const BoardEditorState_DrawPlane &other)=delete
bool updateLastVertexPosition(const Point &pos) noexcept
Definition boardeditorstate_drawplane.cpp:259
virtual bool entry() noexcept override
Definition boardeditorstate_drawplane.cpp:67
BoardEditorState_DrawPlane & operator=(const BoardEditorState_DrawPlane &rhs)=delete
The board editor state base class.
Definition boardeditorstate.h:60
Definition occmodel.cpp:77
Definition uuid.h:186
FSM Context.
Definition boardeditorfsm.h:88
Definition graphicsscene.h:45