KiCad PCB EDA Suite
Loading...
Searching...
No Matches
conn_preview.cpp
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
*
6
* This program is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License as published by the
8
* Free Software Foundation, either version 3 of the License, or (at your
9
* option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* 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 <https://www.gnu.org/licenses/>.
18
*/
19
20
#include "
conn_preview.h
"
21
#include "
conn_facade.h
"
22
#include <
sch_item.h
>
23
#include <
sch_screen.h
>
24
#include <
sch_sheet_path.h
>
25
26
namespace
SCH_CONNECTIVITY
27
{
28
PREVIEW_NET_CODES
CapturePreviewNetCodes
(
const
FACADE
& aFacade,
const
SCH_SHEET_PATH
& aPath )
29
{
30
PREVIEW_NET_CODES
result
;
31
SCH_SCREEN
* screen = aPath.
LastScreen
();
32
33
if
( !screen )
34
return
result
;
35
36
result
.reserve( screen->
Items
().
size
() );
37
const
KIID_PATH
&
path
= aPath.
PathRef
();
38
const
auto
capture = [&](
SCH_ITEM
* item )
39
{
40
if
( !item->IsConnectable() )
41
return
;
42
43
const
auto
connection = aFacade.
Connection
( item->m_Uuid,
path
);
44
const
int
code = connection && connection->IsNet() && !connection->IsUnconnected() ? connection->NetCode() : 0;
45
result
.emplace( item, code > 0 ? std::optional<int>( code ) : std::nullopt );
46
};
47
48
for
(
SCH_ITEM
* item : screen->
Items
() )
49
{
50
capture( item );
51
item->RunOnChildren( capture,
RECURSE_MODE::NO_RECURSE
);
52
}
53
54
return
result
;
55
}
56
}
// namespace SCH_CONNECTIVITY
EE_RTREE::size
size_t size() const
Return the number of items in the tree.
Definition
sch_rtree.h:177
KIID_PATH
Definition
kiid.h:174
SCH_CONNECTIVITY::FACADE
Model-owned source resolver.
Definition
conn_facade.h:123
SCH_CONNECTIVITY::FACADE::Connection
std::optional< ITEM_VIEW > Connection(const KIID &aItem, const KIID_PATH &aPath) const
Definition
conn_facade.cpp:1102
SCH_ITEM
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition
sch_item.h:170
SCH_SCREEN
Definition
sch_screen.h:103
SCH_SCREEN::Items
EE_RTREE & Items()
Get the full RTree, usually for iterating.
Definition
sch_screen.h:122
SCH_SHEET_PATH
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Definition
sch_sheet_path.h:246
SCH_SHEET_PATH::LastScreen
SCH_SCREEN * LastScreen()
Definition
sch_sheet_path.cpp:336
SCH_SHEET_PATH::PathRef
const KIID_PATH & PathRef() const
Borrow the cached path until this sheet path is modified or destroyed.
Definition
sch_sheet_path.h:417
conn_facade.h
conn_preview.h
NO_RECURSE
@ NO_RECURSE
Definition
eda_item.h:52
SCH_CONNECTIVITY
Value keys and the key session of the schematic connectivity engine.
Definition
conn_auxiliary.cpp:28
SCH_CONNECTIVITY::PREVIEW_NET_CODES
std::unordered_map< const SCH_ITEM *, std::optional< int > > PREVIEW_NET_CODES
Definition
conn_preview.h:32
SCH_CONNECTIVITY::CapturePreviewNetCodes
PREVIEW_NET_CODES CapturePreviewNetCodes(const FACADE &aFacade, const SCH_SHEET_PATH &aPath)
Owned local net assignments for advisory drag feedback; unavailable rows remain unknown.
Definition
conn_preview.cpp:28
sch_item.h
sch_screen.h
sch_sheet_path.h
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
path
std::string path
Definition
test_kibis.cpp:99
result
wxString result
Test unit parsing edge cases and error handling.
Definition
test_text_eval_numeric_compat.cpp:598
src
eeschema
connectivity
conn_preview.cpp
Generated on Sat Sep 19 2026 00:07:04 for KiCad PCB EDA Suite by
1.13.2