Global Mapper Pro Coming Soon

GM_CalcEnclosedArea

hany m. magdyhany m. magdy Global Mapper UserPosts: 15
edited July 2009 in SDK
This function is always return 0.
LastGMError = GlobalMapperDLL.GM_CalcEnclosedArea(point, Int32.Parse(point.Length.ToString()), new GM_Projection_t(), out Area);

point is list of points of type GM_Point_t,
Area is double

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited July 2009
    I see a couple of potential problems. First of all the second parameter should just be an integer of the number of points in your 'point' list. It looks like you are doing some kind of strange string conversion rather than just passing in the number.

    Second, the 3rd parameter should define the projection that the points you are providing are in. You are just providing a new uninitialized GM_Projection_t structure. You need to either pass NULL if your points are in the currently defined projection, or you need to define the projection that the points are in via a GM_Projection_t structure and pass that in.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • hany m. magdyhany m. magdy Global Mapper User Posts: 15
    edited July 2009
    Hi Mike

    first the code you don't understand Int32.Parse(point.Length.ToString()) is return the length of the point,
    Second when i pass null in third parameter it get a build error.

    i use VS2008 C#

    Thanks
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited July 2009
    I can see how the length works, although it seems like just a call to point.Length would work without converting to a string and then back to an integer.

    What does your GM_CalcEnclosedArea declaration look like? If you define the 3rd parameter as an IntPtr then you can pass NULL. Otherwise you will need to setup the GM_Projection_t structure to define the projection of your coordinates.What are the projection of the points you are passing in by the way?

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • hany m. magdyhany m. magdy Global Mapper User Posts: 15
    edited July 2009
    Mike

    Thanks it's work good

    Hany
Sign In or Register to comment.