View source
<?php
define('OPENLAYERS_DEFAULT_LIBRARY', '//cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/OpenLayers.js');
define('OPENLAYERS_SUGGESTED_LIBRARY', 2.13);
define('OPENLAYERS_HOSTED_API_LIBRARY', 2.13);
function openlayers_help($path, $arg) {
switch ($path) {
case 'admin/help#openlayers':
return '<p>' . t('The OpenLayers module is the base module for the
OpenLayers suite of modules, and provides the main API.') . '</p>';
}
return '';
}
function openlayers_theme($existing, $type, $theme, $path) {
return array(
'openlayers_map' => array(
'arguments' => array(
'map' => array(),
),
'file' => 'includes/openlayers.theme.inc',
'template' => '/templates/openlayers-map',
),
'openlayers_styles' => array(
'arguments' => array(
'styles' => array(),
'map' => array(),
),
'file' => 'includes/openlayers.theme.inc',
),
);
}
function openlayers_ctools_plugin_directory($module, $plugin) {
return 'plugins/' . $plugin;
}
function openlayers_ctools_plugin_type() {
return array(
'behaviors' => array(
'use hooks' => TRUE,
'classes' => array(
'behavior',
),
),
'layer_types' => array(
'use hooks' => TRUE,
'classes' => array(
'layer_types',
),
),
);
}
function openlayers_include() {
global $language;
$lang = $language->language;
if ('internal' == variable_get('openlayers_source_type', 'external')) {
$variant = variable_get('openlayers_source_internal_variant', NULL);
if ($variant == 'original') {
$variant = NULL;
}
libraries_load('openlayers', $variant);
if ($lang != 'en') {
$main_locale = libraries_get_path('openlayers') . '/lib/OpenLayers/Lang.js';
if (file_exists($main_locale)) {
drupal_add_js($main_locale, 'file');
}
$language_locale = libraries_get_path('openlayers') . '/lib/OpenLayers/Lang/' . $lang . '.js';
if (file_exists($language_locale)) {
drupal_add_js($language_locale, 'file');
}
else {
$country_code = variable_get('site_default_country', '');
$language_locale = libraries_get_path('openlayers') . '/lib/OpenLayers/Lang/' . $lang . '-' . $country_code . '.js';
if (file_exists($language_locale)) {
drupal_add_js($language_locale, 'file');
}
}
}
}
else {
static $once;
if (!isset($once)) {
$once = TRUE;
$path = check_plain(variable_get('openlayers_source_external', OPENLAYERS_DEFAULT_LIBRARY));
if (substr($path, 0, 2) == '//') {
$http_protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
$path = $http_protocol . ':' . $path;
}
if (valid_url($path, TRUE)) {
drupal_add_js($path, 'external');
}
else {
drupal_add_js($path);
}
if ($lang != 'en') {
$main_locale = libraries_get_path('openlayers') . '/lib/OpenLayers/Lang.js';
if (file_exists($main_locale)) {
drupal_add_js($main_locale, 'file');
}
$language_locale = libraries_get_path('openlayers') . '/lib/OpenLayers/Lang/' . $lang . '.js';
if (file_exists($language_locale)) {
drupal_add_js($language_locale, 'file');
}
else {
$country_code = variable_get('site_default_country', '');
$language_locale = libraries_get_path('openlayers') . '/lib/OpenLayers/Lang/' . $lang . '-' . $country_code . '.js';
if (file_exists($language_locale)) {
drupal_add_js($language_locale, 'file');
}
}
}
drupal_add_css(drupal_get_path('module', 'openlayers') . '/css/openlayers.css', 'file');
drupal_add_js(drupal_get_path('module', 'openlayers') . '/js/openlayers.js', 'file');
}
}
}
function openlayers_build_map($map = array()) {
openlayers_include();
module_load_include('inc', 'openlayers', 'includes/openlayers.render');
if (empty($map)) {
if ($loaded_map = openlayers_map_load(variable_get('openlayers_default_map', 'default'))) {
$map = $loaded_map->data;
}
}
$map['id'] = !isset($map['id']) ? _openlayers_create_map_id() : $map['id'];
drupal_alter('openlayers_map_preprocess', $map);
$map['styles'] = isset($map['styles']) ? $map['styles'] : array();
$map['layer_styles'] = isset($map['layer_styles']) ? $map['layer_styles'] : array();
$map['layer_styles_select'] = isset($map['layer_styles_select']) ? $map['layer_styles_select'] : array();
$map['layer_styles_temporary'] = isset($map['layer_styles_temporary']) ? $map['layer_styles_temporary'] : array();
$map['layers'] = _openlayers_layers_process($map['layers'], $map);
$map['behaviors'] = _openlayers_behaviors_render($map['behaviors'], $map);
$map['styles'] = _openlayers_styles_process($map['styles'], $map['layer_styles'], $map['layer_styles_select'], $map['layer_styles_temporary'], $map);
$projection = openlayers_get_projection_by_identifier($map['projection']);
$map['maxExtent'] = $projection
->getProjectedExtent();
foreach ($map['layers'] as $layer_name => $layer) {
if (in_array($map['projection'], $layer['projection'])) {
$map['layers'][$layer_name]['projection'] = $map['projection'];
}
else {
$layerProjectionIdentifier = reset($layer['projection']);
if ($layerProjectionIdentifier === FALSE) {
throw new Exception(t('Layer !title lacks its projection. Please edit it to select a projection.', array(
'!title' => $layer['title'],
)));
}
$map['layers'][$layer_name]['projection'] = $layerProjectionIdentifier;
}
$map['layers'][$layer_name]['isBaseLayer'] = (bool) $layer['isBaseLayer'];
}
drupal_alter('openlayers_map', $map);
$map['errors'] = openlayers_error_check_map($map);
return $map;
}
function openlayers_render_map_data($map = array()) {
$map = openlayers_build_map($map);
$output = '';
if (isset($map['hide_empty_map']) && $map['hide_empty_map'] == TRUE) {
$empty = TRUE;
foreach ($map['layers'] as $layer) {
if (isset($layer['features']) && count($layer['features'])) {
$empty = FALSE;
}
}
if ($empty) {
return '';
}
}
if (array_key_exists('restrict', $map['center']) && (bool) $map['center']['restrict']['restrictextent']) {
openlayers_add_js_projection_definition(openlayers_get_projection_by_identifier('EPSG:3857'));
}
if (empty($map['errors'])) {
foreach ($map['layers'] as $layer_name => $layer) {
openlayers_add_js_projection_definition(openlayers_get_projection_by_identifier($map['layers'][$layer_name]['projection']));
}
openlayers_add_js_projection_definition(openlayers_get_projection_by_identifier($map['projection']));
openlayers_add_js_projection_definition(openlayers_get_projection_by_identifier($map['displayProjection']));
$js = array(
'openlayers' => array(
'maps' => array(
$map['id'] => '',
),
),
);
drupal_add_js($js, 'setting');
$js = array(
'openlayers' => array(
'maps' => array(
$map['id'] => $map,
),
),
);
drupal_add_js($js, 'setting');
$output = theme('openlayers_map', array(
'map' => $map,
));
}
return $output;
}
function openlayers_add_js_projection_definition(openlayers_projection $projection) {
$openlayers_natively_supported = array(
'EPSG:4326',
'EPSG:900913',
);
if (!in_array($projection->identifier, $openlayers_natively_supported)) {
proj4js_load_definition($projection->identifier, $projection
->getDefinition());
}
}
function openlayers_render_map($map = '') {
if (is_array($map)) {
return openlayers_render_map_data($map);
}
if (!$map || is_string($map)) {
$map_name = $map;
if (!$map_name) {
$map_name = variable_get('openlayers_default_map', 'default');
}
$map = openlayers_map_load($map_name);
if (!is_object($map)) {
throw new Exception("Failed to load map called " . $map_name);
}
}
return openlayers_render_map_data($map->data);
}
function openlayers_get_layer_object($layer, $map = array()) {
ctools_include('plugins');
static $layer_types;
if (!isset($layer_types)) {
$layer_types = openlayers_layer_types();
}
$layer->title = t($layer->title);
$layer->description = t($layer->description);
if (isset($layer_types[$layer->data['layer_type']]) && ($class = ctools_plugin_get_class($layer_types[$layer->data['layer_type']], 'layer_type'))) {
$layer_object = new $class($layer, $map);
return $layer_object;
}
else {
watchdog('openlayers', 'Layer !layer_name is unavailable because its
layer type or the module that provides its layer type is missing', array(
'!layer_name' => $layer->title,
), WATCHDOG_ERROR);
return FALSE;
}
}
function openlayers_layer_load($name, $reset = FALSE) {
ctools_include('export');
if ($reset) {
ctools_export_load_object_reset('openlayers_layers');
}
$layer = ctools_export_load_object('openlayers_layers', 'names', array(
$name,
));
if (is_array($layer) && isset($layer[$name])) {
$layer_object = openlayers_get_layer_object($layer[$name]);
if (openlayers_layer_sanity_check($layer_object)) {
return $layer_object;
}
}
else {
return FALSE;
}
}
function openlayers_layers_load($reset = FALSE, $include_disabled = FALSE) {
ctools_include('export');
$layer_objects = array();
if ($reset) {
ctools_export_load_object_reset('openlayers_layers');
}
$layers = ctools_export_load_object('openlayers_layers', 'all', array());
foreach ($layers as $layer) {
if (!$include_disabled && isset($layer->disabled) && $layer->disabled) {
continue;
}
$layer_objects[$layer->name] = openlayers_get_layer_object($layer);
}
return array_filter($layer_objects, 'openlayers_layer_sanity_check');
}
function openlayers_layer_definition_check($definition) {
$mandatory_fields = array(
array(
'title',
),
array(
'description',
),
array(
'name',
),
array(
'path',
),
array(
'layer_type',
'file',
),
array(
'layer_type',
'class',
),
array(
'layer_type',
'parent',
),
);
foreach ($mandatory_fields as $field) {
$missing = drupal_array_nested_key_exists($definition, $field);
if (!$missing) {
drupal_set_message(t("Key !key is missing in in the plugin definition of the layer type <em>!type</em>. The layer will be disabled.", array(
'!key' => htmlspecialchars(implode(', ', $field)),
'!type' => htmlspecialchars($definition['name']),
)), 'warning');
watchdog('openlayers', 'Layer !layer is unavailable because its
plugin definition is incomplete.', array(
'!layer' => $definition['name'],
), WATCHDOG_ERROR);
return FALSE;
}
}
return TRUE;
}
function openlayers_behavior_definition_check($definition) {
$mandatory_fields = array(
array(
'title',
),
array(
'description',
),
array(
'name',
),
array(
'path',
),
array(
'type',
),
array(
'behavior',
'file',
),
array(
'behavior',
'class',
),
array(
'behavior',
'parent',
),
);
foreach ($mandatory_fields as $field) {
$missing = drupal_array_nested_key_exists($definition, $field);
if (!$missing) {
drupal_set_message(t("Key !key is missing in the definition of the behavior <em>!behavior</em>. The behavior will be disabled.", array(
'!key' => htmlspecialchars(implode(', ', $field)),
'!behavior' => htmlspecialchars($definition['name']),
)), 'warning');
watchdog('openlayers', 'Behavior !behavior is unavailable because its
plugin definition is incomplete.', array(
'!behavior' => $definition['name'],
), WATCHDOG_ERROR);
return FALSE;
}
}
return TRUE;
}
function openlayers_layer_sanity_check($layer, $projection = FALSE, $strict = FALSE) {
$layer = is_array($layer) ? (object) $layer : $layer;
if (!isset($layer->name)) {
return !$strict;
}
if (!isset($layer->data['projection']) || !is_array($layer->data['projection'])) {
watchdog('openlayers', 'Layer %name does not have a projection set.', array(
'%name' => $layer->name,
));
drupal_set_message(t('OpenLayers layers failed the sanity check. See the
<a href="@drupallog">Drupal log</a> for details', array(
'@drupallog' => url('admin/reports/dblog'),
)));
return !$strict;
}
if (!isset($layer->data['layer_type'])) {
watchdog('openlayers', 'Layer %name does not have its layer_type set.', array(
'%name' => $layer->name,
));
drupal_set_message(t('OpenLayers layers failed the sanity check. See the
<a href="@drupallog">Drupal log</a> for details', array(
'@drupallog' => url('admin/reports/dblog'),
)));
return !$strict;
}
if ($projection && empty($layer->data['vector']) && !in_array($projection, $layer->data['projection'])) {
watchdog('openlayers', 'The layer %layer_name cannot be reprojected to the map projection: EPSG: %map_proj', array(
'%layer_name' => $layer->name,
'%map_proj' => $map['projection'],
));
return !$strict;
}
return TRUE;
}
function openlayers_layer_delete($layer) {
return openlayers_object_delete($layer, 'layer');
}
function openlayers_layer_types($reset = FALSE, $include_disabled = FALSE) {
ctools_include('plugins');
$layers = ctools_get_plugins('openlayers', 'layer_types');
if (!$include_disabled) {
$layers = array_filter($layers, 'openlayers_object_enabled');
}
return array_filter($layers, 'openlayers_layer_definition_check');
}
function openlayers_object_enabled($object) {
return !isset($object->disabled) || !$object->disabled;
}
function openlayers_layer_type_load($name, $reset = FALSE) {
ctools_include('plugins');
if ($layer_type_class = ctools_plugin_load_class('openlayers', 'layer_types', $name, 'layer_type')) {
$layer_type = new $layer_type_class();
return $layer_type;
}
return FALSE;
}
function openlayers_behaviors($reset = FALSE, $include_disabled = FALSE) {
ctools_include('plugins');
$behaviors = ctools_get_plugins('openlayers', 'behaviors');
if (!$include_disabled) {
$behaviors = array_filter($behaviors, 'openlayers_object_enabled');
}
return array_filter($behaviors, 'openlayers_behavior_definition_check');
}
function openlayers_styles($reset = FALSE, $include_disabled = FALSE) {
ctools_include('export');
if ($reset) {
ctools_export_load_object_reset('openlayers_styles');
}
$styles = ctools_export_load_object('openlayers_styles', 'all', array());
if (!$include_disabled) {
$styles = array_filter($styles, 'openlayers_object_enabled');
}
return $styles;
}
function openlayers_style_load($name, $reset = FALSE) {
$styles = openlayers_styles($reset);
return !empty($styles[$name]) ? $styles[$name] : FALSE;
}
function openlayers_style_save($style) {
if (!empty($style->name)) {
return db_select('openlayers_styles')
->fields('openlayers_styles', array(
'name',
))
->condition('name', $style->name)
->execute()
->fetchCol() ? drupal_write_record('openlayers_styles', $style, 'name') : drupal_write_record('openlayers_styles', $style);
}
return FALSE;
}
function openlayers_style_delete($style) {
return openlayers_object_delete($style, 'style');
}
function openlayers_maps($reset = FALSE, $include_disabled = FALSE) {
ctools_include('export');
if ($reset) {
ctools_export_load_object_reset('openlayers_maps');
}
$maps = ctools_export_load_object('openlayers_maps', 'all', array());
if (!$include_disabled) {
$maps = array_filter($maps, 'openlayers_object_enabled');
}
return $maps;
}
function openlayers_map_load($name = '', $reset = FALSE) {
ctools_include('export');
if ($reset) {
ctools_export_load_object_reset('openlayers_maps');
}
$maps = ctools_export_load_object('openlayers_maps', 'names', array(
$name,
));
if (empty($maps[$name])) {
return FALSE;
}
else {
$map = $maps[$name];
$map->data['map_name'] = $name;
return clone $map;
}
}
function openlayers_map_save($map) {
if (!empty($map->name)) {
return db_select('openlayers_maps')
->fields('openlayers_maps', array(
'name',
))
->condition('name', $map->name)
->execute()
->fetchCol() ? drupal_write_record('openlayers_maps', $map, 'name') : drupal_write_record('openlayers_maps', $map);
}
return FALSE;
}
function openlayers_map_delete($map) {
return openlayers_object_delete($map, 'map');
}
function openlayers_map_options($reset = FALSE) {
$maps = openlayers_maps($reset);
$options = array();
foreach ($maps as $map) {
$options[$map->name] = $map->title;
}
return $options;
}
function openlayers_object_delete($ol_object, $type) {
$tables = array(
'style' => 'openlayers_styles',
'layer' => 'openlayers_layers',
'map' => 'openlayers_maps',
);
if (is_object($ol_object) && isset($ol_object->name) && isset($tables[$type])) {
$ol_object = $ol_object->name;
return db_delete($tables[$type])
->condition('name', $ol_object)
->execute();
}
}
function openlayers_error_check_map($map, $log_errors = TRUE) {
$errors = array();
if (!is_array($map['layers'])) {
$errors[] = t('Map contains no renderable layers.');
}
else {
foreach ($map['layers'] as $layer) {
openlayers_layer_sanity_check(array(
'data' => $layer,
), $map['projection'], TRUE);
}
}
if (count($errors) > 0 && $log_errors) {
watchdog('openlayers', implode(', ', $errors), array(), WATCHDOG_ERROR);
}
return count($errors) > 0 ? $errors : FALSE;
}
class openlayers_projection {
public $identifier;
private $definition;
private $projectedextentleft;
private $projectedextentbottom;
private $projectedextentright;
private $projectedextenttop;
public function __construct($identifier, $definition, $projectedextentleft, $projectedextentbottom, $projectedextentright, $projectedextenttop) {
$this->identifier = $identifier;
$this->definition = $definition;
$this->projectedextentleft = $projectedextentleft;
$this->projectedextentbottom = $projectedextentbottom;
$this->projectedextentright = $projectedextentright;
$this->projectedextenttop = $projectedextenttop;
}
public function getLocalizedMessage() {
return $this->identifier;
}
public function getProjectedExtent() {
return array_map('floatval', array(
$this->projectedextentleft,
$this->projectedextentbottom,
$this->projectedextentright,
$this->projectedextenttop,
));
}
public function getDefinition() {
return $this->definition;
}
}
function openlayers_projection_from_record($record) {
return new openlayers_projection($record->identifier, $record->definition, $record->projectedextentleft, $record->projectedextentbottom, $record->projectedextentright, $record->projectedextenttop);
}
function openlayers_get_projection($authority, $code) {
static $projections;
if (!isset($projections)) {
$projections = array();
}
$identifier = $authority . ':' . $code;
if (!array_key_exists($identifier, $projections)) {
$projections[$identifier] = openlayers_get_projection_by_identifier($identifier);
}
return $projections[$identifier];
}
function openlayers_get_projection_by_identifier($identifier) {
ctools_include('export');
$records = ctools_export_load_object('openlayers_projections', 'names', array(
$identifier,
));
if (empty($records)) {
if (mb_strpos($identifier, ':') === FALSE) {
throw new Exception(t("Projection !projection lacks an authority code. Read http://drupal.org/node/1944074 for hints.", array(
'!projection' => $identifier,
)));
}
throw new Exception(t("Projection !projection requested but not supported.", array(
'!projection' => $identifier,
)));
}
return openlayers_projection_from_record($records[key($records)]);
}
function openlayers_get_all_projections($reset = FALSE, $include_disabled = FALSE) {
ctools_include('export');
$projections = array();
foreach (ctools_export_crud_load_all('openlayers_projections', $reset) as $record) {
if (!$include_disabled && isset($record->disabled) && $record->disabled) {
continue;
}
$projections[] = openlayers_projection_from_record($record);
}
return $projections;
}
function openlayers_map_layerlist(&$form, &$form_state) {
module_load_include('inc', 'openlayers_ui', '/include/openlayers_ui.theme');
unset($form['layerstyles']['#group']);
$form['layerstyles']['#id'] = 'edit-layerstyles';
return $form['layerstyles'];
}
function openlayers_get_extent($authority, $projection) {
return openlayers_get_projection($authority, $projection)
->getProjectedExtent();
}
function openlayers_get_resolutions($projection, $zoom_start = 0, $zoom_end = FALSE) {
switch ($projection) {
case 'EPSG:900913':
$res = array(
156543.0339,
78271.51695,
39135.758475,
19567.8792375,
9783.939618750001,
4891.969809375,
2445.9849046875,
1222.99245234375,
611.496226171875,
305.7481130859375,
152.87405654296876,
76.43702827148438,
38.21851413574219,
19.109257067871095,
9.554628533935547,
4.777314266967774,
2.388657133483887,
1.1943285667419434,
0.5971642833709717,
0.29858214169740677,
0.14929107084870338,
0.07464553542435169,
);
break;
case 'EPSG:4326':
$res = array(
0.703125,
0.3515625,
0.17578125,
0.087890625,
0.0439453125,
0.02197265625,
0.010986328125,
0.0054931640625,
0.00274658203125,
0.001373291015625,
0.0006866455078125,
0.00034332275390625,
0.000171661376953125,
8.58306884765625E-5,
4.291534423828125E-5,
2.1457672119140625E-5,
1.0728836059570312E-5,
);
break;
default:
$res = array();
break;
}
$length = $zoom_end == FALSE ? NULL : $zoom_end - $zoom_start;
$resolutions = array_slice($res, $zoom_start, $length);
return $resolutions;
}
class openlayers_behavior {
var $options, $map;
function __construct($options = array(), $map = array()) {
$this->options = $options + $this
->options_init();
$this->map = $map;
}
function js_dependency() {
return array();
}
function options_init() {
return array();
}
function options_form($defaults = array()) {
return array();
}
function render(&$map) {
}
}
class openlayers_layer_type {
public $data = array();
public $map;
function __construct($layer = array(), $map = array()) {
foreach (array(
'name',
'title',
'description',
'data',
'export_type',
) as $k) {
if (isset($layer->{$k})) {
$this->{$k} = $layer->{$k};
}
}
$this->data += $this
->options_init();
$this->map = $map;
}
public function getProjections() {
$projections = array();
if (isset($this->data['projection'])) {
foreach ($this->data['projection'] as $projection) {
$projections[] = openlayers_get_projection_by_identifier($projection);
}
}
return $projections;
}
function options_init() {
return array(
'layer_type' => get_class($this),
'isBaseLayer' => TRUE,
'projection' => array(
'EPSG:900913',
),
'serverResolutions' => openlayers_get_resolutions('EPSG:900913'),
'resolutions' => openlayers_get_resolutions('EPSG:900913'),
'base_url' => NULL,
'transitionEffect' => 'resize',
'weight' => 0,
);
}
function options_form($default = array()) {
$allProjectionOptions = array();
foreach (openlayers_get_all_projections() as $projection) {
$allProjectionOptions[$projection->identifier] = $projection
->getLocalizedMessage();
}
return array(
'projection' => array(
'#type' => 'select',
'#title' => t('Projection'),
'#multiple' => TRUE,
'#options' => $allProjectionOptions,
'#default_value' => isset($default->data['projection']) ? $default->data['projection'] : openlayers_get_projection('EPSG', '3857')->identifier,
),
'isBaseLayer' => array(
'#type' => 'checkbox',
'#title' => t('Base Layer'),
'#description' => t('Uncheck to make this map an overlay'),
'#default_value' => !empty($default->data['isBaseLayer']) ? $default->data['isBaseLayer'] : FALSE,
),
);
}
function options_form_validate($form, &$form_state) {
}
function options_form_submit($form, &$form_state) {
$form_state['values']['data']['projection'] = array_keys($form_state['values']['data']['projection']);
$form_state['values']['data']['resolutions'] = array_map('floatval', array_values($form_state['values']['data']['resolutions']));
}
function settings_form() {
return array();
}
function render(&$map) {
}
}
function openlayers_ctools_plugin_api($module, $api) {
if ($module == "openlayers") {
switch ($api) {
case 'openlayers_maps':
return array(
'version' => 1,
);
case 'openlayers_layers':
return array(
'version' => 1,
);
case 'openlayers_projections':
return array(
'version' => 1,
);
case 'openlayers_styles':
return array(
'version' => 1,
);
case 'openlayers_layer_types':
return array(
'version' => 1,
);
case 'openlayers_behaviors':
return array(
'version' => 1,
);
}
}
elseif ($module == 'boxes' && $api == 'plugins') {
return array(
'version' => 1,
);
}
}
function openlayers_openlayers_behaviors() {
module_load_include('inc', 'openlayers', 'includes/openlayers.behaviors');
return _openlayers_openlayers_behaviors();
}
function openlayers_openlayers_layer_types() {
module_load_include('inc', 'openlayers', 'includes/openlayers.layer_types');
return _openlayers_openlayers_layer_types();
}
function openlayers_openlayers_layers() {
module_load_include('inc', 'openlayers', 'includes/openlayers.layers');
return _openlayers_openlayers_layers();
}
function openlayers_openlayers_projections() {
module_load_include('inc', 'openlayers', 'includes/openlayers.projections');
return _openlayers_openlayers_projections();
}
function openlayers_openlayers_styles() {
module_load_include('inc', 'openlayers', 'includes/openlayers.styles');
return _openlayers_openlayers_styles();
}
function openlayers_openlayers_maps() {
module_load_include('inc', 'openlayers', 'includes/openlayers.maps');
return _openlayers_openlayers_maps();
}
function openlayers_boxes_plugins() {
return array(
'openlayers_simple' => array(
'title' => 'OpenLayers',
'handler' => array(
'parent' => 'boxes_box',
'class' => 'openlayers_simple',
'file' => 'openlayers_simple.inc',
'path' => drupal_get_path('module', 'openlayers') . '/plugins/boxes',
),
),
);
}
function openlayers_quicktabs_contents() {
$info = array();
$path = drupal_get_path('module', 'openlayers') . '/plugins/quicktabs';
$info['map'] = array(
'path' => $path,
'handler' => array(
'file' => 'QuickMap.inc',
'class' => 'QuickMap',
),
);
return $info;
}
function openlayers_libraries_info() {
$libraries['openlayers'] = array(
'name' => 'OpenLayers',
'vendor url' => 'http://openlayers.org/',
'download url' => 'http://openlayers.org/download/OpenLayers-2.13.tar.gz',
'version arguments' => array(
'file' => 'lib/OpenLayers.js',
'pattern' => '/OpenLayers.VERSION_NUMBER="Release (.*?)"/',
'lines' => 1000,
),
'files' => array(
'js' => array(
'OpenLayers.js',
),
),
'variants' => array(
'original debug' => array(
'files' => array(
'js' => array(
'OpenLayers.debug.js',
),
),
),
'light' => array(
'files' => array(
'js' => array(
'OpenLayers.light.js',
),
),
),
'light debug' => array(
'files' => array(
'js' => array(
'OpenLayers.light.debug.js',
),
),
),
'mobile' => array(
'files' => array(
'js' => array(
'OpenLayers.mobile.js',
),
),
),
'mobile debug' => array(
'files' => array(
'js' => array(
'OpenLayers.mobile.debug.js',
),
),
),
),
'integration files' => array(
'openlayers' => array(
'js' => array(
'js/openlayers.js',
),
'css' => array(
'css/openlayers.css',
),
),
),
);
return $libraries;
}
function openlayers_build_preset($map = array()) {
return openlayers_build_map($map);
}
function openlayers_preset_load($name = '', $reset = FALSE) {
return openlayers_map_load($name, $reset);
}
function openlayers_render_preset_data($map = array(), $map_name = '') {
return openlayers_render_map_data($map, $map_name);
}
function openlayers_presets($reset = FALSE) {
return openlayers_maps($reset);
}
function openlayers_preset_save($map) {
return openlayers_map_save($map);
}
function openlayers_preset_delete($map) {
return openlayers_map_delete($map);
}
function openlayers_preset_options($reset = FALSE) {
return openlayers_map_options($reset);
}
function openlayers_error_check_preset($map, $log_errors = TRUE) {
return openlayers_error_check_map($map, $log_errors);
}
function openlayers_render_preset($map = '', $map_name = '') {
if (is_array($map)) {
return openlayers_render_preset_data($map, $map_name);
}
else {
return openlayers_render_map($map);
}
}