LibrePCB Developers Documentation
Loading...
Searching...
No Matches
symboleditorstate_drawpolygonbase.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_SYMBOLEDITORSTATE_DRAWPOLYGONBASE_H
21#define LIBREPCB_EDITOR_SYMBOLEDITORSTATE_DRAWPOLYGONBASE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "symboleditorstate.h"
27
31
32#include <QtCore>
33#include <QtWidgets>
34
35#include <memory>
36
37/*******************************************************************************
38 * Namespace / Forward Declarations
39 ******************************************************************************/
40namespace librepcb {
41
42class Layer;
43class Polygon;
44
45namespace editor {
46
47class CmdPolygonEdit;
48class PolygonGraphicsItem;
49
50/*******************************************************************************
51 * Class SymbolEditorState_DrawPolygonBase
52 ******************************************************************************/
53
58 Q_OBJECT
59
60public:
61 // Types
62 enum class Mode { LINE, ARC, RECT, POLYGON };
63
64 // Constructors / Destructor
67 const SymbolEditorState_DrawPolygonBase& other) = delete;
68 SymbolEditorState_DrawPolygonBase(const Context& context, Mode mode) noexcept;
69 virtual ~SymbolEditorState_DrawPolygonBase() noexcept;
70
71 // General Methods
72 bool processKeyPressed(const QKeyEvent& e) noexcept override;
73 bool processKeyReleased(const QKeyEvent& e) noexcept override;
74 bool entry() noexcept override;
75 bool exit() noexcept override;
77 const noexcept override;
78
79 // Event Handlers
81 QGraphicsSceneMouseEvent& e) noexcept override;
83 QGraphicsSceneMouseEvent& e) noexcept override;
85 QGraphicsSceneMouseEvent& e) noexcept override;
86 bool processAbortCommand() noexcept override;
87
88 // Operator Overloadings
90 const SymbolEditorState_DrawPolygonBase& rhs) = delete;
91
92private: // Methods
93 bool start() noexcept;
94 bool abort(bool showErrMsgBox = true) noexcept;
95 bool addNextSegment() noexcept;
96 void updateCursorPosition(Qt::KeyboardModifiers modifiers) noexcept;
97 void updatePolygonPath() noexcept;
98 void updateOverlayText() noexcept;
99 void updateStatusBarMessage() noexcept;
100
101 void layerComboBoxValueChanged(const Layer& layer) noexcept;
102 void lineWidthEditValueChanged(const UnsignedLength& value) noexcept;
103 void angleEditValueChanged(const Angle& value) noexcept;
104 void fillCheckBoxCheckedChanged(bool checked) noexcept;
105 void grabAreaCheckBoxCheckedChanged(bool checked) noexcept;
106
107private: // Types / Data
115
116 // Arc tool state
119
120 // parameter memory
126};
127
128/*******************************************************************************
129 * End of File
130 ******************************************************************************/
131
132} // namespace editor
133} // namespace librepcb
134
135#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
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 Polygon class.
Definition polygon.h:45
The CmdPolygonEdit class.
Definition cmdpolygonedit.h:51
The EditorWidgetBase class.
Definition editorwidgetbase.h:61
The PolygonGraphicsItem class.
Definition polygongraphicsitem.h:48
The SymbolEditorState_DrawPolygonBase class.
Definition symboleditorstate_drawpolygonbase.h:57
bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition symboleditorstate_drawpolygonbase.cpp:205
const Layer * mLastLayer
Definition symboleditorstate_drawpolygonbase.h:121
bool abort(bool showErrMsgBox=true) noexcept
Definition symboleditorstate_drawpolygonbase.cpp:286
Point mArcCenter
Definition symboleditorstate_drawpolygonbase.h:117
bool mLastFill
Definition symboleditorstate_drawpolygonbase.h:124
bool addNextSegment() noexcept
Definition symboleditorstate_drawpolygonbase.cpp:309
Mode
Definition symboleditorstate_drawpolygonbase.h:62
bool mArcInSecondState
Definition symboleditorstate_drawpolygonbase.h:118
Mode mMode
Definition symboleditorstate_drawpolygonbase.h:108
void updateCursorPosition(Qt::KeyboardModifiers modifiers) noexcept
Definition symboleditorstate_drawpolygonbase.cpp:373
Angle mLastAngle
Definition symboleditorstate_drawpolygonbase.h:123
bool processAbortCommand() noexcept override
Definition symboleditorstate_drawpolygonbase.cpp:230
bool processKeyPressed(const QKeyEvent &e) noexcept override
Definition symboleditorstate_drawpolygonbase.cpp:185
std::unique_ptr< CmdPolygonEdit > mEditCmd
Definition symboleditorstate_drawpolygonbase.h:110
void fillCheckBoxCheckedChanged(bool checked) noexcept
Definition symboleditorstate_drawpolygonbase.cpp:596
void updateOverlayText() noexcept
Definition symboleditorstate_drawpolygonbase.cpp:446
void grabAreaCheckBoxCheckedChanged(bool checked) noexcept
Definition symboleditorstate_drawpolygonbase.cpp:604
bool mIsUndoCmdActive
Definition symboleditorstate_drawpolygonbase.h:109
SymbolEditorState_DrawPolygonBase(const SymbolEditorState_DrawPolygonBase &other)=delete
bool start() noexcept
Definition symboleditorstate_drawpolygonbase.cpp:242
bool mLastGrabArea
Definition symboleditorstate_drawpolygonbase.h:125
void angleEditValueChanged(const Angle &value) noexcept
Definition symboleditorstate_drawpolygonbase.cpp:584
void layerComboBoxValueChanged(const Layer &layer) noexcept
Definition symboleditorstate_drawpolygonbase.cpp:568
bool exit() noexcept override
Definition symboleditorstate_drawpolygonbase.cpp:159
std::shared_ptr< Polygon > mCurrentPolygon
Definition symboleditorstate_drawpolygonbase.h:111
UnsignedLength mLastLineWidth
Definition symboleditorstate_drawpolygonbase.h:122
void updateStatusBarMessage() noexcept
Definition symboleditorstate_drawpolygonbase.cpp:533
QSet< EditorWidgetBase::Feature > getAvailableFeatures() const noexcept override
Definition symboleditorstate_drawpolygonbase.cpp:175
void lineWidthEditValueChanged(const UnsignedLength &value) noexcept
Definition symboleditorstate_drawpolygonbase.cpp:576
bool processKeyReleased(const QKeyEvent &e) noexcept override
Definition symboleditorstate_drawpolygonbase.cpp:195
bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition symboleditorstate_drawpolygonbase.cpp:213
Point mLastScenePos
Definition symboleditorstate_drawpolygonbase.h:113
Point mCursorPos
Definition symboleditorstate_drawpolygonbase.h:114
bool entry() noexcept override
Definition symboleditorstate_drawpolygonbase.cpp:76
std::shared_ptr< PolygonGraphicsItem > mCurrentGraphicsItem
Definition symboleditorstate_drawpolygonbase.h:112
bool processGraphicsSceneLeftMouseButtonDoubleClicked(QGraphicsSceneMouseEvent &e) noexcept override
Definition symboleditorstate_drawpolygonbase.cpp:224
void updatePolygonPath() noexcept
Definition symboleditorstate_drawpolygonbase.cpp:389
virtual ~SymbolEditorState_DrawPolygonBase() noexcept
Definition symboleditorstate_drawpolygonbase.cpp:69
The SymbolEditorState class is the base class of all symbol editor FSM states.
Definition symboleditorstate.h:54
Definition occmodel.cpp:76
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694
Definition uuid.h:186
Definition symboleditorfsm.h:76