How to add a “hole” to a Circle Polygon (Google Maps API V3)

流过昼夜 提交于 2019-12-12 14:24:19

问题


This Pentagon example shows holes can be added inside a Polygon: http://code.google.com/p/gmaps-samples-v3/source/browse/trunk/poly/pentagon.html?r=40

I would like to add a hole inside a circle.

Currently I am mimicking this by making a circle shape polygon and putting inner and outer bounds and it is working fine, however the code is extremely long seeing as the map has ~15 circles in it.

Any help would be much appreciated

Thanks!


回答1:


I didn't find anything for the Circle class, but someone has figured out a function that will reduce your code size. It does the same thing you are doing, creating polygons shaped like a circle.

http://www.geocodezip.com/v3_polygon_example_donut.html

The function drawCircle(point, radius, dir) uses dir to distinguish positive space and holes. You have to alternate them to create holes.



来源:https://stackoverflow.com/questions/9534263/how-to-add-a-hole-to-a-circle-polygon-google-maps-api-v3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!