LibrePCB Developers Documentation
Loading...
Searching...
No Matches
boardeditorstate_drawpolygon.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_DRAWPOLYGON_H
21#define LIBREPCB_EDITOR_BOARDEDITORSTATE_DRAWPOLYGON_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "boardeditorstate.h"
27
30
31#include <QtCore>
32#include <QtWidgets>
33
34#include <memory>
35
36/*******************************************************************************
37 * Namespace / Forward Declarations
38 ******************************************************************************/
39namespace librepcb {
40
41class BI_Polygon;
42class Layer;
43
44namespace editor {
45
46class CmdBoardPolygonEdit;
47class LayerComboBox;
48class UnsignedLengthEdit;
49
50/*******************************************************************************
51 * Class BoardEditorState_DrawPolygon
52 ******************************************************************************/
53
58 Q_OBJECT
59
60public:
61 // Constructors / Destructor
64 delete;
65 explicit BoardEditorState_DrawPolygon(const Context& context) noexcept;
66 virtual ~BoardEditorState_DrawPolygon() noexcept;
67
68 // General Methods
69 virtual bool entry() noexcept override;
70 virtual bool exit() noexcept override;
71
72 // Event Handlers
73 virtual bool processAbortCommand() noexcept override;
75 QGraphicsSceneMouseEvent& e) noexcept override;
77 QGraphicsSceneMouseEvent& e) noexcept override;
79 QGraphicsSceneMouseEvent& e) noexcept override;
80 virtual bool processSwitchToBoard(int index) noexcept override;
81
82 // Operator Overloadings
84 const BoardEditorState_DrawPolygon& rhs) = delete;
85
86private: // Methods
87 bool startAddPolygon(const Point& pos) noexcept;
88 bool addSegment(const Point& pos) noexcept;
89 bool updateLastVertexPosition(const Point& pos) noexcept;
90 bool abortCommand(bool showErrMsgBox) noexcept;
91 void layerComboBoxLayerChanged(const Layer& layer) noexcept;
92 void widthEditValueChanged(const UnsignedLength& value) noexcept;
93 void filledCheckBoxCheckedChanged(bool checked) noexcept;
94
95private:
96 // State
99
100 // parameter memory
106
107 // Information about the current polygon to place. Only valid if
108 // mIsUndoCmdActive == true.
111};
112
113/*******************************************************************************
114 * End of File
115 ******************************************************************************/
116
117} // namespace editor
118} // namespace librepcb
119
120#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
The BI_Polygon class.
Definition bi_polygon.h:46
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 "draw polygon" state/tool of the board editor.
Definition boardeditorstate_drawpolygon.h:57
virtual bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_drawpolygon.cpp:142
void layerComboBoxLayerChanged(const Layer &layer) noexcept
Definition boardeditorstate_drawpolygon.cpp:283
bool startAddPolygon(const Point &pos) noexcept
Definition boardeditorstate_drawpolygon.cpp:174
const Layer * mLastLayer
Definition boardeditorstate_drawpolygon.h:101
BI_Polygon * mCurrentPolygon
Definition boardeditorstate_drawpolygon.h:109
BoardEditorState_DrawPolygon(const BoardEditorState_DrawPolygon &other)=delete
virtual bool processSwitchToBoard(int index) noexcept override
Definition boardeditorstate_drawpolygon.cpp:165
bool mLastIsGrabArea
Definition boardeditorstate_drawpolygon.h:105
void filledCheckBoxCheckedChanged(bool checked) noexcept
Definition boardeditorstate_drawpolygon.cpp:300
virtual bool processAbortCommand() noexcept override
Definition boardeditorstate_drawpolygon.cpp:132
bool mLastIsFilled
Definition boardeditorstate_drawpolygon.h:104
bool abortCommand(bool showErrMsgBox) noexcept
Definition boardeditorstate_drawpolygon.cpp:261
bool mIsUndoCmdActive
Definition boardeditorstate_drawpolygon.h:97
Angle mLastRotation
Definition boardeditorstate_drawpolygon.h:103
virtual bool exit() noexcept override
Definition boardeditorstate_drawpolygon.cpp:117
UnsignedLength mLastLineWidth
Definition boardeditorstate_drawpolygon.h:102
bool addSegment(const Point &pos) noexcept
Definition boardeditorstate_drawpolygon.cpp:208
void widthEditValueChanged(const UnsignedLength &value) noexcept
Definition boardeditorstate_drawpolygon.cpp:292
std::unique_ptr< CmdBoardPolygonEdit > mCurrentPolygonEditCmd
Definition boardeditorstate_drawpolygon.h:110
virtual ~BoardEditorState_DrawPolygon() noexcept
Definition boardeditorstate_drawpolygon.cpp:66
virtual bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_drawpolygon.cpp:148
bool updateLastVertexPosition(const Point &pos) noexcept
Definition boardeditorstate_drawpolygon.cpp:249
Point mLastSegmentPos
Definition boardeditorstate_drawpolygon.h:98
virtual bool entry() noexcept override
Definition boardeditorstate_drawpolygon.cpp:73
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked(QGraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_drawpolygon.cpp:160
The board editor state base class.
Definition boardeditorstate.h:59
The CmdBoardPolygonEdit class.
Definition cmdboardpolygonedit.h:49
Definition occmodel.cpp:76
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694
Definition uuid.h:186
FSM Context.
Definition boardeditorfsm.h:88