简体   繁体   English

如何在必应地图中将信息框添加到航点

[英]How to add infobox to a waypoint in bing maps

how can I add infobox to waypoint in bing maps.I am unable to find which event or object having option to add infobox to bing map. 如何在bing地图中将信息框添加到航点。我无法找到哪个事件或对象具有将infobox添加到bing地图的选项。

Here is sample code from microsoft site I am using. 这是我正在使用的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();
    }
  }
    }

You can add events to the DirectionsManager that will first after the steps have rendered and then us the information to add your infoboxes. 您可以将事件添加到DirectionsManager中,该事件将在步骤呈现后首先添加,然后再向我们提供信息以添加您的信息框。 Take a look at the afterStepRender, afterWaypointRender, and the afterSummaryRender events: https://msdn.microsoft.com/en-us/library/hh312802.aspx 看一下afterStepRender,afterWaypointRender和afterSummaryRender事件: https ://msdn.microsoft.com/zh-cn/library/hh312802.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM