File: //home/arjun/projects/buyercall_new/buyercall/buyercall/static/js/pages/compMaps.js
/*
* Document : compMaps.js
* Author : pixelcave
* Description: Custom javascript code used in Maps page
*/
var CompMaps = function() {
return {
init: function() {
/*
* With Gmaps.js, Check out examples and documentation at http://hpneo.github.io/gmaps/examples.html
*/
// Set default height to all Google Maps Containers
$('.gmap').css('height', '400px');
// Initialize top map
new GMaps({
div: '#gmap-top',
lat: 40.7,
lng: -73.994901,
zoom: 12,
disableDefaultUI: true,
scrollwheel: false
});
// Initialize satellite map
new GMaps({
div: '#gmap-satellite',
lat: 40.7,
lng: -73.994901,
zoom: 10,
scrollwheel: false
}).setMapTypeId(google.maps.MapTypeId.SATELLITE);
// Initialize terrain map
new GMaps({
div: '#gmap-terrain',
lat: 40.7,
lng: -73.994901,
zoom: 10,
scrollwheel: false
}).setMapTypeId(google.maps.MapTypeId.TERRAIN);
// Initialize overlay map
new GMaps({
div: '#gmap-overlay',
lat: 40.7,
lng: -73.994901,
zoom: 10,
scrollwheel: false
}).drawOverlay({
lat: 40.7,
lng: -73.994901,
content: '<div class="alert alert-warning"><h3><strong>Overlay</strong> Message!</h3></div>'
});
// Initialize map with markers
new GMaps({
div: '#gmap-markers',
lat: 41,
lng: -73.994901,
zoom: 6,
scrollwheel: false
}).addMarkers([
{lat: 43, lng: -73, title: 'Marker #1', animation: google.maps.Animation.DROP, infoWindow: {content: '<strong>Marker #1</strong>'}},
{lat: 42, lng: -74, title: 'Marker #2', animation: google.maps.Animation.DROP, infoWindow: {content: '<strong>Marker #2</strong>'}},
{lat: 41, lng: -75, title: 'Marker #3', animation: google.maps.Animation.DROP, infoWindow: {content: '<strong>Marker #3</strong>'}},
{lat: 41.6, lng: -72, title: 'Marker #4', animation: google.maps.Animation.DROP, infoWindow: {content: '<strong>Marker #4</strong>'}},
{lat: 40, lng: -76, title: 'Marker #5', animation: google.maps.Animation.DROP, infoWindow: {content: '<strong>Marker #5</strong>'}}
]);
// Initialize street view panorama
new GMaps.createPanorama({
el: '#gmap-street',
lat: -22.964461,
lng: -43.171694,
pov: {heading: 160, pitch: 4},
scrollwheel: false
});
// Initialize map geolocation
var gmapGeolocation = new GMaps({
div: '#gmap-geolocation',
lat: 0,
lng: 0,
scrollwheel: false
});
GMaps.geolocate({
success: function(position) {
gmapGeolocation.setCenter(position.coords.latitude, position.coords.longitude);
gmapGeolocation.addMarker({
lat: position.coords.latitude,
lng: position.coords.longitude,
animation: google.maps.Animation.DROP,
title: 'GeoLocation',
infoWindow: {
content: '<div class="text-success"><i class="fa fa-map-marker"></i> <strong>Your location!</strong></div>'
}
});
},
error: function(error) {
alert('Geolocation failed: ' + error.message);
},
not_supported: function() {
alert("Your browser does not support geolocation");
},
always: function() {
// Message when geolocation succeed
}
});
}
};
}();