Hi Mike,
You could also choose to incorporate the information on the SW, NE etc corners in your
custom type:
Type T_NODE
fLong As Float
fLat As Float
'other information ?
End Type
Type T_POLYGON
nSW As Integer
nSE As Integer
nNE As Integer
nNW As Integer
'and more
arrNodes() As T_NODE
End Type
Now you only have to send your variable of type T_POLYGON to your procedures and
functions, and it will contain all nessessary information.
You could even build these procedures to fill the array, and to convert the array to a
polygon etc.
Sub Main
Dim tpPolygon As T_POLYGON,
oSel As Object
If POLYLoadNodesFromObject(oSel, tpPolygon) Then
'**Now the nodes from the polygon is stored in your type
End if
'**Now it's up to you
End Sub
Function POLYLoadNodesFromObject(ByVal oPolygon As Object, tpPolygon As T_POLYGON) As
Logical
POLYLoadNodesFromObject = FALSE
'**Here you put your code for looping thru the polygon
'**Here you put the code for updating the other information on your T_POLYGON
POLYLoadNodesFromObject = TRUE
End Function
So in the end, you are almost doing OOP in MapMasic ... kind of ;-)
I hope this might give you some inspiration,
Peter Horsb�ll M�ller
GIS Developer
Geographical Information & IT
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
Tel +45 6311 4900
Direct +45 6311 4908
Mob +45 5156 1045
Fax +45 6311 4949
E-mail [EMAIL PROTECTED]
http://www.cowi.dk
-----Original Message-----
From: Cummings, Mike [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 20, 2004 1:34 AM
To: [EMAIL PROTECTED]
Subject: MI-L Getting information out of array.
I'm re-writing a procedure that "finds" the corners of a polygon and stores the node
information into a custom type array. So, the first node's information is in the
first entry in the array, second with the second and the last in the last. I haven't
had a lot of experience working with arrays. Some insight would be helpful. I
haven't been able to figure out/find the best way to get to the node information for
the node in the southwest corner?
OR in other words, how do I find X, where: array(X).corner="SW"
When I wrote the code the first time, I defined 9 variables as integers (like SW).
Then cycled through the nodes, if the node was the southwest corner; then SW was
assigned the value of the node number. So, to find the latitude of the southwest
corner: array(SW).Latitude.
I would like to get away from global variables, having a bunch of variables and dim
statements, and be able to pass values with call
commands.
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe,
e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11849