Community of MapPoint and Virtual Earth Users and Developers
This is a discussion on Determine if a polyline is closed? within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Shapes.addPolyline method says "To add a closed polygon, use the same Location object for the first and last items in ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Determine if a polyline is closed? However, is there any way in the API to determine if a shape of type "geoFreeform" is closed or not? The vertices property does not use the same Location object for the first and last items in the array even if it is closed. |
| ||||
|
You could compare the settings in the two Location objects. Eg. is it a street address? If so, do they match? Are they positioned by coordinates? If so, do they match? You could also use Gilles code (on this website) that finds the longitude and latitude of any Location object. You will have to be careful with rounding errors and decide on a tolerance value for comparing - a simple, are they equal? does not working with floating point numbers. Eg. is lat1 == lat2? Should really use the check lat1>(lat2-EPS) AND lat1<(lat2+EPS) EPS should be very small - this is your tolerance value. Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools See the Geoweb Guru for online mapping |
| |||
|
I'm not sure if I have explained the problem clearly based on your response. Say you draw a closed triangle manually with the drawing tools. This means it has 3 vertices. This can easliy be done programatically as well. You create 3 location objects. Then use Shapes.AddPolyline, passing in the array of locations, which is size 4--the first location object is also repeated as the fourth location object. This tells mappoint to close the polygon (triangle). Easy enough. If you don't repeat the first location object in the fourth position, the triangle would not be closed. Now, say you want programmatically determine in the code if this same triangle is closed: 1. Get the triangle from the Shapes Collection. 2. Get the array of location from the vertices property. 3. Here's the problem: The vertices array does not repeat the first location object if the polygon is closed. Therefore there is no way to distinguish this from a polygon that is open. |
| ||||
|
Sorry, I thought you meant the first and last location objects were physically different. It is possible for them to be different objects in different places in memory with the same internal contents - and my answer determines if that is the case. Are these shapes drawn by your program? If so, you could name them and include a code in the name to say "open" or "closed". A bit kludgy but it would work. Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools See the Geoweb Guru for online mapping |
| |||
| Quote:
|
![]() |
| Tags |
| closed, determine, polyline |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Determine if Map has been closed | BirdIslander | MapPoint 2006/2009 Discussion | 1 | 12-07-2005 01:33 PM |
| MapPoint Gets closed on its own | Anonymous | MapPoint 2006/2009 Discussion | 11 | 01-09-2005 04:52 AM |
| If I draw a closed shape around some pushpins, and.... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 03-09-2002 10:48 PM |
| Export to Excel works from 'closed shapes'. Is i.... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 03-04-2002 09:54 AM |
| Is there a way to determine the minimum distance b.... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 01-22-2002 04:45 AM |
Algarve Holiday
Portuguese all year round sunshine is some of what awaits you if you choose the Algarve holiday option through UlookUbook!