aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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