From 718f853d028c3f9bb2e379d87f506778ce4132b5 Mon Sep 17 00:00:00 2001 From: napakalas Date: Tue, 5 Aug 2025 12:33:54 +1200 Subject: [PATCH] Include cuff nerve feature in path_nerve_ids and path_node_ids for no-centreline map (#150). --- mapmaker/routing/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mapmaker/routing/__init__.py b/mapmaker/routing/__init__.py index 3b9d1fc3..7e689db1 100644 --- a/mapmaker/routing/__init__.py +++ b/mapmaker/routing/__init__.py @@ -1108,7 +1108,7 @@ def get_centreline_from_containing_features(start_dict, end_dict, feature_ids: s tmp_edge_dicts[(n,s)] = edge_dict if len(candidates) > 0: new_direct_edges.update([min(candidates, key=candidates.get)]) # type: ignore - elif ((p_dict:=connectivity_graph.nodes[prev_node])['type'] == 'feature' and + elif ((p_dict:=connectivity_graph.nodes[prev_node])['type'] == 'feature' and (n_dict:=connectivity_graph.nodes[node])['type'] == 'feature'): if ((pf:=list(p_dict.get('features'))[0].id) in route_graph.nodes and (nf:=list(n_dict.get('features'))[0].id) in route_graph.nodes): @@ -1376,6 +1376,10 @@ def set_properties_from_feature_id(feature_id: str): route_graph.add_node(node_0, type='terminal') route_graph.add_node(node_1, type='terminal') route_graph.add_edge(node_0, node_1, type='terminal', **debug_properties) + for node in (node_0, node_1): + if (f:=self.__flatmap.get_feature(node)) and f.get_property('type')=='nerve': + path_nerve_ids.add(node) + path_node_ids.add(node) else: upstream_node = node_0 if terminal_graph.nodes[node_0].get('upstream') else node_1 route_graph.nodes[upstream_node]['type'] = 'upstream'