Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 5 of 5

Shape Bug in MP 2006

This is a discussion on Shape Bug in MP 2006 within the MapPoint Desktop Discussion forums, part of the Map Forums category; I think I've found a bug in MapPoint 2006 when reading freeform/polyline shapes. These shapes are marked as 'closed' (ie. ...

  1. #1
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Shape Bug in MP 2006

    I think I've found a bug in MapPoint 2006 when reading freeform/polyline shapes. These shapes are marked as 'closed' (ie. a polygon rather than a polyline) when the first location is repeated at the end. That works well when creating a new shape, but I've found that the repeated location is not returned when you query the vertices of a shape.

    Unless I'm having an end-of-day brain melt, I can't see a way of detecting if a shape is closed or not. (which is what I'm trying to do at the moment)

    Here's some sample C# code to demonstrate what I mean. It creates a closed quadrilateral. This requires 5 vertices because the first location (loc1) is repeated at the end. It displays correctly. The vertices (locations) are queried through the Shape.Vertices property. This returns an array of Location objects. Only four locations are returned. I've checked the coordinates - each is represented once only. No duplication.

    Code:
    // Test locations
    MapPoint.Location loc1 = myMap.GetLocation(30.0, -90.0, 100);
    MapPoint.Location loc2 = myMap.GetLocation(35.0, -90.0,100);
    MapPoint.Location loc3 = myMap.GetLocation(35.0, -95.0,100);
    MapPoint.Location loc4 = myMap.GetLocation(30.0, -95.0,100);
    
    // Create a closed quadrilateral
    MapPoint.Shape shp = myMap.Shapes.AddPolyline(new MapPoint.Location[] { loc1, loc2, loc3, loc4, loc1 });
    
    // Query the shape
    object[] vertices = shp.Vertices as object[];
    
    MessageBox.Show("No. of vertices=" + Convert.ToString(vertices.Length));

    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  2. #2
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4

    Re: Shape Bug in MP 2006

    I was investigating this some about six months ago... I couldn't find a way to tell whether it was closed or not.

    For our purposes at the time, ultimately it did not matter as we always wanted it to be closed, so we could always read off the coordinates and when re-rendering the polygon we would always close it.

    But it was still a little disturbing not to be able to detect whether an existing polygon is closed or not.

    Eric
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  3. #3
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: Shape Bug in MP 2006

    One of those aarghs!

    So far, it is implicitly assumed in MPSuperShape that a selected shape is closed. However a new export option can export lines as well as closed shapes. I'm going to have to assume they're closed, for now.

    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  4. #4
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4

    Re: Shape Bug in MP 2006

    It seems like there's got to be something we're overlooking..

    How about the Fill Property? It is read only. Is it always set if the polygon is closed and not if it's not closed?

    "Returns a FillFormat object that contains the fill color and visibility properties for the specified shape. Read-only."

    Or how about the Type Property? Does it change from geoLine to geoFreeform depending on whether or not it's closed?

    "Returns the data type for the specified Shape object. Read-only GeoShapeType."
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  5. #5
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: Shape Bug in MP 2006

    No Type doesn't do it - my code (or at the very least diagnostics) would have picked that up.
    My test data had lines and freeforms. Some of the freeforms were closed, some were not.
    Note that the lines only have a start & end - they are not polylines.

    The Fill object must be there for open freeforms, otherwise my code would throw an exception!
    A transparent fill doesn't make difference. After all a transparent fill is still valid for a closed shape.


    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Move Shape - get new lat lon.
    By tfmiltz in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 11-09-2007, 09:51 AM
  2. Selecting a Shape by Name in C#
    By Winwaed in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 04-17-2007, 06:45 AM
  3. Shape coordinates
    By MarkStanley in forum MapPoint Desktop Discussion
    Replies: 13
    Last Post: 03-04-2007, 04:57 AM
  4. Difference between MapPoint 2006 and MapPoint 2006 Fleet
    By jlewis in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 11-21-2006, 09:18 AM
  5. Does an object reside in my Shape or Shape boundaries?
    By hotrdd in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-04-2005, 10:51 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85