How to resize the map window

jharding@mtaonline.net
Global Mapper User
Hello,
I have a treeview docked on the left side of my program and the shapes and maps I load under the treeview. Is there a way to resize the area the map draws to? Or how can I display the map in a picture box or another form window. Thanks in advance for your help.
I have a treeview docked on the left side of my program and the shapes and maps I load under the treeview. Is there a way to resize the area the map draws to? Or how can I display the map in a picture box or another form window. Thanks in advance for your help.
Comments
-
The size and position of the map display is entirely determined by the device context that you pass into the draw function and the draw coordinates and pixel dimensions that you provide. So you can put the map window anywhere and even have multiple map windows just by passing in different sets of coordinates and different drawing contexts. The SDK doesn't manage any of that, but the C++ sample application has a GM_MapWindow class that you can use in your own application to simplify some of that.
Thanks,
Mike
Global Mapper Guru
geohelp@bluemarblegeo.com
Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation -
could you please suggest how to make pixel domentions and coordinates settings right ?
-
If you want to do the same thing as the C++ sample application included with the SDK, just define some hidden control on your dialog or application definition, then get its dimensions at startup and set them in a GM_MapWindow class. The C# sample application just uses the entire client area of the window for the map, but you can do any subset you want. Here is the code from the C++ sample application:
// Get the map area window and rectangle
CWnd* theMapWnd = GetDlgItem( IDC_DRAW_WINDOW );
RECT theMapWndRect;
theMapWnd->GetWindowRect( &theMapWndRect );
ScreenToClient( &theMapWndRect );
// Setup the map window to draw to the dialog window in the area of the
// IDC_MAP_AREA control
mMapWindow.SetDrawWindow( GetSafeHwnd() );
mMapWindow.SetDrawWindowRect( theMapWndRect );
For the ground coordinates to draw, the sample applications initially set those to the full bounds of all loaded layers, so when you first load some layers it calls GM_GetLayerInfo on each and builds a full union of the bounding rectangles, then uses that as the initial draw rectangle. Then the bounds of that draw rectangle change to zoom in and out and to pan. The pixel draw coordinates do not change unless you actually resize the map window.
All of the sample applications demonstrate this behavior, so you can check out the sample application in whatever language you are using. The C++ sample app is by far the most extensive though.
Thanks,
Mike
Global Mapper Guru
geohelp@bluemarblegeo.com
Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
Categories
- 12.5K All Categories
- 5.5K Features Discussion
- 314 Downloading Imagery
- 1.3K Elevation Data
- 377 Georeferencing Imagery Discussion
- 611 GM Script Language
- 50 User Scripts
- 112 GPS Features
- 397 Projection Questions
- 803 Raster Data
- 1.3K Vector Data
- 6.5K Support
- 161 Announcement and News
- 893 Bug Report
- 557 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 542 Other Discussion
- 128 GIS Data Sources
- 26 Global Mapper Showcase
- 229 How I use Global Mapper
- 104 Global Mapper Forum Website