ESRI.ArcGIS.Mobile
Map Class
Members  Example  See Also  Send Feedback
ESRI.ArcGIS.Mobile.WinForms Namespace : Map Class

Represents a collection of geographic, annotation, and graphic layers drawn using a map transformation.

Object Model












Syntax

Visual Basic (Declaration) 
<DefaultEventAttribute("ExtentChanged")>
<ToolboxItemAttribute(ToolboxItemType=System.Drawing.Design.ToolboxItem, ToolboxItemTypeName="System.Drawing.Design.ToolboxItem, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>
<ToolboxBitmapAttribute()>
<DesignerCategoryAttribute("code")>
<DockingAttribute(DockingBehavior.Ask)>
Public Class Map 
   Inherits Control
   Implements IIMap, IMapIMapEventsIMapWinFormsEvents 
C# 
[DefaultEventAttribute("ExtentChanged")]
[ToolboxItemAttribute(ToolboxItemType=System.Drawing.Design.ToolboxItem, ToolboxItemTypeName="System.Drawing.Design.ToolboxItem, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[ToolboxBitmapAttribute()]
[DesignerCategoryAttribute("code")]
[DockingAttribute(DockingBehavior.Ask)]
public class Map : Control, IIMap, IMapIMapEventsIMapWinFormsEvents  

Example

The following example shows how to create and use the map control with a MobileServiceConnection.

Visual BasicCopy Code
MobileServiceConnection1.Url = "http://YOURSERVER/arcgis/services/YOURSERVICE/MapServer/MobileServer"
MobileCache1.StoragePath = "C:\Temp\MapCache"
Dim mobileSync As New MobileCacheSyncAgent(MobileCache1, MobileServiceConnection1)
Dim mobileResults As New MobileCacheSyncResults()

MobileServiceConnection1.CreateCache(MobileCache1)
MobileCache1.Open()
mobileSync.Synchronize()
Map1.MapLayers.Add(MobileCache1)
C#Copy Code
MobileServiceConnection mobileServiceConnection1 = new MobileServiceConnection(); 
//link the mobile classes to put the data into the display 
mobileServiceConnection1.Url = @"http://YOURSERVER/arcgis/services/YOURSERVICE/MapServer/MobileServer"; 
mobileCache1.StoragePath = @"C:\Temp\MapCache"; 
MobileCacheSyncAgent mobileSync = new MobileCacheSyncAgent(mobileCache1, mobileServiceConnection1); 
MobileCacheSyncResults mobileResults = new MobileCacheSyncResults(); 
 
mobileServiceConnection1.CreateCache(mobileCache1); 
mobileCache1.Open(); 
mobileSync.Synchronize(); 
map1.MapLayers.Add(mobileCache1);

Remarks

A map is a container for all of the spatial information that you display, query and edit on your mobile application. The way that you display maps in your mobile application is to use the map control. Spatial data drawn in map component can come from various data sources. It can come from a mobile service that you published in an ArcGIS Server, or from tile service from ArcGIS Online, or from local tile cache, and so on. For mobile service, the schema and map data will be stored in the MobileCache, and displayed in Map control by adding the MobileCache to the MapLayers.

If you don't have data pre-cached on your client device and would like to automatically retrieve data from server and render it on the map component when the map extent changes, use a MobileCacheSyncAgent or other equivalent synchronization agents on map's ExtentChanged event.

Map layers are accessible by MapLayers property from which you can manipulate each layer's look-and-feel, including scale, extent, visibility, opacity, label, etc. Keep in mind that map layers stored in the MapLayerCollection and rendered in the Map component only serve the purpose of rendering the map to end-users, which implies that operations such as add/remove map layers from the MapLayerCollection doesn't impact the underlying layers stored in MobileCache.

If there is a need to convert coordinates between map units and client units, use ToMap and ToClient methods.

As a way to provide feedback to end user, the FlashGeometry method enables you to flash specified features (passed-in as parameters) a certain times using customized Pen and Brush.

Use Refresh and Invalidate to refresh the display appropriately on map control. Refresh will redraw the whole client area while Invalidate will only redraw the client area where a change has occurred. Make sure you use Refresh method only when necessary because it will degrade drawing performance if it's called too frequently. If you only have a small area on your map that needs to redraw, use Invalidate() method with a envelope indicating the area that needs to be redrawn. For more information, see Refresh.

Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Windows.Forms.Control
            ESRI.ArcGIS.Mobile.WinForms.Map

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.