| 1 |
<?php // $Id: geo.module,v 1.27 2009/08/07 16:55:12 vauxia Exp $ |
<?php // $Id: geo.module,v 1.28 2009/11/09 17:44:40 vauxia Exp $ |
| 2 |
|
|
| 3 |
/** |
/** |
| 4 |
* Geo: Geospatial storage and retrieval. |
* Geo: Geospatial storage and retrieval. |
| 275 |
* A #process handler for the latlon element. |
* A #process handler for the latlon element. |
| 276 |
*/ |
*/ |
| 277 |
function geo_latlon_process($element, $edit, $form_state, $form) { |
function geo_latlon_process($element, $edit, $form_state, $form) { |
|
$field = $form['#field_info'][$element['#field_name']]; |
|
|
|
|
| 278 |
$element['lat'] = array( |
$element['lat'] = array( |
| 279 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 280 |
'#title' => t('Latitude'), |
'#title' => t('Latitude'), |
| 299 |
return theme('form_element', $element, $output); |
return theme('form_element', $element, $output); |
| 300 |
} |
} |
| 301 |
|
|
|
function geo_element_set_value($element, &$form_state) { |
|
|
if (!$element['#value']) $element['#value'] = $element['#default_value']; |
|
|
if (!isset($element['#gis_input_value'])) $element['#gis_input_value'] = $element['#value']; |
|
|
|
|
|
$value = geo_value_convert($element['#value'], $element['#gis_input'], $element['#gis_output']); |
|
|
$element['#gis_output_value'] = $value; |
|
|
form_set_value($element, $value, $form_state); |
|
|
return $element; |
|
|
} |
|
|
|
|
| 302 |
function geo_value_convert($value, $in = 'array', $out = 'wkt') { |
function geo_value_convert($value, $in = 'array', $out = 'wkt') { |
| 303 |
// TODO We are taking the element's requested input and output formats, and |
// TODO We are taking the element's requested input and output formats, and |
| 304 |
// making the necessary adjustments. This needs to be refactored and set up |
// making the necessary adjustments. This needs to be refactored and set up |