Coordinates are passed to and from MapViewer as arrays of doubles or longs with alternating X and Y coordinates. For example, the triangle specified by the coordinates (x1,y1), (x2,y2), (x3,y3) would be passed in an array with the elements arranged like so: x1,y1,x2,y2,x3,y3. MapViewer is flexible about the dimension of the array so long as the X and Y coordinates are contiguous (no empty elements) and alternating. To use arrays in MapViewer from within VB:
Singly dimensioned array:
Dim coordinates(1 to 6) As Double
coordinates(1)=x1
coordinates(2)=y1
coordinates(3)=x2
coordinates(4)=y2
coordinates(5)=x3
coordinates(6)=y3
Doubly dimensioned array:
Dim Points(1 To 2,1 To NumPoints) As Double
Points(1,1) = x1: Points(2,1) = y1
Points(1,2) = x2: Points(2,2) = y2
Points(1,3) = x3: Points(2,3) = y3
The first dimension is used for the X and Y coordinate, the second dimension refers to the vertex index.
You can use the Array statement for initialization, and then copy the results to a double array:
coordinates = Array(x1,y1,x2,y2,x3,y3)
dim Points(1 to 6) As Double
For i=1 to 6
Points(i) = coordinates(i)
Next
See Also