Export (0) Print
Expand All

IconType Enumeration

Bing

Contains route icon types.

Constants

Type Code Name Description

0

none

There is no route icon.

1

other

The icon is some other type of icon.

2

auto

The icon is a car icon.

3

ferry

The icon is a ferry icon.

4

walk

The icon is a walking icon.

5

bus

The icon is a bus, or transit, icon

6

train

The icon is a train icon.

7

airline

The icon is an airline icon.

Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>

      <script type="text/javascript">
         
         var map = null;
         var directionsManager = null;

         function GetMap()
         {
            // Initialize the map
            map = new Microsoft.Maps.Map(document.getElementById("mapDiv"),{credentials:"Bing Maps Key"});
            Microsoft.Maps.loadModule('Microsoft.Maps.Directions', { callback: directionsModuleLoaded });

         }



         function directionsModuleLoaded()
         {
            // Initialize the DirectionsManager
            directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);

            // Create start and end waypoints and add them to the route
            var startWaypoint = new Microsoft.Maps.Directions.Waypoint({address:"Seattle, WA"});
            var endWaypoint = new Microsoft.Maps.Directions.Waypoint({address:"Bellevue, WA"});

            directionsManager.addWaypoint(startWaypoint);
            directionsManager.addWaypoint(endWaypoint);

            // Set directions options
            directionsManager.setRequestOptions({ routeMode: Microsoft.Maps.Directions.RouteMode.transit});
            directionsManager.setRenderOptions({ itineraryContainer: document.getElementById('itineraryDiv') });

            // Specify a handler for when the directions are calculated
            Microsoft.Maps.Events.addHandler(directionsManager, 'directionsUpdated', displayMessage );
            Microsoft.Maps.Events.addHandler(directionsManager, 'itineraryStepClicked', displayStepMessage );
            Microsoft.Maps.Events.addHandler(directionsManager, 'directionsError', displayError);

            // Calculate directions, which displays a route on the map
            directionsManager.calculateDirections();


         } 


         function displayError(e)
         {
            alert(e.message);
         }


         function displayMessage(e)
         {
            alert("Click a step in the itinerary to display extra transit information.");             
         }


         function displayStepMessage(e)
         {

            if (e.step.iconType == Microsoft.Maps.Directions.IconType.bus )
            {
               alert("The name of the transit agency for this step is: " + e.step.transitLine.agencyName + ".  For information about this transit agency and transit line, go to " + e.step.transitLine.agencyUrl + ".");
            }
            else
            {
               alert("The step that was clicked is not a transit step.");
            }
         }
   


      </script>
   </head>
   <body onload="GetMap();">
      <div id='mapDiv' style="position:relative; width:400px; height:400px;"></div>       
      <div id='itineraryDiv' style="position:relative; width:400px;"></div>
   </body>
</html>
Show:
© 2015 Microsoft