Rotate display


Purpose
This sample primarily demonstrates setting the MapControl's Rotation property, and secondly demonstrates setting the MapControl MouseIcon and MousePointer properties.

How to use

If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Run the application.
  2. Load a MapDocument into the MapControl.
  3. Use the left hand mouse button to zoom in and the right hand mouse button to rotate the display.

Additional information

The MouseIcon property is set to a custom icon stored in a resource file using the IPictureDisp LoadResFile method in the FormLoad event. This MouseIcon will be used whenever the MousePointer property is set to esriPointerCustom. The browse dialog allows users to search and select map documents, which are validated and loaded into the MapControl using the CheckMxFile and LoadMxFile methods. The OnBeforeScreenDraw and OnAfterScreenDraw events are used to set the MousePointer while the display is refreshing due to Extent changes.
 
The OnMouseDown event uses either the TrackRectangle method to zoom in or the IScreenDisplay RotateStart method to start rotating around the centre of the display based upon the current mouse location. The OnMouseMove event uses the IScreenDisplay RotateMoveTo and RotateTimer methods to move and re-draw the display to the screen. The OnMouseUp event uses the IScreenDisplay RotateStop method to determine the angle of rotation. The MapControl's Rotation property is set to this angle, and the display is refreshed is reflect the change.


RotateDisplay.h Main header file
RotateDisplay.cpp Main implementation file
MapControlEvents.h Event header file
MapControlEvents.h Event implementation file
Makefile.SolarisMotif Solaris Project Makefile
Makefile.LinuxMotif Linux Project Makefile
Download the Motif_CPP files

Download the files for all languages




Development licensing Deployment licensing
Engine Developer Kit Engine Runtime