define(["dojo/on",
"dojo/_base/declare",
"dojo/_base/lang",
"dojo/_base/window",
"dojo/dom",
"dojo/dom-geometry",
"dojo/io/script",
"dijit/registry",
"dojox/mobile/ProgressIndicator",
"./structure"],
function(on, declare, lang, win, dom, domGeom, script, registry, ProgressIndicator, structure){
// Map class
var Map = declare(null, {
constructor: function(args){
this.id = args.id;
this.location = args.location;
this.options = {
center: args.location,
zoom : (structure.layout.leftPane.hidden ? 11 : 12),
mapTypeId : google.maps.MapTypeId.ROADMAP,
panControl: false,
zoomControl: true,
mapTypeControl: true,
scaleControl: true,
streetViewControl: true,
overviewMapControl: false,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL
}
};
},
load: function(){
this.map = new google.maps.Map(document.getElementById(this.id),
this.options);
// add a marker for current location
var marker = new google.maps.Marker({
map: this.map,
position: this.location
});
// search the address of current location
var geocoder = new google.maps.Geocoder();
var infoWindow = new google.maps.InfoWindow();
var map = this.map;
geocoder.geocode({"latLng":this.location}, function(results, status){
if (status === google.maps.GeocoderStatus.OK){
google.maps.event.addListener(marker, "click", function(){
infoWindow.setContent("Location
" + results[0].formatted_address.replace(", ", "