javascript - 如何允许用户从 Bing 地图打印路线?
问题描述
我已经组装了将显示路线和方向的 javascript 代码。如何为这些方向启用打印选项?我浏览了文档,但找不到任何允许用户打印方向的选项。
到目前为止,我已经渲染了一张地图并列出了旁边的方向。
有没有启用打印按钮的选项?
这是我的脚本。
function loadMapScenario() {
var map = new Microsoft.Maps.Map(document.getElementById("myMap"), {
/* No need to set credentials if already passed in URL */
center: new Microsoft.Maps.Location(40.418386, -80.019262),
zoom: 160 });
Microsoft.Maps.loadModule("Microsoft.Maps.Directions", function () {
var directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);
directionsManager.setRenderOptions(
{
itineraryContainer: document.getElementById("printoutPanel"),
displayDisclaimer:false,
showInputPanel:true,
drivingPolylineOptions:
{
strokeColor: 'green',
strokeThickness: 6
},
}
);
directionsManager.setRequestOptions({
routeMode: Microsoft.Maps.Directions.RouteMode.truck,
vehicleSpec: {
vehicleAxles: 3,
vehicleTrailers: 2,
vehicleSemi: true
}
});
var wp1 = new Microsoft.Maps.Directions.Waypoint({
address: "590 Crane Ave, Pittsburgh, PA",
location: new Microsoft.Maps.Location(40.419228, -80.018138)
});
var wp2 = new Microsoft.Maps.Directions.Waypoint({
address: "600 Forbes Ave, Pittsburgh, PA",
location: new Microsoft.Maps.Location(40.033230, 75.622310)
});
var wp3 = new Microsoft.Maps.Directions.Waypoint({
address: "600 Exton Commons, Exton, PA",
location: new Microsoft.Maps.Location(40.033230, 75.622310)
});
directionsManager.addWaypoint(wp1);
//directionsManager.addWaypoint(wp2);
directionsManager.addWaypoint(wp3);
directionsManager.calculateDirections();
});
$("#printoutPanel").hide();
$("#btnPrint").hide()
}
解决方案
推荐阅读
- javascript - 将 String html 转换为数组对象类型
- c++ - C++:竞争性编程技巧的解释
- linux - 未为复制的库更新 ldconfig 缓存
- javascript - 使用 VBA 抓取脚本标签
- javascript - 如何生成一个新的 Angular 4 项目而不是创建生成 Angular 6?
- javascript - 使用 window.open() 有过早提交表单的效果
- javascript - 表格单元格没有将它们的 ID 传递给我的函数参数
- android - 如何显示下一张/上一张卡片 RecyclerView 的一部分
- sql-server - SQL Server 并发用户限制 1 - 锁定
- angular - 材料单选按钮内的角度材料表单字段不会触发单选按钮