问题描述
如下图所示,将多边形设置为编辑模式后,它在地图上会翻倍。Bingmap dev center
function loadMapScenario() {
var map = new Microsoft.Maps.Map(document.getElementById('myMap'),{});
var center = map.getCenter();
var nose = new Microsoft.Maps.pushpin(center,null);
var eyes = [
new Microsoft.Maps.polygon([
new Microsoft.Maps.Location(center.latitude + 0.01,center.longitude - 0.03),new Microsoft.Maps.Location(center.latitude + 0.01,center.longitude - 0.11),new Microsoft.Maps.Location(center.latitude + 0.05,center.longitude - 0.07)
]),new Microsoft.Maps.polygon([
new Microsoft.Maps.Location(center.latitude + 0.01,center.longitude + 0.03),center.longitude + 0.11),center.longitude + 0.07)
])
];
var mouth = new Microsoft.Maps.polyline([
new Microsoft.Maps.Location(center.latitude - 0.02,center.longitude - 0.10),new Microsoft.Maps.Location(center.latitude - 0.05,center.longitude - 0.07),center.longitude + 0.07),new Microsoft.Maps.Location(center.latitude - 0.02,center.longitude + 0.10)
]);
Microsoft.Maps.loadModule('Microsoft.Maps.DrawingTools',function() {
var tools = new Microsoft.Maps.DrawingTools(map);
tools.showDrawingManager(function(manager) {
manager.setPrimitives([mouth]);
manager.add(eyes);
manager.add(nose);
//set a polygon into edit mode.
tools.edit(eyes[0]);
});
});
}
<!DOCTYPE html>
<html>
<head>
<title>dteditthingsHTML</title>
<Meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<style type='text/css'>
body {
margin: 0;
padding: 0;
overflow: hidden;
font-family: 'Segoe UI',Helvetica,Arial,Sans-Serif
}
</style>
</head>
<body>
<div id='printoutPanel'></div>
<div id='myMap' style='width: 100vw; height: 100vh;'></div>
<script type='text/javascript' src='https://www.bing.com/api/maps/mapcontrol?key=YourBingMapsKey&callback=loadMapScenario' async defer></script>
</body>
</html>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)