| 1 |
<?php |
<?php |
| 2 |
// $Id: wms.module,v 1.1.2.17 2008/06/15 18:37:46 openwereld Exp $ |
// $Id: wms.module,v 1.1.2.18 2008/06/29 15:30:37 openwereld Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* wms proxy module |
* wms proxy module |
| 6 |
*/ |
*/ |
| 7 |
|
|
| 8 |
define("DEFAULT_WMS_CAPABILITIES_REFRESH_TIME", 3600*24*7); |
define("DEFAULT_WMS_CAPABILITIES_REFRESH_TIME", 3600*24*7); |
| 9 |
|
define("DEFAULT_MAPPINGKIT_MAX_LAYERS_VISIBLE", 5); |
| 10 |
|
|
| 11 |
/** |
/** |
| 12 |
* |
* |
| 163 |
, '#default_value' => variable_get('wms_map_height', variable_get('mappingkit_map_height', DEFAULT_MAPPINGKIT_MAP_HEIGHT)) |
, '#default_value' => variable_get('wms_map_height', variable_get('mappingkit_map_height', DEFAULT_MAPPINGKIT_MAP_HEIGHT)) |
| 164 |
); |
); |
| 165 |
|
|
| 166 |
|
$form['maps']['wms_max_layers_visible'] = array('#type' => 'textfield' |
| 167 |
|
, '#title' => t('Maximum layers visible') |
| 168 |
|
, '#size' => 10 |
| 169 |
|
, '#default_value' => variable_get('wms_max_layers_visible', variable_get('wms_max_layers_visible', DEFAULT_MAPPINGKIT_MAX_LAYERS_VISIBLE)) |
| 170 |
|
, '#description' => t('Below this maximum, all layers will be visible at the same time.') |
| 171 |
|
); |
| 172 |
|
|
| 173 |
$form['maps']['wms_count_usage'] = array('#type' => 'checkbox' |
$form['maps']['wms_count_usage'] = array('#type' => 'checkbox' |
| 174 |
, '#title' => t('Count usage') |
, '#title' => t('Count usage') |
| 175 |
, '#size' => 10 |
, '#size' => 10 |
| 635 |
$bbox = $node->layers[0]->bbox[0]; |
$bbox = $node->layers[0]->bbox[0]; |
| 636 |
$projection = $bbox['SRS']; |
$projection = $bbox['SRS']; |
| 637 |
unset($bbox['SRS']); |
unset($bbox['SRS']); |
| 638 |
|
$visibility = count($node->layers) <= (int)variable_get('wms_max_layers_visible', DEFAULT_MAPPINGKIT_MAX_LAYERS_VISIBLE); |
| 639 |
|
|
| 640 |
if ($projection != $node->capabilities_data->wms_srs) { |
if ($projection != $node->capabilities_data->wms_srs) { |
| 641 |
$logger->info('First layer not in default projection '.$node->capabilities_data->wms_srs); |
$logger->info('First layer not in default projection '.$node->capabilities_data->wms_srs); |
| 671 |
$layer_names .= $layer->name; |
$layer_names .= $layer->name; |
| 672 |
|
|
| 673 |
$layer_params = array('wms', $node->serviceurl, $layer->title, $layer->name); |
$layer_params = array('wms', $node->serviceurl, $layer->title, $layer->name); |
| 674 |
|
|
| 675 |
|
// extra params? |
| 676 |
|
$extras = array(); |
| 677 |
if ($layer->legendurl != '') { |
if ($layer->legendurl != '') { |
| 678 |
$layer_params[] = 'legendurl='. $layer->legendurl; |
$extras[] = 'legendurl='. $layer->legendurl; |
| 679 |
|
} |
| 680 |
|
if (!$visibility) { |
| 681 |
|
$extras[] = 'visibility=false'; |
| 682 |
} |
} |
| 683 |
|
$layer_params[] = implode(',', $extras); |
| 684 |
|
|
| 685 |
$map_layers[++$i] = implode('|', $layer_params); |
$map_layers[++$i] = implode('|', $layer_params); |
| 686 |
} |
} |
| 687 |
} |
} |
| 688 |
|
//drupal_set_message('map layers '.var_export($map_layers, true)); |
| 689 |
|
|
| 690 |
if (true) { |
if (true) { |
| 691 |
// show individual layers separately |
// show individual layers separately |