maps-google.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. (function (global, factory) {
  2. if (typeof define === "function" && define.amd) {
  3. define("/advanced/maps-google", ["jquery", "Site"], factory);
  4. } else if (typeof exports !== "undefined") {
  5. factory(require("jquery"), require("Site"));
  6. } else {
  7. var mod = {
  8. exports: {}
  9. };
  10. factory(global.jQuery, global.Site);
  11. global.advancedMapsGoogle = mod.exports;
  12. }
  13. })(this, function (_jquery, _Site) {
  14. "use strict";
  15. _jquery = babelHelpers.interopRequireDefault(_jquery);
  16. (0, _jquery.default)(document).ready(function () {
  17. (0, _Site.run)(); // Simple
  18. // ------------------
  19. (function () {
  20. var simpleMap = new GMaps({
  21. el: '#simpleGmap',
  22. zoom: 8,
  23. center: {
  24. lat: -34.397,
  25. lng: 150.644
  26. }
  27. });
  28. })(); // Custom
  29. // ------------------
  30. (function () {
  31. var map = new GMaps({
  32. el: '#customGmap',
  33. lat: -12.043333,
  34. lng: -77.028333,
  35. zoomControl: true,
  36. zoomControlOpt: {
  37. style: "SMALL",
  38. position: "TOP_LEFT"
  39. },
  40. panControl: true,
  41. streetViewControl: false,
  42. mapTypeControl: false,
  43. overviewMapControl: false
  44. });
  45. map.drawOverlay({
  46. lat: -12.043333,
  47. lng: -77.028333,
  48. content: '<i class="wb-map" style="font-size:40px;color:' + Config.colors("red", 500) + ';"></i>'
  49. });
  50. map.drawOverlay({
  51. lat: -12.05449279282314,
  52. lng: -77.04333,
  53. content: '<i class="wb-map" style="font-size:32px;color:' + Config.colors("primary", 500) + ';"></i>'
  54. });
  55. map.addStyle({
  56. styledMapName: "Styled Map",
  57. styles: Plugin.getDefaults('gmaps', 'styles'),
  58. mapTypeId: "map_style"
  59. });
  60. map.setStyle("map_style");
  61. var path = [[-12.044012922866312, -77.02470665341184], [-12.05449279282314, -77.03024273281858], [-12.055122327623378, -77.03039293652341], [-12.075917129727586, -77.02764635449216], [-12.07635776902266, -77.02792530422971], [-12.076819390363665, -77.02893381481931], [-12.088527520066453, -77.0241058385925], [-12.090814532191756, -77.02271108990476]];
  62. map.drawPolyline({
  63. path: path,
  64. strokeColor: '#131540',
  65. strokeOpacity: 0.6,
  66. strokeWeight: 6
  67. });
  68. })(); // Markers
  69. // ------------------
  70. (function () {
  71. var map = new GMaps({
  72. div: '#markersGmap',
  73. lat: -12.043333,
  74. lng: -77.028333
  75. });
  76. map.addMarker({
  77. lat: -12.043333,
  78. lng: -77.03,
  79. title: 'Lima',
  80. details: {
  81. database_id: 42,
  82. author: 'HPNeo'
  83. },
  84. click: function click(e) {
  85. if (console.log) console.log(e);
  86. alert('You clicked in this marker');
  87. }
  88. });
  89. map.addMarker({
  90. lat: -12.042,
  91. lng: -77.028333,
  92. title: 'Marker with InfoWindow',
  93. infoWindow: {
  94. content: '<p>You clicked in this marker</p>'
  95. }
  96. });
  97. })(); // Polylines
  98. // ------------------
  99. (function () {
  100. var map = new GMaps({
  101. div: '#polylinesGmap',
  102. lat: -12.043333,
  103. lng: -77.028333,
  104. click: function click(e) {
  105. console.log(e);
  106. }
  107. });
  108. var path = [[-12.044012922866312, -77.02470665341184], [-12.05449279282314, -77.03024273281858], [-12.055122327623378, -77.03039293652341], [-12.075917129727586, -77.02764635449216], [-12.07635776902266, -77.02792530422971], [-12.076819390363665, -77.02893381481931], [-12.088527520066453, -77.0241058385925], [-12.090814532191756, -77.02271108990476]];
  109. map.drawPolyline({
  110. path: path,
  111. strokeColor: '#131540',
  112. strokeOpacity: 0.6,
  113. strokeWeight: 6
  114. });
  115. })(); // Polygons
  116. // ------------------
  117. (function () {
  118. var map = new GMaps({
  119. div: '#polygonsGmap',
  120. lat: -12.043333,
  121. lng: -77.028333
  122. });
  123. var path = [[-12.040397656836609, -77.03373871559225], [-12.040248585302038, -77.03993927003302], [-12.050047116528843, -77.02448169303511], [-12.044804866577001, -77.02154422636042]];
  124. map.drawPolygon({
  125. paths: path,
  126. strokeColor: '#BBD8E9',
  127. strokeOpacity: 1,
  128. strokeWeight: 3,
  129. fillColor: '#BBD8E9',
  130. fillOpacity: 0.6
  131. });
  132. })(); // Fusion Tables layers
  133. // ------------------
  134. (function () {
  135. var infoWindow = new google.maps.InfoWindow({}),
  136. map = new GMaps({
  137. div: '#FTLGmap',
  138. zoom: 11,
  139. lat: 41.850033,
  140. lng: -87.6500523
  141. });
  142. map.loadFromFusionTables({
  143. query: {
  144. select: '\'Geocodable address\'',
  145. from: '1mZ53Z70NsChnBMm-qEYmSDOvLXgrreLTkQUvvg'
  146. },
  147. suppressInfoWindows: true,
  148. events: {
  149. click: function click(point) {
  150. infoWindow.setContent('You clicked here!');
  151. infoWindow.setPosition(point.latLng);
  152. infoWindow.open(map.map);
  153. }
  154. }
  155. });
  156. })(); // Panoramas
  157. // ------------------
  158. (function () {
  159. var panorama = GMaps.createPanorama({
  160. el: '#panoramasGmap',
  161. lat: 42.3455,
  162. lng: -71.0983
  163. });
  164. })(); // Satellite
  165. // ------------------
  166. (function () {
  167. var simpleMap = new GMaps({
  168. div: "#satelliteGmap",
  169. lat: 0,
  170. lng: 0,
  171. zoom: 1,
  172. scrollwheel: !1
  173. }).setMapTypeId(google.maps.MapTypeId.SATELLITE);
  174. })();
  175. });
  176. });