开发者

Best approach to render PrimeFaces gMap to auto zoom to show all markers, and show location with accuracy?

I have couple of gMap related questions which I didn't find from user guide, I hope some one could help me..

1) I needs to shows a marker on gMap with location accuracy in a circle (For example, if tracking with GPS signal, the accuracy 开发者_开发百科is about 50-60 meters, however, if tracking with Network cell, the radius is about 600-800 meters), what is the best way to do this?

2) What is the best way to auto zoom, and center the map so that it able to shows all the markers I set in the Map Model..

Thanks! Cheers James


I just found solution on how to shows accuracy in a circle using primefaces, here is the code

 <p:gmap id="mygmap" 
         center="#{trackingBean.mapVO.centerLocation}"
         zoom="#{trackingBean.mapVO.zoomLevel}" type="ROADMAP"
         style="width:500px;height:400px"
         widgetVar="tmap"
         model="#{trackingBean.mapVO.mapModel}">
  </p:gmap>
  <script type="text/javascript">
      var gmap = tmap.getMap();
      var centerLatLng = new google.maps.LatLng(#{trackingBean.currentLocStr});
      var circle = new google.maps.Circle({
                              center: centerLatLng,
                              fillColor: '#00f',
                              fillOpacity: 0.1,
                              strokeColor: '#00f',
                              strokeOpacity: 0.3,
                              strokeWeight: 1
                           });
                   circle.setRadius(#{trackingBean.radious}); 
                   circle.setMap(gmap);
  </script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜