gpt4 book ai didi

javascript - 谷歌地图 API (v3) 中的可选形状(圆形/矩形)

转载 作者:行者123 更新时间:2023-12-02 19:23:10 24 4
gpt4 key购买 nike

我制作了一个谷歌地图,您可以使用绘图管理器或使用自定义“绘制圆形”和“绘制矩形”按钮来绘制圆形/矩形,如示例所示 http://googlegeodevelopers.blogspot.com.au/2011/11/make-your-map-interactive-with-shape.html

但是,在这个示例中,可以选择形状,然后在我的版本中删除,这是不可能的;所有形状始终被选中,但我在文档中找不到任何内容?

我的代码:

<script type="text/javascript">
function drawCircle(){
console.log("Drawing Circle on Map");
var circleOptions = {
<!--draw the circle in the center of the viewport-->
center : (map.getCenter()),
radius : 1000000,
map: map,
editable: true,
clickable:true
};

circle = new google.maps.Circle(circleOptions);
return false;
}

function drawRectangle(){
console.log("Drawing Rectangle on Map");
var rectOptions = {
<!--draw the circle in the center of the viewport-->
bounds: map.getBounds(),
radius : 1000000,
map: map,
editable: true,
clickable:true
};

rectangle = new google.maps.Rectangle(rectOptions);
return false;
}

function showDrawingManager(){
var managerOptions = {
drawingControl: true,
drawingControlOptions: {
position: google.maps.ControlPosition.TOP_CENTER,
drawingModes: [google.maps.drawing.OverlayType.MARKER, google.maps.drawing.OverlayType.CIRCLE,google.maps.drawing.OverlayType.RECTANGLE]
},
markerOptions: {
editable: true
},
circleOptions: {
editable: true
},
rectangleOptions: {
editable : true
}
}

var drawingManager = new google.maps.drawing.DrawingManager(managerOptions);
drawingManager.setMap(map);
}
</script>

最佳答案

关于javascript - 谷歌地图 API (v3) 中的可选形状(圆形/矩形),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12301088/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com