Adds link vertex get/set functions to the API

This commit is contained in:
Lew Rossman
2019-10-29 16:33:40 -04:00
parent d5becaf1a0
commit 7aadc83ddf
15 changed files with 297 additions and 32 deletions

View File

@@ -5,7 +5,7 @@ Attribute VB_Name = "Module1"
'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
'(EPANET2.DLL)
'Last updated on 10/26/2019
'Last updated on 10/29/2019
' These are codes used by the DLL functions
Public Const EN_ELEVATION = 0 ' Node parameters
@@ -336,6 +336,9 @@ Public Const EN_R_IS_ACTIVE = 3
Declare Function ENgetlinkvalue Lib "epanet2.dll" (ByVal index As Long, ByVal property As Long, value As Single) As Long
Declare Function ENsetlinkvalue Lib "epanet2.dll" (ByVal index As Long, ByVal property As Long, ByVal value As Single) As Long
Declare Function ENsetpipedata Lib "epanet2.dll" (ByVal index As Long, ByVal length As Single, ByVal diam As Single, ByVal rough As Single, ByVal mloss As Single) As Long
Declare Function ENgetvertexcount Lib "epanet2.dll" (ByVal index As Long, count As Long) As Long
Declare Function ENgetvertex Lib "epanet2.dll" (ByVal index As Long, ByVal vertex As Long, x As Double, y As Double) As Long
Declare Function ENsetvertices Lib "epanet2.dll" (ByVal index As Long, xCoords As Any, yCoords As Any, ByVal count As Long) As Long
'Pump Functions
Declare Function ENgetheadcurveindex Lib "epanet2.dll" (ByVal linkIndex As Long, curveIndex As Long) As Long

View File

@@ -46,7 +46,7 @@ EXPORTS
ENgetlinknodes = _ENgetlinknodes@12
ENsetlinknodes = _ENsetlinknodes@12
ENgetlinktype = _ENgetlinktype@8
ENgetlinkvalue = _ENgetlinkvalue@12
ENgetlinkvalue = _ENgetlinkvalue@12
ENgetnodeid = _ENgetnodeid@8
ENgetnodeindex = _ENgetnodeindex@8
ENgetnodetype = _ENgetnodetype@8
@@ -69,6 +69,8 @@ EXPORTS
ENgettimeparam = _ENgettimeparam@8
ENgettitle = _ENgettitle@12
ENgetversion = _ENgetversion@4
ENgetvertex = _ENgetvertex@16
ENgetvertexcount = _ENgetvertexcount@8
ENinit = _ENinit@16
ENinitH = _ENinitH@4
ENinitQ = _ENinitQ@4
@@ -121,6 +123,7 @@ EXPORTS
ENsetthenaction = _ENsetthenaction@20
ENsettimeparam = _ENsettimeparam@8
ENsettitle = _ENsettitle@12
ENsetvertices = _ENsetvertices@16
ENsolveH = _ENsolveH@0
ENsolveQ = _ENsolveQ@0
ENstepQ = _ENstepQ@4

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 10/26/2019
Last Updated: 10/29/2019
******************************************************************************
*/
@@ -285,6 +285,12 @@ extern "C" {
int DLLEXPORT ENsetpipedata(int index, EN_API_FLOAT_TYPE length,
EN_API_FLOAT_TYPE diam, EN_API_FLOAT_TYPE rough,
EN_API_FLOAT_TYPE mloss);
int DLLEXPORT ENgetvertexcount(int index, int *count);
int DLLEXPORT ENgetvertex(int index, int vertex, double *x, double *y);
int DLLEXPORT ENsetvertices(int index, double *x, double *y, int count);
/********************************************************************

View File

@@ -3,7 +3,7 @@ unit epanet2;
{ Declarations of imported procedures from the EPANET PROGRAMMERs TOOLKIT }
{ (EPANET2.DLL) }
{Last updated on 10/26/19}
{Last updated on 10/29/19}
interface
@@ -353,6 +353,10 @@ const
function ENsetlinkvalue(Index: Integer; Code: Integer; Value: Single): Integer; stdcall; external EpanetLib;
function ENsetpipedata(Index: Integer; Length: Single; Diam: Single; Rough: Single; Mloss:Single): Integer; stdcall; external EpanetLib;
function ENgetvertexcount(Index: Integer; var Count: Integer): Integer; stdcall; external EpanetLib;
function ENgetvertex(Index: Integer; Vertex: Integer; var X: Double; var Y: Double): Integer; stdcall; external EpanetLib;
function ENsetvertices(Index: Integer; X: array of Double; Y: array of Double; Count: Integer): Integer; stdcall; external EpanetLib;
{Pump Functions}
function ENgetpumptype(LinkIndex: Integer; var PumpType: Integer): Integer; stdcall; external EpanetLib;
function ENgetheadcurveindex(LinkIndex: Integer; var CurveIndex: Integer): Integer; stdcall; external EpanetLib;

View File

@@ -4,7 +4,7 @@
'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
'(EPANET2.DLL) for use with VB.Net.
'Last updated on 10/26/2019
'Last updated on 10/29/2019
Imports System.Runtime.InteropServices
Imports System.Text
@@ -341,6 +341,9 @@ Public Const EN_R_IS_ACTIVE = 3
Declare Function ENgetlinkvalue Lib "epanet2.dll" (ByVal index As Int32, ByVal property As Int32, value As Single) As Int32
Declare Function ENsetlinkvalue Lib "epanet2.dll" (ByVal index As Int32, ByVal property As Int32, ByVal value As Single) As Int32
Declare Function ENsetpipedata Lib "epanet2.dll" (ByVal index As Int32, ByVal length As Single, ByVal diam As Single, ByVal rough As Single, ByVal mloss As Single) As Int32
Declare Function ENgetvertexcount Lib "epanet2.dll" (ByVal index As Int32, count As Int32) As Int32
Declare Function ENgetvertex Lib "epanet2.dll" (ByVal index As Int32, ByVal vertex As Int32, x As Double, y As Double) As Int32
Declare Function ENsetvertices Lib "epanet2.dll" (ByVal index As Int32, xCoords As Any, yCoords As Any, ByVal count As Int32) As Int32
'Pump Functions
Declare Function ENgetheadcurveindex Lib "epanet2.dll" (ByVal linkIndex As Int32, curveIndex As Int32) As Int32

View File

@@ -11,7 +11,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 10/26/2019
Last Updated: 10/29/2019
******************************************************************************
*/
@@ -1214,6 +1214,36 @@ typedef struct Project *EN_Project;
int DLLEXPORT EN_setpipedata(EN_Project ph, int index, double length, double diam,
double rough, double mloss);
/**
@brief Retrieves the number of internal vertex points assigned to a link.
@param ph an EPANET project handle.
@param index a link's index.
@param[out] count the number of vertex points that describe the link's shape.
@return an error code.
*/
int DLLEXPORT EN_getvertexcount(EN_Project ph, int index, int *count);
/**
@brief Retrieves the coordinate's of a vertex point assigned to a link.
@param ph an EPANET project handle.
@param index a link's index.
@param vertex a vertex point index.
@param[out] x the vertex's X-coordinate value.
@param[out] y the vertex's Y-coordinate value.
@return an error code.
*/
int DLLEXPORT EN_getvertex(EN_Project ph, int index, int vertex, double *x, double *y);
/**
@brief Assigns a set of internal vertex points to a link.
@param ph an EPANET project handle.
@param index a link's index.
@param x an array of X-coordinates for the vertex points.
@param y an array of Y-coordinates for the vertex points.
@param count the number of vertex points being assigned.
@return an error code.
*/
int DLLEXPORT EN_setvertices(EN_Project ph, int index, double *x, double *y, int count);
/********************************************************************