GM_GetLayerInfo and GM_SetLayerInfo
K. Osei-Agyemang
Global Mapper User
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.
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
-
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 -
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? -
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 -
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 -
Thanks a mill.
-
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 -
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 -
Thanks a lot. Works now
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website