MapDotNet UX Help

To add a RIM (rich interactive mapping) control to your WPF window or Silverlight page you must add the following XAML:

Namespace declarations for Silverlight:

xmlns:rim="clr-namespace:ISC.RIM.Silverlight;assembly=ISC.RIM.Silverlight"
xmlns:Projections="clr-namespace:ISC.RIM.Silverlight.Projections;assembly=ISC.RIM.Silverlight"
xmlns:Requestors="clr-namespace:ISC.RIM.Silverlight.Requestor;assembly=ISC.RIM.Silverlight"

Namespace declarations for WPF:

xmlns:rim="clr-namespace:ISC.RIM.WPF;assembly=ISC.RIM.Silverlight"
xmlns:Projections="clr-namespace:ISC.RIM.WPF.Projections;assembly=ISC.RIM.Silverlight"
xmlns:Requestors="clr-namespace:ISC.RIM.WPF.Requestor;assembly=ISC.RIM.Silverlight"

Control markup:

<rim:Map x:Name="myMap" MDNSAddress="http://demo.mapdotnet.com/MDNUXiSDKService/">
    
    <rim:MapView x:Name="mapView" />

    <rim:Map.TileProjection>
        <Projections:SphericalMercatorTileProjection />
    </rim:Map.TileProjection>

    <rim:Map.MapModel>
        <rim:MapModel>

            <!-- TileLayer declarations are added here. -->
            
            <rim:TileLayer Descriptor="r"> 
            	<rim:TileLayer.TileRequestor> 
            		<Requestors:BingMapsTileRequestor /> 
            	</rim:TileLayer.TileRequestor> 
            </rim:TileLayer> 
            
            <rim:TileLayer ExcludeFromBackdrop="True" Descriptor="Sample"> 
            	<rim:TileLayer.TileRequestor> 
            		<Requestors:MDNSMapTileRequestor /> 
            	</rim:TileLayer.TileRequestor> 
            </rim:TileLayer> 

        </rim:MapModel>
    </rim:Map.MapModel>

</rim:Map>

Note: if you are looking at an existing application that does not declare a MapModel and one or more TileLayers, see Declarations Without Tile Layers below.

rim:Map attributes

The Map is usually named to reference it in the code-behind.  The MDNSAddress is used to validate the control (see below) and is also passed to MapDotNet UX tile requestors when they do not have an Endpoint specified.  

If the tile layers do not include a TileLayer that uses an MDNSMapTileRequestor, then the ZoomLevel and MapCenter attributes should be set.  If there is an MDNSMapTileRequestor, the specified map's initiakl extents will be used if these attributes are not set.

The following events can be declared for the map.  They are listed in the order in which they occur.

InitializeMVCComplete is called when the map controls have been initialized.  Declared controls have been instantiated and needed undeclared controls created.  Tile layers have not been fully initialized and their Descriptors may not yet be valid.  If you are using CommandBindings, this is an appropriate time to set them up.

TileLayerSetupComplete is called once the Descriptors for tile layers have been initialized.  Certain TileRequestors convert the Descriptors of associated tile layers from strings into other object types.  Descriptors will be of the expected type at the time this event is called.  Descriptors can be modified at this time.

PreInitializePosition is called just before the map is set to its initial center point and zoom level.  These may be overridden at this time.

PostInitializePosition is called just after the map is set to its initial center point and zoom level.  This is the first time a valid map scale can be determined.

ExceptionEvent is called when the Map catches an exception within its controls.

rim:MapView element

The content type for the Map control is MapViewBase, so this may be declared within the body of the Map declaration without the need to wrap it in <rim:Map.MapView> tags.  The MapView declaration is optional.  If no MapView is declared, a default MapView will be created during Map control initialization.

The MapView may be declared in order to name it  or to declare event handlers.

ViewChangeComplete is called when the map center or zoom level has changed.  During continuous motion such as pans, it is not called until the movement is complete.

MouseHover is called when the mouse pauses over the map.  The MouseHoverDelay property sets the interval the mouse must be paused for before MouseHover is called.

MouseLeftSingleClickPosition and MouseLeftDoubleClickPosition fire on single and double clicks, respectively.  The MouseDblClickDelayMs property sets the interval clicks must fall within to be considered a double-click.  Firing the single click event is delayed by this interval.

MouseMovePosition is called on mouse move.

All the above events give access to the mouse position in both device and map units.  All other mouse events are those of the base Canvas class inherited by MapView.  We recommend that those not be used directly.

rim:Map.TileProjection element

An ITileProjection implementation is required.  This is usually SphericalMercatorTileProjection, which implements the projection used by Bing Maps and OpenStreetMaps.    

rim:Map.MapModel

Tile layers are declared within the MapModel object.  Tile Layers are rendered in the order listed, so your base map should always be the first tile layer listed.  The example above shows Bing Maps road tiles as the base layer with a MapDotNet UX map called "Sample" as the overlay.

Declarations Without Tile Layers

Tile layers can be set up in code rather than declaratively.  This is no longer the preferred approach, but a lot of older MapDotNet implementations use this approach.

Namespace declarations for Silverlight:

xmlns:rim="clr-namespace:ISC.RIM.Silverlight;assembly=ISC.RIM.Silverlight"
xmlns:Projections="clr-namespace:ISC.RIM.Silverlight.Projections;assembly=ISC.RIM.Silverlight"

Namespace declarations for WPF:

xmlns:rim="clr-namespace:ISC.RIM.WPF;assembly=ISC.RIM.Silverlight"
xmlns:Projections="clr-namespace:ISC.RIM.WPF.Projections;assembly=ISC.RIM.Silverlight"

Control markup:

<UserControl ... LayoutUpdated="LayoutUpdated">
... 
<rim:Map x:Name="myMap" MDNSAddress="http://demo.mapdotnet.com/MDNUXiSDKService/">
    
    <rim:MapView x:Name="mapView" />

    <rim:Map.TileProjection>
        <Projections:SphericalMercatorTileProjection />
    </rim:Map.TileProjection>

    <rim:Map.MapModel>
        <rim:MapModel>

            <!-- TileLayer declarations are added here. -->

        </rim:MapModel>
    </rim:Map.MapModel>

</rim:Map>

Note the handler "LayoutUpdated" - in your code behind you will need to add the following lines:

/
/ this sets the license validation URI
myMap.MDNSAddress = "http://server/MapDotNetUXWebServicesInstance";

// this wires up internal dependencies and must be called at load complete
myMap.InitializeMVC();

After this code you declare your tile layers and add them to the map, e.g. myMap.MapController.AddTileLayer(myTileLayer);