add ENgetnodesvalues and ENgetlinksvalues methods

This commit is contained in:
Abel Heinsbroek
2024-04-23 11:31:17 +02:00
parent ef234a1919
commit 4dff3bd054
5 changed files with 78 additions and 0 deletions

View File

@@ -2358,6 +2358,26 @@ int DLLEXPORT EN_getnodevalue(EN_Project p, int index, int property, double *val
return 0;
}
int DLLEXPORT EN_getnodesvalues(EN_Project p, int property, double *values)
/*----------------------------------------------------------------
** Input: property = node property code (see EN_NodeProperty)
** Output: values = array of node property values
** Returns: error code
** Purpose: retrieves an array of node property values
**----------------------------------------------------------------
*/
{
int status = 0;
for (int i = 1; i <= p->network.Nnodes; i++)
{
status = EN_getnodevalue(p, i, property, &values[i - 1]);
// if status is not 0, return the error code
if (status != 0) { return status; }
}
return 0;
}
int DLLEXPORT EN_setnodevalue(EN_Project p, int index, int property, double value)
/*----------------------------------------------------------------
** Input: index = node index
@@ -3903,6 +3923,25 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
return 0;
}
int DLLEXPORT EN_getlinksvalues(EN_Project p, int property, double *values)
/*----------------------------------------------------------------
** Input: property = link property code (see EN_LinkProperty)
** Output: values = array of link property values
** Returns: error code
** Purpose: retrieves property values for all links
**----------------------------------------------------------------
*/
{
int status = 0;
for(int i = 1; i <= p->network.Nlinks; i++)
{
status = EN_getlinkvalue(p, i, property, &values[i-1]);
// If an error occurs, return the error code
if(status != 0) { return status; }
}
return 0;
}
int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double value)
/*----------------------------------------------------------------
** Input: index = link index