From 375a098c6d1deac4f2c7b1ee591e6aec1ed5d12b Mon Sep 17 00:00:00 2001 From: Silvio Date: Wed, 27 Feb 2013 17:32:47 -0300 Subject: Now fully working with Google Maps v3 --- gmap_arcgis.js | 46 ++++++++++++++++------------------------------ 1 file changed, 16 insertions(+), 30 deletions(-) diff --git a/gmap_arcgis.js b/gmap_arcgis.js index a63003d..a7da5a9 100644 --- a/gmap_arcgis.js +++ b/gmap_arcgis.js @@ -6,7 +6,7 @@ // Global variables var map, mapExtension, gOverlays; -// Setup custom GMap Overlays (layers and labels) +// Setup custom GMap Overlays function gmap_arcgis() { /** * Use a timer to make sure everything is loaded upon execution time. @@ -38,7 +38,6 @@ function gmap_arcgis() { gmapArcgisShowPolygons(Drupal.settings.gmap_arcgis.polygons); }, 5); - //setTimeout(unblockUI, 10000); } // Show all defined polygons @@ -76,47 +75,34 @@ function showPolygon(polygon) { } }); + blockUI(); polygon.overlay.setMap(map); polygon.overlay.setOpacity(defaultOpacity); - // TODO - return; - GEvent.addListener(polygon.overlay, "load", showPolygonCallback); - GEvent.addListener(polygon.overlay, "update", function() { unblockUI(); }); -} - -// Callback for showPolygon -function showPolygonCallback(mapservicelayer, error) { - map.addOverlay(mapservicelayer); - setTimeout(unblockUI, 6000); -} - -// Add custom marker -function createMarker(point, name, html, icone) { - var icon = new GIcon(); - icon.image = icone; - icon.shadow = "http://maps.google.com/mapfiles/ms/micons/msmarker.shadow.png"; - icon.iconSize = new GSize(20, 20); - icon.shadowSize = new GSize(22, 20); - icon.iconAnchor = new GPoint(6, 20); - icon.infoWindowAnchor = new GPoint(5, 1); - - var marker = new GMarker(point); - GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); - return marker; + google.maps.event.addListener(polygon.overlay.getMapService(), 'load', function() { + unblockUI(); + }); } +// UI unblocker wrapper function unblockUI() { $.unblockUI(); } +// UI blocker wrapper +function blockUI() { + $.blockUI(); +} + // Add map overlays $(document).ready(function() { google.setOnLoadCallback(gmap_arcgis); $('#edit-lista-uc').change(function() { - oelem = $("option:selected", this).val(); - marcador = Drupal.gmap.getMap('auto1map').vars.markers[oelem]; - GEvent.trigger(marcador.marker,"click"); + // TODO: this is still needed? + //oelem = $("option:selected", this).val(); + //marcador = Drupal.gmap.getMap('auto1map').vars.markers[oelem]; + //GEvent.trigger(marcador.marker,"click"); + $('#header').hide(); $('#nav').hide(); }); -- cgit v1.2.3