Merge pull request #478 from eladsal/473

For "conditional" do not delete a node connected to a link
This commit is contained in:
Elad Salomons
2019-05-08 16:56:23 +03:00
committed by GitHub
2 changed files with 4 additions and 4 deletions

View File

@@ -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

View File

@@ -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")