Community of VE/MapPoint 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 ...
| |||||||
| 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 Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
| |||
|
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 Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
| |||
| Quote:
|
![]() |
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 |
Flights from Edinburgh
Book flights from Edinburgh to exotic destinations all over the globe. Holiday Hypermarket will search for the latest great deals, so you don't have to.
Portugal Holidays
Find great Portugal Holidays with Travel Counsellors. A personal Travel Counsellor can help you plan the perfect holiday to Portugal.
Holidays Italy
Book your holidays in Italy. Italy has a great climate and the beaches to go with it. Book a great deal for great value online at dealchecker.co.uk.
Antigua Holidays
We have the most popular Antigua holidays at highly competitive prices at The Holiday Place. Book a break in sunny Antigua today.
Portugal
As well as providing some great weather Portugal has much to offer culturally. There are numerous museums, monuments and places of historical interest to explore. Despite the rich history there is a buzzing nightlife and great shopping too.
Travel
Before making a choice regarding travel, check out the amazing variety of options on Travel.co.uk.
Gran Canaria Holidays
Visit the Canary Islands! See information on Gran Canaria holidays at On The Beach!