aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2013-07-23 13:27:38 -0300
committerSilvio <silvio@socioambiental.org>2013-07-23 13:27:38 -0300
commit4ba0173083ec60cfdf546ba0a9d79a49ddcfc464 (patch)
tree3d3a8ca4c6555dc356c9962f11597c997ddb2b7d
parent3084a6db32eddbd1bc68aeb25cb25cb5f22a0cf1 (diff)
downloadgmap_arcgis_js-4ba0173083ec60cfdf546ba0a9d79a49ddcfc464.tar.gz
gmap_arcgis_js-4ba0173083ec60cfdf546ba0a9d79a49ddcfc464.tar.bz2
Support to show/hide layers created from queries
-rw-r--r--gmap_arcgis.js22
1 files 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);