From 3d2768b6156b593acb1127b6489eb7961a5f25cf Mon Sep 17 00:00:00 2001 From: Silvio Date: Tue, 2 Apr 2013 18:18:46 -0300 Subject: Adds infoWindow support to identifyPolygon --- gmap_arcgis.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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); } }); }); -- cgit v1.2.3