Creating applications with the Mobile ADF API  

Working with the Map control



 

A map is a container for all of the spatial information that you display, query and edit on your mobile device. The way that you display maps in your mobile application is to use the map control. The map control is a Microsoft Visual Studio .NET component that you can drag from the Toolbox onto a form when designing your application. The map has a number of properties, methods and events that control how you display maps on a mobile device.

 

When you add a map component to your application you will notice that a map cache component is created for you. The map cache contains both the schema definition, precision and spatial reference information, and the map data that is drawn to the map control. The map cache not only contains the information displayed in the map control but it is also the component responsible for synchronizing information with the server.

The CurrentMapAction property allows you to assign a default map action or tool to the map, such as Pan, Zoom In, Zoom Out, Selection, etc. To detach a map action from the map, set the CurrentMapAction property to null.

The map object contains several properties related to the map extent. You can get the initial extent of the map that you created and published, the full extent of the map data, the rotated extent and the extent of the current view using the GetExtent, GetFullExtent, GetRotatedExtent and GetViewExtent properties. You can use either the Invalidate method or the Refresh method to refresh the display on the map control. Refresh will redraw the current extent while Invalidate will only redraw the client area where the change has occurred.

A map contains a collection of map layers. You can use MapLayers property to receive and alter properties such as the scale, extent, visibility, transparency and labeling information for a given layer. Map layers serve the purpose of rendering the content of the layer on the map control only and do not impact the map schema, storage or cached layer representation. In addition to the map layers, you can sketch or redline graphics on top of the map using either GDI directly or by using the Display object and the MapPaintEventArgs.

In addition to the various properties and methods on the map control, there are a number of events that you can listen to and perform different functions. You can use the Paint event draw graphics on top of the map, the LayersDrawingStarted and LayersDrawingCompleted events to monitor the starting and stopping of drawing on the map display.