From cf82ef9af23b3a7c60a93069781fdd2faf449049 Mon Sep 17 00:00:00 2001 From: Silvio Date: Mon, 4 Mar 2013 12:26:25 -0300 Subject: Major cleanup: do not add polygons via hook anymore --- gmap_arcgis.js | 35 +++++------------- gmap_arcgis.module | 103 +---------------------------------------------------- 2 files changed, 9 insertions(+), 129 deletions(-) diff --git a/gmap_arcgis.js b/gmap_arcgis.js index f28106a..aad3872 100644 --- a/gmap_arcgis.js +++ b/gmap_arcgis.js @@ -1,8 +1,5 @@ // $Id$ -// Load Google Maps API -//google.load("maps", "3"); - // Global variables var map, mapExtension, gOverlays; @@ -14,28 +11,17 @@ function gmap_arcgis() { */ setTimeout(function() { // Variables - var polygons = new Array(); - var labels = new Array(); - var fields = new Array(); - var id = 'auto1map'; - var content, label; + var id = 'auto1map'; - // Get data from Drupal - if (Drupal.settings.gmap_arcgis !== undefined) { - // Get array of labels - if (Drupal.settings.gmap_arcgis.labels !== undefined) { - labels = Drupal.settings.gmap_arcgis.labels; - } - // Get Map Id - if (Drupal.settings.gmap_arcgis.id !== undefined) { - id = Drupal.settings.gmap_arcgis.id; - } + // Get Map Id + if (Drupal.settings.gmap_arcgis.id !== undefined) { + id = Drupal.settings.gmap_arcgis.id; } // Get an existing GMap instance using Drupal GMap Module API map = Drupal.gmap.getMap(id).map; - gmapArcgisShowPolygons(map, Drupal.settings.gmap_arcgis.polygons); + //gmapArcgisShowPolygons(map, Drupal.settings.gmap_arcgis.polygons); }, 5); } @@ -65,7 +51,7 @@ function showPolygon(map, polygon) { return; } - uri = polygon['base'] + polygon['service']; + uri = polygon['uri']; layers = polygon['layers']; polygon.overlay = new gmaps.ags.MapOverlay(uri, { @@ -97,12 +83,7 @@ function blockUI() { $(document).ready(function() { google.setOnLoadCallback(gmap_arcgis); $('#edit-lista-uc').change(function() { - // 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(); + $('#header').hide(); + $('#nav').hide(); }); }); diff --git a/gmap_arcgis.module b/gmap_arcgis.module index f69b0e2..1a73928 100644 --- a/gmap_arcgis.module +++ b/gmap_arcgis.module @@ -55,104 +55,6 @@ function gmap_arcgis_gmap($op, &$map) { // Setup Map Id drupal_add_js(array('gmap_arcgis' => array('id' => $map['id'])), 'setting'); - /** - * Setup polygons and labels. Labels have the following format: - * - * $map['arcgis']['labels'] = array($layer1 [, $layer2 [,... $layerN]]); - * - * Where $layer is - * - * $layer = array($layer_uri, $fields, $content, $icon); - * - * Where $layer_uri is a MapService layer, $fields is an array with - * a pair of layer fields to pass to the query, $content is a string - * with the content to display for each marker and $icon is an array - * with parameteres from a GIcon class - * - * $icon = array($shadow, $image, $info_size, $shadow_size, - * $info_anchor, $info_window_anchor); - * - * For more info on the GIcon class, see - * http://code.google.com/intl/pt-BR/apis/maps/documentation/reference.html#GIcon - * - * Example: - * - * $labels = array( - * array("http://mapservice/layer1", array('id', 'name'), array( - * NULL, 'http://path/to/icon.png', - * array(20, 34), array(37, 34), array(9, 34), array(9, 2) - * ) - * ), - * array("http://mapservice/layer2"), - * ); - */ - /** - * The code below provides titles on markers - */ - //if(is_array($map['markers'])) { - // array_walk($map['markers'], 'add_title_on_marker'); - //} - - if (isset($map['arcgis']['polygons'])) { - drupal_add_js(array('gmap_arcgis' => array('polygons' => $map['arcgis']['polygons'])), 'setting'); - } - if (isset($map['arcgis']['labels'])) { - drupal_add_js(array('gmap_arcgis' => array('labels' => $map['arcgis']['labels'])), 'setting'); - } - - /* $map['markers'][] = array( - 'latitude' => '-22.7559207', - 'longitude' => '-48.1640625', - 'markername' => 'Eventos', - 'offset' => 0, - 'text' => 'Um teste', - 'opts' => array( - 'title' => 'Teste de evento', - 'nid' => 10853, - 'category' => 'marker_uc', - ), - - ); */ - - // print views_embed_view('eventos'); - /* - $my_content_view = views_get_view('eventos'); - $my_content_view->build('default'); - $my_content_view->execute('default'); - - $results = $my_content_view->result; - - foreach($results AS $r) { - - // Format the Body of the ballon - $inicio = format_date($r->event_unix_event_start); - $fim = format_date($r->event_unix_event_end); - $body = '
'; - $body .= "

$r->node_title

"; - $body .= " -

- $r->node_revisions_body -

- - "; - $body .= '
'; - - $data['latitude'] = $r->location_latitude; - $data['longitude'] = $r->location_longitude; - $data['title'] = $r->node_title; - $data['offset'] = 0; - $data['nid'] = $r->nid; - $data['body'] = $body; - $data['category'] = 'marker_uc'; - - __addMarker(&$map, $data); - - } */ - // Add custom js $gmap_arcgis_path = drupal_get_path('module', 'gmap_arcgis') . '/'; drupal_add_js($gmap_arcgis_path . 'gmap_arcgis.js'); @@ -236,11 +138,8 @@ function gmap_arcgis_block($op='list', $delta=0, $edit=array()) { } } - +// TODO: move to isa_gmap_overlays function gmap_arcgis_link_nota_tecnica() { - // global $base_url; - //$str = http://uc.socioambiental.org/quem-somos# - return l(t('Sources'), 'quem-somos', array('fragment' => 'tabset-tab-3', 'external' => TRUE)); } -- cgit v1.2.3