Blame view

plast/js/map.js 2.19 KB
c420c609   alex   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
  

  window.onload = function() {

      initialize();

  

  }

  function initialize() {

      var zooms = 12;

      var paramsList = $('.adress-map');

      zooms = paramsList.data('zoom');

  

      if (paramsList.attr('data-start-lat') && paramsList.attr('data-start-lng')) {

          var start_position = new google.maps.LatLng(paramsList.attr('data-start-lat'), paramsList.attr('data-start-lng'));

      } else {

          var start_position = new google.maps.LatLng('50.435', '30.60');

      }

  

      var styles = [

          {

              stylers: [

                  {saturation: -100}

              ]

          }

      ];

      var settings= {

              styles:styles, zoom:zooms, scrollwheel:false, center:start_position, mapTypeControl:true, mapTypeControlOptions: {

                  style: google.maps.MapTypeControlStyle.DROPDOWN_MENU

              }

              , navigationControl:false, navigationControlOptions: {

                  style: google.maps.NavigationControlStyle.SMALL

              }

              , scaleControl:true, streetViewControl:true, rotateControl:true, zoomControl:true, mapTypeId:google.maps.MapTypeId.ROADMAP

          }

      ;

      var map = new google.maps.Map(document.getElementById("map_canvas"), settings);

      var image1 = new google.maps.MarkerImage('images/markers/marker-we-1.png', new google.maps.Size(68, 80), new google.maps.Point(0, 0), new google.maps.Point(16, 35));

      var markers = [];

      $('.adress-map span')

          .each(function() {

              var newLat = $(this)

                  .data('lat');

              var newLng = $(this)

                  .data('lng');

              var newName = $(this)

                  .text();

              var marker = new google.maps.Marker({

                  position: new google.maps.LatLng(newLat, newLng),

                  map: map,

                  title: newName,

                  icon: image1

              });

              markers.push(marker);

          });

      var clusterStyles = [

          {

              url: 'images/markers/clasters.png',

              height: 36,

              width: 36

          }

      ];

      markerClusterer = new MarkerClusterer(map, markers, {

          maxZoom: 10,

          gridSize: 100,

          styles: clusterStyles

      });

  }