For "conditional" do delete a node connected to a link
For "conditional" deletion the node is deleted only if all of its links have been explicitly deleted beforehand #473 Co-Authored-By: Lew Rossman <lrossman@outlook.com>
This commit is contained in:
@@ -1867,16 +1867,15 @@ int DLLEXPORT EN_deletenode(EN_Project p, int index, int actionCode)
|
||||
// Can't delete a water quality trace node
|
||||
if (index == p->quality.TraceNode) return 260;
|
||||
|
||||
// Count number of simple & rule-based controls that contain the node
|
||||
// Do not delete a node contained in a control or is connected to a link
|
||||
if (actionCode == EN_CONDITIONAL)
|
||||
{
|
||||
actionCode = incontrols(p, NODE, index);
|
||||
if (incontrols(p, NODE, index)) return 261;
|
||||
for (i = 1; i <= net->Nlinks; i++)
|
||||
{
|
||||
if (net->Link[i].N1 == index ||
|
||||
net->Link[i].N2 == index) actionCode += incontrols(p, LINK, i);
|
||||
net->Link[i].N2 == index) return 259;
|
||||
}
|
||||
if (actionCode > 0) return 261;
|
||||
}
|
||||
|
||||
// Get a reference to the node & its type
|
||||
|
||||
@@ -54,6 +54,7 @@ DAT(253,"nonexistent demand category")
|
||||
DAT(254,"node with no coordinates")
|
||||
DAT(257,"nonexistent rule")
|
||||
DAT(258,"nonexistent rule clause")
|
||||
DAT(259,"attempt to delete a node that still has links connected to it")
|
||||
DAT(260,"attempt to delete node assigned as a Trace Node")
|
||||
DAT(261,"attempt to delete a node or link contained in a control")
|
||||
DAT(262,"attempt to modify network structure while solver is active")
|
||||
|
||||
Reference in New Issue
Block a user