| 1 |
<?php |
<?php |
| 2 |
// $Id: maplayer.module,v 1.1.2.4 2008/06/11 14:59:09 openwereld Exp $ |
// $Id: maplayer.module,v 1.1.2.5 2008/06/15 18:37:44 openwereld Exp $ |
| 3 |
|
|
| 4 |
function maplayer_perm() { |
function maplayer_perm() { |
| 5 |
return array('administer maplayer' |
return array('administer maplayer' |
| 173 |
$node->legendurl = $wms_layer->legendurl; |
$node->legendurl = $wms_layer->legendurl; |
| 174 |
$bbox = $wms_layer->bbox[0]; |
$bbox = $wms_layer->bbox[0]; |
| 175 |
$srs = explode(':', $bbox['SRS']); |
$srs = explode(':', $bbox['SRS']); |
| 176 |
|
|
| 177 |
|
$default_srs = variable_get('maplayer_default_srs', ''); |
| 178 |
|
if ($default_srs != '' && $bbox['SRS'] != $default_srs |
| 179 |
|
&& function_exists('mapserver_transform')) { |
| 180 |
|
$points = mapserver_transform($bbox['SRS'], $default_srs, array($bbox['minx'], $bbox['miny'], $bbox['maxx'], $bbox['maxy'])); |
| 181 |
|
if ($points) { |
| 182 |
|
drupal_set_message(t('Bounding box is transformed from %old_srs to %new_srs', array('%old_srs' => $bbox['SRS'], '%new_srs' => $default_srs))); |
| 183 |
|
|
| 184 |
|
$srs = explode(':', $default_srs); |
| 185 |
|
$bbox['minx'] = $points[0][0]; |
| 186 |
|
$bbox['miny'] = $points[0][1]; |
| 187 |
|
$bbox['maxx'] = $points[1][0]; |
| 188 |
|
$bbox['maxy'] = $points[1][1]; |
| 189 |
|
} |
| 190 |
|
else { |
| 191 |
|
drupal_set_message(t('Failed to transform bounding box from %old_srs to %new_srs', array('%old_srs' => $bbox['SRS'], '%new_srs' => $default_srs)), 'error'); |
| 192 |
|
} |
| 193 |
|
} |
| 194 |
|
|
| 195 |
$node->srid = $srs[1]; |
$node->srid = $srs[1]; |
| 196 |
$node->minx = $bbox['minx']; |
$node->minx = $bbox['minx']; |
| 197 |
$node->miny = $bbox['miny']; |
$node->miny = $bbox['miny']; |