LibrePCB Developers Documentation
Loading...
Searching...
No Matches
symboleditorstate_drawcircle.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_DRAWCIRCLE_H
21#define LIBREPCB_EDITOR_SYMBOLEDITORSTATE_DRAWCIRCLE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "symboleditorstate.h"
27
29
30#include <QtCore>
31
32#include <memory>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38namespace editor {
39
40class CircleGraphicsItem;
41class CmdCircleEdit;
42
43/*******************************************************************************
44 * Class SymbolEditorState_DrawCircle
45 ******************************************************************************/
46
51 Q_OBJECT
52
53public:
54 // Constructors / Destructor
57 delete;
58 explicit SymbolEditorState_DrawCircle(const Context& context) noexcept;
60
61 // General Methods
62 bool entry() noexcept override;
63 bool exit() noexcept override;
64
65 // Event Handlers
67 const GraphicsSceneMouseEvent& e) noexcept override;
69 const GraphicsSceneMouseEvent& e) noexcept override;
70 bool processAbortCommand() noexcept override;
71
72 // Connection to UI
73 QSet<const Layer*> getAvailableLayers() const noexcept;
74 const Layer& getLayer() const noexcept {
76 }
77 void setLayer(const Layer& layer) noexcept;
78 const UnsignedLength& getLineWidth() const noexcept {
80 }
81 void setLineWidth(const UnsignedLength& width) noexcept;
82 bool getFilled() const noexcept { return mCurrentProperties.isFilled(); }
83 void setFilled(bool filled) noexcept;
84 bool getGrabArea() const noexcept { return mCurrentProperties.isGrabArea(); }
85 void setGrabArea(bool grabArea) noexcept;
86
87 // Operator Overloadings
89 const SymbolEditorState_DrawCircle& rhs) = delete;
90
91signals:
92 void layerChanged(const Layer& layer);
93 void lineWidthChanged(const UnsignedLength& width);
94 void filledChanged(bool filled);
95 void grabAreaChanged(bool grabArea);
96
97private: // Methods
98 bool startAddCircle(const Point& pos) noexcept;
99 bool updateCircleDiameter(const Point& pos) noexcept;
100 bool finishAddCircle(const Point& pos) noexcept;
101 bool abortAddCircle() noexcept;
102
103private:
105
109};
110
111/*******************************************************************************
112 * End of File
113 ******************************************************************************/
114
115} // namespace editor
116} // namespace librepcb
117
118#endif
The Circle class.
Definition circle.h:46
bool isFilled() const noexcept
Definition circle.h:77
const Layer & getLayer() const noexcept
Definition circle.h:75
const UnsignedLength & getLineWidth() const noexcept
Definition circle.h:76
bool isGrabArea() const noexcept
Definition circle.h:78
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 CircleGraphicsItem class.
Definition circlegraphicsitem.h:48
The CmdCircleEdit class.
Definition cmdcircleedit.h:51
The SymbolEditorState_DrawCircle class.
Definition symboleditorstate_drawcircle.h:50
bool processGraphicsSceneMouseMoved(const GraphicsSceneMouseEvent &e) noexcept override
Definition symboleditorstate_drawcircle.cpp:89
bool updateCircleDiameter(const Point &pos) noexcept
Definition symboleditorstate_drawcircle.cpp:196
std::shared_ptr< Circle > mCurrentCircle
Definition symboleditorstate_drawcircle.h:107
bool getGrabArea() const noexcept
Definition symboleditorstate_drawcircle.h:84
~SymbolEditorState_DrawCircle() noexcept
Definition symboleditorstate_drawcircle.cpp:61
void setLayer(const Layer &layer) noexcept
Definition symboleditorstate_drawcircle.cpp:126
bool startAddCircle(const Point &pos) noexcept
Definition symboleditorstate_drawcircle.cpp:171
bool processGraphicsSceneLeftMouseButtonPressed(const GraphicsSceneMouseEvent &e) noexcept override
Definition symboleditorstate_drawcircle.cpp:99
bool processAbortCommand() noexcept override
Definition symboleditorstate_drawcircle.cpp:109
const Layer & getLayer() const noexcept
Definition symboleditorstate_drawcircle.h:74
bool abortAddCircle() noexcept
Definition symboleditorstate_drawcircle.cpp:226
QSet< const Layer * > getAvailableLayers() const noexcept
Definition symboleditorstate_drawcircle.cpp:121
SymbolEditorState_DrawCircle & operator=(const SymbolEditorState_DrawCircle &rhs)=delete
const UnsignedLength & getLineWidth() const noexcept
Definition symboleditorstate_drawcircle.h:78
std::shared_ptr< CircleGraphicsItem > mCurrentGraphicsItem
Definition symboleditorstate_drawcircle.h:108
void setFilled(bool filled) noexcept
Definition symboleditorstate_drawcircle.cpp:147
bool exit() noexcept override
Definition symboleditorstate_drawcircle.cpp:75
std::unique_ptr< CmdCircleEdit > mCurrentEditCmd
Definition symboleditorstate_drawcircle.h:106
bool finishAddCircle(const Point &pos) noexcept
Definition symboleditorstate_drawcircle.cpp:207
void setGrabArea(bool grabArea) noexcept
Definition symboleditorstate_drawcircle.cpp:157
Circle mCurrentProperties
Definition symboleditorstate_drawcircle.h:104
void setLineWidth(const UnsignedLength &width) noexcept
Definition symboleditorstate_drawcircle.cpp:136
bool getFilled() const noexcept
Definition symboleditorstate_drawcircle.h:82
void lineWidthChanged(const UnsignedLength &width)
bool entry() noexcept override
Definition symboleditorstate_drawcircle.cpp:69
SymbolEditorState_DrawCircle(const SymbolEditorState_DrawCircle &other)=delete
The SymbolEditorState class is the base class of all symbol editor FSM states.
Definition symboleditorstate.h:56
Definition occmodel.cpp:77
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694
Definition uuid.h:186
Definition graphicsscene.h:45
Definition symboleditorfsm.h:75