问题
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