2015-07-23 05:20:37 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* farm_area.default_openlayers_maps.inc
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_default_openlayers_maps().
|
|
|
|
*/
|
|
|
|
function farm_area_default_openlayers_maps() {
|
|
|
|
$export = array();
|
|
|
|
|
|
|
|
$ol_map = new stdClass();
|
|
|
|
$ol_map->disabled = FALSE; /* Edit this to true to make a default ol_map disabled initially */
|
|
|
|
$ol_map->api_version = 1;
|
|
|
|
$ol_map->machine_name = 'farm_areas';
|
|
|
|
$ol_map->name = 'Farm Areas';
|
2015-12-31 20:17:59 +01:00
|
|
|
$ol_map->description = 'A map of all farm areas, color-coded by type.';
|
2015-07-23 05:20:37 +02:00
|
|
|
$ol_map->factory_service = 'openlayers.Map:OLMap';
|
|
|
|
$ol_map->options = array(
|
|
|
|
'width' => 'auto',
|
2015-07-29 23:09:00 +02:00
|
|
|
'height' => '500px',
|
2015-07-23 05:20:37 +02:00
|
|
|
'view' => array(
|
2016-03-19 13:15:26 +01:00
|
|
|
'center' => array(
|
|
|
|
'lat' => 0,
|
|
|
|
'lon' => 0,
|
|
|
|
),
|
2015-07-23 05:20:37 +02:00
|
|
|
'rotation' => 0,
|
2016-03-19 04:26:57 +01:00
|
|
|
'zoom' => 2,
|
2015-07-23 05:20:37 +02:00
|
|
|
'minZoom' => 0,
|
2016-03-09 15:42:01 +01:00
|
|
|
'maxZoom' => 24,
|
2015-07-23 05:20:37 +02:00
|
|
|
),
|
|
|
|
'renderer' => 'canvas',
|
|
|
|
'layers' => array(
|
2015-07-31 19:03:10 +02:00
|
|
|
0 => 'farm_area_layer_group',
|
2015-07-23 05:20:37 +02:00
|
|
|
),
|
|
|
|
'controls' => array(
|
2015-07-31 18:21:48 +02:00
|
|
|
0 => 'openlayers_control_zoom',
|
|
|
|
1 => 'openlayers_control_scaleline',
|
|
|
|
2 => 'farm_map_control_layer_switcher',
|
|
|
|
3 => 'farm_map_control_geolocate',
|
2018-10-10 18:21:37 +02:00
|
|
|
4 => 'farm_map_control_geocoder',
|
2015-07-31 18:21:48 +02:00
|
|
|
/**
|
|
|
|
* @todo
|
|
|
|
* https://www.drupal.org/node/2543186
|
|
|
|
*/
|
2018-10-10 18:21:37 +02:00
|
|
|
// 5 => 'openlayers_control_fullscreen',
|
2015-07-23 05:20:37 +02:00
|
|
|
),
|
|
|
|
'components' => array(
|
|
|
|
0 => 'farm_area_component_areas_zoom_to_source',
|
|
|
|
1 => 'farm_area_component_area_details_popup',
|
2015-07-30 23:37:45 +02:00
|
|
|
2 => 'farm_map_component_progress_bar',
|
2015-07-23 05:20:37 +02:00
|
|
|
),
|
|
|
|
'interactions' => array(
|
|
|
|
0 => 'openlayers_interaction_doubleclickzoom',
|
|
|
|
1 => 'openlayers_interaction_dragpan',
|
|
|
|
2 => 'openlayers_interaction_mousewheelzoom',
|
2015-07-31 21:17:45 +02:00
|
|
|
3 => 'openlayers_interaction_pinchzoom',
|
2015-07-23 05:20:37 +02:00
|
|
|
),
|
|
|
|
);
|
|
|
|
$export['farm_areas'] = $ol_map;
|
|
|
|
|
|
|
|
return $export;
|
|
|
|
}
|
2015-07-31 05:00:44 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_default_openlayers_maps_alter().
|
|
|
|
*/
|
|
|
|
function farm_area_default_openlayers_maps_alter(&$maps) {
|
|
|
|
|
2016-04-13 15:47:16 +02:00
|
|
|
// Add "all areas" group layer to farm_geofield* maps.
|
2015-07-31 05:00:44 +02:00
|
|
|
foreach ($maps as &$map) {
|
|
|
|
if (substr($map->machine_name, 0, 17) == 'farm_map_geofield') {
|
2016-04-13 15:47:16 +02:00
|
|
|
$map->options['layers'][] = 'farm_area_layer_areas_group';
|
2015-07-31 05:00:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|