public bool TryGetNodeIndex([NotNull] IPoint point, out int index) { if (AreaOfInterest != null && GeometryUtils.Disjoint(AreaOfInterest, point)) { index = -1; return(false); } Node node = CreateNode(point); return(NodeIndexesByNode.TryGetValue(node, out index)); }
public void RemoveNodeAt([NotNull] IPoint point) { Node node = CreateNode(point); int nodeIndex; if (!NodeIndexesByNode.TryGetValue(node, out nodeIndex)) { return; } // instead of removing the node (and updating all the lists), make it a dead-end -> set node to null as well? Nodes[nodeIndex] = null; Connections[nodeIndex].Clear(); // Check if it is an interior node, remove from the interior list, if it is in the list foreach (List <int> interiorNodes in EdgeInteriorNodesByEdge.Values) { interiorNodes.Remove(nodeIndex); } NodeIndexesByNode.Remove(node); }