在谷歌地图上显示自定义绘制圆圈内的文本

时间:2014-04-07 19:34:21

标签: javascript google-maps-api-3 coffeescript

我希望有一种方法可以让自定义文字显示在预定义的圈子中,如同截图:

enter image description here

下面是我的代码(在coffeescript中),目前正在使用硬编码的圆圈显示地图:

# Country View // Stage 1 of 3
  madrid = new google.maps.LatLng(40.416798,-3.700178)
  barcelona = new google.maps.LatLng(41.383997,2.163154)
  cordoba = new google.maps.LatLng(37.888171,-4.779383)

  initialize = ->
    @_initCircle "madrid",
      center:madrid,
      radius:90000,
      strokeColor:"#00FF00",
      strokeOpacity:0.8,
      strokeWeight:2,
      fillColor:"#00FF00",
      fillOpacity:0.4

    @_initCircle "barcelona",
      center:barcelona,
      radius:55000,
      strokeColor:"#FF0000",
      strokeOpacity:0.8,
      strokeWeight:2,
      fillColor:"#FF0000",
      fillOpacity:0.4

     @_initCircle "cordoba",
      center:cordoba,
      radius:40000,
      strokeColor:"#ff6702",
      strokeOpacity:0.8,
      strokeWeight:2,
      fillColor:"#ff6702",
      fillOpacity:0.4

  @googleMap.notifier.on 'map:settled', _.bind initialize, @

_initOverlay: (name, opts) ->
  @circle[name] = new google.maps.Overlay opts

0 个答案:

没有答案