Speed up PAN
Hi Mike,
I have been trying to implement something similar to Global Mapper's PAN tool using SDK. What I did was in OnMouseMove handler, I re-center the mMapWindow each time the mouse moves. This is very slow. Do you have any other suggestions?
Thanks,
Qiao
I have been trying to implement something similar to Global Mapper's PAN tool using SDK. What I did was in OnMouseMove handler, I re-center the mMapWindow each time the mouse moves. This is very slow. Do you have any other suggestions?
Thanks,
Qiao
Comments
-
Qiao,
What I would suggest (and is what the GM application does) is to save your map window to an offscreen bitmap, then just BitBlt that to different locations as you move the map around in your OnMouseMove handler. When the user releases the mouse button, then do a new draw of the map window to your offscreen bitmap and draw that to your main map window.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Thanks Mike.
I will try your idea and will let you know how that goes.
Qiao -
Hi Mike,
Following your suggestions, in panning, I copy the screen to a bitmap when a mouse is down and then bitblt it when the mouse is moving.
It seems working except the background is not erased correctly at each move and this creats a bit of mess.
Here is the line for the first time bitblt (when a mouse is down):
m_MemDC->bitblt(0, 0, view_width, view_height,pDC, 0,0,SRCCOPY);
Here is the line for the second time bitblt (when a mouse is moving):
pDC->bitblt(x0_new, y0_new, view_width, view_height,&m_MemDC, 0,0,SRCCOPY);
Could you help me on this?
Thanks,
Qiao -
Qiao,
Just erase the background of the entire window before you BitBlt using a PatBlt with a brush. To avoid flicker you might want to create a second offscreen bitmap for what you will draw to the screen and erase it then BitBlt the other offscreen map to that, then finally BitBlt the entire second offscreen map to the screen.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Can you provide me Sample code for the same for Mouse Move and DOWN in C#, i am not able to do PANNING as per your suggestion.
-
We don't have any sample C# code for doing the flicker-free panning, but the C++ sample application has a lot of relevant sample code. Are you having trouble with the offscreen bitmap part or just handling mouse events in general in C#? We are more of a C++ shop so don't have as much experience in C# for more complex things, but the offscreen bitmap handling is more of a general C# Windows programming issue rather than something specific to the Global Mapper SDK.
Thanks,
Mike
Global Mapper Guru
gmsupport@bluemarblegeo.com
http://www.globalmapper.com
Categories
- 12.8K All Categories
- 5.7K Features Discussion
- 345 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 637 GM Script Language
- 54 User Scripts
- 114 GPS Features
- 417 Projection Questions
- 826 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 178 Announcement and News
- 913 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