forked from fillerwriter/geofield
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeofield.openlayers.inc
208 lines (202 loc) · 5.92 KB
/
geofield.openlayers.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<?php
/**
* @file
* Provides hooks for integration with OpenLayers (http://drupal.org/project/openlayers)
*/
/**
* Implements hook_openlayers_maps().
*/
function geofield_openlayers_maps() {
// Create full preset array
$widget = new stdClass;
$widget->disabled = FALSE; /* Edit this to true to make a default openlayers_maps disabled initially */
$widget->api_version = 1;
$widget->name = 'geofield_widget_map';
$widget->title = 'Geofield Widget Map';
$widget->description = 'A Map Used for Geofield Input';
$widget->data = array(
'width' => '600px',
'height' => '400px',
'image_path' => drupal_get_path('module', 'openlayers') . '/themes/default_dark/img/',
'css_path' => drupal_get_path('module', 'openlayers') . '/themes/default_dark/style.css',
'proxy_host' => '',
'hide_empty_map' => 0,
'center' => array(
'initial' => array(
'centerpoint' => '0, 0',
'zoom' => '1',
),
'restrict' => array(
'restrictextent' => 0,
'restrictedExtent' => '',
),
),
'behaviors' => array(
'openlayers_behavior_geofield' => array(
'feature_types' => array(
'point' => 'point',
'path' => 'path',
'polygon' => 'polygon',
),
'allow_edit' => 1,
),
'openlayers_behavior_keyboarddefaults' => array(),
'openlayers_behavior_navigation' => array(
'zoomWheelEnabled' => 0,
'zoomBoxEnabled' => 1,
'documentDrag' => 0,
),
'openlayers_behavior_panzoombar' => array(
'zoomWorldIcon' => 0,
'panIcons' => 1,
),
),
'default_layer' => 'mapquest_osm',
'layers' => array(
'mapquest_osm' => 'mapquest_osm',
),
'layer_weight' => array(
'openlayers_geojson_picture_this' => '0',
'geofield_formatter' => '0',
),
'layer_styles' => array(
'geofield_formatter' => '0',
'openlayers_geojson_picture_this' => '0',
),
'layer_styles_select' => array(
'geofield_formatter' => '0',
'openlayers_geojson_picture_this' => '0',
),
'layer_activated' => array(
'geofield_formatter' => 0,
'openlayers_geojson_picture_this' => 0,
),
'layer_switcher' => array(
'geofield_formatter' => 0,
'openlayers_geojson_picture_this' => 0,
),
'projection' => '900913',
'displayProjection' => '4326',
'styles' => array(
'default' => 'default',
'select' => 'default',
'temporary' => 'default',
),
'map_name' => 'geofield_widget_map',
);
$formatter = new stdClass();
$formatter->api_version = 1;
$formatter->name = 'geofield_formatter_map';
$formatter->title = t('Geofield Formatter Map');
$formatter->description = t('A Map Used for Geofield Output');
$formatter->data = array(
'width' => '600px',
'height' => '400px',
'image_path' => drupal_get_path('module','openlayers') . '/themes/default_dark/img/',
'css_path' => drupal_get_path('module','openlayers') . '/themes/default_dark/style.css',
'proxy_host' => '',
'hide_empty_map' => 0,
'center' => array(
'initial' => array(
'centerpoint' => '0, 0',
'zoom' => '1',
),
'restrict' => array(
'restrictextent' => 0,
'restrictedExtent' => '',
),
),
'behaviors' => array(
'openlayers_behavior_keyboarddefaults' => array(),
'openlayers_behavior_navigation' => array(
'zoomWheelEnabled' => 0,
'zoomBoxEnabled' => 1,
'documentDrag' => 0,
),
'openlayers_behavior_panzoombar' => array(
'zoomWorldIcon' => 0,
'panIcons' => 1,
),
'openlayers_behavior_zoomtolayer' => array(
'zoomtolayer' => array(
'geofield_formatter' => 'geofield_formatter',
),
'point_zoom_level' => '5',
'zoomtolayer_scale' => '1',
),
),
'default_layer' => 'mapquest_osm',
'layers' => array(
'mapquest_osm' => 'mapquest_osm',
'geofield_formatter' => 'geofield_formatter',
),
'layer_weight' => array(
'geofield_formatter' => '0',
'openlayers_geojson_picture_this' => '0',
),
'layer_styles' => array(
'openlayers_geojson_picture_this' => '0',
'geofield_formatter' => '0',
),
'layer_styles_select' => array(
'openlayers_geojson_picture_this' => '0',
'geofield_formatter' => '0',
),
'layer_activated' => array(
'geofield_formatter' => 'geofield_formatter',
'openlayers_geojson_picture_this' => 0,
),
'layer_switcher' => array(
'geofield_formatter' => 0,
'openlayers_geojson_picture_this' => 0,
),
'projection' => '900913',
'displayProjection' => '4326',
'styles' => array(
'default' => 'default',
'select' => 'default',
'temporary' => 'default',
),
'map_name' => 'geofield_formatter_map',
);
return array(
'geofield_widget_map' => $widget,
'geofield_formatter_map' => $formatter,
);
}
/**
* Implements hook_openlayers_behaviors().
*/
function geofield_openlayers_behaviors() {
return array(
'openlayers_behavior_geofield' => array(
'title' => t('Geofield'),
'description' => t('Fuels the geofield map-input form.'),
'type' => 'layer',
'behavior' => array(
'path' => drupal_get_path('module', 'geofield') . '/includes/behaviors',
'file' => 'openlayers_behavior_geofield.inc',
'class' => 'openlayers_behavior_geofield',
'parent' => 'openlayers_behavior',
),
),
);
}
/**
* Formatter layers
*/
function geofield_openlayers_layers() {
$layers = array();
$layer = new stdClass();
$layer->api_version = 1;
$layer->name = 'geofield_formatter';
$layer->title = 'Placeholder for Geofield Formatter';
$layer->description = '';
$layer->data = array(
'layer_type' => 'openlayers_layer_type_raw',
'projection' => array('900913'),
'features' => array()
);
$layers[$layer->name] = $layer;
return $layers;
}