Display scale bar with GM_DrawLayerList
Hello,
I have a problem to display a scale bar with the function "GM_DrawLayerList" and the flag "GM_DrawFlags_t32.GM_DrawFlags_DrawMapLayoutLayers".
Actually, the scale bar is displayed and works but I use the function "GM_DrawLayerList" to get a bitmap of my layers one by one (cause I save these bitmaps independently). So, I set the paramater "int aLayerCount" to 1 for each call :
Now, my problem. I get a pointer of a layer from my database with the function "GM_LoadLayerListEx". When I pass this pointer to the function "GM_DrawLayer" (not "GM_DrawLayerList"), I have the right Bitmap of the layer. But when I use "GM_DrawLayerList", I have "GM_Error_InvalidLayer".
Moreover, if I set the parameter "int aLayerCount" to 0 (to draw all layers in the list whereas I have always only one), it works but the generated Bitmap has all previous layers drawn and not only the one that I passed in parameter (I already verified the paramater "layerToDraw").
Best regards,
Tristan
I have a problem to display a scale bar with the function "GM_DrawLayerList" and the flag "GM_DrawFlags_t32.GM_DrawFlags_DrawMapLayoutLayers".
Actually, the scale bar is displayed and works but I use the function "GM_DrawLayerList" to get a bitmap of my layers one by one (cause I save these bitmaps independently). So, I set the paramater "int aLayerCount" to 1 for each call :
lastGMError = GlobalMapperDLL.GM_DrawLayerList ( Hdc, layerToDraw, 1, GlobalMapperDLL.GM_DrawFlags_t32.GM_DrawFlags_DrawMapLayoutLayers, ref currentViewRect, 0, 0, widthGraphic, heightGraphic );
Now, my problem. I get a pointer of a layer from my database with the function "GM_LoadLayerListEx". When I pass this pointer to the function "GM_DrawLayer" (not "GM_DrawLayerList"), I have the right Bitmap of the layer. But when I use "GM_DrawLayerList", I have "GM_Error_InvalidLayer".
Moreover, if I set the parameter "int aLayerCount" to 0 (to draw all layers in the list whereas I have always only one), it works but the generated Bitmap has all previous layers drawn and not only the one that I passed in parameter (I already verified the paramater "layerToDraw").
Best regards,
Tristan
Comments
-
Tristan,
If you use GM_DrawLayerList the layer list parameter is the address of an array of GM_LayerHandle_t32 types and not just the actual layer handle value for GM_DrawLayer. For just a single layer you can just pass in the address of that one value with a value of 1. For multiple layers you would need to allocate a contiguous chunk of memory, which gets slightly more complex in languages that hide all that stuff.
If you will only ever need to draw all or none, define the layer list as 'ref GM_LayerHandle_32' in the declaration for GM_DrawLayerList. That will then get the address of your variable automatically and pass that in, which is essentially an array of length 1.
Thanks,
Mike
Global Mapper Guru
gmsupport@bluemarblegeo.com
Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation -
Mike,
Thank you very much, it works prefectly with "ref GM_LayerHandle_32" !
Best regards,
Tristan -
Hello,
I think the last release of SDK on your website ("http://www.bluemarblegeo.com/products/global-mapper-sdk-download.php") don't have the correction for connection with a spatial database. When I use this last release, I have the same problems than old release. So I use the release that you gave me in a post on the forum.
Just for information. If it is a mistake from me, sorry.
Best regards,
Tristan -
Tristan,
We haven't official released a new SDK since that fix so it's not out there on the normal download page. We should officially release a new one in a week or two though that will include that fix. It will then be v14.2.0.
Thanks,
Mike
Global Mapper Guru
geohelp@bluemarblegeo.com
Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
Categories
- 12.8K All Categories
- 5.7K Features Discussion
- 345 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 636 GM Script Language
- 54 User Scripts
- 114 GPS Features
- 417 Projection Questions
- 825 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 178 Announcement and News
- 912 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 569 Other Discussion
- 131 GIS Data Sources
- 27 Global Mapper Showcase
- 238 How I use Global Mapper
- 107 Global Mapper Forum Website