aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2013-04-02 15:51:56 -0300
committerSilvio <silvio@socioambiental.org>2013-04-02 15:51:56 -0300
commit594675dccca5fbc6055f5fc31870e0a3cf4a52e0 (patch)
tree6cea61a03575654353a32fc1f1cf94ff76da4032
parentf873a1d5a193f98659235708777e1acc64a4b03c (diff)
downloadgmap_arcgis_js-594675dccca5fbc6055f5fc31870e0a3cf4a52e0.tar.gz
gmap_arcgis_js-594675dccca5fbc6055f5fc31870e0a3cf4a52e0.tar.bz2
Working code for clickable polygons
-rw-r--r--gmap_arcgis.js19
1 files changed, 12 insertions, 7 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index 07a4330..190f9b3 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -46,18 +46,18 @@ function gmapArcgis(config) {
params.overlay.setMap(this.map);
params.overlay.setOpacity(params.opacity);
- // TODO: support for clickable polygons
// See https://google-maps-utility-library-v3.googlecode.com/svn/trunk/arcgislink/examples/identify.js
if (typeof params.identify != 'undefined') {
- google.maps.event.addListener(this.map, 'click', function(point) {
+ var self = this;
+ params.identifyListener = google.maps.event.addListener(this.map, 'click', function(point) {
params.identify.geometry = point.latLng;
- params.identify.bounds = this.map.getBounds();
+ params.identify.bounds = self.map.getBounds();
+ params.identify.width = self.map.getDiv().offsetWidth;
+ params.identify.height = self.map.getDiv().offsetHeight;
params.service.identify(params.identify, function(results, err) {
- if (err) {
- alert(err.message + err.details.join('\n'));
- } else {
- //addResultToMap(results, evt.latLng);
+ if (!err) {
+ params.identify.callback(results, err);
}
});
});
@@ -107,6 +107,7 @@ 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.unblockUI();
@@ -231,6 +232,10 @@ function gmapArcgis(config) {
// Toggle layer visibility
toggleLayers: function(element) {
this.config['layers'][element].overlay.setOpacity(0);
+
+ if (this.config['layers'][element].identifyListener != undefined) {
+ google.maps.event.removeListener(this.config['layers'][element].identifyListener);
+ }
},
// Toggle marker visibility