Guest User

Untitled

a guest
Jul 19th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. Index: C:/svn/about-australia.com/protected/extensions/geocoder/libraries/Result.php
  2. ===================================================================
  3. --- C:/svn/about-australia.com/protected/extensions/geocoder/libraries/Result.php (revision 537)
  4. +++ C:/svn/about-australia.com/protected/extensions/geocoder/libraries/Result.php (revision 538)
  5. @@ -172,6 +172,7 @@
  6.  
  7. // Register the javascript
  8. Yii::app()->getClientScript()->registerScript("{$type}_map_js".(self::$_map_count++), $map_script, CClientScript::POS_READY);
  9. +
  10. }
  11.  
  12. // Render the map point
  13. @@ -206,6 +207,24 @@
  14. // Register the javascript
  15. Yii::app()->clientScript->registerScript("{$type}_point_js".(self::$_point_count++), $point_script, CClientScript::POS_READY);
  16. }
  17. +
  18. + public function renderAutoZoom($container_id)
  19. + {
  20. + // Validate the container
  21. + if (!isset(self::$_map_containers[$container_id]))
  22. + throw new GeoCode_Exception("Unknown map container '{$container_id}'");
  23. +
  24. + // Get our type
  25. + $type = self::$_map_containers[$container_id];
  26. +
  27. + // Render the view
  28. + $zoom_script = $this->render("{$type}/zoom", array(
  29. +
  30. + ), true);
  31. +
  32. + // Register the javascript
  33. + Yii::app()->clientScript->registerScript("{$type}_zoom_js".$container_id, $zoom_script, CClientScript::POS_READY);
  34. + }
  35.  
  36. /**
  37. * Get the string associated with the accuracy constant
  38. Index: C:/svn/about-australia.com/protected/extensions/geocoder/views/google/point.php
  39. ===================================================================
  40. --- C:/svn/about-australia.com/protected/extensions/geocoder/views/google/point.php (revision 537)
  41. +++ C:/svn/about-australia.com/protected/extensions/geocoder/views/google/point.php (revision 538)
  42. @@ -22,6 +22,7 @@
  43. */
  44. ?>
  45. var point = new google.maps.LatLng(<?php echo $latitude; ?>, <?php echo $longitude; ?>);
  46. +points.push(point);
  47. var marker = new google.maps.Marker({
  48. position: point,
  49. map: gmap,
  50. Index: C:/svn/about-australia.com/protected/extensions/geocoder/views/google/map.php
  51. ===================================================================
  52. --- C:/svn/about-australia.com/protected/extensions/geocoder/views/google/map.php (revision 537)
  53. +++ C:/svn/about-australia.com/protected/extensions/geocoder/views/google/map.php (revision 538)
  54. @@ -29,6 +29,7 @@
  55. $options['mapTypeId'] = 'google.maps.MapTypeId.'.$options['mapTypeId'];
  56. ?>
  57. var point = new google.maps.LatLng(<?php echo $latitude; ?>, <?php echo $longitude; ?>);
  58. +var points = new Array(point);
  59. var gmap = new google.maps.Map(document.getElementById("<?php echo $container_id; ?>"), {
  60. <?php
  61. // Output the options. We don't use json_encode because it escapes the strings and
  62. Index: C:/svn/about-australia.com/protected/extensions/geocoder/views/google/zoom.php
  63. ===================================================================
  64. --- C:/svn/about-australia.com/protected/extensions/geocoder/views/google/zoom.php (revision 0)
  65. +++ C:/svn/about-australia.com/protected/extensions/geocoder/views/google/zoom.php (revision 538)
  66. @@ -0,0 +1,6 @@
  67. +var bounds = new google.maps.LatLngBounds();
  68. +for (var _marker in points) {
  69. + bounds.extend(points[_marker]);
  70. +}
  71. +gmap.setZoom(gmap.fitBounds(bounds));
  72. +gmap.setCenter(bounds.getCenter());
  73. \ No newline at end of file
Add Comment
Please, Sign In to add comment