List of points in VB.net issue
Hi Mike,
i have a question about the correct syntax of the GM_LineFeature_t and the GM_AreaFeature_t types, in VB.Net, concerning the mPointList.
Should the mPointList be declared as
1. Public mPointList as IntPtr or
2. Public mPointList() as GM_Point_t.
Of course if someone else (except Mike) is able to create (Poly)lines and Areas in VB.net, is more than welcome to answer.
Thanks in advance.
i have a question about the correct syntax of the GM_LineFeature_t and the GM_AreaFeature_t types, in VB.Net, concerning the mPointList.
Should the mPointList be declared as
1. Public mPointList as IntPtr or
2. Public mPointList() as GM_Point_t.
Of course if someone else (except Mike) is able to create (Poly)lines and Areas in VB.net, is more than welcome to answer.
Thanks in advance.
Comments
-
Hi Mike,
dont bother to reply to me, since i found the answer to my problem.
The real question was, how to find the address of the first array elent in vb.net and vice versa. This is the reason why i started this discussion and i wanted to start from the definitions.
At the same time i was trying to find out the solution, so i post it in case someone else has the some question.
The correct definition of the mPointList is the "Public mPointList as IntPtr".
In order to find the address of the first array element the following lines should be used:
Declare Sub RtlMoveMemory Lib "kernel32" (ByVal hpvDest As IntPtr, _
ByRef hpvSource As gm_point_t, ByVal cbCopy As Integer)
dim theptr as intptr
theptr = marshal.allochglobal(n*16) ,where n is the number of points
Call RtlMoveMemory(theptr, pointlist(0), n *16)
If someone wants the oposite then:
Declare Sub RtlMoveMemory Lib "kernel32" (ByRef hpvDest As gm_point_t, _
ByVal hpvSource As IntPtr, ByVal cbCopy As Integer)
Dim pointlist() As gm_point_t
ReDim pointlist(0 to n - 1)
Call RtlMoveMemory(pointlist(0), theptr, n * 16).
Thats all.
Categories
- 13K All Categories
- 5.8K Features Discussion
- 350 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 652 GM Script Language
- 56 User Scripts
- 115 GPS Features
- 421 Projection Questions
- 837 Raster Data
- 1.4K Vector Data
- 6.7K Support
- 182 Announcement and News
- 943 Bug Report
- 562 SDK
- 1.2K Suggestion Box
- 3.8K Technical Support
- 581 Other Discussion
- 132 GIS Data Sources
- 27 Global Mapper Showcase
- 245 How I use Global Mapper
- 111 Global Mapper Forum Website
