2016-02-10 2 views
0

Как добавить инфобокс к путевой точке в бинговых картах. Я не могу найти, какое событие или объект имеет возможность добавлять инфобокс на карту bing.Как добавить инфобокс к путевой точке в бинговых картах

Вот пример кода с сайта microsoft, который я использую.

function getMap() 
    { 
     map = new Microsoft.Maps.Map(document.getElementById('myMap'), 
      { 
       credentials: 'bing map key', 
      }); 
     createDirections(); 
    function createDrivingRoute() 
    { 
    if (!directionsManager) { createDirectionsManager(); } 
    directionsManager.resetDirections(); 
    directionsManager.setRequestOptions({ routeMode: Microsoft.Maps.Directions.RouteMode.driving }); 
    var seattleWaypoint = new Microsoft.Maps.Directions.Waypoint({ address: 'Seattle, WA' }); 
    var TukwilaWaypoint = new Microsoft.Maps.Directions.Waypoint({ address: 'Tukwila, WA' }); 
    directionsManager.addWaypoint(seattleWaypoint); 
    directionsManager.addWaypoint(TukwilaWaypoint); 
    var tacomaWaypoint = new Microsoft.Maps.Directions.Waypoint({ address: 'Tacoma, WA', location: new Microsoft.Maps.Location(47.255134, -122.441650) }); 
    directionsManager.addWaypoint(tacomaWaypoint); 
    // Set the element in which the itinerary will be rendered 
    directionsManager.setRenderOptions({ itineraryContainer: document.getElementById('directionsItinerary') }); 
    alert('Calculating directions...'); 
    directionsManager.calculateDirections(); 
    } 

    function createDirections() { 
    if (!directionsManager) 
    { 
     Microsoft.Maps.loadModule('Microsoft.Maps.Directions', { callback: createDrivingRoute }); 
    } 
    else 
    { 
     createDrivingRoute(); 
    } 
    } 
    } 

ответ

0

Вы можете добавлять события в DirectionsManager, который будет первым после того, как оказавшего шаги, а затем нам информацию, чтобы добавить ваши infoboxes. Взгляните на afterStepRender, afterWaypointRender и события afterSummaryRender: https://msdn.microsoft.com/en-us/library/hh312802.aspx

Смежные вопросы