LibrePCB Developers Documentation
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 <optional.hpp>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38
39class BI_Via;
40
41namespace editor {
42
43class BoardGraphicsScene;
44class CmdBoardViaEdit;
45class PositiveLengthEdit;
46
47/*******************************************************************************
48 * Class BoardEditorState_AddVia
49 ******************************************************************************/
50
55 Q_OBJECT
56
57public:
58 // Constructors / Destructor
61 explicit BoardEditorState_AddVia(const Context& context) noexcept;
62 virtual ~BoardEditorState_AddVia() noexcept;
63
64 // General Methods
65 virtual bool entry() noexcept override;
66 virtual bool exit() noexcept override;
67
68 // Event Handlers
70 QGraphicsSceneMouseEvent& e) noexcept override;
72 QGraphicsSceneMouseEvent& e) noexcept override;
74 QGraphicsSceneMouseEvent& e) noexcept override;
75
76 // Operator Overloadings
78 delete;
79
80private: // Methods
81 bool addVia(const Point& pos) noexcept;
82 bool updatePosition(BoardGraphicsScene& scene, const Point& pos) noexcept;
83 void setNetSignal(NetSignal* netsignal) noexcept;
84 bool fixPosition(const Point& pos) noexcept;
85 bool abortCommand(bool showErrMsgBox) noexcept;
86 void sizeEditValueChanged(const PositiveLength& value) noexcept;
87 void drillDiameterEditValueChanged(const PositiveLength& value) noexcept;
88 void applySelectedNetSignal() noexcept;
90 const Point& pos) noexcept;
91 NetSignal* getCurrentNetSignal() const noexcept;
92
93private: // Data
94 // State
97
100
103
106
107 // Information about the current via to place. Only valid if
108 // mIsUndoCmdActive == true.
111
112 // Widgets for the command toolbar
113 QPointer<QComboBox> mNetSignalComboBox;
114};
115
116/*******************************************************************************
117 * End of File
118 ******************************************************************************/
119
120} // namespace editor
121} // namespace librepcb
122
123#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:79
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
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:54
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:99
bool addVia(const Point &pos) noexcept
Definition: boardeditorstate_addvia.cpp:227
void updateClosestNetSignal(BoardGraphicsScene &scene, const Point &pos) noexcept
Definition: boardeditorstate_addvia.cpp:448
bool mClosestNetSignalIsUpToDate
Whether mCurrentNetSignal contains an up-to-date closest net signal.
Definition: boardeditorstate_addvia.h:105
BI_Via * mCurrentViaToPlace
Definition: boardeditorstate_addvia.h:109
virtual ~BoardEditorState_AddVia() noexcept
Definition: boardeditorstate_addvia.cpp:88
void drillDiameterEditValueChanged(const PositiveLength &value) noexcept
Definition: boardeditorstate_addvia.cpp:410
BoardEditorState_AddVia(const BoardEditorState_AddVia &other)=delete
void applySelectedNetSignal() noexcept
Definition: boardeditorstate_addvia.cpp:419
QScopedPointer< CmdBoardViaEdit > mCurrentViaEditCmd
Definition: boardeditorstate_addvia.h:110
bool abortCommand(bool showErrMsgBox) noexcept
Definition: boardeditorstate_addvia.cpp:377
void setNetSignal(NetSignal *netsignal) noexcept
bool mIsUndoCmdActive
Definition: boardeditorstate_addvia.h:95
tl::optional< Uuid > mCurrentNetSignal
The current net signal of the via.
Definition: boardeditorstate_addvia.h:102
Via mLastViaProperties
Definition: boardeditorstate_addvia.h:96
QPointer< QComboBox > mNetSignalComboBox
Definition: boardeditorstate_addvia.h:113
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:402
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:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
Definition: uuid.h:183
FSM Context.
Definition: boardeditorfsm.h:88