LibrePCB Developers Documentation
packageeditorstate_addholes.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_PACKAGEEDITORSTATE_ADDHOLES_H
21 #define LIBREPCB_EDITOR_PACKAGEEDITORSTATE_ADDHOLES_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "packageeditorstate.h"
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 #include <memory>
32 
33 /*******************************************************************************
34  * Namespace / Forward Declarations
35  ******************************************************************************/
36 namespace librepcb {
37 
38 class Hole;
39 
40 namespace editor {
41 
42 class CmdHoleEdit;
43 class HoleGraphicsItem;
44 
45 /*******************************************************************************
46  * Class PackageEditorState_AddHoles
47  ******************************************************************************/
48 
53  Q_OBJECT
54 
55 public:
56  // Constructors / Destructor
57  PackageEditorState_AddHoles() = delete;
59  delete;
60  explicit PackageEditorState_AddHoles(Context& context) noexcept;
62 
63  // General Methods
64  bool entry() noexcept override;
65  bool exit() noexcept override;
66  QSet<EditorWidgetBase::Feature> getAvailableFeatures()
67  const noexcept override;
68 
69  // Event Handlers
71  QGraphicsSceneMouseEvent& e) noexcept override;
73  QGraphicsSceneMouseEvent& e) noexcept override;
74 
75  // Operator Overloadings
77  const PackageEditorState_AddHoles& rhs) = delete;
78 
79 private: // Methods
80  bool startAddHole(const Point& pos) noexcept;
81  bool finishAddHole(const Point& pos) noexcept;
82  bool abortAddHole() noexcept;
83  void diameterEditValueChanged(const PositiveLength& value) noexcept;
84 
85 private: // Data
86  QScopedPointer<CmdHoleEdit> mEditCmd;
87  std::shared_ptr<Hole> mCurrentHole;
88  std::shared_ptr<HoleGraphicsItem> mCurrentGraphicsItem;
89 
90  // parameter memory
92 };
93 
94 /*******************************************************************************
95  * End of File
96  ******************************************************************************/
97 
98 } // namespace editor
99 } // namespace librepcb
100 
101 #endif
bool finishAddHole(const Point &pos) noexcept
Definition: packageeditorstate_addholes.cpp:165
Definition: packageeditorfsm.h:89
QScopedPointer< CmdHoleEdit > mEditCmd
Definition: packageeditorstate_addholes.h:86
bool entry() noexcept override
Definition: packageeditorstate_addholes.cpp:66
Definition: occmodel.cpp:77
bool exit() noexcept override
Definition: packageeditorstate_addholes.cpp:93
The PackageEditorState_AddHoles class.
Definition: packageeditorstate_addholes.h:52
bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition: packageeditorstate_addholes.cpp:128
std::shared_ptr< Hole > mCurrentHole
Definition: packageeditorstate_addholes.h:87
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:79
bool startAddHole(const Point &pos) noexcept
Definition: packageeditorstate_addholes.cpp:142
PositiveLength mLastDiameter
Definition: packageeditorstate_addholes.h:91
bool abortAddHole() noexcept
Definition: packageeditorstate_addholes.cpp:180
void diameterEditValueChanged(const PositiveLength &value) noexcept
Definition: packageeditorstate_addholes.cpp:194
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition: packageeditorstate_addholes.cpp:116
QSet< EditorWidgetBase::Feature > getAvailableFeatures() const noexcept override
Definition: packageeditorstate_addholes.cpp:106
~PackageEditorState_AddHoles() noexcept
Definition: packageeditorstate_addholes.cpp:58
The PackageEditorState class is the base class of all package editor FSM states.
Definition: packageeditorstate.h:52
PackageEditorState_AddHoles & operator=(const PackageEditorState_AddHoles &rhs)=delete
std::shared_ptr< HoleGraphicsItem > mCurrentGraphicsItem
Definition: packageeditorstate_addholes.h:88