KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_drag_net_collision.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 * Copyright (C) 2025 VUT Brno, Faculty of Electrical Engineering and Communication
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef KICAD_SCH_DRAG_NET_COLLISION_H
22#define KICAD_SCH_DRAG_NET_COLLISION_H
23
24#include <cstddef>
25#include <optional>
26#include <unordered_map>
27#include <vector>
28#include <memory>
29
30#include <gal/cursors.h>
31#include <math/vector2d.h>
32#include <sch_sheet_path.h>
33
34class SCH_EDIT_FRAME;
35class SCH_ITEM;
36class SCH_JUNCTION;
37class SCH_SELECTION;
38
39namespace KIGFX
40{
41class VIEW;
42class VIEW_OVERLAY;
43}
44
51{
52public:
55
56 void Initialize( const SCH_SELECTION& aSelection );
57
58 bool Update( const std::vector<SCH_JUNCTION*>& aJunctions, const SCH_SELECTION& aSelection );
59
60 void Reset();
61
62 KICURSOR AdjustCursor( KICURSOR aBaseCursor ) const;
63
64private:
66 {
68 double radius;
69 };
70
77
85
86 std::optional<COLLISION_MARKER> analyzeJunction( SCH_JUNCTION* aJunction,
87 const SCH_SELECTION& aSelection ) const;
88
89 void recordItemNet( SCH_ITEM* aItem );
90 void recordOriginalConnections( const SCH_SELECTION& aSelection );
91 std::vector<DISCONNECTION_MARKER> collectDisconnectedMarkers( const SCH_SELECTION& aSelection ) const;
92
93 void ensureOverlay();
94 void clearOverlay() const;
95
96private:
99 std::shared_ptr<KIGFX::VIEW_OVERLAY> m_overlay;
100 std::unordered_map<const SCH_ITEM*, std::optional<int>> m_itemNetCodes;
102 std::vector<ORIGINAL_CONNECTION> m_originalConnections;
104};
105
106#endif // KICAD_SCH_DRAG_NET_COLLISION_H
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:63
std::vector< ORIGINAL_CONNECTION > m_originalConnections
std::vector< DISCONNECTION_MARKER > collectDisconnectedMarkers(const SCH_SELECTION &aSelection) const
std::optional< COLLISION_MARKER > analyzeJunction(SCH_JUNCTION *aJunction, const SCH_SELECTION &aSelection) const
std::unordered_map< const SCH_ITEM *, std::optional< int > > m_itemNetCodes
bool Update(const std::vector< SCH_JUNCTION * > &aJunctions, const SCH_SELECTION &aSelection)
void recordOriginalConnections(const SCH_SELECTION &aSelection)
KICURSOR AdjustCursor(KICURSOR aBaseCursor) const
std::shared_ptr< KIGFX::VIEW_OVERLAY > m_overlay
SCH_DRAG_NET_COLLISION_MONITOR(SCH_EDIT_FRAME *aFrame, KIGFX::VIEW *aView)
void Initialize(const SCH_SELECTION &aSelection)
Schematic editor (Eeschema) main window.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:165
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
KICURSOR
Definition cursors.h:40
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:30
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683