diff options
Diffstat (limited to 'gmap_arcgis.js')
-rw-r--r-- | gmap_arcgis.js | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js index 0f34921..9960f94 100644 --- a/gmap_arcgis.js +++ b/gmap_arcgis.js @@ -4,7 +4,7 @@ google.load("maps", "2.x"); // Global variables -var map, mapExtension, gOverlays; +var map, mapExtension, gOverlays,markers,pol; // Setup custom GMap Overlays (layers and labels) function gmap_arcgis() { @@ -19,7 +19,7 @@ function gmap_arcgis() { var fields = new Array(); var id = 'auto1map'; var content, label; - + // Get data from Drupal if (Drupal.settings.gmap_arcgis !== undefined) { // Get array of polygons @@ -35,6 +35,8 @@ function gmap_arcgis() { id = Drupal.settings.gmap_arcgis.id; } } + + // Get an existing GMap instance using Drupal GMap Module API // and add an ArcGIS extension to it @@ -47,7 +49,7 @@ function gmap_arcgis() { fields = ["id", "name"]; content = 'Placeholder'; icon = new GIcon(G_DEFAULT_ICON); - + if (label[1] !== undefined) { // Set custom fields fields = [ label[1][0], label[1][1] ]; @@ -72,10 +74,15 @@ function gmap_arcgis() { showLabels(label[0], fields, content, icon); } - for (var j = 0; j < polygons.length; j++) { - showPolygons(polygons[j]); + for (j = 0; j < polygons.length; j++) { + + showPolygons(polygons[j]); } - }, 500); + + + + }, 5); + //setTimeout($.unblockUI, 10000); } // Add labels from a given ArcGIS MapServer Layer @@ -104,7 +111,8 @@ function showLabelsCallback(fields, content, icon) { return function(fset) { // Label title var title = '{' + fields[1] + '}'; - + + // JS literal class esri.arcgis.gmaps.MarkerOptions var myMarkerOptions = { title:title, icon:icon }; @@ -120,12 +128,15 @@ function showLabelsCallback(fields, content, icon) { // Add polygons from a given ArcGIS MapServer Layer function showPolygons(uri) { - polygons = new esri.arcgis.gmaps.DynamicMapServiceLayer(uri, null, 0.45, showPolygonsCallback); + pol = new esri.arcgis.gmaps.DynamicMapServiceLayer(uri, null, 0.55); + + GEvent.addListener(pol,"load",function(g){ map.addOverlay(g);setTimeout($.unblockUI, 6000);}); + } // Callback for showPolygons function showPolygonsCallback(mapservicelayer, error) { - map.addOverlay(mapservicelayer); + map.addOverlay(mapservicelayer); } // Add custom marker @@ -133,11 +144,12 @@ 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(12, 20); + 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; @@ -145,5 +157,25 @@ function createMarker(point, name, html, icone) { // Add map overlays $(document).ready(function() { + //showOverlay(13000); 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"); + $('#header').hide(); + $('#nav').hide(); + + //get(Drupal.gmap.getMap('auto1map').vars.behavior); + + }); + + //$('auto1map').append('<div>oi oi oi</div>'); + }); + +$(document).ready(function() { + $("#uc-form").show(); + +}); + |