Global Mapper v25.0

GM_GetLayerInfo and GM_SetLayerInfo

K. Osei-Agyemang
K. Osei-Agyemang Global Mapper User
edited May 2008 in Vector Data
I was wondering why there is no method for setting some attributes of a layer. I was hoping to set a value in a layer so that whenever I save to a GlobalMapper package and reload it, I will know which layer is which.

I was expecting SetLayerInfo. Since it doesnt exist, is there a way by which I can mark a layer so that whenever I save and reload, I will know that this layer is,say, my contour layer and that one is my property layer.

Comments

  • global_mapper
    global_mapper Administrator
    edited March 2008
    You can always open the Overlay Control Center, right-click on a layer, then select the option to change the layer's description. That description should be saved in the package file to allow easy identification of the layer when you load the package file back up.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • K. Osei-Agyemang
    K. Osei-Agyemang Global Mapper User
    edited March 2008
    That is exactly the kind of solution that came to my mind. Set the layer's description to whatever you want.
    I must however say that while it is possible to do this in the Global Mapper application, I don't know how this is done in the SDK which is what I am using. The only place I find the Description of a layer is when you get the GM_LayerInfo structure by calling

    GM_GetLayerInfo

    The problem is I cannot change the Description of this structure to make it reflect in the layer because the pointer returned is a const pointer.
    If there were a GM_SetLayerInfo method or GM_SetLayerDescription method, then my problem would be solved.

    Is there any other way to do this?
  • global_mapper
    global_mapper Administrator
    edited March 2008
    There is not currently any way to do this in the SDK, but I can add a new function to set the description of a layer in the SDK and then point you at a new build when it is ready.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • global_mapper
    global_mapper Administrator
    edited March 2008
    I have placed a new build of the SDK at http://www.globalmapper.com/GlobalMapperSDK_v127_beta.zip that has a GM_SetLayerDescription function for changing the description of a layer.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • K. Osei-Agyemang
    K. Osei-Agyemang Global Mapper User
    edited March 2008
    Thanks a mill.
  • Osei
    Osei Global Mapper User Trusted User
    edited May 2008
    Hi,
    Thanks for the effort in getting me the above-named method.

    However, it is not working for me. I tried it in both C++ and C#.

    C#
    IntPtr ip = (IntPtr)clsGlobalVARS.LayerHandles[0];
    GlobalMapperDLL.GM_Error_t32 err = GlobalMapperDLL.GM_SetLayerDescription(ip, "rockdboat");

    MessageBox.Show("Test -> "+err);
    //Shows GM_Error_None

    IntPtr ipInf = GlobalMapperDLL.GM_GetLayerInfo(ip);


    GM_LayerInfo_t inf = (GM_LayerInfo_t)Marshal.PtrToStructure(ipInf, typeof(GM_LayerInfo_t));

    MessageBox.Show(inf.Description);
    //Shows same old description



    C++
    GM_LayerHandle_t32 theLayer = mMapWindow.mLayerHandleList[0];

    GM_SetLayerDescription(theLayer,"West");
    // Get info about the layer
    const GM_LayerInfo_t* theLayerInfo = GM_GetLayerInfo( theLayer );
    if ( NULL == theLayerInfo )
    {
    AfxMessageBox( _T("Error getting layer info") );
    //Does not show.
    }

    AfxMessageBox(theLayerInfo->mDescription);
    //Shows same old description
  • global_mapper
    global_mapper Administrator
    edited May 2008
    I took a look and found the problem. I have placed a new build of the SDK at http://www.globalmapper.com/GlobalMapperSDK_v128_beta.zip which should work correctly.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • Osei
    Osei Global Mapper User Trusted User
    edited May 2008
    Thanks a lot. Works now