aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2013-04-02 16:00:57 -0300
committerSilvio <silvio@socioambiental.org>2013-04-02 16:00:57 -0300
commit7dab7dfcefc3b9f5355e420e328ab14cf58186af (patch)
tree421dd3027c62c352638949f0950786409fba3211
parent594675dccca5fbc6055f5fc31870e0a3cf4a52e0 (diff)
downloadgmap_arcgis_js-7dab7dfcefc3b9f5355e420e328ab14cf58186af.tar.gz
gmap_arcgis_js-7dab7dfcefc3b9f5355e420e328ab14cf58186af.tar.bz2
Working code for clickable polygons (2)
-rw-r--r--gmap_arcgis.js35
1 files changed, 20 insertions, 15 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index 190f9b3..c1023c9 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -46,6 +46,25 @@ function gmapArcgis(config) {
params.overlay.setMap(this.map);
params.overlay.setOpacity(params.opacity);
+ this.identifyPolygon(params);
+
+ if (params.callback == undefined) {
+ // Default callback: remove the blockUI once the layer is shown
+ google.maps.event.addListener(params.overlay.getMapService(), 'update', function() {
+ this.unblockUI();
+ });
+ }
+ else {
+ google.maps.event.addListener(params.overlay.getMapService(), 'update', function() {
+ params.callback(this.map, params) ; this.unblockUI();
+ });
+ }
+
+ return params.overlay;
+ },
+
+ // Add an identify callback to a layer
+ identifyPolygon: function(params) {
// See https://google-maps-utility-library-v3.googlecode.com/svn/trunk/arcgislink/examples/identify.js
if (typeof params.identify != 'undefined') {
var self = this;
@@ -62,20 +81,6 @@ function gmapArcgis(config) {
});
});
}
-
- if (params.callback == undefined) {
- // Default callback: remove the blockUI once the layer is shown
- google.maps.event.addListener(params.overlay.getMapService(), 'update', function() {
- this.unblockUI();
- });
- }
- else {
- google.maps.event.addListener(params.overlay.getMapService(), 'update', function() {
- params.callback(this.map, params) ; this.unblockUI();
- });
- }
-
- return params.overlay;
},
// Add a KML to the map
@@ -107,9 +112,9 @@ function gmapArcgis(config) {
addLayers: function(element) {
this.config['layers'][element].opacity = this.defaultOpacity(element);
- // TODO: add identify listener
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]);
this.unblockUI();
return;
}