SILICON
Loading...
Searching...
No Matches
diagramSceneEdit.hpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2026. Giulio Cocconi
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include <cstdint>
21#include <utility>
22#include <vector>
23
24#include <QPointF>
26
27namespace SILICON::ui {
28
30 uint64_t uiId;
31 QPointF before;
32 QPointF after;
33};
34
36 uint64_t uiId;
37 std::vector<QPointF> before;
38 std::vector<QPointF> after;
39};
40
41enum class WireDragKind { Bend, Edge, Endpoint };
42
44 struct NetState {
45 uint64_t routeId;
47 };
58 using ContactList = std::vector<WireManager::ExplicitContact>;
59
60 uint64_t segmentId = 0;
63 std::vector<TopologyChange> topologyChanges;
64 std::vector<NetChange> netChanges;
65
67 [[nodiscard]] bool changesTopology() const
68 {
69 return segmentId && (!beforeContacts.empty() || !afterContacts.empty()
70 || !topologyChanges.empty() || !netChanges.empty());
71 }
72
77 [[nodiscard]] const ContactList& contacts(const bool useAfter) const
78 {
79 return useAfter ? afterContacts : beforeContacts;
80 }
81};
82
83} // namespace SILICON::ui
std::vector< TopologyChange > topologyChanges
bool changesTopology() const
Returns whether a segment edit records contact, topology, or net changes.
const ContactList & contacts(const bool useAfter) const
Borrows the contact snapshot selected for undo or redo.
std::vector< NetChange > netChanges
std::vector< WireManager::ExplicitContact > ContactList
std::vector< QPointF > before
std::vector< QPointF > after