From ccaa9e7ea24f735ae83bd03cce41feef7738cd0d Mon Sep 17 00:00:00 2001 From: Silvio Date: Thu, 22 Oct 2009 15:44:14 -0200 Subject: Initial import --- gmap_arcgis.module | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 gmap_arcgis.module (limited to 'gmap_arcgis.module') diff --git a/gmap_arcgis.module b/gmap_arcgis.module new file mode 100644 index 0000000..9988676 --- /dev/null +++ b/gmap_arcgis.module @@ -0,0 +1,102 @@ +'); + + // Add ArcGIS js API + drupal_set_html_head($script .'src="http://serverapi.arcgisonline.com/jsapi/gmaps/?v=1.4">'); + + // 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, $icon); + * + * Where $layer_uri is a MapService layer and $fields is an array with + * a pair of layer fields to pass to the queryand $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"), + * ); + */ + 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'); + } + + // Add custom js + $gmap_arcgis_path = drupal_get_path('module', 'gmap_arcgis') .'/'; + drupal_add_js($gmap_arcgis_path .'gmap_arcgis.js'); + } + } +} -- cgit v1.2.3