aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2013-03-04 13:00:50 -0300
committerSilvio <silvio@socioambiental.org>2013-03-04 13:00:50 -0300
commitcdceb27f4f231c5bea9c07cc8d7d545d4439193c (patch)
tree24040998595abb59235ab53884bb2a8fd2be767d
parentcf82ef9af23b3a7c60a93069781fdd2faf449049 (diff)
downloadgmap_arcgis-cdceb27f4f231c5bea9c07cc8d7d545d4439193c.tar.gz
gmap_arcgis-cdceb27f4f231c5bea9c07cc8d7d545d4439193c.tar.bz2
Adding callbacks from isa_gmap_overlays
-rw-r--r--gmap_arcgis.js36
1 files changed, 25 insertions, 11 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index aad3872..2d03795 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -42,31 +42,45 @@ function gmapArcgisHidePolygons(map, polygons) {
}
// Add polygons from a given ArcGIS MapServer Layer
-function showPolygon(map, polygon) {
+function showPolygon(map, params) {
var defaultOpacity = 0.55;
- if (typeof polygon.overlay != 'undefined') {
- polygon.overlay.setOpacity(defaultOpacity);
+ if (typeof params.overlay != 'undefined') {
+ params.overlay.setOpacity(defaultOpacity);
unblockUI();
return;
}
- uri = polygon['uri'];
- layers = polygon['layers'];
+ uri = params['uri'];
+ layers = params['layers'];
- polygon.overlay = new gmaps.ags.MapOverlay(uri, {
+ params.overlay = new gmaps.ags.MapOverlay(uri, {
exportOptions: {
layerIds: layers,
layerOption: 'show',
}
});
- polygon.overlay.setMap(map);
- polygon.overlay.setOpacity(defaultOpacity);
+ params.overlay.setMap(map);
+ params.overlay.setOpacity(defaultOpacity);
- google.maps.event.addListener(polygon.overlay.getMapService(), 'load', function() {
- unblockUI();
- });
+ if (params.callback == undefined) {
+ // Default callback: remove the blockUI once the layer is shown
+ google.maps.event.addListener(params.overlay.getMapService(), 'update', function() {
+ unblockUI();
+ });
+ }
+ else {
+ google.maps.event.addListener(params.overlay.getMapService(), 'update', function() {
+ params.callback(map, params) ; unblockUI();
+ });
+ }
+}
+
+// Add a KML to the map
+function showKML(map, params) {
+ params.overlay = new google.maps.KmlLayer(params.uri);
+ params.overlay.setMap(map);
}
// UI unblocker wrapper