Annotations: Warn if the annotation does not annotate current topology

topo-mov
LEdoian 1 year ago
parent b4d7d730d0
commit f2f6784363

@ -77,8 +77,14 @@ class AnnotatedTopology:
raise ValueError('Annotator fakes its ID!') raise ValueError('Annotator fakes its ID!')
annotation.annotator_id = ann_id annotation.annotator_id = ann_id
for v in annotation.for_vertex: for v in annotation.for_vertex:
if v not in self.topology.vertices:
print(f'WARNING: vertex not in the topology, skipping. {ann_id=}, {v=}')
continue
self.vertex_annotators[v].add(ann_id) self.vertex_annotators[v].add(ann_id)
for e in annotation.for_edge: for e in annotation.for_edge:
if e not in self.topology.edges:
print(f'WARNING: edge not in the topology, skipping. {ann_id=} {e}')
continue
self.edge_annotators[e].add(ann_id) self.edge_annotators[e].add(ann_id)
if annotation.for_topology is not None: if annotation.for_topology is not None:
self.global_annotators.add(ann_id) self.global_annotators.add(ann_id)

Loading…
Cancel
Save