Changed coordinates are saved to INP
Added a flag which controls the loading of coordinates at epanet.c line 213. When set to TRUE coordinates are loaded and users can use the ENgetcoord and ENsetcoord functions. Changes are then saved when ENsaveinpfile is called. When set to FALSE coordinates are not loaded and can't be retrieved or changed. When saved, the COORD section is copied from the original INP file.
This commit is contained in:
@@ -77,7 +77,11 @@ void saveauxdata(FILE *f) /
|
||||
switch(sect)
|
||||
{
|
||||
case _RULES:
|
||||
case _COORDS:
|
||||
case _COORDS: if (Coordflag == FALSE)
|
||||
{
|
||||
fprintf(f, "%s", line);
|
||||
}
|
||||
break;
|
||||
case _VERTICES:
|
||||
case _LABELS:
|
||||
case _BACKDROP:
|
||||
@@ -92,7 +96,11 @@ void saveauxdata(FILE *f) /
|
||||
switch(sect)
|
||||
{
|
||||
case _RULES:
|
||||
case _COORDS:
|
||||
case _COORDS: if (Coordflag == FALSE)
|
||||
{
|
||||
fprintf(f, "%s", line);
|
||||
}
|
||||
break;
|
||||
case _VERTICES:
|
||||
case _LABELS:
|
||||
case _BACKDROP:
|
||||
@@ -615,6 +623,21 @@ int saveinpfile(char *fname)
|
||||
}
|
||||
fprintf(f, "\n\n");
|
||||
|
||||
/* Write [COORDINATES] section */
|
||||
|
||||
if (Coordflag == TRUE)
|
||||
{
|
||||
fprintf(f, "\n\n[COORDINATES]");
|
||||
for (i=1; i<=Nnodes; i++)
|
||||
{
|
||||
if (Coord[i].HaveCoords == TRUE)
|
||||
{
|
||||
fprintf(f,"\n %-31s %14.6f %14.6f",Node[i].ID,Coord[i].X,Coord[i].Y);
|
||||
}
|
||||
}
|
||||
fprintf(f, "\n\n");
|
||||
}
|
||||
|
||||
/* Save auxilary data to new input file */
|
||||
|
||||
saveauxdata(f);
|
||||
|
||||
Reference in New Issue
Block a user