DrawLayers issue
Hi Mike,
In my application i have two layers,
the first layer is used for the map rendering and
the second layer is used for displaying moving tracks (icons/symbols) received for example from the ethernet.
The concept is that every one second, the application have to update the tracks positions on the display.
What i observe, is that if i use the GM_DrawLayer function only for the second layer (tracks layer), then the previous tracks positions are displayed and not cleaned.
Is this the way it should be?
Thanks in advance.
In my application i have two layers,
the first layer is used for the map rendering and
the second layer is used for displaying moving tracks (icons/symbols) received for example from the ethernet.
The concept is that every one second, the application have to update the tracks positions on the display.
What i observe, is that if i use the GM_DrawLayer function only for the second layer (tracks layer), then the previous tracks positions are displayed and not cleaned.
Is this the way it should be?
Thanks in advance.
Comments
-
The GM_DrawLayer behavior is going to depend on what flags you pass in. Unless you pass in the GM_DrawFlags_EraseBackground, the GM_DrawLayer call won't erase anything that you've already drawn to your device context. I think what you'll want to do is draw your map layer to an offscreen bitmap, then each time you want to update your track display, bit-blt that offscreen bitmap into your DC, then draw your updated track layer on top of that.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
ok, i understand the point with the drawing flags.
Exactly, how to use the double buffering mechanism, i am looking for the last two days, in VB.NET in combination with GM.
Which GM function should i use, in order to draw the map layer to an offscreen bitmap?
Thanks again. -
You use the same GM SDK functions for offscreen bitmaps. The draw functions just take a device context and don't care if they are based on offscreen or onscreen bitmaps. I don't know how to do it in VB.NET, but in the Windows GDI you could create an offscreen device context with CreateCompatibleDC and then an offscreen bitmap with CreateCompatibleBitmap, then select that bitmap into the DC and draw to that with the SDKto get your offscreen bitmap populated with the map data. You can then BitBlt from that offscreen DC to the onscreen one to start each draw.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com
Categories
- 13K All Categories
- 5.8K Features Discussion
- 350 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 652 GM Script Language
- 56 User Scripts
- 115 GPS Features
- 421 Projection Questions
- 837 Raster Data
- 1.4K Vector Data
- 6.7K Support
- 182 Announcement and News
- 943 Bug Report
- 562 SDK
- 1.2K Suggestion Box
- 3.8K Technical Support
- 581 Other Discussion
- 132 GIS Data Sources
- 27 Global Mapper Showcase
- 245 How I use Global Mapper
- 111 Global Mapper Forum Website
