This repository has been archived by the owner on Jun 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
farm_map.default_openlayers_layers.inc
148 lines (138 loc) · 4.69 KB
/
farm_map.default_openlayers_layers.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
/**
* @file
* farm_map.default_openlayers_layers.inc
*/
/**
* Implements hook_default_openlayers_layers().
*/
function farm_map_default_openlayers_layers() {
$export = array();
// Google Hybrid layer.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_map_layer_google_hybrid';
$ol_layer->name = 'Google Hybrid';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Tile';
$ol_layer->options = array(
'source' => 'farm_map_source_google_hybrid',
'visible' => 1,
'opacity' => 1,
/**
* @todo
* https://www.drupal.org/node/2543130
*/
'type' => 'base',
);
$export['farm_map_layer_google_hybrid'] = $ol_layer;
// Google Satellite layer.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_map_layer_google_satellite';
$ol_layer->name = 'Google Satellite';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Tile';
$ol_layer->options = array(
'source' => 'farm_map_source_google_satellite',
'visible' => 1,
'opacity' => 1,
/**
* @todo
* https://www.drupal.org/node/2543130
*/
'type' => 'base',
);
$export['farm_map_layer_google_satellite'] = $ol_layer;
// Google Terrain layer.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_map_layer_google_terrain';
$ol_layer->name = 'Google Terrain';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Tile';
$ol_layer->options = array(
'source' => 'farm_map_source_google_terrain',
'visible' => 1,
'opacity' => 1,
/**
* @todo
* https://www.drupal.org/node/2543130
*/
'type' => 'base',
);
$export['farm_map_layer_google_terrain'] = $ol_layer;
// Base layer group.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_map_layer_group';
$ol_layer->name = 'Farm Map Layer Group';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Group';
$ol_layer->options = array(
'source' => '',
'visible' => 1,
'grouptitle' => 'Base layers',
'grouplayers' => array(
0 => 'farm_map_layer_google_hybrid',
/**
* @todo
* https://www.drupal.org/node/2543188
*/
// 1 => 'farm_map_layer_google_satellite',
// 2 => 'farm_map_layer_google_terrain',
),
);
$export['farm_map_layer_group'] = $ol_layer;
// Geofield widget layer group.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_map_geofield_widget_layer_group';
$ol_layer->name = 'Farm Map Geofield Widget Layer Group';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Group';
$ol_layer->options = array(
'source' => '',
'visible' => 1,
'grouptitle' => 'Draw',
'grouplayers' => array(
'openlayers_geofield_layer_widget',
),
);
$export['farm_map_geofield_widget_layer_group'] = $ol_layer;
// Geofield formatter layer group.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_map_geofield_formatter_layer_group';
$ol_layer->name = 'Farm Map Geofield Formatter Layer Group';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Group';
$ol_layer->options = array(
'source' => '',
'visible' => 1,
'grouptitle' => 'Geometry',
'grouplayers' => array(
'openlayers_geofield_layer_formatter',
),
);
$export['farm_map_geofield_formatter_layer_group'] = $ol_layer;
return $export;
}
/**
* Implements hook_default_openlayers_layers_alter().
*/
function farm_map_default_openlayers_layers_alter(&$layers) {
// Override the styles of the Geofield Widget and Formatter layers.
if (!empty($layers['openlayers_geofield_layer_widget'])) {
$layers['openlayers_geofield_layer_widget']->options['style'] = 'farm_map_style_geofield';
}
if (!empty($layers['openlayers_geofield_layer_formatter'])) {
$layers['openlayers_geofield_layer_formatter']->options['style'] = 'farm_map_style_geofield';
}
}