From 033521e5825558c8316a9805a4ce546ab9b185bd Mon Sep 17 00:00:00 2001 From: Silvio Date: Tue, 12 Mar 2013 11:45:32 -0300 Subject: Misc fixes --- gmap_arcgis.js | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/gmap_arcgis.js b/gmap_arcgis.js index 78a664e..caf5c8c 100644 --- a/gmap_arcgis.js +++ b/gmap_arcgis.js @@ -82,11 +82,12 @@ function gmapArcgis(config) { }, // Add makers to the map - addMarkers: function(elements) { + addMarkers: function(element) { var bounds = this.map.getBounds(); + var self = this; if (this.config['markers'][element].overlay != undefined) { - this.toggleMarkers(this.config['markers'][element]); + this.toggleMarkers(element); return; } else { this.config['markers'][element].overlay = []; @@ -121,19 +122,19 @@ function gmapArcgis(config) { for (var i = 0, c = fs.length; i < c; i++) { fset = fs[i]; - this.config['markers'][element].overlay[i] = {}; - this.config['markers'][element].overlay[i].marker = new google.maps.Marker({ - title: (this.config['markers'][element].title != undefined) ? fset.attributes[this.config['markers'][element].title] : fset.attributes.nome, - icon: this.config['markers'][element].icon, + self.config['markers'][element].overlay[i] = {}; + self.config['markers'][element].overlay[i].marker = new google.maps.Marker({ + title: (self.config['markers'][element].title != undefined) ? fset.attributes[self.config['markers'][element].title] : fset.attributes.nome, + icon: self.config['markers'][element].icon, position: fset.geometry[0].getPosition(), map: map, }); // Use a closure so marker data remains available to the listeners - this.config['markers'][element].overlay[i].addListener = function() { - var marker = this.config['markers'][element].overlay[i].marker; - var infowindow = this.config['markers'][element].infowindow; - var content = this.config['markers'][element].content; + self.config['markers'][element].overlay[i].addListener = function() { + var marker = self.config['markers'][element].overlay[i].marker; + var infowindow = self.config['markers'][element].infowindow; + var content = self.config['markers'][element].content; var attributes = fset.attributes; google.maps.event.addListener(marker, 'click', function() { @@ -143,10 +144,10 @@ function gmapArcgis(config) { }; // Execute - this.config['markers'][element].overlay[i].addListener(); + self.config['markers'][element].overlay[i].addListener(); } - this.unblockUI(); + self.unblockUI(); } }, @@ -171,7 +172,7 @@ function gmapArcgis(config) { // Toggle marker visibility toggleMarkers: function(element, raw) { - markers = (raw == true) ? element : this.config['markers'][element].overlay; + var markers = (raw == true) ? element : this.config['markers'][element].overlay; for (i=0; i < markers.length; i++) { if (markers[i].marker.getVisible()) { @@ -242,6 +243,22 @@ function gmapArcgis(config) { }, + // Setup slider + activateSlider: function() { + var self = this; + // Max is the number of layers in the service + $("#slider").slider({ + value: 1, + min: -1, + max: 11, + step: 1, + animate: true, + change: function(event, ui) { + self.deforestationUpdate.bind(self, ui.value); + }, + }); + }, + setMap: function(map) { this.map = map; }, -- cgit v1.2.3