2015-11-13 24 views
0

嗨即時通訊使用gmap3(jquery插件)來顯示谷歌地圖。 這裏是鏈接到頁面:website 這裏是js代碼:作爲默認Gmap3風格

   $("#mapa").gmap3({ 
        defaults:{ 
         classes:{ 
          Marker:MarkerWithLabel 
         } 
        },       
        map:{ 
         options:{ 
          zoom: 16, 
          center: new google.maps.LatLng(54.81592345170086,17.954444355125368), 
          mapTypeId: google.maps.MapTypeId.ROADMAP, 
          mapTypeControlOptions: { 
           mapTypeIds: [google.maps.MapTypeId.ROADMAP, "style1"] 
          }, 
          icon: new google.maps.MarkerImage("assets/gfx/itmarker_01.png", new google.maps.Size(64, 60, "px", "px")), 
          streetViewControl: false, 
          draggable: true, 
         } 
        } 
        , 
        styledmaptype:{ 
         id: "style1", 
         options:{ 
          name: "Style 1" 
         }, 
         styles: [ 
          { 
          featureType: "landscape", 
          stylers: [ 
           { hue: "#013e53" }, 
           { saturation: 0 }, 
           { lightness: 0 } 
          ] 
          } 
         ] 
        }    
        , 
        marker:{ 
         latLng:[54.81558744636294,17.954398119049074], 
         options:{ 
          icon: new google.maps.MarkerImage("assets/gfx/itmarker_01.png", new google.maps.Size(64, 60, "px", "px")), 
          labelContent: "$425K", 
          labelAnchor: new google.maps.Point(160, 110), 
          labelClass: "labels", 
          labelStyle: {opacity: 0.9}, 
          labelContent: "PROMYK<br/>ul. Lubiatowska 4/3, 84-113 Białogóra", 
         } 
        } 

       }); 
       function toggleStreetView(){ 
        var promyk = {lat: 54.81557641505586, lng: 17.954616016502314}; 
        var map = $("#mapa").gmap3("get"), 
         panorama = map.getStreetView(); 
        if (panorama.getVisible()){ 
         panorama.setVisible(false); 
        } else { 
         //panorama.setPosition(map.getCenter()); 
         panorama.setPosition(promyk); 
         panorama.setPov({ 
          heading: 320, 
          zoom:1, 
          pitch:5 
         }); 
         panorama.setVisible(true); 
        } 
       } 

其做工精細。我正在尋找一些方法來將我的「樣式1」設置爲該地圖的默認樣式,而無需控件即可更改衛星或路線圖。我的風格只改變色調效果。

回答

1

確定發現

    $("#mapa").gmap3({ 
        defaults:{ 
         classes:{ 
          Marker:MarkerWithLabel 
         } 
        },       
        map:{ 
         options:{ 
          zoom: 16, 
          center: new google.maps.LatLng(54.81592345170086,17.954444355125368), 
          mapTypeId: google.maps.MapTypeId.ROADMAP, 
          mapTypeControlOptions: { 
           mapTypeIds: [google.maps.MapTypeId.ROADMAP, "style1"] 
          }, 
          styles: [ 
           { 
            featureType: "landscape", 
            stylers: [ 
            { hue: "#013e53" }, 
            { saturation: 0 }, 
            { lightness: 0 } 
            ] 
           } 
           ], 
          icon: new google.maps.MarkerImage("assets/gfx/itmarker_01.png", new google.maps.Size(64, 60, "px", "px")), 
          streetViewControl: false, 
          draggable: true, 
         } 
        }    
        , 
        marker:{ 
         latLng:[54.81558744636294,17.954398119049074], 
         options:{ 
          icon: new google.maps.MarkerImage("assets/gfx/itmarker_01.png", new google.maps.Size(64, 60, "px", "px")), 
          labelContent: "$425K", 
          labelAnchor: new google.maps.Point(160, 110), 
          labelClass: "labels", 
          labelStyle: {opacity: 0.9}, 
          labelContent: "PROMYK<br/>ul. Lubiatowska 4/3, 84-113 Białogóra", 
         } 
        } 

       }); 
       function toggleStreetView(){ 
        var promyk = {lat: 54.81557641505586, lng: 17.954616016502314}; 
        var map = $("#mapa").gmap3("get"), 
         panorama = map.getStreetView(); 
        if (panorama.getVisible()){ 
         panorama.setVisible(false); 
        } else { 
         //panorama.setPosition(map.getCenter()); 
         panorama.setPosition(promyk); 
         panorama.setPov({ 
          heading: 320, 
          zoom:1, 
          pitch:5 
         }); 
         panorama.setVisible(true); 
        } 
       }