Circumference of a geoFreeform or Polygon

DRZ400
03-27-2008, 06:54 PM
Hi everyone,

I have a problem that my ambition outweighs my abilities by a considerable margin.

What I want to do is obtain the same value as the "shapes" "SizeVisible" value but apparently reading this forum this isn't available. :48v:

Reading Johns post (below) bit seems it is possible from reading the "shapes" vertices and using the distance method????

I'm really not sure how to deal with vertices if anyone can help.

I'm using MP2004 and VB6 ... any information would be greatly appreciated.

Cheers
Phil

#4 (http://www.mapforums.com/8087-post4.html) (permalink (http://www.mapforums.com/polyline-size-3289.html#post8087)) http://www.mapforums.com/images/buttons/report.gif (http://www.mapforums.com/report.php?p=8087)
http://www.mapforums.com/images/statusicon/post_old.gif 09-28-2004
http://www.mapforums.com/avatars/john-meyer.gif?dateline=2006 (http://www.mapforums.com/john-meyer-member.html)John Meyer (http://www.mapforums.com/john-meyer-member.html) http://www.mapforums.com/images/statusicon/user_offline.gif
Senior Member
Blue Belt
Join Date: Jul 2002
Posts: 479


The value does not appear to be available via the object model. You can get the value yourself using the Distance method.

DRZ400
03-28-2008, 05:47 PM
Hi all,

I've figured it out with the help of all the info on this forum. Here's my vb6 code, I hope it saves someone else of 2 days of hell!! :)

Here's the bit that calculates distance between all the vertices for the selected freeform shape.


Dim curshape As Integer
Dim objLoc1 As MapPointCtl.Location
Dim objLoc2 As MapPointCtl.Location
Set obj1 = objMap.Selection
'curshape = obj1.Name
n = UBound(obj1.Vertices)
dist = 0
i = 0
Text6.Text = 0
For i = 0 To (n - 1) ' loop through all the points
Set objLoc1 = obj1.Vertices(i)
Set objLoc2 = obj1.Vertices(i + 1)
dist = dist + objMap.Distance(objLoc1, objLoc2)

Next i
' calculate the distance from the end point back to the start point
Set objLoc1 = obj1.Vertices(0)
Set objLoc2 = obj1.Vertices(i)
dist = dist + objMap.Distance(objLoc1, objLoc2)
Text6.Text = Int(dist)
obj1.SizeVisible = True


It's not the best code as I'm not that good but it works and I'm chuffed!!!

Time for a beer!

Cheers
Phil

 
Web mp2kmag.com
mapforums.com