/// <summary> /// Remove this object from all connected anchors /// </summary> public void ClearNodes() { foreach (Node node in ConnectedNodes) { node.ConnectedElements.Remove(this); // Remove the anchor from the node } ConnectedNodes.Clear(); }
/// <summary> /// Splits this island across the /// specified field. This island will contain /// the field's parent node, while the returned island /// will contain the connected node. Note that this /// does not gurantee that the island will be split /// into two pieces (if the nodes are still connected). /// </summary> /// <returns>The newly created island</returns> public Island Split(Field field) { var parent = field.ParentNode; var connected = field.ConnectedNode; // Find all current connections with the parent node ConnectedNodes.Clear(); _connectedFields.Clear(); FindConnected(parent, ConnectedNodes, _connectedFields); // Find all current connections with the connected node var splitNodes = new HashSet <Node>(); var splitFields = new HashSet <Field>(); FindConnected(connected, splitNodes, splitFields); // Return the island containing the connected node return(new Island(splitNodes, splitFields)); }
/// <summary> /// /// </summary> public void RemoveAllConnections() { ConnectedNodes.Clear(); }