LibrePCB Developers Documentation
Loading...
Searching...
No Matches
boardeditorstate_addvia.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_ADDVIA_H
21#define LIBREPCB_EDITOR_BOARDEDITORSTATE_ADDVIA_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "boardeditorstate.h"
27
29
30#include <QtCore>
31
32#include <memory>
33#include <optional>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39
40class BI_Via;
41
42namespace editor {
43
44class BoardGraphicsScene;
45class CmdBoardViaEdit;
46class PositiveLengthEdit;
47
48/*******************************************************************************
49 * Class BoardEditorState_AddVia
50 ******************************************************************************/
51
56 Q_OBJECT
57
58public:
59 // Constructors / Destructor
62 explicit BoardEditorState_AddVia(const Context& context) noexcept;
63 virtual ~BoardEditorState_AddVia() noexcept;
64
65 // General Methods
66 virtual bool entry() noexcept override;
67 virtual bool exit() noexcept override;
68
69 // Event Handlers
71 QGraphicsSceneMouseEvent& e) noexcept override;
73 QGraphicsSceneMouseEvent& e) noexcept override;
75 QGraphicsSceneMouseEvent& e) noexcept override;
76
77 // Operator Overloadings
79 delete;
80
81private: // Methods
82 bool addVia(const Point& pos) noexcept;
83 bool updatePosition(BoardGraphicsScene& scene, const Point& pos) noexcept;
84 void setNetSignal(NetSignal* netsignal) noexcept;
85 bool fixPosition(const Point& pos) noexcept;
86 bool abortCommand(bool showErrMsgBox) noexcept;
87 void sizeEditValueChanged(const PositiveLength& value) noexcept;
88 void drillDiameterEditValueChanged(const PositiveLength& value) noexcept;
89 void applySelectedNetSignal() noexcept;
91 const Point& pos) noexcept;
92 NetSignal* getCurrentNetSignal() const noexcept;
93
94private: // Data
95 // State
98
101
104
107
108 // Information about the current via to place. Only valid if
109 // mIsUndoCmdActive == true.
112
113 // Widgets for the command toolbar
114 QPointer<QComboBox> mNetSignalComboBox;
115};
116
117/*******************************************************************************
118 * End of File
119 ******************************************************************************/
120
121} // namespace editor
122} // namespace librepcb
123
124#endif
The BI_Via class.
Definition bi_via.h:44
The NetSignal class.
Definition netsignal.h:50
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 Via class represents a via of a board.
Definition via.h:52
The "add via" state/tool of the board editor.
Definition boardeditorstate_addvia.h:55
virtual bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_addvia.cpp:201
bool mUseAutoNetSignal
Whether the net signal is determined automatically or not.
Definition boardeditorstate_addvia.h:100
bool addVia(const Point &pos) noexcept
Definition boardeditorstate_addvia.cpp:227
void updateClosestNetSignal(BoardGraphicsScene &scene, const Point &pos) noexcept
Definition boardeditorstate_addvia.cpp:447
bool mClosestNetSignalIsUpToDate
Whether mCurrentNetSignal contains an up-to-date closest net signal.
Definition boardeditorstate_addvia.h:106
BI_Via * mCurrentViaToPlace
Definition boardeditorstate_addvia.h:110
virtual ~BoardEditorState_AddVia() noexcept
Definition boardeditorstate_addvia.cpp:88
void drillDiameterEditValueChanged(const PositiveLength &value) noexcept
Definition boardeditorstate_addvia.cpp:409
std::optional< Uuid > mCurrentNetSignal
The current net signal of the via.
Definition boardeditorstate_addvia.h:103
BoardEditorState_AddVia(const BoardEditorState_AddVia &other)=delete
void applySelectedNetSignal() noexcept
Definition boardeditorstate_addvia.cpp:418
bool abortCommand(bool showErrMsgBox) noexcept
Definition boardeditorstate_addvia.cpp:376
void setNetSignal(NetSignal *netsignal) noexcept
bool mIsUndoCmdActive
Definition boardeditorstate_addvia.h:96
Via mLastViaProperties
Definition boardeditorstate_addvia.h:97
QPointer< QComboBox > mNetSignalComboBox
Definition boardeditorstate_addvia.h:114
std::unique_ptr< CmdBoardViaEdit > mCurrentViaEditCmd
Definition boardeditorstate_addvia.h:111
virtual bool exit() noexcept override
Definition boardeditorstate_addvia.cpp:186
bool updatePosition(BoardGraphicsScene &scene, const Point &pos) noexcept
Definition boardeditorstate_addvia.cpp:264
NetSignal * getCurrentNetSignal() const noexcept
Definition boardeditorstate_addvia.cpp:484
bool fixPosition(const Point &pos) noexcept
Definition boardeditorstate_addvia.cpp:279
virtual bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_addvia.cpp:210
void sizeEditValueChanged(const PositiveLength &value) noexcept
Definition boardeditorstate_addvia.cpp:401
virtual bool entry() noexcept override
Definition boardeditorstate_addvia.cpp:95
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked(QGraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_addvia.cpp:218
The board editor state base class.
Definition boardeditorstate.h:59
The BoardGraphicsScene class.
Definition boardgraphicsscene.h:77
The CmdBoardViaEdit class.
Definition cmdboardviaedit.h:49
Definition occmodel.cpp:76
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
Definition uuid.h:186
FSM Context.
Definition boardeditorfsm.h:88