【发布时间】:2014-08-29 17:04:07
【问题描述】:
我已经在地图上的国家/地区周围设置了一个多边形地图,并希望添加一个信息框,以便在悬停时显示每个国家/地区的一些信息。
如果没有多边形,我可以很容易地显示信息框,但是将它们分配给 PolygonOptions 类时,什么也没有发生。文档说,只要我加载了 Bing 主题模块(我这样做了),信息框就会在悬停和单击时显示。
这方面的文档/示例似乎为零,因此希望各位聪明人能提供帮助。
这里是一些相关代码;
var center = this.map.getCenter();
// Create an info box
var infoboxOptions = {
width: 300,
height: 100,
title: 'Testing', // sourceItems.data.dataset[0].data[index].key,
description: "Visits: 20", // + sourceItems.data.dataset[0].data[index].visits,
showPointer: true,
titleClickHandler: this.polygonInfo,
offset: new Microsoft.Maps.Point(-100, 0),
typeName: Microsoft.Maps.InfoboxType.mini,
zIndex: 1000
};
var polyinfobox = new Microsoft.Maps.Infobox(center, infoboxOptions);
var polygonOptions = {
fillColor: Microsoft.Maps.Color.fromHex(fillColour),
strokeColor: Microsoft.Maps.Color.fromHex(fillColour),
strokeThickness: 1,
infobox: polyinfobox
};
var result = new Microsoft.Maps.Polygon(vertices, polygonOptions);
【问题讨论】:
标签: maps bing-maps bing infobox