From 4ba0173083ec60cfdf546ba0a9d79a49ddcfc464 Mon Sep 17 00:00:00 2001 From: Silvio Date: Tue, 23 Jul 2013 13:27:38 -0300 Subject: Support to show/hide layers created from queries --- gmap_arcgis.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/gmap_arcgis.js b/gmap_arcgis.js index f5783d3..7fe4fca 100644 --- a/gmap_arcgis.js +++ b/gmap_arcgis.js @@ -227,8 +227,16 @@ function gmapArcgis(config) { this.config['layers'][element].opacity = this.defaultOpacity(element); if (typeof this.config['layers'][element].overlay != 'undefined') { - this.config['layers'][element].overlay.setOpacity(this.config['layers'][element].opacity); - this.identifyPolygon(this.config['layers'][element]); + if (this.config['layers'][element].overlay.setOpacity != undefined) { + this.config['layers'][element].overlay.setOpacity(this.config['layers'][element].opacity); + this.identifyPolygon(this.config['layers'][element]); + } + else if (this.config['layers'][element].overlay[0] != undefined) { + for (i=0; i < this.config['layers'][element].overlay.length; i++) { + this.config['layers'][element].overlay[i].setVisible(true); + } + } + this.unblockUI(); return; } @@ -354,8 +362,16 @@ function gmapArcgis(config) { }, // Toggle layer visibility + // TODO: it should really toggle and not just hide layers toggleLayers: function(element) { - this.config['layers'][element].overlay.setOpacity(0); + if (this.config['layers'][element].overlay.setOpacity != undefined) { + this.config['layers'][element].overlay.setOpacity(0); + } + else if (this.config['layers'][element].overlay[0] != undefined) { + for (i=0; i < this.config['layers'][element].overlay.length; i++) { + this.config['layers'][element].overlay[i].setVisible(false); + } + } if (this.config['layers'][element].identifyListener != undefined) { google.maps.event.removeListener(this.config['layers'][element].identifyListener); -- cgit v1.2.3