aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2013-04-02 18:18:46 -0300
committerSilvio <silvio@socioambiental.org>2013-04-02 18:18:46 -0300
commit3d2768b6156b593acb1127b6489eb7961a5f25cf (patch)
tree4da76532381e463059220f446db1a42e41125f40
parent24adf1e5de21777c1a2f94b0adbe0ae7216d8e18 (diff)
downloadgmap_arcgis_js-3d2768b6156b593acb1127b6489eb7961a5f25cf.tar.gz
gmap_arcgis_js-3d2768b6156b593acb1127b6489eb7961a5f25cf.tar.bz2
Adds infoWindow support to identifyPolygon
-rw-r--r--gmap_arcgis.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index 89193f7..e58bae4 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -68,12 +68,28 @@ function gmapArcgis(config) {
// See https://google-maps-utility-library-v3.googlecode.com/svn/trunk/arcgislink/examples/identify.js
if (typeof params.identify != 'undefined') {
var self = this;
+
+ // Configure event listener
params.identifyListener = google.maps.event.addListener(this.map, 'click', function(point) {
params.identify.geometry = point.latLng;
params.identify.bounds = self.map.getBounds();
params.identify.width = self.map.getDiv().offsetWidth;
params.identify.height = self.map.getDiv().offsetHeight;
+ // Configure infoWindow
+ if (params.infowindow != undefined) {
+ params.infowindow.close();
+ params.infowindow.setContent('');
+ params.infowindow.setPosition(point.latLng);
+ }
+ else {
+ params.infowindow = new google.maps.InfoWindow({
+ content: '',
+ position: point.latLng,
+ });
+ }
+
+ // Identify layers
params.service.identify(params.identify, function(identify, err) {
if (!err) {
var layers = { };
@@ -93,7 +109,8 @@ function gmapArcgis(config) {
}
}
- params.identify.callback(layers, err);
+ // Callback
+ params.identify.callback(layers, params.infowindow, err);
}
});
});