/[drupal]/contributions/modules/geo/geo.module
ViewVC logotype

Diff of /contributions/modules/geo/geo.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.27, Fri Aug 7 16:55:12 2009 UTC revision 1.28, Mon Nov 9 17:44:40 2009 UTC
# Line 1  Line 1 
1  <?php // $Id: geo.module,v 1.26 2009/08/06 04:09:32 vauxia Exp $  <?php // $Id: geo.module,v 1.27 2009/08/07 16:55:12 vauxia Exp $
2    
3  /**  /**
4   * Geo: Geospatial storage and retrieval.   * Geo: Geospatial storage and retrieval.
5   */   */
6    
7  define(GEO_SRID_DEFAULT, 4326);  define('GEO_SRID_DEFAULT', 4326);
8  define(GEO_DEGREE_M, 111206);  define('GEO_DEGREE_M', 111206);
9    
10  define(GEO_TYPE_POINT, 0);  define('GEO_TYPE_POINT', 0);
11  define(GEO_TYPE_CURVE, 2);  define('GEO_TYPE_CURVE', 2);
12  define(GEO_TYPE_LINESTRING, 3);  define('GEO_TYPE_LINESTRING', 3);
13  define(GEO_TYPE_SURFACE, 4);  define('GEO_TYPE_SURFACE', 4);
14  define(GEO_TYPE_POLYGON, 5);  define('GEO_TYPE_POLYGON', 5);
15  define(GEO_TYPE_COLLECTION, 6);  define('GEO_TYPE_COLLECTION', 6);
16  define(GEO_TYPE_MULTIPOINT, 7);  define('GEO_TYPE_MULTIPOINT', 7);
17  define(GEO_TYPE_MULTICURVE, 8);  define('GEO_TYPE_MULTICURVE', 8);
18  define(GEO_TYPE_MULTILINESTRING, 9);  define('GEO_TYPE_MULTILINESTRING', 9);
19  define(GEO_TYPE_MULTISURFACE, 10);  define('GEO_TYPE_MULTISURFACE', 10);
20  define(GEO_TYPE_MULTIPOLYGON, 11);  define('GEO_TYPE_MULTIPOLYGON', 11);
21    
22  /**  /**
23   * Call an API function from the geo backend databases.   * Call an API function from the geo backend databases.
# Line 188  function geo_wkb_get_data($wkb = NULL, $ Line 188  function geo_wkb_get_data($wkb = NULL, $
188   */   */
189  function geo_units($unit = NULL) {  function geo_units($unit = NULL) {
190    $units = array(    $units = array(
191      'mi' => t('Miles'),      'mi' => t('Miles'),
192      'km' => t('Kilometers'),      'km' => t('Kilometers'),
193      'm'  => t('Meters'),      'm'  => t('Meters'),
194    );    );
# Line 268  function geo_elements() { Line 268  function geo_elements() {
268  }  }
269    
270  function theme_geo_fields($element) {  function theme_geo_fields($element) {
271    return $element['#children'];    return isset($element['#children']) ? $element['#children'] : '';
272  }  }
273    
274  /**  /**
# Line 355  function geo_gis_input_info($gis_type = Line 355  function geo_gis_input_info($gis_type =
355  }  }
356    
357  function geo_set_pre_render(&$element) {  function geo_set_pre_render(&$element) {
358    if (!isset($element['#pre_render'])    if (!isset($element['#pre_render'])
359      || !in_array('geo_field_convert_value', $element['#pre_render'])) {      || !in_array('geo_field_convert_value', $element['#pre_render'])) {
360      $element['#pre_render'][] = 'geo_field_convert_value';      $element['#pre_render'][] = 'geo_field_convert_value';
361    }    }
# Line 379  function geo_field_convert_value($elemen Line 379  function geo_field_convert_value($elemen
379  function geo_set_value($item, $theme) {  function geo_set_value($item, $theme) {
380    init_theme();    init_theme();
381    $registry = theme_get_registry();    $registry = theme_get_registry();
382    
383    if ($format = $registry[$theme]['gis input']) {    if ($format = $registry[$theme]['gis input']) {
384      $value = geo_wkb_get_data($item['wkb'], $format);      if (isset($item['wkb'])) {
385      $item[$format] = $value['value'];        $value = geo_wkb_get_data($item['wkb'], $format);
386          $item[$format] = $value['value'];
387        }
388        else {
389          $item[$format] = '';
390        }
391    }    }
392    return $item;    return $item;
393  }  }

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

  ViewVC Help
Powered by ViewVC 1.1.2