By default the your site will point to a hosted version of the
- OpenLayers library at %ol_api_url.
-
For better performance and reliability, you should use an internal version of the library.
- Download the OpenLayers library, and add it to your Drupal installation.
- Use the new drush command \'dl-openlayers\' to download it and place it at the right place automatically.
- If you download the library manually, then place it in the libraries/openlayers folder and new options will appear under OpenLayers source type on this page.
- You can also use a double backslash before the domain name
- (eg. //www.example.com/OpenLayers.js) which then respects the use of both HTTPS and HTTP protocols.
-
-
The default suggested, compatible version: %suggested_api
-
The default suggested, compatible hosted URL: %ol_api_url
-
Your version found from client-side, Javascript check: %client
Select internal to load the OpenLayers library from your drupal installation.
- You can use the drush command dl-openlayers to download the library and place it at the right place automatically.
-
Select external to load it from Internet.
-
-
You should use the libraries module to enable the internal loading of the library.
- ', array('!libraries' => 'http://drupal.org/project/libraries')),
- '#default_value' => variable_get('openlayers_source_type', 'external')
- );
-
- $form['openlayers_source_external'] = array(
- '#type' => 'textfield',
- '#title' => t('OpenLayers external source'),
- '#description' => $source_description,
- '#default_value' => variable_get('openlayers_source_external', OPENLAYERS_DEFAULT_LIBRARY),
- '#states' => array(
- 'visible' => array(
- ':input[name="openlayers_source_type"]' => array('value' => 'external'),
- ),
- ),
- );
-
- $library = libraries_info('openlayers');
- $variants = array('original' => 'original') + $library['variants'];
-
- $form['openlayers_source_internal_variant'] = array(
- '#type' => 'radios',
- '#options' => array_combine(array_keys($variants), array_map('ucfirst', array_keys($variants))),
- '#title' => t('OpenLayers internal source variant'),
- '#description' => t('The OpenLayers library (version >= 2.12) has different variants. Select the one you prefer for your installation. Warning: OpenLayers is design to only work for original variants. Hopefully more variants will be supported soon.'),
- '#default_value' => variable_get('openlayers_source_internal_variant', 'original'),
- '#states' => array(
- 'visible' => array(
- ':input[name="openlayers_source_type"]' => array('value' => 'internal'),
- ),
- ),
- );
-
$form['openlayers_default_map'] = array(
'#type' => 'select',
- '#title' => t('OpenLayers Default Map'),
- '#description' => t('This is the default map that will be used
- in cases where one is not defined. It will also be used as
- the default when creating new maps.'),
- '#options' => openlayers_map_options(),
- '#default_value' => variable_get('openlayers_default_map', 'default'),
+ '#title' => t('OpenLayers maps'),
+ '#description' => t('This form is just a test, it just shows the AJAX possibility of the module.'),
+ '#options' => $options,
+ '#default_value' => 'map_mapquest_openstreetmap',
'#ajax' => array(
'callback' => '_ajax_reload_default_map',
'method' => 'replace',
@@ -106,98 +44,24 @@ function openlayers_ui_admin_settings() {
'#suffix' => '',
'#type' => 'openlayers',
'#description' => t('This is the map set as default.'),
- '#map' => variable_get('openlayers_default_map', 'default')
- );
-
- $form['openlayers_ui_preview_map'] = array(
- '#type' => 'checkbox',
- '#title' => t('Preview Map'),
- '#description' => t('Turning this on will show you a map preview when editing it through the !link.',
- array('!link' => l(t('Map Interface'), 'admin/structure/openlayers/maps'))),
- '#default_value' => variable_get('openlayers_ui_preview_map', FALSE),
- '#ajax' => array(
- 'callback' => '_ajax_reload_default_map',
- 'method' => 'replace',
- 'wrapper' => 'default_map_ajax',
- 'effect' => 'fade'
- ),
+ '#map' => 'map_mapquest_openstreetmap'
);
- // A hidden value to reset client check
- $form['openlayers_ui_version_check'] = array(
- '#type' => 'hidden',
- '#value' => '',
- );
+ // This is for preventing 'system/ajax' as destination when using AJAX maps.
+ // See: http://drupal.stackexchange.com/questions/86958/get-current-url-arguments-inside-ajax-callback
+ $form['current_path'] = array('#type' => 'hidden', '#value' => current_path());
// Make a system setting form and return
return system_settings_form($form);
}
-/**
- * Ajax callback for the default map element in the form.
- *
- * @param $form
- * @param $form_state
- * @return mixed
- */
function _ajax_reload_default_map($form, &$form_state) {
- $output = $form['default_map'];
- $output['#map'] = $form_state['values']['openlayers_default_map'];
- return $output;
-}
-
-/**
- * Settings form validation
- *
- * @param $form
- * @param $form_state
- */
-function openlayers_ui_admin_settings_validate($form, &$form_state) {
- if ($form_state['values']['openlayers_source_type'] == 'external') {
- $url = $form_state['values']['openlayers_source_external'];
- // If protocol neutral, fake a URL that will pass valid_url() and
- // url_is_external().
- if (strpos($url, '//') === 0) {
- $url = 'http:' . $url;
- }
- if (!valid_url($url, TRUE) && !url_is_external($url)) {
- form_set_error('openlayers_source_external', 'The source must be a valid external URL, beginning with http(s).');
- }
- }
-}
-
-/**
- * Callback endpoint for sending in OL version from client JS.
- */
-function openlayers_ui_version_check($version = 0) {
- $version = check_plain($version);
-
- // Set variable with version for hook_requirements
- // and so we dont do this on every page load.
- variable_set('openlayers_ui_version_check', $version);
-
- // Do a basic check
- if (strpos($version, (string) OPENLAYERS_SUGGESTED_LIBRARY) !== FALSE) {
- $status = 'valid';
- $message = t('Valid library found with a Javascript client check; version: %version', array('%version' => $version));
- }
- else {
- $status = 'invalid';
- $message = t('Could not find a valid library with a Javascript client-side check; Value found: %version. Please visit the !settings for more details.',
- array(
- '%version' => $version,
- '!settings' => l(t('OpenLayers settings page'), 'admin/structure/openlayers'),
- )
- );
- }
-
- // Kind of a hack, but since we are using messages for this, let's clear the
- // messages queue out.
- $messages = drupal_get_messages();
-
- // We just want to send some markup back.
- drupal_json_output(array(
- 'status' => $status,
- 'response' => $message,
- ));
+ // This is for preventing 'system/ajax' as destination when using AJAX maps.
+ // See: http://drupal.stackexchange.com/questions/86958/get-current-url-arguments-inside-ajax-callback
+ $_SESSION['current_path'] = $form_state['input']['current_path'];
+ $map = openlayers_object_load('map', $form_state['values']['openlayers_default_map']);
+ $form['default_map']['map'] = array(
+ '#markup' => openlayers_render_map($map)
+ );
+ return $form['default_map'];
}
diff --git a/modules/openlayers_ui/includes/openlayers_ui.layers.inc b/modules/openlayers_ui/includes/openlayers_ui.layers.inc
deleted file mode 100644
index 5051b16937493c3c5407384ecd00d4c0496ee691..0000000000000000000000000000000000000000
--- a/modules/openlayers_ui/includes/openlayers_ui.layers.inc
+++ /dev/null
@@ -1,49 +0,0 @@
- $type_def) {
- $type = openlayers_layer_type_load($name);
- if ($type->settings_form()) {
- $form[$name] = array(
- '#type' => 'fieldset',
- '#tree' => TRUE,
- '#title' => $type_def['title']
- );
- $form[$name]['settings'] = $type->settings_form();
- }
- }
-
- $form['submit'] = array(
- '#type' => 'submit',
- '#value' => t('Save'),
- );
-
- return $form;
-}
-
-/**
- * Submit handler for openlayers_ui_layers_settings
-*/
-function openlayers_ui_layers_settings_submit(&$form, &$form_state) {
- $layer_types = openlayers_layer_types();
- foreach ($form_state['values'] as $key => $value) {
- if (in_array($key, array_keys($layer_types))) {
- foreach ($value['settings'] as $k => $v) {
- variable_set($k, $v);
- }
- }
- }
-}
diff --git a/modules/openlayers_ui/includes/openlayers_ui.maps.inc b/modules/openlayers_ui/includes/openlayers_ui.maps.inc
deleted file mode 100644
index 0f2f400898cdfbefdf70b4608eff3faf37a3b85d..0000000000000000000000000000000000000000
--- a/modules/openlayers_ui/includes/openlayers_ui.maps.inc
+++ /dev/null
@@ -1,287 +0,0 @@
- NULL, 'submitted' => FALSE);
- $form_build_id = $_POST['form_build_id'];
- $form = form_get_cache($form_build_id, $form_state);
-
- // Get variables
- $args = $form['#parameters'];
- $form_id = array_shift($args);
- $form_state['post'] = $form['#post'] = $_POST;
- $form['#programmed'] = $form['#redirect'] = FALSE;
-
- // Reprocess form with new form state
- drupal_process_form($form_id, $form, $form_state);
-
- // Rebuild form and remove any submit handlers
- $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
-
- // Unset wrapper and create output
- $output = theme('status_messages') . drupal_render($form['layerstyles']);
-
- // Final rendering callback.
- drupal_json(array('status' => TRUE, 'data' => $output));
-}
-
-/**
- * Process form submission into a map array.
- *
- * @param $values
- * Array of values to process.
- * @return
- * Map data array.
- */
-function openlayers_ui_maps_form_process($values = array()) {
- // Valid keys that we will cherry-pick from the form values.
- $keys = array(
- 'width',
- 'height',
- 'image_path',
- 'css_path',
- 'proxy_host',
- 'hide_empty_map',
- 'center',
- 'behaviors',
- 'layers',
- 'layer_weight',
- 'layer_styles',
- 'layer_styles_select',
- 'layer_styles_temporary',
- 'layer_activated',
- 'layer_switcher',
- 'projections',
- 'styles'
- );
-
- // TODO: eliminate this process, too much disconnect between
- // forms and data
- $processed = array();
- foreach ($keys as $key) {
- switch ($key) {
- case 'behaviors':
- $processed['behaviors'] = array();
- foreach ($values['behaviors'] as $behavior => $settings) {
- if ($settings['enabled']) {
- $processed['behaviors'][$behavior] =
- isset($settings['options_set']['options']) ?
- $settings['options_set']['options'] : array();
- }
- }
- break;
-
- case 'projections':
- $processed['projection'] = $values['layerstyles']['projections']['easy_projection'];
- $processed['displayProjection'] = $values['layerstyles']['projections']['displayProjection'];
- break;
-
- case 'layers':
- // Put the default layer in the right place.
- // TODO: finish port here
- $processed['default_layer'] = $values['layerstyles']['layers']['default_layer'];
- $baselayers = array_filter($values['layerstyles']['layers']['baselayers']);
- $overlays = (isset($values['layerstyles']['layers']['overlays'])) ?
- array_filter($values['layerstyles']['layers']['overlays']) : array();
- // Sort overlay layers by weight, in case browser didn't
- // send them already sorted
- if (isset($values['layerstyles']['layer_weight'])) {
- $overlays = array();
- asort($values['layerstyles']['layer_weight']);
- foreach (array_keys($values['layerstyles']['layer_weight']) as $layer_key) {
- if ($values['layerstyles']['layers']['overlays'][$layer_key]) {
- $overlays[$layer_key] = $layer_key;
- }
- }
- // TODO: Above code is terrrrrrrrible. rewrite when I have the time
- }
-
- // Merge our different layer sections together
- $processed['layers'] = array_merge($baselayers, $overlays);
- break;
-
- case 'layer_weight':
- case 'layer_styles':
- case 'layer_styles_select':
- case 'layer_styles_temporary':
- case 'layer_activated':
- case 'layer_switcher':
- case 'projections':
- case 'styles':
- $processed[$key] = isset($values['layerstyles'][$key]) ? $values['layerstyles'][$key] : array();
- break;
-
- default:
- // $processed[$key] = is_array($values[$key]) ?
- // array_filter($values[$key]) : $values[$key];
- $processed[$key] = isset($values[$key]) ? $values[$key] : array();
- break;
- }
- }
-
- // Ensure these values are arrays
- $ensure_array = array('behaviors', 'layers', 'layer_weight', 'layer_styles', 'layer_styles_select', 'layer_styles_temporary', 'styles');
- foreach ($ensure_array as $key) {
- if (empty($processed[$key])) {
- $processed[$key] = array();
- }
- }
-
- return $processed;
-}
-
-/**
- * Get behavior options.
- */
-function openlayers_ui_get_behavior_options($type, $defaults) {
- $form = array();
- $behaviors = openlayers_behaviors();
- $enabled_behaviors = array();
-
- foreach ($defaults['behaviors'] as $key => $options) {
- $enabled_behaviors[$key] = $behaviors[$key];
- unset($behaviors[$key]);
- }
-
- // Ordering behaviors
- // First display the enabled, then the disabled.
- uasort($enabled_behaviors, '_openlayers_ui_sort_behaviors');
- uasort($behaviors, '_openlayers_ui_sort_behaviors');
-
- $behaviors = array_merge($enabled_behaviors, $behaviors);
-
- foreach ($behaviors as $key => $plugin) {
-
- // Get behavior class
- $class = ctools_plugin_load_class(
- 'openlayers',
- 'behaviors',
- $key,
- 'behavior');
- if (!empty($class)) {
- $options = isset($defaults['behaviors'][$key]) ?
- $defaults['behaviors'][$key] : array();
-
- $behavior = new $class($options, $defaults);
-
- if (!isset($plugin['ui_visibility']) || $plugin['ui_visibility']) {
- // Create basic form structure for behavior
- $form[$key] = array(
- '#type' => 'fieldset',
- '#title' => $plugin['title'],
- '#collapsible' => TRUE,
- '#collapsed' => isset($defaults['behaviors'][$key]) ? FALSE : TRUE,
- 'enabled' => array(
- '#type' => 'checkbox',
- '#title' => $plugin['title'],
- '#description' => $plugin['description'],
- '#default_value' => isset($defaults['behaviors'][$key]),
- )
- );
-
- // Create options items
- $options = $behavior->options_form($options);
- if (!empty($options)) {
- $form[$key]['options_set'] = array(
- '#type' => 'fieldset',
- '#title' => t('Options'),
- '#collapsible' => FALSE,
- '#collapsed' => FALSE,
- '#states' => array(
- 'visible' => array(
- ':input[name="behaviors['.$key.'][enabled]"]' => array('checked' => TRUE),
- ),
- ),
- 'options' => $options
- );
- }
- }
- }
- }
- return $form;
-}
-
-/**
- * Callback sorting behaviors alphabetically
- */
-function _openlayers_ui_sort_behaviors($a, $b) {
- return strnatcmp($a['title'], $b['title']);
-}
-
-/**
- * Create Centering Map
- *
- * Create map for interactive default centering
- *
- * @param $defaults
- * Array of defults to use for the map of centering and zooming
- * @return
- * Themed map array
- */
-function openlayers_ui_maps_form_center_map($defaults = array()) {
- // Pass variables etc. to javascript
- $pass_values = array(
- 'openlayersForm' => array(
- 'projectionLayers' => openlayers_ui_get_projection_options(),
- ),
- );
- drupal_add_js($pass_values, 'setting');
-
- $projection = openlayers_get_projection('EPSG', '3857');
- openlayers_add_js_projection_definition($projection);
-
- // centerpoint & zoom of this map are overridden
- // by the mapformvalues behavior on page load.
- //
- // Note that navigation screws up the boxselect
- // behavior for getting extent.
- $centermap_def = array(
- 'id' => 'openlayers-center-helpmap',
- 'projection' => $projection->identifier,
- 'displayProjection' => $projection->identifier,
- 'default_layer' => 'mapquest_osm',
- 'width' => '600px',
- 'height' => '400px',
- 'center' => array(
- 'initial' => array(
- 'centerpoint' => "0, 0",
- 'zoom' => 2,
- ),
- ),
- 'image_path' => drupal_get_path('module', 'openlayers') . '/themes/default_dark/img/',
- 'layers' => array(
- 'mapquest_osm',
- ),
- 'behaviors' => array(
- 'openlayers_behavior_navigation' => array(),
- 'openlayers_behavior_panzoombar' => array(),
- 'openlayers_behavior_dragpan' => array(),
- 'openlayers_behavior_mapformvalues' => array(),
- 'openlayers_behavior_boxselect' => array(),
- 'openlayers_behavior_attribution' => array(),
- ),
- );
- return openlayers_render_map_data($centermap_def);
-}
diff --git a/modules/openlayers_ui/includes/openlayers_ui.theme.inc b/modules/openlayers_ui/includes/openlayers_ui.theme.inc
deleted file mode 100644
index 2d2a542442109430d02043039ed130ded8d88fa7..0000000000000000000000000000000000000000
--- a/modules/openlayers_ui/includes/openlayers_ui.theme.inc
+++ /dev/null
@@ -1,96 +0,0 @@
- drupal_get_destination()));
- }
- return $args['layer_title'] . ($args['layer_description'] ?
- ' ' .
- $args['layer_description'] . '' :
- '');
-}
-
-/**
- * Theme function for form description of projection
- */
-function theme_openlayers_ui_form_projection_description($args) {
- $output = $args['projection']->getLocalizedMessage();
- if (count($args['available_layers'])) {
- $names = implode(', ', $args['available_layers']);
- $output .= " - $names";
- }
- return $output;
-}
-
-function theme_openlayers_ui_maps_form_layers($args) {
- $form = $args['elements'];
-
- $output = drupal_render($form['projections'])
- . drupal_render($form['help_data_overlays']);
-
- // Base layers
- $rows = array();
- foreach (element_children($form['layers']['baselabels']) as $key) {
- unset($form['layers']['default_layer'][$key]['#title']);
- unset($form['layers']['baselayers'][$key]['#title']);
-
- $rows[] = array(
- drupal_render($form['layers']['baselabels'][$key]),
- drupal_render($form['layers']['baselayers'][$key]),
- drupal_render($form['layers']['default_layer'][$key]));
- }
- $output_layer_list = theme('table', array(
- 'header' => array(t('Base layers'), t('Enabled'), t('Default')),
- 'rows' => $rows)
- );
-
- // Overlay layers
- $rows = array();
- foreach (element_children($form['layers']['overlaylabels']) as $key) {
- unset($form['overlays'][$key]['#title']);
- unset($form['layers']['overlays'][$key]['#title']);
- unset($form['layer_activated'][$key]['#title']);
- unset($form['layer_switcher'][$key]['#title']);
-
- $rows[] = array(
- 'data' => array(
- drupal_render($form['layers']['overlaylabels'][$key]),
- drupal_render($form['layer_weight'][$key]),
- drupal_render($form['layers']['overlays'][$key]),
- drupal_render($form['layer_activated'][$key]),
- drupal_render($form['layer_switcher'][$key]),
- drupal_render($form['layer_styles'][$key]),
- drupal_render($form['layer_styles_select'][$key]),
- drupal_render($form['layer_styles_temporary'][$key]),
- ),
- 'class' => array('draggable')
- );
- }
- $output_layer_list .= theme('table',
- array(
- 'header' => array(
- t('Overlay layers'), t('Weight'), t('Enabled'),
- t('Activated'), t('In Switcher'), t('Style'), t('Select Style'),
- ('Temporary Style')
- ),
- 'rows' => $rows,
- array('id' => 'overlay-layer-table')
- )
- );
- $form['layers']['layerlist']['#markup'] = $output_layer_list;
- $output .= drupal_render($form['layers']);
-
- drupal_add_tabledrag('overlay-layer-table', 'order', 'sibling',
- 'layer-weight');
- return $form['#prefix'] . $output . drupal_render_children($form) . $form['#suffix'];
-}
diff --git a/modules/openlayers_ui/js/openlayers_ui.admin.js b/modules/openlayers_ui/js/openlayers_ui.admin.js
deleted file mode 100644
index 4f4f8272b489d2afd13d27cebab897a33a252b4c..0000000000000000000000000000000000000000
--- a/modules/openlayers_ui/js/openlayers_ui.admin.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * @file
- * Javascript for OL UI Admin
- *
- * @ingroup openlayers
- */
-
-// Namespace jQuery
-(function ($) {
-
-/**
- * Drupal behaviors for OpenLayers UI form.
- */
-Drupal.behaviors.openlayers_ui_admin = {
- 'attach': function(context, settings) {
- $('.openlayers-ui-version-check-message').once('openlayers-ui-version-check-message', function() {
- // Determine version
- var version = '0';
- var $thisContainer = $(this);
-
- if (typeof OpenLayers != 'undefined' && OpenLayers.hasOwnProperty('VERSION_NUMBER')) {
- version = OpenLayers.VERSION_NUMBER;
- }
-
- // Mark as loading, then do AJAX request
- $thisContainer.addClass('throbbing');
- var url = settings.basePath + '?q=admin/structure/openlayers/callbacks/version_check/' + version;
- $.ajax({
- url: url,
- success: function(data) {
- $thisContainer.removeClass('throbbing');
- $thisContainer.html(data.response);
- if (data.status == 'valid') {
- $thisContainer.parent()
- .removeClass('warning')
- .addClass('status');
- }
- else {
- $thisContainer.parent()
- .removeClass('status')
- .addClass('warning');
- }
- },
- error: function(data) {
- $thisContainer.removeClass('throbbing');
- $thisContainer.html(Drupal.t('Error making request to server.'));
- }
- });
- });
- }
-};
-
-})(jQuery);
diff --git a/modules/openlayers_ui/js/openlayers_ui.maps.js b/modules/openlayers_ui/js/openlayers_ui.maps.js
deleted file mode 100644
index 893f57edf0993166319c4d5ce8f7b349d871fbf1..0000000000000000000000000000000000000000
--- a/modules/openlayers_ui/js/openlayers_ui.maps.js
+++ /dev/null
@@ -1,75 +0,0 @@
-
-/**
- * @file
- * This file holds the javascript functions for the map UI
- *
- * @ingroup openlayers
- */
-
-/**
- * Test whether function exists,
- * even if it is the child of another object
- * @param head the function name as a string,
- * optionally with dots for invoking children
- * @return bool true or false for existence
- */
-function function_exists(head) {
- return _function_exists(head.split('.'), window);
-}
-
-function _function_exists(head, f) {
- if (head.length == 0) {
- return true;
- }
- h = head.shift();
- if (typeof f[h] !== 'undefined') {
- return _function_exists(head, f[h]);
- }
- else {
- return false;
- }
-}
-
-(function ($) {
-/**
- * Drupal behaviors for OpenLayers UI form.
- */
-Drupal.behaviors.openlayers_ui = {
- 'attach': function(context, settings) {
-
- // mark openlayers dependencies as valid or invalid
- $('.openlayers-dependency-flag').each(function() {
- if (!function_exists($(this).find('.openlayers-dependency-value').text())) {
- $(this).find('.openlayers-dependency-broken').show();
- }
- });
-
- // Since CTools dependency is not working
- $('#edit-behaviors:not(.openlayers-behaviors-checks-processed)').each(function () {
- $('#edit-behaviors').addClass('openlayers-behaviors-checks-processed');
- $('#edit-behaviors table tbody tr td > div.form-type-checkbox').each(function () {
- var $thisBehavior = $(this);
- var $thisCheck = $('input[type=checkbox]', $thisBehavior);
-
- if ($thisCheck.attr('checked')) {
- $thisBehavior.siblings().show();
- }
- else {
- $thisBehavior.siblings().hide();
- }
-
- $thisCheck.click(function() {
- if ($thisCheck.attr('checked')) {
- $thisBehavior.siblings().show();
- }
- else {
- $thisBehavior.siblings().hide();
- }
- });
-
- });
- });
- }
-};
-
-})(jQuery);
diff --git a/modules/openlayers_ui/js/openlayers_ui.styles.js b/modules/openlayers_ui/js/openlayers_ui.styles.js
deleted file mode 100644
index 3fce3d079a715194401d576de91c654ba12cc93f..0000000000000000000000000000000000000000
--- a/modules/openlayers_ui/js/openlayers_ui.styles.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * @file
- * Javascript for OL Styles UI.
- *
- * @ingroup openlayers
- */
-
-// Namespace jQuery
-(function ($) {
-
-/**
- * Drupal behaviors for OpenLayers UI form.
- */
-Drupal.behaviors.openlayers_ui_styles = {
- 'attach': function(context, settings) {
- var maps = {};
-
- // Go through each preview
- $('.openlayers-ui-style-preview:not(.openlayers-ui-style-preview-processed)').each(function() {
- $thisPreview = $(this);
- $thisPreview.addClass('openlayers-ui-style-preview-processed');
- var id = $thisPreview.attr('id');
- var style = Drupal.settings.openlayers_ui.style_preview[id].data;
-
- // We want to create a very simple map with a style on
- // top. There's no need to use the Drupal API for this as we
- // want to keep it lean.
- maps[id] = new OpenLayers.Map(id, { controls: [] });
- var mapquest = new OpenLayers.Layer.OSM(Drupal.t('MapQuest-OSM Tiles'),
- [(location.protocol === 'https:' ? '//otile1-s' : '//otile1') + '.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png']);
- maps[id].addLayer(mapquest);
- var point = new OpenLayers.LonLat(Math.random() * 175, Math.random() * 80).transform(
- new OpenLayers.Projection("EPSG:4326"), maps[id].getProjectionObject()
- );
- maps[id].setCenter(point, (Math.floor(Math.random() * 4) + 1));
-
- // Now add a point with the preview style.
- var feature = new OpenLayers.Feature.Vector(
- new OpenLayers.Geometry.Point(point.lon, point.lat));
- var vector = new OpenLayers.Layer.Vector(Drupal.t('Preview'), {
- styleMap: new OpenLayers.StyleMap(style)
- });
- vector.addFeatures([ feature ]);
- maps[id].addLayer(vector);
-
- // And finally, lets add a little crosshair so that
- // the user can see how the style is centered. If it is
- // enabled;
- if (Drupal.settings.openlayers_ui.style_preview[id + '_crosshairs']) {
- $thisPreview.find('.olMapViewport')
- .append('')
- .append('');
- }
- });
- }
-};
-
-})(jQuery);
diff --git a/modules/openlayers_ui/openlayers_ui.css b/modules/openlayers_ui/openlayers_ui.css
deleted file mode 100644
index 6b1439b7224850155547593710d52b6ff9ee64ab..0000000000000000000000000000000000000000
--- a/modules/openlayers_ui/openlayers_ui.css
+++ /dev/null
@@ -1,120 +0,0 @@
-
-/**
- * @file
- * OpenLayers Admin CSS
- *
- * This file holds CSS for the openlayers ui module
- *
- * @ingroup openlayers
- */
-
-/**
- * Map Form
- */
-.openlayers-form-projection-description,
-.openlayers-form-layer-description {
- font-size: smaller;
- font-style: italic;
-}
-
-#openlayers-form-proj-msg {
- display: none;
-}
-
-span.openlayers-dependency-value {
- display: none;
-}
-
-span.openlayers-dependency-broken {
- font-size: smaller;
- display: none;
- color: red;
-}
-
-/**
- * Overriding for vertical tabs
- */
-div.vertical-tabs fieldset {
- border: 1px solid #CCCCCC;
- margin: 1em 0;
- padding: 2.5em 0 0;
- position: relative;
-}
-
-div.vertical-tabs .vertical-tabs-panes legend {
- display: block;
-}
-
-div.vertical-tabs .vertical-tabs-panes > fieldset {
- border: 0 none;
- margin: 0;
- padding: 0;
-}
-
-div.vertical-tabs .vertical-tabs-panes > fieldset > legend {
- display: none;
-}
-
-/**
- * Behaviors table
- */
-div.vertical-tabs table tbody tr fieldset {
- font-size: .85em;
- margin-left: 20px;
- margin-right: 20px;
- padding: 10px;
- background-color: #EEEEEE;
- position: inherit;
-}
-
-div.vertical-tabs table tbody tr.odd .form-item,
-div.vertical-tabs table tbody tr.even .form-item {
- white-space: normal;
-}
-
-/**
- * Style previews
- */
-.openlayers-ui-style-preview {
- width: 60px;
- height: 60px;
- background-color: #DDDDDD;
- border: 1px solid #222222;
-}
-
-#openlayers-ui-styles-form .openlayers-ui-style-preview {
- width: 200px;
- height: 200px;
-}
-
-#openlayers-ui-styles-form #edit-preview-style-container {
- float: right;
- width: 210px;
- margin: 0 0 10px 10px;
-}
-
-.openlayers-ui-style-preview .openlayers-ui-style-preview-top,
-.openlayers-ui-style-preview .openlayers-ui-style-preview-left {
- position: absolute;
- z-index: 999999;
-}
-
-.openlayers-ui-style-preview .openlayers-ui-style-preview-top {
- top: 0;
- right: 0;
- left: 0;
- width: 100%;
- height: 50%;
- border-bottom: 1px solid rgb(33, 33, 33);
- border-bottom: 1px solid rgba(33, 33, 33, .2);
-
-}
-.openlayers-ui-style-preview .openlayers-ui-style-preview-left {
- top: 0;
- right: 0;
- left: 0;
- width: 50%;
- height: 100%;
- border-right: 1px solid rgb(33, 33, 33);
- border-right: 1px solid rgba(33, 33, 33, .2);
-}
\ No newline at end of file
diff --git a/modules/openlayers_ui/openlayers_ui.install b/modules/openlayers_ui/openlayers_ui.install
index 719c62037970657f65fae1affb90c181f0e9e210..b3d9bbc7f3711e882119cd6b3af051245d859d04 100644
--- a/modules/openlayers_ui/openlayers_ui.install
+++ b/modules/openlayers_ui/openlayers_ui.install
@@ -1,34 +1 @@
condition('link_path', 'admin/structure/openlayers%', 'LIKE')
- ->execute();
-}
diff --git a/modules/openlayers_ui/openlayers_ui.module b/modules/openlayers_ui/openlayers_ui.module
index 2a80755e0c9159ad03786095b9c660589f9d5d85..f5259766ae86dc2a84e581213ea2f9a74bef2c0f 100644
--- a/modules/openlayers_ui/openlayers_ui.module
+++ b/modules/openlayers_ui/openlayers_ui.module
@@ -1,111 +1,4 @@
!title !message', array(
- '!title' => $r['value'],
- '!message' => isset($r['description']) ? $r['description'] : '',
- )), $severity);
- }
- }
-
- // We also want to do some nice AJAX magic to get the library
- // version to the system.
- $check = variable_get('openlayers_ui_version_check', '');
- if (empty($check)) {
- // Load AJAX libraries
- drupal_add_library('system', 'drupal.ajax');
- drupal_add_library('system', 'jquery.form');
- // Ensure that the library is included
- openlayers_include();
- // Add custom client JS
- drupal_add_js(drupal_get_path('module', 'openlayers_ui') . '/js/openlayers_ui.admin.js');
- // We shouldn't, but we are just gonna put a message up there
- // to get replaced.
- drupal_set_message('
' .
- t('Checking client library via Javascript...') . '
' . t('Provides a user interface to manage OpenLayers maps.') . '
';
- case 'admin/structure/openlayers':
- return '
' . t('Configure where Drupal finds
- the OpenLayers javascript library. Using a local or compacted
- version of OpenLayers can reduce filesize, but remember to set the Image Path and
- CSS Path options in every map, because OpenLayers is not able to find these resources
- automatically. See the included documentation in /doc for
- more details.',
- array('@olb' => 'http://trac.openlayers.org/wiki/Profiles')) . '
';
- case 'admin/structure/openlayers/styles':
- return '
' . t('OpenLayer styles are stored versions of
- javascript StyleMap objects, but are much easier to
- configure through an interface. Styles will typically define the icon,
- fill color, border, and radius of points or polygons, so they are used
- on overlays more often than base layers, which are not affected by vector
- styles.', array("@ols" => 'http://trac.openlayers.org/wiki/Styles')) . '
';
- case 'admin/structure/openlayers/styles/add':
- return '
' . t('The name, title, and description you give a style is for Drupal\'s
- interal storage. The rest of the properties are documented on openlayers.org')
- . '
';
- case 'admin/structure/openlayers/maps':
- return '
' . t('Maps are combinations of the layers, styles, and behaviors
- which constitute maps. They also contain basic configuration like the
- width and centerpoint of the map - everything except for a mechanism
- to put a map on a page. For that, use the Views OpenLayers Map style.') . '
';
- case 'admin/structure/openlayers/layers':
- return '
' . t('Layers are stored versions of javascript OpenLayers layer
- objects. They point at a data source, like OpenStreetMap, Google Maps,
- or Drupal itself, and sometimes define the zoom levels for which they apply.') . '
';
- case 'admin/structure/openlayers/projections':
- return t('
Projections describe how the earth is flattened to a map image. They define coordinate systems for data retrieval.
');
- case 'admin/structure/openlayers/layers/settings':
- return '
' . t('Commercial layer providers like Google will require API keys
- to ensure that users are\'t abusing the service and to enforce limits. Not all
- of these keys are required, of course, only those that are used on a site.') . '
A proxy (typically on the same domain as this site)
- which enables requests to cross-domain AJAX resources (including remote
- KML). Use any of the following:
-
-
Leave blank no proxy path.
-
Relative Drupal path a path without leading slash and
- the base path will be prepended, ex. "proxy?request="
-
Absolute path a path with leading slash and path will
- start from sites root directory, ex. "/cgi_proxy?request="
-
Full URL such as "http://example.com/proxy?request="
-
-
This is actually a setting for the OpenLayers
- object and will affect all maps on the same page.
'
- ),
- '#default_value' => !empty($defaults['proxy_host']) ?
- $defaults['proxy_host'] : '',
- );
-
- // Center
- $form['center'] = array(
- '#title' => t('Center & Bounds'),
- '#description' => t('Where the map will center itself initially.
- Shift-drag a box on the map to set the Restricted Extent.'),
- '#tree' => TRUE,
- '#type' => 'fieldset',
- '#group' => 'ui'
- );
- $build = openlayers_ui_maps_form_center_map($defaults);
- $form['center']['helpmap'] = array(
- '#markup' => '
' . render($build) . '
'
- );
- $form['center']['initial'] = array(
- '#type' => 'fieldset',
- '#title' => t('Initial Map View')
- );
- $form['center']['initial']['centerpoint'] = array(
- '#type' => 'textfield',
- '#title' => t('Centerpoint'),
- '#description' => t('Coordinates that are the intial focus of the map. This
- is formated like longitude,latitude.'),
- '#default_value' => $defaults['center']['initial']['centerpoint'],
- '#attributes' => array('class' => array('openlayers-form-centerpoint')),
- '#size' => 25,
- );
- $form['center']['initial']['zoom'] = array(
- '#type' => 'textfield',
- '#title' => t('Zoom Level'),
- '#description' => t('Initial Zoom Level when the map intially displays.
- Higher is more zoomed in.'),
- '#default_value' => $defaults['center']['initial']['zoom'],
- '#attributes' => array('class' => array('openlayers-form-zoom')),
- '#size' => 25,
- );
- $form['center']['restrict'] = array(
- '#type' => 'fieldset',
- '#title' => t('Restrict Extent')
- );
- $form['center']['restrict']['restrictextent'] = array(
- '#type' => 'checkbox',
- '#title' => t('Restrict Extent'),
- '#description' => t('Setting the restricted extent of a map prevents users
- from panning the map outside a specified area. This can be set
- interactively by holding the shift key and dragging a box over the map
- above. Setting the extent does not restrict how far users can zoom out,
- so setting restricted zoom levels (via individual layer settings) is
- recommended.'),
- '#id' => 'restrictextent',
- '#default_value' => isset($defaults['center']['restrict']['restrictextent']) ?
- $defaults['center']['restrict']['restrictextent'] : '',
- );
- $form['center']['restrict']['restrictedExtent'] = array(
- '#type' => 'textfield',
- '#title' => t('Restricted Extent'),
- '#description' => t('Prevents users from panning outside of a specific bounding box'),
- '#default_value' => isset($defaults['center']['restrict']['restrictedExtent']) ?
- $defaults['center']['restrict']['restrictedExtent'] : '',
- '#attributes' => array('class' => array('openlayers-form-restrictedExtent')),
- '#size' => 25,
- '#process' => array('ctools_dependent_process'),
- '#dependency' => array('restrictextent' => array(1))
- );
-
- // Layers & styles
- $form['layerstyles'] = array(
- '#type' => 'fieldset',
- '#title' => t('Layers & Styles'),
- '#description' => t('Layer settings. The Layer options will change based on the projection chosen.'),
- '#theme' => 'openlayers_ui_maps_form_layers',
- '#tree' => TRUE,
- '#group' => 'ui',
- '#prefix' => '',
- '#suffix' => ''
- );
-
- // Projection options
- $projections = array();
- foreach (openlayers_ui_get_projection_options() as $projection) {
- $projection_layers = array_merge(
- openlayers_ui_get_layer_options('baselayer', $projection),
- openlayers_ui_get_layer_options('overlay', $projection));
-
- $projections[$projection->identifier] = theme(
- 'openlayers_ui_form_projection_description',
- array(
- 'projection' => $projection,
- 'available_layers' => $projection_layers
- )
- );
- }
-
- $form['layerstyles']['projections'] = array(
- '#type' => 'fieldset',
- '#title' => t('Projections'),
- '#description' => t('
WARNING: Projections are not well supported in
- this module. If you need to handle non spherical mercator projections
- you may be better using the API directly.
-
Select the !link_proj for your map. The list next
- to each projection is the layers that support this projection.
',
- array('!link_proj' => l(t('geographical projection'),
- 'http://en.wikipedia.org/wiki/Map_projection'))
- ),
- '#tree' => TRUE,
- );
- $form['layerstyles']['projections']['easy_projection'] = array(
- '#type' => 'radios',
- '#title' => t('Map Projection'),
- '#description' => t('The !link_proj of this map: all layers will either be requested or reprojected to this format.', array(
- '!link_proj' => l(
- t('geographical projection'),
- 'http://en.wikipedia.org/wiki/Map_projection'),
- )),
- '#default_value' => $defaults['projection']->identifier,
- '#options' => $projections,
- '#attributes' => array('class' => array('openlayers-form-easy-projection')),
- '#ajax' => array(
- 'callback' => 'openlayers_map_layerlist',
- 'wrapper' => 'edit-layerstyles',
- 'method' => 'replace',
- 'event' => 'change'
- )
- );
- $displayProjectionOptions = array();
- foreach(openlayers_ui_get_projection_options() as $projectionIdentifier => $projection){
- $displayProjectionOptions[$projectionIdentifier] = $projection->getLocalizedMessage();
- }
- $form['layerstyles']['projections']['displayProjection'] = array(
- '#type' => 'select',
- '#title' => t('Display Projection'),
- '#description' => t('All interaction with the map - drawing, panning,
- centering, and more - occurs in the display projection. The vast majority
- of maps use 4326 (latitude/longitude) for this value.'),
- '#default_value' => !empty($defaults['displayProjection']) ?
- $defaults['displayProjection']->identifier : openlayers_get_projection('EPSG', '4326')->identifier,
- '#options' => $displayProjectionOptions,
- );
-
- $form['layerstyles']['layers'] = array(
- '#title' => t('Layers & Styles'),
- '#description' => t('Layer settings. The Layer options will change based on the projection chosen.'),
- '#type' => 'fieldset',
- );
-
- // Construct data for theme_openlayers_ui_maps_form_layers
- $form['layerstyles']['layers']['#tree'] = TRUE;
- $form['layerstyles']['layers']['baselabels'] = array();
- if(isset($form_state['values']['layerstyles']['projections']['easy_projection'])){
- // Projection was choosen by editing the form
- $easy_projection = openlayers_get_projection_by_identifier($form_state['values']['layerstyles']['projections']['easy_projection']);
- } else {
- // Form was not yet edited, use default
- $easy_projection = $defaults['projection'];
- }
- $base_options = openlayers_ui_get_layer_options('baselayer', $easy_projection);
- foreach ($base_options as $id => $description) {
- $form['layerstyles']['layers']['baselabels'][$id] =
- array('#markup' => $description);
- }
- $form['layerstyles']['layers']['baselayers'] = array(
- '#type' => 'checkboxes',
- '#options' => $base_options,
- '#default_value' => !empty($defaults['layers']) ?
- array_intersect_key($defaults['layers'], $base_options) :
- array()
- );
- $form['layerstyles']['layers']['default_layer'] = array(
- '#type' => 'radios',
- '#options' => $base_options,
- '#default_value' => !empty($defaults['default_layer']) &&
- isset($base_options[$defaults['default_layer']]) ?
- $defaults['default_layer'] :
- NULL,
- );
-
- // Overlay layers
- $overlay_options = openlayers_ui_get_layer_options('overlay', $easy_projection);
- $form['layerstyles']['layers']['overlaylabels'] = array();
- if (!empty($overlay_options)) {
-
- // Have enabled layers maintain their order
- $available = array_keys($overlay_options);
- $enabled = array_intersect(array_keys($defaults['layers']), $available);
- $disabled = array_diff($available, $enabled);
- $overlay_options_keys = array_merge($disabled, $enabled);
-
- // Create overlay options.
- $form['layerstyles']['layer_styles']['#tree'] = TRUE;
- $form['layerstyles']['layer_styles_select']['#tree'] = TRUE;
- $form['layerstyles']['layer_styles_temporary']['#tree'] = TRUE;
- $form['layerstyles']['layer_weight']['#tree'] = TRUE;
- foreach ($overlay_options_keys as $id) {
- $description = $overlay_options[$id];
- $form['layerstyles']['layers']['overlaylabels'][$id] = array('#markup' => $description);
-
- // Layer styles that define the default style of layer.
- $form['layerstyles']['layer_styles'][$id] = array(
- '#type' => 'select',
- '#options' => array('<' . t('use default style') . '>') + openlayers_ui_get_style_options(),
- '#default_value' => !empty($defaults['layer_styles'][$id]) ?
- $defaults['layer_styles'][$id] : '',
- );
-
- // Layer select style.
- $form['layerstyles']['layer_styles_select'][$id] = array(
- '#type' => 'select',
- '#options' => array('<' . t('use default style') . '>') + openlayers_ui_get_style_options(),
- '#default_value' => !empty($defaults['layer_styles_select'][$id]) ?
- $defaults['layer_styles_select'][$id] : '',
- );
-
- // Layer temporary style.
- $form['layerstyles']['layer_styles_temporary'][$id] = array(
- '#type' => 'select',
- '#options' => array('<' . t('use default style') . '>') + openlayers_ui_get_style_options(),
- '#default_value' => !empty($defaults['layer_styles_temporary'][$id]) ?
- $defaults['layer_styles_temporary'][$id] : '',
- );
-
- // Weight of layer. This will affect how the layer shows up in the
- // switcher and is rendered.
- $form['layerstyles']['layer_weight'][$id] = array(
- '#type' => 'weight',
- '#default_value' => !empty($defaults['layer_weight'][$id]) ? $defaults['layer_weight'][$id] : 0,
- '#attributes' => array(
- 'class' => array('layer-weight')
- )
- );
- }
-
- // Checkbox options for overlay layers.
- $form['layerstyles']['layers']['overlays'] = array(
- '#type' => 'checkboxes',
- '#options' => $overlay_options,
- '#default_value' => !empty($defaults['layers']) ?
- array_intersect_key($defaults['layers'], $overlay_options) : array(),
- );
- $form['layerstyles']['layer_activated'] = array(
- '#type' => 'checkboxes',
- '#options' => $overlay_options,
- '#default_value' => !empty($defaults['layer_activated']) ?
- array_intersect_key($defaults['layer_activated'], $overlay_options) : array(),
- );
- $form['layerstyles']['layer_switcher'] = array(
- '#type' => 'checkboxes',
- '#options' => $overlay_options,
- '#default_value' => !empty($defaults['layer_switcher']) ?
- array_intersect_key($defaults['layer_switcher'], $overlay_options) : array(),
- );
- }
-
- // Data overlay help.
- $form['layerstyles']['help_data_overlays'] = array(
- '#type' => 'item',
- '#description' => t('Add Data Overlays: You can add regular
- overlays, like GeoJSON or KML,
- or you can utilize Views to create data overlays.
- To create a Views-based overlay, you must choose the OpenLayers
- Data Overlay Display Type, and then explicitly set the the
- same for the Format. The options in the Format
- Settings will only use fields you have added. To learn more, take
- a look at the online documentation on Drupal.org.',
- array(
- '!views_url' => url('admin/structure/views'),
- '!geojson' => url('admin/structure/openlayers/layers/add/openlayers_layer_type_geojson'),
- '!kml' => url('admin/structure/openlayers/layers/add/openlayers_layer_type_kml'),
- '!online_url' => url('http://drupal.org/node/595872'),
- )
- ),
- );
-
-
- // Styles
- $form['layerstyles']['styles'] = array(
- '#type' => 'fieldset',
- '#title' => t('Default Styles'),
- '#description' => t('Define default style designations for layers when there
- are no overrides.'),
- '#tree' => TRUE,
- );
- $form['layerstyles']['styles']['default'] = array(
- '#type' => 'select',
- '#title' => t('Default style'),
- '#description' => t('Default style for features in a vector.'),
- '#options' => openlayers_ui_get_style_options(),
- '#default_value' => !empty($defaults['styles']['default']) ?
- $defaults['styles']['default'] : NULL,
- );
- $form['layerstyles']['styles']['select'] = array(
- '#type' => 'select',
- '#title' => t('Select style'),
- '#description' => t('Style for features in a vector that are selected.'),
- '#options' => openlayers_ui_get_style_options(),
- '#default_value' => !empty($defaults['styles']['select']) ?
- $defaults['styles']['select'] : NULL,
- );
- $form['layerstyles']['styles']['temporary'] = array(
- '#type' => 'select',
- '#title' => t('Temporary Style'),
- '#description' => t('Default temporary style for any features in a vector.
- This can be used with the "Hover behavior" or things like Tooltips.'),
- '#options' => openlayers_ui_get_style_options(),
- '#default_value' => !empty($defaults['styles']['temporary']) ?
- $defaults['styles']['temporary'] : NULL,
- );
-
- // Behaviors
- $form['behaviors'] = array(
- '#title' => t('Behaviors'),
- '#description' => t('Configure interactive map behaviors. Behaviors are general interactions for the map, they can be anything from popups or keyboard handling. Enable the ones you want and their respective options. Note that some behaviors do not work with each other or one may encompass another.'),
- '#theme' => 'openlayers_ui_maps_form_behaviors',
- '#tree' => TRUE,
- '#type' => 'fieldset',
- '#group' => 'ui'
- );
- $form['behaviors'] = $form['behaviors'] + openlayers_ui_get_behavior_options('map', $defaults);
-
- // Displays
- $form['displays'] = array(
- '#title' => t('Displays'),
- '#description' => t('Learn how to display your maps.'),
- '#tree' => TRUE,
- '#type' => 'fieldset',
- '#group' => 'ui'
- );
- if (module_exists('openlayers_views')) {
- $form['displays']['views'] = array(
- '#type' => 'item',
- '#title' => t('Views'),
- '#description' => t('Utilize the Views module to
- display your map as page or in a block. By creating a new Views Display of
- type Page or Block you can then choose
- the OpenLayers Map Format. For more details, check out
- the online documentation on Drupal.org.',
- array(
- '!views_url' => url('admin/structure/views'),
- '!online_url' => url('http://drupal.org/node/595872')
- )
- ),
- '#suffix' => theme('image', array('path' =>
- 'https://img.skitch.com/20111106-c6ukwxgpgykxx8m41yrn8qew4n.png')),
- );
- $form['displays']['api'] = array(
- '#type' => 'item',
- '#title' => t('API'),
- '#description' => t('You can always utilize the API to directly display
- your maps. The key function to use is openlayers_render_map().
- Most of the code is well documented. To learn how to extend the module,
- take a look at the online documentation on
- Drupal.org as well as the files in the docs/ folder.',
- array('!online_url' => url('http://drupal.org/node/595872'))
- ),
- );
- }
-
- $form['buttons']['submit']['#weight'] = 0;
- $form['buttons']['delete']['#weight'] = 20;
-
- $form['buttons']['saveandedit'] = array(
- '#type' => 'submit',
- '#value' => t('Save and edit'),
- '#weight' => 10
- );
-
- // Add preview button.
- $form['buttons']['preview'] = array(
- '#type' => 'button',
- '#value' => t('Preview'),
- '#weight' => 30
- );
- }
-
- /**
- * Prepare the tag values before they are added to the database.
- */
- function edit_form_submit(&$form, &$form_state) {
- module_load_include('inc', 'openlayers_ui', 'includes/openlayers_ui.maps');
- $form_state['values']['data'] = openlayers_ui_maps_form_process($form_state['values']);
- parent::edit_form_submit($form, $form_state);
- }
-
- /**
- * Implements ctools_export_ui::edit_execute_form().
- *
- * This is hacky, but since CTools Export UI uses drupal_goto() we have to
- * effectively change the plugin to modify the redirect path dynamically.
- */
- function edit_execute_form(&$form_state) {
- $output = parent::edit_execute_form($form_state);
- if (!empty($form_state['executed'])) {
- $clicked = $form_state['clicked_button']['#value'];
- if (t('Save and edit') == $clicked) {
- // We always want to redirect back to this page when adding an item,
- // but we want to preserve the destination so we can be redirected back
- // to where we came from after clicking "Save".
- $options = array();
- if (!empty($_GET['destination'])) {
- $options['query']['destination'] = $_GET['destination'];
- unset($_GET['destination']);
- }
-
- // Sets redirect path and options.
- $op = $form_state['op'];
- $name = $form_state['values']['name'];
- $path = ('add' != $op) ? current_path() : 'admin/structure/openlayers/maps/list/' . $name . '/edit';
- $this->plugin['redirect'][$op] = array($path, $options);
- }
- }
- return $output;
- }
-
- /**
- * Build a row based on the item.
- *
- * By default all of the rows are placed into a table by the render
- * method, so this is building up a row suitable for theme('table').
- * This doesn't have to be true if you override both.
- */
- function list_build_row($item, &$form_state, $operations) {
- // Set up sorting
- $name = $item->{$this->plugin['export']['key']};
- $schema = ctools_export_get_schema($this->plugin['schema']);
-
- // Note: $item->{$schema['export']['export type string']} should have already been set up by export.inc so
- // we can use it safely.
- switch ($form_state['values']['order']) {
- case 'disabled':
- $this->sorts[$name] = empty($item->disabled) . $name;
- break;
- case 'title':
- $this->sorts[$name] = $item->{$this->plugin['export']['admin_title']};
- break;
- case 'name':
- $this->sorts[$name] = $name;
- break;
- case 'storage':
- $this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
- break;
- }
-
- $this->rows[$name]['data'] = array();
- $this->rows[$name]['class'] = !empty($item->disabled) ? array('ctools-export-ui-disabled') : array('ctools-export-ui-enabled');
-
- // If we have an admin title, make it the first row.
- if (!empty($this->plugin['export']['admin_title'])) {
- $this->rows[$name]['data'][] = array('data' => check_plain($item->{$this->plugin['export']['admin_title']}), 'class' => array('ctools-export-ui-title'));
- }
-
- $layers = openlayers_layers_load();
- $layers_names = array();
- foreach ($item->data['layers'] as $layer) {
- if (isset($layers[$layer])) {
- $layers_names[] = empty($layers[$layer]->title) ? $layer : filter_xss_admin($layers[$layer]->title);
- }
- }
-
- sort($layers_names);
- $layers_names = implode(',', $layers_names);
-
- $this->rows[$name]['data'][] = array('data' => $item->title, 'class' => array('ctools-export-ui-title'));
- $this->rows[$name]['data'][] = array('data' => $layers_names, 'class' => array('ctools-export-ui-layers'));
- $this->rows[$name]['data'][] = array('data' => $item->description, 'class' => array('ctools-export-ui-description'));
- $this->rows[$name]['data'][] = array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => array('ctools-export-ui-storage'));
-
- $ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
-
- $this->rows[$name]['data'][] = array('data' => $ops, 'class' => array('ctools-export-ui-operations'));
-
- // Add an automatic mouseover of the description if one exists.
- if (!empty($this->plugin['export']['admin_description'])) {
- $this->rows[$name]['title'] = $item->{$this->plugin['export']['admin_description']};
- }
- }
-
- /**
- * Provide the table header.
- *
- * If you've added columns via list_build_row() but are still using a
- * table, override this method to set up the table header.
- */
- function list_table_header() {
- $header = array();
- if (!empty($this->plugin['export']['admin_title'])) {
- $header[] = array('data' => t('Name'), 'class' => array('ctools-export-ui-name'));
- }
-
- $header[] = array('data' => t('Title'), 'class' => array('ctools-export-ui-title'));
- $header[] = array('data' => t('Layers'), 'class' => array('ctools-export-ui-layers'));
- $header[] = array('data' => t('Description'), 'class' => array('ctools-export-ui-description'));
- $header[] = array('data' => t('Storage'), 'class' => array('ctools-export-ui-storage'));
- $header[] = array('data' => t('Operations'), 'class' => array('ctools-export-ui-operations'));
-
- return $header;
- }
-
/**
* hook_menu() entry point.
*
@@ -705,41 +11,8 @@ class openlayers_maps_ui extends ctools_export_ui {
function hook_menu(&$items) {
parent::hook_menu($items);
$items['admin/structure/openlayers/maps']['type'] = MENU_LOCAL_TASK;
- $items['admin/structure/openlayers/maps/list/%ctools_export_ui/clone']['context'] = MENU_CONTEXT_INLINE;
- $items['admin/structure/openlayers/maps/list/%ctools_export_ui/edit']['context'] = MENU_CONTEXT_INLINE;
- $items['admin/structure/openlayers/maps/list/%ctools_export_ui/export']['context'] = MENU_CONTEXT_INLINE;
- $items['admin/structure/openlayers/maps/list/%ctools_export_ui/revert']['context'] = MENU_CONTEXT_INLINE;
- $items['admin/structure/openlayers/maps/list/%ctools_export_ui/clone']['type'] = MENU_LOCAL_TASK;
- $items['admin/structure/openlayers/maps/list/%ctools_export_ui/edit']['type'] = MENU_LOCAL_TASK;
- $items['admin/structure/openlayers/maps/list/%ctools_export_ui/export']['type'] = MENU_LOCAL_TASK;
- $items['admin/structure/openlayers/maps/list/%ctools_export_ui/revert']['type'] = MENU_LOCAL_TASK;
- }
-
- /**
- * Provide a list of sort options.
- *
- * Override this if you wish to provide more or change how these work.
- * The actual handling of the sorting will happen in build_row().
- */
- function list_sort_options() {
- if (!empty($this->plugin['export']['admin_title'])) {
- $options = array(
- 'disabled' => t('Enabled, title'),
- $this->plugin['export']['admin_title'] => t('Title'),
- );
- }
- else {
- $options = array(
- 'disabled' => t('Enabled, title'),
- );
- }
-
- $options += array(
- 'storage' => t('Storage'),
- );
-
- return $options;
+ $items['admin/structure/openlayers/maps']['context'] = MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE;
+ $items['admin/structure/openlayers/maps']['weight'] = -10;
}
-
}
diff --git a/modules/openlayers_ui/plugins/export_ui/openlayers_projections.inc b/modules/openlayers_ui/plugins/export_ui/openlayers_projections.inc
deleted file mode 100644
index 4166c07e1902f46dd339bd9a1e52a1f1f3017914..0000000000000000000000000000000000000000
--- a/modules/openlayers_ui/plugins/export_ui/openlayers_projections.inc
+++ /dev/null
@@ -1,47 +0,0 @@
- 'openlayers_projections',
- 'access' => 'administer openlayers',
- 'menu' => array(
- 'menu prefix' => 'admin/structure/openlayers',
- 'menu item' => 'projections',
- // TODO Translation?
- 'menu title' => 'Projections',
- // TODO Translation?
- 'menu description' => 'Administer OpenLayers projections.',
- ),
-
- 'handler' => array(
- 'class' => 'openlayers_projections_ui',
- ),
-
- 'export' => array(
- 'key' => 'identifier'
- ),
-
- // TODO What is this good for?
- 'title singular' => t('projections'),
- 'title plural' => t('projections'),
- 'title singular proper' => t('OpenLayers projection'),
- 'title plural proper' => t('OpenLayers projections'),
-
- 'strings' => array(
- 'confirmation' => array(
- 'add' => array(
- 'success' => t('Projection saved.'),
- ),
- 'delete' => array(
- 'success' => t('Projection was deleted.'),
- )
- )
- ),
- );
-}
diff --git a/modules/openlayers_ui/plugins/export_ui/openlayers_projections_ui.class.php b/modules/openlayers_ui/plugins/export_ui/openlayers_projections_ui.class.php
deleted file mode 100644
index e9a1e1e47945ffac5bbb9ffe971c46591e4b4d40..0000000000000000000000000000000000000000
--- a/modules/openlayers_ui/plugins/export_ui/openlayers_projections_ui.class.php
+++ /dev/null
@@ -1,88 +0,0 @@
- 'projectionauthority',
- '#type' => 'textfield',
- '#weight' => 1,
- '#title' => t('Projection Authority'),
- '#default_value' => $projectionData->authority,
- '#description' => t('Authority defining the projection'),
- '#required' => TRUE
- );
- $form['info']['code'] = array(
- '#id' => 'projectioncode',
- '#type' => 'textfield',
- '#weight' => 2,
- '#title' => t('Projection Code'),
- '#default_value' => $projectionData->code,
- '#description' => t('Identifier (unique within authority)'),
- '#required' => TRUE
- );
- $form['info']['definition'] = array(
- '#id' => 'projectiondefinition',
- '#type' => 'textarea',
- '#weight' => 3,
- '#title' => t('proj4 Definition'),
- '#default_value' => $projectionData->definition,
- '#description' => t('Description that can be used to handle rough conversions between coordinate systems. A correct definition is essential for coordinate displays or scale bars to work properly.'),
- '#required' => TRUE
- );
- $form['info']['projectedextentleft'] = array(
- '#id' => 'projectionprojectedextentleft',
- '#type' => 'textfield',
- '#weight' => 4,
- '#title' => t('Left Extent Boundary'),
- '#default_value' => $projectionData->projectedextentleft,
- '#description' => t("Leftmost value in this projection's coordinates"),
- '#required' => TRUE
- );
- $form['info']['projectedextentbottom'] = array(
- '#id' => 'projectionprojectedextentbottom',
- '#type' => 'textfield',
- '#weight' => 5,
- '#title' => t('Bottom Extent Boundary'),
- '#default_value' => $projectionData->projectedextentbottom,
- '#description' => t("Bottommost value in this projection's coordinates"),
- '#required' => TRUE
- );
- $form['info']['projectedextentright'] = array(
- '#id' => 'projectionprojectedextentright',
- '#type' => 'textfield',
- '#weight' => 6,
- '#title' => t('Right Extent Boundary'),
- '#default_value' => $projectionData->projectedextentright,
- '#description' => t("Rightmost value in this projection's coordinates"),
- '#required' => TRUE
- );
- $form['info']['projectedextenttop'] = array(
- '#id' => 'projectionprojectedextenttop',
- '#type' => 'textfield',
- '#weight' => 7,
- '#title' => t('Top Extent Boundary'),
- '#default_value' => $projectionData->projectedextenttop,
- '#description' => t("Topmost value in this projection's coordinates"),
- '#required' => TRUE
- );
- }
-
- function edit_form_submit(&$form, &$form_state) {
- // Fill identifier with data from required fields. No empty string must result as ctools can't handle it.
- $form_state['values']['identifier'] = $form_state['values']['authority'].':'.$form_state['values']['code'];
-
- parent::edit_form_submit($form, $form_state);
- }
-
- function hook_menu(&$items) {
- parent::hook_menu($items);
- $items['admin/structure/openlayers/projections']['type'] = MENU_LOCAL_TASK;
- }
-}
\ No newline at end of file
diff --git a/modules/openlayers_ui/plugins/export_ui/openlayers_sources.inc b/modules/openlayers_ui/plugins/export_ui/openlayers_sources.inc
new file mode 100644
index 0000000000000000000000000000000000000000..57e408558722be500e8a09d433546f524efd2a57
--- /dev/null
+++ b/modules/openlayers_ui/plugins/export_ui/openlayers_sources.inc
@@ -0,0 +1,118 @@
+ 'openlayers_sources',
+ 'access' => 'administer openlayers',
+ 'menu' => array(
+ 'menu prefix' => 'admin/structure/openlayers',
+ 'menu item' => 'sources',
+ 'menu title' => 'Sources',
+ 'menu description' => 'Administer OpenLayers sources.',
+ ),
+
+ 'handler' => array(
+ 'class' => 'openlayers_sources_ui',
+ 'parent' => 'ctools_export_ui'
+ ),
+
+ 'export' => array(
+ 'admin_title' => 'name',
+ 'admin_description' => 'description',
+ ),
+
+ 'use wizard' => TRUE,
+ 'form info' => array(
+ 'order' => array(
+ 'start' => t('Administrative settings'),
+ 'second' => t('Source type'),
+ 'third' => t('Source type options'),
+ ),
+ 'forms' => array(
+ 'start' => array(
+ 'form id' => 'openlayers_source_form_start'
+ ),
+ 'second' => array(
+ 'form id' => 'openlayers_source_form_second'
+ ),
+ 'third' => array(
+ 'form id' => 'openlayers_source_form_third'
+ ),
+ )
+ ),
+
+
+ 'title singular' => t('source'),
+ 'title plural' => t('sources'),
+ 'title singular proper' => t('OpenLayers source preset'),
+ 'title plural proper' => t('OpenLayers sources presets'),
+
+ 'strings' => array(
+ 'confirmation' => array(
+ 'add' => array(
+ 'success' => t('Source saved.'),
+ ),
+ 'delete' => array(
+ 'success' => t('Source was deleted.'),
+ )
+ )
+ ),
+ );
+}
+
+function openlayers_source_form_start($form, &$form_state) {
+ $class = new ctools_export_ui();
+ $class->init($form_state['plugin']);
+ $class->edit_form($form, $form_state);
+ return $form;
+}
+
+function openlayers_source_form_start_validate($form, &$form_state) {
+ $class = new ctools_export_ui();
+ $class->init($form_state['plugin']);
+ $class->edit_form_validate($form, $form_state);
+}
+
+function openlayers_source_form_start_submit($form, &$form_state) {
+ $class = new ctools_export_ui();
+ $class->init($form_state['plugin']);
+ $class->edit_form_submit($form, $form_state);
+}
+
+function openlayers_source_form_second($form, &$form_state) {
+ $sources = ctools_get_plugins('openlayers', 'source');
+ $options = array('' => t(''));
+ foreach ($sources as $class => $plugin) {
+ $options[$class] = $class;
+ }
+
+ $form['class'] = array(
+ '#type' => 'select',
+ '#title' => t('Source Type'),
+ '#default_value' => isset($form_state['item']->class) ? $form_state['item']->class: '',
+ '#description' => t('Select the type of source.'),
+ '#options' => $options,
+ '#required' => TRUE
+ );
+
+ return $form;
+}
+
+function openlayers_source_form_second_submit($form, &$form_state) {
+ $form_state['item']->class = $form_state['values']['class'];
+}
+
+
+function openlayers_source_form_third($form, &$form_state) {
+ $source = openlayer_object_factory_create('source', $form_state['item']->class, $form_state['item']);
+ $form['options'] = $source->options_form();
+ $form['options']['#tree'] = TRUE;
+
+ return $form;
+}
+function openlayers_source_form_third_submit($form, &$form_state) {
+ $form_state['item']->options = array_replace_recursive((array) $form_state['item']->options, $form_state['values']['options']);
+}
diff --git a/modules/openlayers_ui/plugins/export_ui/openlayers_sources_ui.class.php b/modules/openlayers_ui/plugins/export_ui/openlayers_sources_ui.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..27b733bf3df2f8b1f76e8ce8d043cb2a0c9fbed2
--- /dev/null
+++ b/modules/openlayers_ui/plugins/export_ui/openlayers_sources_ui.class.php
@@ -0,0 +1,92 @@
+plugin['export']['admin_title'])) {
+ $header[] = array('data' => t('Name'), 'class' => array('ctools-export-ui-title'));
+ }
+
+ $header[] = array('data' => t('Machine name'), 'class' => array('ctools-export-ui-name'));
+ $header[] = array('data' => t('Class'), 'class' => array('ctools-export-ui-class'));
+ $header[] = array('data' => t('Storage'), 'class' => array('ctools-export-ui-storage'));
+ $header[] = array('data' => t('Operations'), 'class' => array('ctools-export-ui-operations'));
+
+ return $header;
+ }
+
+ /**
+ * Build a row based on the item.
+ *
+ * By default all of the rows are placed into a table by the render
+ * method, so this is building up a row suitable for theme('table').
+ * This doesn't have to be true if you override both.
+ */
+ function list_build_row($item, &$form_state, $operations) {
+ // Set up sorting
+ $name = $item->{$this->plugin['export']['key']};
+ $schema = ctools_export_get_schema($this->plugin['schema']);
+
+ // Note: $item->{$schema['export']['export type string']} should have already been set up by export.inc so
+ // we can use it safely.
+ switch ($form_state['values']['order']) {
+ case 'disabled':
+ $this->sorts[$name] = empty($item->disabled) . $name;
+ break;
+ case 'title':
+ $this->sorts[$name] = $item->{$this->plugin['export']['admin_title']};
+ break;
+ case 'name':
+ $this->sorts[$name] = $name;
+ break;
+ case 'class':
+ $this->sorts[$name] = $name;
+ break;
+ case 'storage':
+ $this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
+ break;
+ }
+
+ $this->rows[$name]['data'] = array();
+ $this->rows[$name]['class'] = !empty($item->disabled) ? array('ctools-export-ui-disabled') : array('ctools-export-ui-enabled');
+
+ // If we have an admin title, make it the first row.
+ if (!empty($this->plugin['export']['admin_title'])) {
+ $this->rows[$name]['data'][] = array('data' => check_plain($item->{$this->plugin['export']['admin_title']}), 'class' => array('ctools-export-ui-title'));
+ }
+ $this->rows[$name]['data'][] = array('data' => check_plain($name), 'class' => array('ctools-export-ui-name'));
+ $this->rows[$name]['data'][] = array('data' => check_plain($item->class), 'class' => array('ctools-export-ui-class'));
+ $this->rows[$name]['data'][] = array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => array('ctools-export-ui-storage'));
+
+ $ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
+
+ $this->rows[$name]['data'][] = array('data' => $ops, 'class' => array('ctools-export-ui-operations'));
+
+ // Add an automatic mouseover of the description if one exists.
+ if (!empty($this->plugin['export']['admin_description'])) {
+ $this->rows[$name]['title'] = $item->{$this->plugin['export']['admin_description']};
+ }
+ }
+
+
+
+}
diff --git a/modules/openlayers_ui/plugins/export_ui/openlayers_styles.inc b/modules/openlayers_ui/plugins/export_ui/openlayers_styles.inc
deleted file mode 100644
index 6fdfc16445155f0f9d115865fbc2a2eca82ff1ce..0000000000000000000000000000000000000000
--- a/modules/openlayers_ui/plugins/export_ui/openlayers_styles.inc
+++ /dev/null
@@ -1,42 +0,0 @@
- 'openlayers_styles',
- 'access' => 'administer openlayers',
- 'menu' => array(
- 'menu prefix' => 'admin/structure/openlayers',
- 'menu item' => 'styles',
- 'menu title' => 'Styles',
- 'menu description' => 'Administer OpenLayers Styles presets.',
- ),
-
- 'handler' => array(
- 'class' => 'openlayers_styles_ui',
- ),
-
- 'export' => array(
- 'admin_title' => 'name',
- 'admin_description' => 'description',
- ),
-
- 'title singular' => t('style'),
- 'title plural' => t('styles'),
- 'title singular proper' => t('OpenLayers Style preset'),
- 'title plural proper' => t('OpenLayers Styles presets'),
-
- 'strings' => array(
- 'confirmation' => array(
- 'add' => array(
- 'success' => t('Style saved.'),
- ),
- 'delete' => array(
- 'success' => t('Style was deleted.'),
- )
- )
- ),
- );
-}
diff --git a/modules/openlayers_ui/plugins/export_ui/openlayers_styles_ui.class.php b/modules/openlayers_ui/plugins/export_ui/openlayers_styles_ui.class.php
deleted file mode 100644
index 99f41530d35cf65dc24774d10940c5a0f37dcc19..0000000000000000000000000000000000000000
--- a/modules/openlayers_ui/plugins/export_ui/openlayers_styles_ui.class.php
+++ /dev/null
@@ -1,472 +0,0 @@
-name)) {
- $style = NULL;
- }
-
- module_load_include('inc', 'openlayers_ui', 'includes/openlayers_ui.styles');
-
- $properties = array(
- 'externalGraphic' => array(
- 'default' => '',
- 'desc' => t('The URL of an icon for points in a layer. The following options are available:
-
Full path, such as http://example.com/icon.png
-
Relative Drupal path, such as sites/all/modules/example/icon.png
-
Absolute path, such as /icon.png (though this is not suggested for maintainability reasons)
'),
- 'maxlength' => 2083
- ),
- 'backgroundGraphic' => array(
- 'default' => '',
- 'desc' => t('Url to a graphic to be used as the background under an externalGraphic.'),
- 'maxlength' => 2083
- ),
- 'backgroundGraphicZIndex' => array(
- 'default' => '',
- 'desc' => t('The integer z-index value to use in rendering the background graphic.'),
- ),
- 'backgroundXOffset' => array(
- 'default' => '',
- 'desc' => t('The x offset (in pixels) for the background graphic.'),
- ),
- 'backgroundYOffset' => array(
- 'default' => '',
- 'desc' => t('The y offset (in pixels) for the background graphic.'),
- ),
- 'backgroundHeight' => array(
- 'default' => '',
- 'desc' => t('The height of the background graphic. If not provided, the graphicHeight will be used.'),
- ),
- 'backgroundWidth' => array(
- 'default' => '',
- 'desc' => t('The width of the background width. If not provided, the graphicWidth will be used.'),
- ),
- 'pointRadius' => array(
- 'default' => 6,
- 'desc' => t('The radius of a vector point or the size of
- an icon. Note that, when using icons, this value should be half the
- width of the icon image.'),
- ),
- 'fillColor' => array(
- 'default' => '#EE9900',
- 'desc' => t('This is the color used for
- filling in Polygons. It is also used in the center of marks for
- points: the interior color of circles or other shapes. It is
- not used if an externalGraphic is applied to a point. This should be
- a hexadecimal value like #FFFFFF.'),
- ),
- 'fillOpacity' => array(
- 'default' => 1,
- 'desc' => t('This is the opacity used for filling in Polygons.
- It is also used in the center of marks for points: the interior
- color of circles or other shapes. It is not used if an
- externalGraphic is applied to a point. This should be a value
- between 0 and 1.'),
- ),
- 'strokeColor' => array(
- 'default' => '#EE9900',
- 'desc' => t('This is color of the line on features. On
- polygons and point marks, it is used as an outline to the feature.
- On lines, this is the representation of the feature. This should be
- a hexadecimal value like #FFFFFF.'),
- ),
- 'strokeWidth' => array(
- 'default' => 1,
- 'desc' => t('This is width of the line on features. On
- polygons and point marks, it is used as an outline to
- the feature. On lines, this is the representation of the
- feature. This is a value in pixels.'),
- ),
- 'strokeOpacity' => array(
- 'default' => 1,
- 'desc' => t('This is opacity of the line on features.
- On polygons and point marks, it is used as an outline to the
- feature. On lines, this is the representation of the feature.
- This should be a value between 0 and 1.'),
- ),
- 'strokeLinecap' => array(
- 'default' => 'round',
- 'desc' => t('Options are butt, round, square. This property
- is similar to the SVG stroke-linecap property. It determines
- what the end of lines should look like. See the SVG link for
- image examples.'),
- 'options' => array(
- 'butt' => t('Butt'),
- 'round' => t('Round'),
- 'square' => t('Square'),
- ),
- ),
- 'strokeDashstyle' => array(
- 'default' => 'solid',
- 'desc' => t('Options are dot, dash, dashdot, longdash, longdashdot, solid.'),
- 'options' => array(
- 'dot' => t('Dot'),
- 'dash' => t('Dash'),
- 'dashdot' => t('Dash-dot'),
- 'longdash' => t('Long-dash'),
- 'longdashdot' => t('Long-dash-dot'),
- 'solid' => t('Solid'),
- ),
- ),
- 'cursor' => array(
- 'default' => '',
- 'desc' => t('Cursor used when mouse is over the feature. Default
- is an empty string, which inherits from parent elements. See
- CSS cursor styles.', array(
- '!url' => 'http://www.w3schools.com/css/pr_class_cursor.asp',
- )),
- ),
- 'graphicWidth' => array(
- 'default' => '',
- 'desc' => t('This properties define the width of an externalGraphic.
- This is an alternative to the pointRadius symbolizer property
- to be used when your graphic has different sizes in the X and
- Y direction. This should be in pixels.'),
- ),
- 'graphicHeight' => array(
- 'default' => '',
- 'desc' => t('This properties define the height of an externalGraphic.
- This is an alternative to the pointRadius symbolizer property
- to be used when your graphic has different sizes in the X and
- Y direction. This should be in pixels.'),
- ),
- 'graphicOpacity' => array(
- 'default' => '1',
- 'desc' => t('Opacity of an external graphic. This should be a
- value between 0 and 1. Graphics that are already semitransparent,
- like alpha PNGs, should have this set to 1, or rendering problems in
- Internet Explorer will ensue.'),
- ),
- 'graphicXOffset' => array(
- 'default' => '',
- 'desc' => t('Where the X value of the "center" of an
- externalGraphic should be. This should be in pixels.'),
- ),
- 'graphicYOffset' => array(
- 'default' => '',
- 'desc' => t('Where the Y value of the "center" of an
- externalGraphic should be. This should be in pixels.'),
- ),
- 'graphicName' => array(
- 'default' => '',
- 'desc' => t('Name of a type of symbol to be used
- for a point mark.'),
- ),
- 'graphicZIndex' => array(
- 'default' => '',
- 'desc' => t('The integer z-index value to use in rendering.'),
- ),
- 'rotation' => array(
- 'default' => '',
- 'desc' => t('The rotation angle in degrees clockwise for
- a point symbolizer.'),
- ),
- 'display' => array(
- 'default' => '',
- 'desc' => t('Can be set to "none" to hide features
- from rendering.'),
- 'options' => array(
- '' => t('On'),
- 'none' => t('None (off)'),
- ),
- ),
- 'title' => array(
- 'default' => '',
- 'desc' => t('Tooltip when hovering over a feature. Not supported by the canvas renderer.')
- ),
- 'label' => array(
- 'default' => '',
- 'desc' => t('The text for an optional label. For browsers that use the canvas renderer, this requires either fillText or mozDrawText to be available. Typically used with ${attribute} syntax.')
- ),
- 'labelAlign' => array(
- 'default' => 'cm',
- 'desc' => t('Label alignment.'),
- 'options' => array(
- 'cm' => t('Center, middle'),
- 'ct' => t('Center, top'),
- 'cb' => t('Center, bottom'),
- 'lm' => t('Left, middle'),
- 'lt' => t('Left, top'),
- 'lb' => t('Left, bottom'),
- 'rm' => t('Right, middle'),
- 'rt' => t('Right, top'),
- 'rb' => t('Right, bottom'),
- ),
- ),
- 'labelXOffset' => array(
- 'default' => '',
- 'desc' => t('Label X offset. Positive numbers move label right.'),
- ),
- 'labelYOffset' => array(
- 'default' => '',
- 'desc' => t('Label Y offset. Positive numbers move label up.'),
- ),
- 'fontColor' => array(
- 'default' => '',
- 'desc' => t('The font color for the label, to be provided like CSS.'),
- ),
- 'fontOpacity' => array(
- 'default' => '',
- 'desc' => t('Opacity (0-1) for the label'),
- ),
- 'fontFamily' => array(
- 'default' => '',
- 'desc' => t('The font family for the label, to be provided like in CSS.'),
- ),
- 'fontSize' => array(
- 'default' => '',
- 'desc' => t('The font size for the label, to be provided like in CSS.'),
- ),
- 'fontStyle' => array(
- 'default' => '',
- 'desc' => t('The font style for the label, to be provided like in CSS.'),
- ),
- 'fontWeight' => array(
- 'default' => '',
- 'desc' => t('The font weight for the label, to be provided like in CSS.'),
- ),
- );
-
- $form['info']['title'] = array(
- '#id' => 'styletitle',
- '#type' => 'textfield',
- '#weight' => -1,
- '#title' => t('Style title'),
- '#default_value' => isset($style->title) ? $style->title : '',
- '#description' => t('The friendly name of your style, which will appear in the administration interface as well on the map interface.'),
- );
- $form['info']['name']['#machine_name']['source'] = array('info', 'title');
-
- $fields = array();
- $views = views_get_all_views();
- foreach($views as $vid => $view) {
- if (isset($view->display)) {
- foreach ($view->display as $vdid => $display) {
- if (isset($display->display_options)) {
- if (isset($display->display_options['style_plugin'])) {
- if ($display->display_options['style_plugin'] == 'openlayers_data') {
- foreach ($display->display_options['fields'] as $fid => $fdata) {
- $fields[] = t('@fid(from view @viewname and display @displayname.)', array('@fid' => '${' . $fid . '}', '@viewname' => $view->name, '@displayname' => $vdid));
- }
- }
- }
- }
- }
- }
- }
-
- $form['available_fields'] = array(
- '#type' => 'fieldset',
- '#tree' => TRUE,
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#title' => t('Available fields to use as token'),
- '#description' => t('Notice: Since OpenLayers beta 9, the rendering of
- . the fields has changed, it\'s not using the raw value of the field,
- . but the full row rendering. You must disable all the HTML element by
- . selecting None in the Style setting fieldset of the field in Views or
- . you might get a mix of HTML with the raw value of the field.'),
- );
-
- if ($fields) {
- $form['available_fields']['fields'] = array(
- '#markup' => theme('item_list', array('items' => $fields)),
- );
- }
- else {
- $form['available_fields']['fields'] = array(
- '#prefix' => '
',
- '#markup' => t('There are no available fields to use as tokens.'),
- '#suffix' => '
';
- }
-
- function render() {
- return $this->view->style_plugin->render($this->view->result);
- }
-
- function option_definition() {
- $options = parent::option_definition();
- $options['title']['translatable'] = 0;
- $options['displays'] = array('default' => array());
- $options['style_plugin']['default'] = 'openlayers_data';
- $options['row_plugin']['default'] = 'fields';
- $options['defaults']['default']['row_plugin'] = FALSE;
- return $options;
- }
-
- function options_summary(&$categories, &$options) {
- parent::options_summary($categories, $options);
- unset($options['header']);
- unset($options['footer']);
- unset($options['empty']);
- unset($options['exposed_block']);
- unset($options['analyze-theme']);
- }
-}
diff --git a/modules/openlayers_views/views/openlayers_views_style_data.inc b/modules/openlayers_views/views/openlayers_views_style_data.inc
deleted file mode 100644
index f85e1fe83b80b05c238bc4549ce1b447e9ecc330..0000000000000000000000000000000000000000
--- a/modules/openlayers_views/views/openlayers_views_style_data.inc
+++ /dev/null
@@ -1,467 +0,0 @@
-render
- */
- function render() {
- $grouped_results = $this->render_grouping($this->view->result, $this->options['grouping']);
- $data = $this->map_features($grouped_results);
-
- // If we are not in preview, just return the data
- if (empty($this->view->live_preview)) {
- return $data;
- }
- else {
- // If we are in preview mode, dump out some useful information about this data layer
- $output = "You can use the following parameters in your styles as dynamic values";
- $output .= "\n------------\n";
- if (!empty($data)) {
- $keys = array_keys($data);
- foreach ($data[$keys[0]]['attributes'] as $key => $value) {
- $output .= '${' . $key . "}\n";
- }
- }
- $output .= "\n------------\n";
-
- $output .= t('The following is a dump of the data that is rendered from this display. It is used for debugging purposes only.') . '
- ' . var_export($data, TRUE);
-
- return $output;
- }
- }
-
- /**
- * Set default options
- *
- * Overrides views_plugin_style->option_definition
- */
- function option_definition() {
- $options = parent::option_definition();
- $options['data_source'] = array('default' => 'openlayers_wkt');
- return $options;
- }
-
- /**
- * Options form
- *
- * Overrides views_plugin_style->options_form
- */
- function options_form(&$form, &$form_state) {
- parent::options_form($form, $form_state);
-
- // Get list of fields in this view & flag available geodata fields
- $handlers = $this->display->handler->get_handlers('field');
-
- // Check for any fields, as the view needs them
- if (empty($handlers)) {
- $form['error_markup'] = array(
- '#value' => t('You need to enable at least one field before you can '
- . 'configure your field settings'),
- '#prefix' => '
',
- '#suffix' => '
',
- );
- return;
- }
-
- $fields = array();
- foreach ($handlers as $field_id => $handler) {
- $fields[$field_id] = $handler->ui_name() . ' (' . $field_id .')';
- }
-
- $form['data_source'] = array(
- '#type' => 'fieldset',
- '#tree' => TRUE,
- '#title' => t('Data Source'),
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- );
- $form['data_source']['value'] = array(
- '#type' => 'select',
- '#title' => t('Map Data Sources'),
- '#description' => t('Choose which sources of data that the map will '
- . 'provide features for.'),
- '#options' => array(
- 'other_latlon' => t('Lat/Lon Pair'),
- 'other_boundingbox' => t('Bounding Box'),
- 'wkt' => t('WKT')
- ),
- '#default_value' => $this->options['data_source']['value'],
- );
- if (count($fields > 0)) {
- $form['data_source']['other_lat'] = array(
- '#type' => 'select',
- '#title' => t('Latitude Field'),
- '#description' => t('Choose a field for Latitude. This should be a '
- . 'field that is a decimal or float value.'),
- '#options' => $fields,
- '#default_value' => $this->options['data_source']['other_lat'],
- '#states' => $this->datasource_dependent('other_latlon')
- );
- $form['data_source']['other_lon'] = array(
- '#type' => 'select',
- '#title' => t('Longitude Field'),
- '#description' => t('Choose a field for Longitude. This should be a '
- . 'field that is a decimal or float value.'),
- '#options' => $fields,
- '#default_value' => $this->options['data_source']['other_lon'],
- '#states' => $this->datasource_dependent('other_latlon')
- );
-
- $form['data_source']['wkt'] = array(
- '#type' => 'select',
- '#title' => t('WKT Field'),
- '#description' => t('Choose the OpenLayers WKT field.'),
- '#options' => $fields,
- '#default_value' => $this->options['data_source']['wkt'],
- '#states' => $this->datasource_dependent('wkt')
- );
-
- $form['data_source']['other_top'] = array(
- '#type' => 'select',
- '#title' => t('Top Field'),
- '#description' => t('Choose a field for Top. This should be a '
- . 'field that is a decimal or float value.'),
- '#options' => $fields,
- '#default_value' => $this->options['data_source']['other_top'],
- '#states' => $this->datasource_dependent('other_boundingbox')
- );
- $form['data_source']['other_right'] = array(
- '#type' => 'select',
- '#title' => t('Right Field'),
- '#description' => t('Choose a field for Right. This should be a field '
- . 'that is a decimal or float value.'),
- '#options' => $fields,
- '#default_value' => $this->options['data_source']['other_right'],
- '#states' => $this->datasource_dependent('other_boundingbox')
- );
- $form['data_source']['other_bottom'] = array(
- '#type' => 'select',
- '#title' => t('Bottom Field'),
- '#description' => t('Choose a field for Bottom. This should be a '
- . 'field that is a decimal or float value.'),
- '#options' => $fields,
- '#default_value' => $this->options['data_source']['other_bottom'],
- '#states' => $this->datasource_dependent('other_boundingbox')
- );
- $form['data_source']['other_left'] = array(
- '#type' => 'select',
- '#title' => t('Left Field'),
- '#description' => t('Choose a field for Left. This should be a field ' .
- 'that is a decimal or float value.'),
- '#options' => $fields,
- '#default_value' => $this->options['data_source']['other_left'],
- '#states' => $this->datasource_dependent('other_boundingbox')
- );
- }
- $form['data_source']['name_field'] = array(
- '#type' => 'select',
- '#title' => t('Title Field'),
- '#description' => t('Choose the field which will appear as a title on ' .
- 'tooltips.'),
- '#options' => array_merge(array('' => ''), $fields),
- '#default_value' => $this->options['data_source']['name_field'],
- );
-
- $desc_options = array_merge(array(
- '' => '',
- '#row' => '<' . t('entire row') . '>',
- ), $fields);
-
- // Description field
- $form['data_source']['description_field'] = array(
- '#type' => 'select',
- '#title' => t('Description Content'),
- '#description' => t('Choose the field or rendering method which will
- appear as a description on tooltips or popups.'),
- '#required' => FALSE,
- '#options' => $desc_options,
- '#default_value' => $this->options['data_source']['description_field'],
- );
-
- // A simple way to display attributes and styling
- $form['attributes'] = array(
- '#type' => 'fieldset',
- '#title' => t('Attributes and Styling'),
- '#description' => t('Attributes are field data attached to each '
- . 'feature. This can be used with styling to create Variable styling.'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- );
- $variable_fields = array();
- foreach ($this->view->display_handler->get_handlers('field') as
- $field => $handler) {
- $variable_fields[$field] = '${' . $field . '}';
- }
- if (!empty($this->options['data_source']['name_field'])) {
- $variable_fields['name'] = '${name}';
- }
- if (!empty($this->options['data_source']['description_field'])) {
- $variable_fields['description'] = '${description}';
- }
-
- $form['attributes']['display'] = array(
- '#title' => 'Select attributes to include in the features',
- '#type' => 'checkboxes',
- '#options' => $variable_fields,
- '#default_value' => !empty($this->options['attributes']['display']) ?
- $this->options['attributes']['display'] : array_combine(array_keys($variable_fields), array_keys($variable_fields)),
- '#description' => t('Any fields that you select will be attached to '
- . 'their respective feature (point, line, polygon) as attributes. '
- . 'These attributes can then be used to add variable styling to your '
- . 'themes. This is accomplished by using the %syntax syntax in the '
- . 'values for a style. You can see a list of available variables in '
- . 'the view preview; these can be placed right in the style interface. '
- . 'The field has been processed by Views.'
- . 'By disabling some of them, you can reduce the size '
- . 'of the Javascript included in your pages.'
- . 'Please note that this does not apply to Grouped Displays.',
- array(
- '%syntax' => '${field_name}'
- ))
- );
- }
-
-
- /**
- * @param $records ...
- *
- * openlayers_views_style_data specific
- */
- function map_features($sets = array()) {
- $features = $excluded_fields = array();
- $handlers = $this->display->handler->get_handlers('field');
-
- foreach ($sets as $title => $records) {
- foreach ($records as $id => $record) {
- $this->view->row_index = $id;
- $attributes = array();
- $wkt = NULL;
- $field_exclude = array();
-
- // Save the 'exclude' options of fields as backup.
- foreach ($this->view->field as $fid => $field) {
- $field_exclude[$fid] = $field->options['exclude'];
- }
- // Loop through each fields and render it if there were only one
- // field in the row, so we have all the goodness of Views's field
- // wrapping, class customizations and label.
- foreach ($handlers as $hid => $handler) {
- $field_id = $handler->options['id'];
- // Exclude all the field from rendering
- foreach ($this->view->field as $field) {
- $field->options['exclude'] = TRUE;
- }
- // Enable only the field we want to render the row.
- $this->view->field[$field_id]->options['exclude'] = FALSE;
- // Render the row.
- $attributes[$hid] = trim($this->row_plugin->render($record));
- }
- // Restore the state of the exclude options in the fields.
- foreach ($this->view->field as $fid => $field) {
- $this->view->field[$fid]->options['exclude'] = $field_exclude[$fid];
- }
-
- // Add the 'name' attribute.
- if (isset($this->options['data_source']['name_field'])) {
- if (isset($attributes[$this->options['data_source']['name_field']])) {
- $attributes['name'] = $attributes[$this->options['data_source']['name_field']];
- }
- }
-
- // Add the 'description' attribute.
- if (isset($this->options['data_source']['description_field'])) {
- // Handle rendering the whole record.
- if ($this->options['data_source']['description_field'] === '#row') {
- $attributes['description'] = trim($this->row_plugin->render($record));
- } else {
- if (isset($attributes[$this->options['data_source']['description_field']])) {
- $attributes['description'] = $attributes[$this->options['data_source']['description_field']];
- }
- }
- }
-
- // We do not need the rendered value for these fields,
- // just the raw value.
- // This is why we use $this->rendered_fields.
- if (isset($this->options['data_source']['value'])) {
- switch ($this->options['data_source']['value']) {
- case 'wkt':
- $handler = $handlers[$this->options['data_source']['wkt']];
- $wkt = $handler->allow_advanced_render() ? $handler->advanced_render($record) : $handler->render($record);
- break;
- case 'other_latlon':
- $handler = $handlers[$this->options['data_source']['other_lon']];
- $other_lon = $handler->allow_advanced_render() ? $handler->advanced_render($record) : $handler->render($record);
- $handler = $handlers[$this->options['data_source']['other_lat']];
- $other_lat = $handler->allow_advanced_render() ? $handler->advanced_render($record) : $handler->render($record);
- $wkt = 'POINT(' . $other_lon . ' ' . $other_lat . ')';
- break;
- }
- }
-
- // Only render features that has been enabled in the configuration
- // of the display.
- if (isset($this->options['attributes']['display'])) {
- foreach($this->options['attributes']['display'] as $fid => $value) {
- if ($this->options['attributes']['display'][$fid] === 0) {
- unset($attributes[$fid]);
- }
- }
- }
-
- // Create features array.
- $feature = array(
- 'projection' => 'EPSG:4326',
- 'attributes' => $attributes,
- 'wkt' => $wkt,
- );
-
- $features = $this->reduce_features($this->options['grouping'], $features, $feature, $title);
- }
- }
-
- // For grouping, handle a bit differently.
- if ($this->options['grouping']) {
- $features = $this->coalesce_groups($features, $handlers, $this->options['data_source']);
- }
-
- return $features;
- }
-
- /**
- * Basically a macro because
- * #state is rather verbose
- *
- * openlayers_views_style_data specific
- */
- function datasource_dependent($type) {
- return array('visible' => array('#edit-style-options-data-source-value' => array('value' => $type)));
- }
-
- /**
- * Coalesce features into single grouped feature when grouping is enabled.
- *
- * openlayers_views_style_data specific
- */
- function coalesce_groups($features, $handlers, $ds) {
-
- // Combine wkt into geometry collections if they are an array
- foreach ($features as &$feature) {
- if (is_array($feature['wkt'])) {
- if (count($feature['wkt']) > 1) {
- $feature['wkt'] = $this->get_group_wkt($feature['wkt']);
- }
- else {
- $feature['wkt'] = $feature['wkt'][0];
- }
- }
- }
-
- // Process title and description for groups
- foreach ($features as $k => &$feature) {
- $feature['attributes']['name'] = $k;
- $feature['attributes'] = array_merge($feature['attributes'], $feature['features'][0]['attributes']);
-
- $formatted_features = array();
- foreach ($feature['features'] as $subfeature) {
-
- // Create name and description attributes. Note that there are a
- // couple exceptions to using fields.
- $exceptions = array('#row');
-
- // Run the output through a theme.
- $formatted_features[] = theme('openlayers_views_group_display_item',
- array(
- 'name' => isset($handlers[$ds['name_field']]) ?
- $subfeature['attributes'][$ds['name_field']] : FALSE,
- 'description' => (in_array($ds['description_field'], $exceptions) ||
- isset($handlers[$ds['description_field']])) ?
- $subfeature['attributes'][$ds['description_field']] : FALSE
- )
- );
-
- // Remove rendered rows to keep data size down for JS.
- if (in_array($ds['description_field'], $exceptions)) {
- unset($subfeature['attributes'][$ds['description_field']]);
- }
- }
-
- // Then run all gathered features through item_ist theme.
- $feature['attributes']['description'] = theme('item_list',
- array('items' => $formatted_features)
- );
- }
- return $features;
- }
-
- /**
- * Combine all group wkt into a single geometry collection
- *
- * openlayers_views_style_data specific
- */
- function get_group_wkt($wkt_array) {
- geophp_load();
- $geophp = geoPHP::load($wkt_array, 'wkt');
- return $geophp->out('wkt');
- }
-
- /**
- * Split string according to first match of passed regEx index of $regExes
- */
- function preg_explode($regEx, $str) {
- $matches = array();
- preg_match($this->regExes[$regEx], $str, $matches);
- return empty($matches)?array(trim($str)):explode($matches[0], trim($str));
- }
-
- /**
- * Basically an algebraic reduction; given whether to group,
- * a feature, a list of features, etc., return a full $features
- * array with the element added, either straight non-grouped,
- * or within a new or existing group
- *
- * openlayers_views_style_data specific
- */
- function reduce_features($is_grouped, $features, $feature, $group) {
- if ($is_grouped) {
- if (isset($features[$group])) {
- $features[$group]['attributes']['count']++;
- $features[$group]['wkt'][] = $feature['wkt'];
- $features[$group]['features'][] = $feature;
- return $features;
- }
- else {
- $features[$group] = array(
- 'attributes' => array('count' => 1),
- 'wkt' => array($feature['wkt']),
- 'projection' => $feature['projection'],
- 'features' => array($feature)
- );
- return $features;
- }
- }
- else {
- array_push($features, $feature);
- return $features;
- }
- }
-
-}
diff --git a/modules/openlayers_views/views/openlayers_views_style_data_image.inc b/modules/openlayers_views/views/openlayers_views_style_data_image.inc
deleted file mode 100644
index 720b471d0634262189fc6610bcaedf3628286af3..0000000000000000000000000000000000000000
--- a/modules/openlayers_views/views/openlayers_views_style_data_image.inc
+++ /dev/null
@@ -1,149 +0,0 @@
-option_definition
- */
- function option_definition() {
- $options = parent::option_definition();
- $options['config'] = array();
- return $options;
- }
-
- /**
- * Render the map.
- *
- * Overrides views_plugin_style->render
- */
- function render() {
- $view = $this->view;
-
- // Render fields to trigger rewriting and other field processing.
- $this->view->style_plugin->render_fields($this->view->result);
- $image_field = isset($this->options['config']['image_field']) ? $this->options['config']['image_field'] : NULL;
- $factor_x = !empty($this->options['config']['factors']['x']) ? $this->options['config']['factors']['x'] : 1;
- $factor_y = !empty($this->options['config']['factors']['y']) ? $this->options['config']['factors']['y'] : 1;
- $numzoomlevels = !empty($this->options['config']['numZoomLevels']) ? $this->options['config']['numZoomLevels'] : 1;
- $maxextent = !empty($this->options['config']['maxExtent']) ? $this->options['config']['maxExtent'] : NULL;
-
- foreach ($this->view->result as $count => $row) {
- if (isset($view->style_plugin->rendered_fields[$count][$image_field])) {
- $image = $view->style_plugin->rendered_fields[$count][$image_field];
- $value = $view->style_plugin->get_field_value($count, $image_field);
- $field_output = array_shift($value);
-
- $data[] = array(
- 'file' => $image,
- 'size' => array(
- 'w' => floatval($field_output['width']),
- 'h' => floatval($field_output['height'])
- ),
- 'factors' => array(
- 'x' => floatval($factor_x),
- 'y' => floatval($factor_y)
- ),
- 'numZoomLevels' => floatval($numzoomlevels),
- 'maxExtent' => $maxextent
- );
- }
- }
-
- if (!empty($data)) {
- // Skip rendering if view is being edited or previewed.
- if (empty($this->view->live_preview)) {
- return $data[0];
- } else {
- return print_r($data[0], 1);
- }
- } else {
- return '';
- }
- }
-
- /**
- * Options form
- *
- * Overrides views_plugin_style->options_form
- */
- function options_form(&$form, &$form_state) {
- parent::options_form($form, $form_state);
-
- // Get list of fields in this view & flag available geodata fields
- $handlers = $this->display->handler->get_handlers('field');
-
- // Check for any fields, as the view needs them
- if (empty($handlers)) {
- $form['error_markup'] = array(
- '#value' => t('You need to enable at least one field before you can '
- . 'configure your field settings'),
- '#prefix' => '
',
- '#suffix' => '
',
- );
- return;
- }
-
- $fields = array();
- foreach ($handlers as $field_id => $handler) {
- $fields[$field_id] = $handler->ui_name();
- }
-
- $form['config'] = array(
- '#type' => 'fieldset',
- '#tree' => TRUE,
- '#title' => t('Image Source'),
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- );
- $form['config']['image_field'] = array(
- '#type' => 'select',
- '#title' => t('Map Data Sources'),
- '#description' => t('Choose which sources of data that the map will '
- . 'provide features for.'),
- '#options' => $fields,
- '#default_value' => $this->options['config']['image_field'],
- );
- $form['config']['factors'] = array(
- '#tree' => TRUE,
- 'x' => array(
- '#title' => 'Width divider',
- '#type' => 'textfield',
- '#default_value' => isset($this->options['config']['factors']['x']) ? $this->options['config']['factors']['x'] : 1,
- '#description' => t('Width divider.'),
- ),
- 'y' => array(
- '#title' => 'Height divider',
- '#type' => 'textfield',
- '#default_value' => isset($this->options['config']['factors']['y']) ? $this->options['config']['factors']['y'] : 1,
- '#description' => t('Height divider.'),
- ),
- );
- $form['config']['maxExtent'] = array(
- '#type' => 'textfield',
- '#title' => t('Max Extent'),
- '#default_value' => isset($this->options['config']['maxExtent']) ? implode(', ', $this->options['config']['maxExtent']) : '',
- '#description' => t('Should consist of four values (left, bottom, right, top). The maximum extent for the layer. Image is stretched to cover whole map if left empty.'),
- );
- $form['config']['numZoomLevels'] = array(
- '#title' => 'Zoomlevels',
- '#type' => 'textfield',
- '#default_value' => isset($this->options['config']['numZoomLevels']) ? $this->options['config']['numZoomLevels'] : 1
- );
- }
-}
diff --git a/modules/openlayers_views/views/openlayers_views_style_map.inc b/modules/openlayers_views/views/openlayers_views_style_map.inc
deleted file mode 100644
index e19fec9b407d1c47a2732bb3e8e067a6eea51689..0000000000000000000000000000000000000000
--- a/modules/openlayers_views/views/openlayers_views_style_map.inc
+++ /dev/null
@@ -1,74 +0,0 @@
- variable_get('openlayers_default_map', 'default'));
- return $options;
- }
-
- /**
- * Options form
- */
- function options_form(&$form, &$form_state) {
- parent::options_form($form, $form_state);
-
- // Map
- $form['map'] = array(
- '#type' => 'select',
- '#title' => t('Map'),
- '#description' => t('This is map that will be used to render the view.'),
- '#options' => openlayers_map_options(),
- '#default_value' => $this->options['map'] ?
- $this->options['map'] :
- variable_get('openlayers_default_map', 'default'),
- );
- }
-
- /**
- * Query - override to make sure this doesn't get run
- */
- function query() {
- if (isset($this->view->query->fields)) {
- $this->view->query->fields = array();
- }
- $this->view->executed = TRUE;
- $this->view->result = TRUE;
- $map = openlayers_map_load($this->options['map']);
- $build = openlayers_render_map_data($map->data);
- $render = render($build);
- $this->view->result = $render || !$map->data['hide_empty_map'] ? TRUE : FALSE;
- if ($this->view->result) {
- $this->render = $render;
- }
- }
-
- /**
- * Renders views (map)
- */
- function render() {
- return theme($this->theme_functions(), array(
- 'view' => $this->view,
- 'options' => $this->options,
- 'map' => $this->render
- ));
- }
-}
diff --git a/openlayers.info b/openlayers.info
index a9ead1c20db696d70f22c1a4c67da5b8732cf910..0721d4c7abd93c1cd5c118e287482cfe9d552639 100644
--- a/openlayers.info
+++ b/openlayers.info
@@ -3,26 +3,15 @@ description = "OpenLayers base API module"
core = 7.x
package = "OpenLayers"
dependencies[] = libraries (>=2.1)
-dependencies[] = proj4js
dependencies[] = ctools
dependencies[] = file
dependencies[] = image
; Core files
files[] = openlayers.module
-files[] = plugins/layer_types/openlayers_layer_type_bing.inc
-files[] = plugins/layer_types/openlayers_layer_type_cloudmade.inc
-files[] = plugins/layer_types/openlayers_layer_type_dummy.inc
-files[] = plugins/layer_types/openlayers_layer_type_geojson.inc
-files[] = plugins/layer_types/openlayers_layer_type_google.inc
-files[] = plugins/layer_types/openlayers_layer_type_gpx.inc
-files[] = plugins/layer_types/openlayers_layer_type_image.inc
-files[] = plugins/layer_types/openlayers_layer_type_kml.inc
-files[] = plugins/layer_types/openlayers_layer_type_maptiler.inc
-files[] = plugins/layer_types/openlayers_layer_type_osm.inc
-files[] = plugins/layer_types/openlayers_layer_type_pointgrid.inc
-files[] = plugins/layer_types/openlayers_layer_type_raw.inc
-files[] = plugins/layer_types/openlayers_layer_type_tms.inc
-files[] = plugins/layer_types/openlayers_layer_type_wms.inc
-files[] = plugins/layer_types/openlayers_layer_type_wmts.inc
-files[] = plugins/layer_types/openlayers_layer_type_xyz.inc
+files[] = includes/openlayers.object.inc
+files[] = includes/openlayers.interaction.inc
+files[] = includes/openlayers.map.inc
+files[] = includes/openlayers.layer.inc
+files[] = includes/openlayers.source.inc
+files[] = includes/openlayers.control.inc
diff --git a/openlayers.install b/openlayers.install
index c0d48bf9ccaee5f7a24f03e86ac02a40c214ebbf..eed2ae6d094d51d2f6588c75f4dbf078daa2b4aa 100644
--- a/openlayers.install
+++ b/openlayers.install
@@ -1,19 +1,5 @@
'Storage for User defined OpenLayers maps.',
'export' => array(
- 'key' => 'name',
- 'key name' => 'Name',
- 'primary key' => 'name',
- 'identifier' => 'openlayers_maps',
- 'default hook' => 'openlayers_maps',
+ 'key' => 'machine_name',
+ 'key name' => 'Machine name',
+ 'primary key' => 'machine_name',
+ 'identifier' => 'map',
+ 'default hook' => 'default_maps',
+ //'load all callback' => 'openlayers_maps_load_all',
+ //'load all' => 'openlayers_maps_load',
+ 'object factory' => 'openlayers_maps_factory',
'api' => array(
'owner' => 'openlayers',
- 'api' => 'openlayers_maps',
+ 'api' => 'default_maps',
'minimum_version' => 1,
'current_version' => 1,
),
),
'fields' => array(
- 'name' => array(
+ 'machine_name' => array(
'description' => 'The primary identifier for the map.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
- 'title' => array(
+ 'name' => array(
'description' => 'The title of the map.',
'type' => 'varchar',
'length' => 255,
@@ -67,521 +56,263 @@ function openlayers_schema() {
'type' => 'text',
'not null' => TRUE,
),
- 'data' => array(
+ 'class' => array(
+ 'type' => 'text',
+ 'not null' => TRUE,
+ 'description' => 'Map class.',
+ ),
+ 'options' => array(
'description' => 'The serialized map.',
'type' => 'text',
'not null' => TRUE,
'serialize' => TRUE,
),
),
- 'primary key' => array('name'),
+ 'primary key' => array('machine_name'),
+ 'unique keys' => array(
+ 'machine_name' => array('machine_name'),
+ ),
);
- // Layer table (ctools extras)
+ // table (ctools extras)
$schema['openlayers_layers'] = array(
'description' => 'Storage for user defined OpenLayers layers.',
'export' => array(
- 'key' => 'name',
- 'key name' => 'Name',
- 'primary key' => 'name',
- 'identifier' => 'openlayers_layers',
- 'default hook' => 'openlayers_layers',
+ 'admin_title' => 'machine_name',
+ 'key' => 'machine_name',
+ 'key name' => 'Machine name',
+ 'primary key' => 'machine_name',
+ 'identifier' => 'layer',
+ 'default hook' => 'default_layers',
+ //'load all callback' => 'openlayers_layers_load_all',
+ //'load all' => 'openlayers_layers_load',
+ 'object factory' => 'openlayers_layers_factory',
'api' => array(
'owner' => 'openlayers',
- 'api' => 'openlayers_layers',
+ 'api' => 'default_layers',
'minimum_version' => 1,
'current_version' => 1,
),
),
'fields' => array(
- 'name' => array(
+ 'machine_name' => array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
- 'default' => '',
- 'description' => 'Layer name.',
+ 'description' => 'system name.',
),
- 'title' => array(
+ 'name' => array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
- 'description' => 'Layer title.',
+ 'description' => 'name.',
),
'description' => array(
'type' => 'text',
'not null' => TRUE,
- 'description' => 'Layer description.',
+ 'description' => 'description.',
+ ),
+ 'class' => array(
+ 'type' => 'text',
+ 'not null' => TRUE,
+ 'description' => 'class.',
),
- 'data' => array(
+ 'options' => array(
'type' => 'text',
'not null' => FALSE,
- 'description' => 'Layer data serialized.',
+ 'description' => 'options serialized.',
'serialize' => TRUE,
),
),
- 'primary key' => array('name'),
+ 'primary key' => array('machine_name'),
+ 'unique keys' => array(
+ 'machine_name' => array('machine_name'),
+ ),
);
- // Projection table (ctools extras)
- // TODO: Translations missing?
- $schema['openlayers_projections'] = array(
- 'description' => 'Storage for user defined OpenLayers projections.',
+ // table (ctools extras)
+ $schema['openlayers_sources'] = array(
+ 'description' => 'Storage for user defined OpenLayers sources.',
'export' => array(
- 'key' => 'identifier',
- 'key name' => 'Identifier',
- 'primary key' => 'identifier',
- 'identifier' => 'openlayers_projections',
- 'default hook' => 'openlayers_projections',
+ 'admin_title' => 'machine_name',
+ 'key' => 'machine_name',
+ 'key name' => 'Machine name',
+ 'primary key' => 'machine_name',
+ 'identifier' => 'source',
+ 'default hook' => 'default_sources',
+ 'load all callback' => 'openlayers_sources_load_all',
+ 'object factory' => 'openlayers_sources_factory',
'api' => array(
'owner' => 'openlayers',
- 'api' => 'openlayers_projections',
+ 'api' => 'default_sources',
'minimum_version' => 1,
'current_version' => 1,
),
),
'fields' => array(
- 'identifier' => array(
+ 'machine_name' => array(
'type' => 'varchar',
- 'length' => 255,
+ 'length' => '255',
'not null' => TRUE,
- 'description' => 'Opaque identifier. Guaranteed to be unique but does not have any other meaning.'
+ 'description' => 'Source system name.',
),
- 'authority' => array(
- 'type' => 'text',
+ 'name' => array(
+ 'type' => 'varchar',
+ 'length' => '255',
'not null' => TRUE,
- 'description' => 'Projection authority.',
+ 'default' => '',
+ 'description' => 'Source name.',
),
- 'code' => array(
+ 'description' => array(
'type' => 'text',
'not null' => TRUE,
- 'description' => 'Projection code.',
+ 'description' => 'Source description.',
),
- 'definition' => array(
+ 'class' => array(
'type' => 'text',
'not null' => TRUE,
- 'description' => 'Projection definition (proj4 format).',
+ 'description' => 'Source class.',
),
- 'projectedextentleft' => array(
- 'type' => 'numeric',
- 'not null' => TRUE,
- 'description' => "Leftmost value in this projection's coordinates",
- ),
- 'projectedextentbottom' => array(
- 'type' => 'numeric',
- 'not null' => TRUE,
- 'description' => "Bottommost value in this projection's coordinates",
- ),
- 'projectedextentright' => array(
- 'type' => 'numeric',
- 'not null' => TRUE,
- 'description' => "Rightmost value in this projection's coordinates",
- ),
- 'projectedextenttop' => array(
- 'type' => 'numeric',
- 'not null' => TRUE,
- 'description' => "Topmost value in this projection's coordinates",
- ),
- // TODO Hopefully never used
- 'data' => array(
+ 'options' => array(
'type' => 'text',
'not null' => FALSE,
- 'description' => 'Projection data serialized.',
+ 'description' => 'Source options serialized.',
'serialize' => TRUE,
),
),
- 'primary key' => array('identifier'),
+ 'primary key' => array('machine_name'),
+ 'unique keys' => array(
+ 'machine_name' => array('machine_name'),
+ ),
);
- // Styles table (ctools extras)
- $schema['openlayers_styles'] = array(
- 'description' => 'Storage for user defined OpenLayers styles.',
+ $schema['openlayers_controls'] = array(
+ 'description' => 'Storage for user defined OpenLayers controls.',
'export' => array(
- 'key' => 'name',
- 'key name' => 'Name',
- 'primary key' => 'name',
- 'identifier' => 'openlayers_styles',
- 'default hook' => 'openlayers_styles',
+ 'admin_title' => 'machine_name',
+ 'key' => 'machine_name',
+ 'key name' => 'Machine name',
+ 'primary key' => 'machine_name',
+ 'identifier' => 'control',
+ 'default hook' => 'default_controls',
'api' => array(
'owner' => 'openlayers',
- 'api' => 'openlayers_styles',
+ 'api' => 'default_controls',
'minimum_version' => 1,
'current_version' => 1,
),
),
'fields' => array(
- 'name' => array(
+ 'machine_name' => array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
- 'description' => 'Style name.',
+ 'description' => 'Control system name.',
),
- 'title' => array(
+ 'name' => array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
- 'description' => 'Style title.',
+ 'description' => 'Control name.',
),
'description' => array(
'type' => 'text',
'not null' => TRUE,
- 'description' => 'Style description.',
+ 'description' => 'Control description.',
),
- 'data' => array(
+ 'class' => array(
+ 'type' => 'text',
+ 'not null' => TRUE,
+ 'description' => 'Control class.',
+ ),
+ 'options' => array(
'type' => 'text',
'not null' => FALSE,
- 'description' => 'Style data serialized.',
+ 'description' => 'Control options serialized.',
'serialize' => TRUE,
),
),
- 'primary key' => array('name'),
+ 'primary key' => array('machine_name'),
+ 'unique keys' => array(
+ 'machine_name' => array('machine_name'),
+ ),
+ $schema['openlayers_interactions'] = array(
+ 'description' => 'Storage for user defined OpenLayers interactions.',
+ 'export' => array(
+ 'admin_title' => 'machine_name',
+ 'key' => 'machine_name',
+ 'key name' => 'Machine name',
+ 'primary key' => 'machine_name',
+ 'identifier' => 'interaction',
+ 'default hook' => 'default_interactions',
+ 'api' => array(
+ 'owner' => 'openlayers',
+ 'api' => 'default_interactions',
+ 'minimum_version' => 1,
+ 'current_version' => 1,
+ ),
+ ),
+ 'fields' => array(
+ 'machine_name' => array(
+ 'type' => 'varchar',
+ 'length' => '255',
+ 'not null' => TRUE,
+ 'default' => '',
+ 'description' => 'Interaction system name.',
+ ),
+ 'name' => array(
+ 'type' => 'varchar',
+ 'length' => '255',
+ 'not null' => TRUE,
+ 'default' => '',
+ 'description' => 'Interaction name.',
+ ),
+ 'description' => array(
+ 'type' => 'text',
+ 'not null' => TRUE,
+ 'description' => 'Interaction description.',
+ ),
+ 'class' => array(
+ 'type' => 'text',
+ 'not null' => TRUE,
+ 'description' => 'Interaction class.',
+ ),
+ 'options' => array(
+ 'type' => 'text',
+ 'not null' => FALSE,
+ 'description' => 'Interaction options serialized.',
+ 'serialize' => TRUE,
+ ),
+ ),
+ 'primary key' => array('machine_name'),
+ 'unique keys' => array(
+ 'machine_name' => array('machine_name'),
+ ),
+ )
);
return $schema;
}
-/**
- * Implements hook_requirements().
- */
function openlayers_requirements($phase) {
- $req = array();
- $t = get_t();
+ $requirements = array();
- // We should not require a specfic version of the OpenLayers library, but
- // we should tell the administrator that specific versions are more
- // compatible than others.
- if ($phase == 'runtime') {
- $ol_library_version = 0;
- $current_library = variable_get('openlayers_source', OPENLAYERS_DEFAULT_LIBRARY);
+ if ($phase != 'install') {
+ $ol3 = libraries_detect('openlayers3');
- // As of 2.11, the hosted version supports the newest hosted
- // stable with an actual version number. This used to be just under
- // the 'api' path.
- if (strpos($current_library, (string) OPENLAYERS_SUGGESTED_LIBRARY) !== FALSE) {
- $ol_library_version = OPENLAYERS_SUGGESTED_LIBRARY;
- }
-
- // Check if it is the default hosted.
- if ($current_library == 'http://openlayers.org/api/OpenLayers.js') {
- $ol_library_version = OPENLAYERS_HOSTED_API_LIBRARY;
- }
-
- // Finally, let's see if the client has sent us a value
- // from the UI module AJAX magic.
- $client = variable_get('openlayers_ui_version_check', '');
- if (strpos($client, (string) OPENLAYERS_SUGGESTED_LIBRARY) !== FALSE) {
- $ol_library_version = OPENLAYERS_SUGGESTED_LIBRARY;
- }
-
- // Check if suggest version.
- if ($ol_library_version == OPENLAYERS_SUGGESTED_LIBRARY) {
- $req['openlayers_old_presets'] = array(
- 'title' => $t('OpenLayers library version'),
- 'value' => $t('Using suggested compatible version %suggested.',
- array(
- '%suggested' => OPENLAYERS_SUGGESTED_LIBRARY,
- )),
+ if ($ol3) {
+ $requirements['openlayers3'] = array(
+ 'title' => 'OpenLayers library installed',
'severity' => REQUIREMENT_OK,
+ 'value' => t('OpenLayers %version library installed at %path', array('%path' => $ol3['library path'], '%version' => $ol3['version'])),
);
- }
- else {
- $req['openlayers_old_presets'] = array(
- 'title' => $t('OpenLayers library version'),
- 'value' => $t('Not suggested compatible version.'),
- 'description' => $t('Though you are very welcome to use whatever version of the OpenLayers library you want, it is suggested that you use version %suggested. You are currently not using that version or we are unable to determine which version you are using. Update your library settings at !settings.',
- array(
- '%suggested' => OPENLAYERS_SUGGESTED_LIBRARY,
- '!settings' => l(t('OpenLayers settings'), 'admin/structure/openlayers'),
- )),
- 'severity' => REQUIREMENT_WARNING,
- );
- }
- }
-
- // There are some backwards compability for the shift from
- // preset to maps. We want to communicate to administrators
- // that this will not be there forever.
- if ($phase == 'runtime') {
- // Check preset hook
- $presets = module_invoke_all('openlayers_presets');
- $found_presets = (count($presets) > 0) ? TRUE : FALSE;
-
- // Check features
- $feature_names = array();
- $found_features = FALSE;
- if (module_exists('features')) {
- $features = features_get_features();
- foreach ($features as $feature) {
- // Only utilize enabled features and look for presets
- if ($feature->status > 0 && !empty($feature->info['features']['openlayers_map_presets'])) {
- $feature_names[] = $feature->name;
- $found_features = TRUE;
- }
- }
- }
-
- // Create requirement entries
- if ($found_presets) {
- $req['openlayers_old_presets'] = array(
- 'title' => $t('OpenLayers Presets'),
- 'value' => $t('Found old presets.'),
- 'description' => $t('With the 7.x-2.x version of the OpenLayers module, map presets were renamed to just maps. This has some implications on APIs and hooks. One or more of of the modules installed on this site is utilizing the deprecated %hook. Please read the upgrade page, then contact the module owner or fix the custom module yourself.',
- array(
- '%hook' => 'hook_openlayers_presets()',
- '@url' => url('http://drupal.org/node/1136810'),
- )),
- 'severity' => REQUIREMENT_ERROR,
- );
- }
- if ($found_features) {
- $req['openlayers_old_features'] = array(
- 'title' => $t('OpenLayers Presets'),
- 'value' => $t('Found Features with presets.'),
- 'description' => $t('With the 7.x-2.x version of the OpenLayers module, map presets were renamed to just maps. This has some implications on APIs and hooks. There are Features on this site that contain the old map presets. Please read the upgrade page, and rebuild the following Features: %features',
- array(
- '@url' => url('http://drupal.org/node/1136810'),
- '%features' => implode(',', $feature_names),
- )),
+ } else {
+ $requirements['openlayers3'] = array(
+ 'title' => t('OpenLayers'),
'severity' => REQUIREMENT_ERROR,
+ 'value' => t('OpenLayers library was not found.'),
);
}
}
- return $req;
-}
-
-/**
- * Implements hook_update_N().
- *
- * Rename of presets to maps.
- */
-function openlayers_update_7201() {
- // Change table name
- db_rename_table('openlayers_map_presets', 'openlayers_maps');
- // Set default map variable
- variable_set('openlayers_default_map', variable_get('openlayers_default_preset', 'default'));
- variable_del('openlayers_default_preset');
-}
-
-/**
- * Drop name indexes duplicates of primary key.
- */
-function openlayers_update_7202() {
- db_drop_index('openlayers_layers', 'name');
- db_drop_index('openlayers_styles', 'name');
-}
-
-/**
- * Rename the 'baselayer' in 'isBaseLayer' in layers.
- */
-function openlayers_update_7204() {
- openlayers_update_create_projection_table();
-
- foreach (openlayers_layers_load() as $key => $layer) {
- if ($layer->export_type != 1) continue;
- if (isset($layer->data['baselayer'])) {
- $layer->data['isBaseLayer'] = $layer->data['baselayer'];
- unset($layer->data['baselayer']);
- ctools_export_crud_save('openlayers_layers', $layer);
- }
- }
+ return $requirements;
}
-
-/**
- * Change the case of machine_name for layers, maps and styles.
- * Warning, it can break things.
- */
-function openlayers_update_7205() {
- db_query('UPDATE {openlayers_layers} SET name = LOWER(name);');
- db_query('UPDATE {openlayers_styles} SET name = LOWER(name);');
- db_query('UPDATE {openlayers_maps} SET name = LOWER(name);');
-}
-
-/**
- * Rename the 'base_url' in 'url' in layer type TMS.
- */
-function openlayers_update_7206() {
- openlayers_update_create_projection_table();
-
- foreach (openlayers_layers_load() as $key => $layer) {
- if ($layer->export_type != 1) continue;
- if ($layer->data['layer_type'] != 'openlayers_layer_type_tms') continue;
- if (isset($layer->data['base_url'])) {
- $layer->data['url'] = $layer->data['base_url'];
- unset($layer->data['base_url']);
- ctools_export_crud_save('openlayers_layers', $layer);
- }
- }
-}
-
-/**
- * Makes projections available that are required for update hooks to work properly.
- * Must by called at least once by any of the update hooks.
- */
-function openlayers_update_create_projection_table() {
- static $hasRun = FALSE;
- if($hasRun || db_table_exists('openlayers_projections')){
- return;
- } else {
- $hasRun = TRUE;
- }
-
- // Create projection table
- $openlayers_projections_schema = array(
- 'description' => 'Storage for user defined OpenLayers projections.',
- 'export' => array(
- 'key' => 'identifier',
- 'key name' => 'Identifier',
- 'primary key' => 'identifier',
- 'identifier' => 'openlayers_projections',
- 'default hook' => 'openlayers_projections',
- 'api' => array(
- 'owner' => 'openlayers',
- 'api' => 'openlayers_projections',
- 'minimum_version' => 1,
- 'current_version' => 1,
- ),
- ),
- 'fields' => array(
- 'identifier' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'description' => 'Opaque identifier. Guaranteed to be unique but does not have any other meaning.'
- ),
- 'authority' => array(
- 'type' => 'text',
- 'not null' => TRUE,
- 'description' => 'Projection authority.',
- ),
- 'code' => array(
- 'type' => 'text',
- 'not null' => TRUE,
- 'description' => 'Projection code.',
- ),
- 'definition' => array(
- 'type' => 'text',
- 'not null' => TRUE,
- 'description' => 'Projection definition (proj4 format).',
- ),
- 'projectedextentleft' => array(
- 'type' => 'numeric',
- 'not null' => TRUE,
- 'description' => "Leftmost value in this projection's coordinates",
- ),
- 'projectedextentbottom' => array(
- 'type' => 'numeric',
- 'not null' => TRUE,
- 'description' => "Bottommost value in this projection's coordinates",
- ),
- 'projectedextentright' => array(
- 'type' => 'numeric',
- 'not null' => TRUE,
- 'description' => "Rightmost value in this projection's coordinates",
- ),
- 'projectedextenttop' => array(
- 'type' => 'numeric',
- 'not null' => TRUE,
- 'description' => "Topmost value in this projection's coordinates",
- ),
- // TODO Hopefully never used
- 'data' => array(
- 'type' => 'text',
- 'not null' => FALSE,
- 'description' => 'Projection data serialized.',
- 'serialize' => TRUE,
- ),
- ),
- 'primary key' => array('identifier'),
- );
- db_create_table('openlayers_projections', $openlayers_projections_schema);
-}
-
-/**
- * Migrate configured projections so that other projections than those of EPSG can be used, too.
- */
-function openlayers_update_7207() {
- openlayers_update_create_projection_table();
-
- // Migrate stored layers
- foreach (openlayers_layers_load(TRUE) as $key => $layer) {
- $projections = array();
-
- // Takeover srs key that no longer exists and migrate it to a projection
- if ($layer instanceof openlayers_layer_type_wms && array_key_exists('srs', $layer->data['options']) && !in_array($layer->data['options']['srs'], $layer->data['projection'])) {
- $projections[] = $layer->data['options']['srs'];
- }
- unset($layer->data['options']['srs']);
-
- foreach ($layer->data['projection'] as $projection) {
- if (is_string($projection)) {
- $projections[] = $projection;
- }
- else {
- throw new DrupalUpdateException("Unsupported projection type encountered in layer " . $key);
- }
- }
- $layer->data['projection'] = $projections;
- ctools_export_crud_save('openlayers_layers', $layer);
- }
-
- // The code for the projection changed but its semantics stayed.
- // Only update the display projection as servers might be in use that don't yet support the new code.
- foreach (openlayers_maps(TRUE) as $key => $map) {
- if ($map->data['displayProjection']==='EPSG:900913') {
- $map->data['displayProjection'] = 'EPSG:3857';
- }
- ctools_export_crud_save('openlayers_maps', $map);
- }
-}
-
-/**
- * Ensure projections carry an authority code.
- */
-function openlayers_update_7208() {
- // Commit 95108d3fa82c34fc5dc5e6e159263232a891a27a introduced authority codes
- // for layers and maps but did not migrate existing data.
- foreach (openlayers_layers_load(TRUE) as $key => $layer) {
- $projections = array();
- foreach ($layer->data['projection'] as $projection) {
- if(mb_strpos($projection, 'EPSG:')===FALSE){
- $projections[] = 'EPSG:'.$projection;
- } else {
- $projections[] = $projection;
- }
- }
- $layer->data['projection'] = $projections;
- ctools_export_crud_save('openlayers_layers', $layer);
- }
- foreach (openlayers_maps(TRUE) as $key => $map) {
- foreach(array('projection', 'displayProjection') as $projectionKey){
- $projection = $map->data[$projectionKey];
- if(mb_strpos($projection, 'EPSG:')===FALSE){
- $projection = 'EPSG:'.$projection;
- } else {
- $projection = $projection;
- }
- $map->data[$projectionKey] = $projection;
- }
- ctools_export_crud_save('openlayers_maps', $map);
- }
-}
-
-/**
- * Drop maxExtent from layers where layers don't handle it. OpenLayers will
- * then take the property from the map for the affected layers.
- */
-function openlayers_update_7209(){
- foreach (openlayers_layers_load(TRUE) as $key => $layer) {
- if($layer instanceof openlayers_layer_type_google
- || $layer instanceof openlayers_layer_type_bing
- || $layer instanceof openlayers_layer_type_cloudmade
- || $layer instanceof openlayers_layer_type_geojson
- || $layer instanceof openlayers_layer_type_kml
- || $layer instanceof openlayers_layer_type_osm
- || $layer instanceof openlayers_layer_type_raw
- || $layer instanceof openlayers_layer_type_wms
- ){
- unset($layer->data['maxExtent']);
- }
- ctools_export_crud_save('openlayers_layers', $layer);
- }
-}
\ No newline at end of file
diff --git a/openlayers.make.example b/openlayers.make.example
index c5316f09b1623c1eb62ab94aca047f957d50db38..e5d35182fcee5e46900779511aa2bfaeaf85f899 100644
--- a/openlayers.make.example
+++ b/openlayers.make.example
@@ -2,6 +2,6 @@ api = 2
core = 7.x
libraries[openlayers][download][type] = "file"
-libraries[openlayers][download][url] = http://github.com/openlayers/openlayers/releases/download/release-2.13.1/OpenLayers-2.13.1.zip
-libraries[openlayers][directory_name] = openlayers
+libraries[openlayers][download][url] = https://github.com/openlayers/ol3/releases/download/v3.0.0/v3.0.0.zip
+libraries[openlayers][directory_name] = openlayers3
libraries[openlayers][destination] = "libraries"
diff --git a/openlayers.module b/openlayers.module
index 74da6789cb7c57c5415e90300f40f1835883a4fe..205449ba9479496cebd0d2df62d21c3bc16d4a73 100644
--- a/openlayers.module
+++ b/openlayers.module
@@ -1,1603 +1,295 @@
' . t('The OpenLayers module is the base module for the
- OpenLayers suite of modules, and provides the main API.') . '';
- }
- return '';
+function openlayers_ctools_plugin_api($module, $api) {
+ $path = drupal_get_path('module', 'openlayers') . '/includes';
+ return array(
+ 'version' => 1,
+ 'path' => $path
+ );
}
/**
* Implements hook_ctools_plugin_directory().
*/
function openlayers_ctools_plugin_directory($module, $plugin) {
- return 'plugins/' . $plugin;
+ return 'plugins/openlayers/' . $plugin;
}
/**
* Implements hook_ctools_plugin_type().
*/
function openlayers_ctools_plugin_type() {
- // For backwards compatibility, we allow for the use
- // of hooks to define these plugins.
- //
- // This should be removed in 7.x-3.x
return array(
- 'behaviors' => array(
- 'use hooks' => TRUE,
- 'classes' => array('behavior'),
+ 'map' => array(
+ 'use hooks' => FALSE,
+ 'classes' => array('handler')
+ ),
+ 'layer' => array(
+ 'use hooks' => FALSE,
+ 'classes' => array('handler')
+ ),
+ 'source' => array(
+ 'use hooks' => FALSE,
+ 'classes' => array('handler')
),
- 'layer_types' => array(
- 'use hooks' => TRUE,
- 'classes' => array('layer_types'),
+ 'control' => array(
+ 'use hooks' => FALSE,
+ 'classes' => array('handler')
+ ),
+ 'interaction' => array(
+ 'use hooks' => FALSE,
+ 'classes' => array('handler')
)
);
}
-/**
- * Include necessary CSS and JS for rendering maps
- *
- * @ingroup openlayers_api
- */
-function openlayers_include() {
- // Get the page language for string translation.
- 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);
+function openlayer_object_factory_create($object_type, $object_class, $export = NULL) {
+ ctools_include('plugins');
+ $object_class = ctools_plugin_load_class('openlayers', $object_type, $object_class, 'handler');
+ $object = call_user_func(array(
+ new ReflectionClass($object_class), 'newInstance')
+ );
- if ($lang != 'en') {
- drupal_add_js(libraries_get_path('openlayers') . '/lib/OpenLayers/Lang.js', 'file');
- drupal_add_js(libraries_get_path('openlayers') . '/lib/OpenLayers/Lang/' . $lang . '.js', 'file');
- }
+ if ($export) {
+ $object->init($export);
}
- else {
- // Use a static variable to prevent running URL check code repeatedly.
- static $once;
- if (!isset($once)) {
- $once = TRUE;
- $path = check_plain(variable_get('openlayers_source_external', OPENLAYERS_DEFAULT_LIBRARY));
+ // This line is needed for openlayers_object::attached().
+ $object->plugin = ctools_get_plugins('openlayers', $object_type, $object_class);
+ return $object;
+}
- // Correctly handle URLs beginning with a double backslash, see RFC 1808 Section 4
- if (substr($path, 0, 2) == '//') {
- $http_protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
- $path = $http_protocol . ':' . $path;
- }
+function openlayers_object_load($object_type, $object_machine_name) {
+ ctools_include('export');
+ $export = ctools_export_crud_load('openlayers_' . $object_type .'s', $object_machine_name);
+ $object = openlayer_object_factory_create($object_type, $export->class, $export);
- // Check for full URL and include it manually if external.
- if (valid_url($path, TRUE)) {
- drupal_add_js($path, array('type' => 'external', 'weight' => -3));
- }
- else {
- drupal_add_js($path);
- }
- if ($lang != 'en') {
- drupal_add_js(libraries_get_path('openlayers') . '/lib/OpenLayers/Lang.js', 'file');
- drupal_add_js(libraries_get_path('openlayers') . '/lib/OpenLayers/Lang/' . $lang . '.js', 'file');
- }
- }
+ if (property_exists($export, 'disabled') && ($export->disabled == 1 || $export->disabled == TRUE)) {
+ $object->disabled = 1;
}
+
+ return $object;
}
-/**
- * Render map array
- *
- * Given a map array, render into HTML to display
- * a map.
- *
- * @ingroup openlayers_api
- *
- * @param $map
- * Associative array of map paramters.
- * @return
- * Map HTML.
- */
-function openlayers_render_map_data($map = array()) {
+function openlayers_render_build_map(openlayers_map $map) {
// Run map through build process
// Get the necessary parts
- openlayers_include();
- module_load_include('inc', 'openlayers', 'includes/openlayers.render');
-
- // If no map is specified, use the default map.
- if (empty($map)) {
- if ($loaded_map = openlayers_map_load(
- variable_get('openlayers_default_map', 'default'))) {
- $map = $loaded_map->data;
- }
- }
+ libraries_load('openlayers3');
// Hook to alter map before main processing. Styles, behaviors,
// layers may all be added here.
// hook_openlayers_map_preprocess_alter($map)
drupal_alter('openlayers_map_preprocess', $map);
- // Styles and layer styles are not required parameters
- $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();
+ $objects = array();
+ $objects['layer'] = $map->getLayers();
+ $objects['source'] = $map->getSources();
+ $objects['control'] = $map->getControls();
+ $objects['interaction'] = $map->getInteractions();
+
+ foreach($objects as $type => $list) {
+ if (is_array($list)) {
+ foreach($list as $index => $machine_name) {
+ $object = openlayers_object_load($type, $machine_name);
+ unset($object->plugin);
+ unset($object->name);
+ unset($object->description);
+ $objects[$type][$index] = $object;
+ }
+ }
+ }
- // Process map parts.
- $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);
+ $map->setOption('target', $map->getId());
+ $objects['map'] = $map->toArray();
- // Restrict map to its projection extent (data outwith cannot be represented).
- // Layer can additionally specfiy their maxExtent in case they use
- // non-default grids.
- $projection = openlayers_get_projection_by_identifier($map['projection']);
- $map['maxExtent'] = $projection->getProjectedExtent();
+ $attached = $map->attached();
- // Hook to alter map one last time. Final modification to existing
- // styles, behaviors, layers can happen here, but adding new styles,
- // behaviors will not get rendered.
- // hook_openlayers_map_alter($map)
drupal_alter('openlayers_map', $map);
- // Check map for errors
- $map['errors'] = openlayers_error_check_map($map);
-
- // Given hide_empty_map flag, check if the map has any features
- // defined. If not, assume it is an empty map and shouldn't be displayed.
- 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) {
- // Abort early because there are no features to display on the map anyway
- return '';
- }
- }
-
// Return themed map if no errors found
- if (empty($map['errors'])) {
- $styles = array(
- 'width' => $map['width'],
- 'height' => $map['height']
- );
+ $setting = array(
+ 'openlayers' => array(
+ 'maps' => array(
+ $map->getId() => $objects
+ )
+ )
+ );
- $css_styles = '';
- foreach ($styles as $property => $value) {
- $css_styles .= $property . ':' . $value . ';';
- }
+ $attached['js'][] = array(
+ 'data' => $setting,
+ 'type' => 'setting'
+ );
- $map['map_name'] = isset($map['map_name']) ? $map['map_name'] : substr(str_shuffle(md5(time())), 0, 8);
- $css_map_name = drupal_clean_css_identifier($map['map_name']);
+ $styles = array(
+ 'width' => $map->getOption('width'),
+ 'height' => $map->getOption('height')
+ );
- // Create ID for map as this will help with alters.
- $map['id'] = _openlayers_create_map_id('openlayers-map-' . $css_map_name);
+ $css_styles = '';
+ foreach ($styles as $property => $value) {
+ $css_styles .= $property . ':' . $value . ';';
+ }
- // TODO: contextual links
- $links = array(
- '#type' => 'contextual_links',
- '#contextual_links' => array(
- 'openlayers' => array(
- 'admin/structure/openlayers/maps/list', array($map['map_name']),
- ),
- )
- );
+ $current_path = current_path();
+ if ('system/ajax' == $current_path) {
+ $current_path = $_SESSION['current_path'];
+ }
- $container_classes = implode(" ", array(
- 'contextual-links-region',
- 'openlayers-container',
- 'openlayers-container-map-' . $css_map_name
- ));
+ $links = array(
+ 'openlayers' => array(
+ 'title' => 'Edit',
+ 'href' => 'admin/structure/openlayers/maps/list/' . $map->machine_name . '/edit',
+ 'query' => array(
+ 'destination' => $current_path
+ )
+ ),
+ );
- $build = array(
- '#type' => 'container',
+ $container_classes = implode(" ", array(
+ 'contextual-links-region',
+ 'openlayers-container',
+ 'openlayers-container-map-' . $map->getId()
+ ));
+
+ $build = array(
+ '#type' => 'container',
+ 'contextual_links' => array(
+ '#prefix' => '
',
+ '#suffix' => '
',
+ '#theme' => 'links__contextual',
+ '#links' => $links,
+ '#attributes' => array('class' => array('contextual-links')),
+ '#attached' => array(
+ 'library' => array(array('contextual', 'contextual-links')),
+ ),
+ ),
+ '#attributes' => array(
+ 'id' => 'openlayers-container-' . $map->getId(),
+ 'class' => $container_classes
+ ),
+ 'map' => array(
+ '#theme' => 'html_tag',
+ '#tag' => 'div',
+ '#value' => '',
'#attributes' => array(
- 'id' => 'openlayers-container-' . $map['id'],
+ 'id' => $map->getId(),
'style' => $css_styles,
- 'class' => $container_classes
+ 'class' => 'openlayers-map openlayers-map-' . $map->getId()
),
- 'map' => array(
- '#theme' => 'html_tag',
- '#tag' => 'div',
- '#value' => '',
- '#attributes' => array(
- 'id' => $map['id'],
- 'style' => $css_styles,
- 'class' => 'openlayers-map openlayers-map-' . $css_map_name
- )
+ '#attached' => array(
+ 'js' => $attached['js']
)
- );
-
- $build['#attached'] = array();
- $build['#attached']['js'] = array(
- drupal_get_path('module', 'openlayers') . '/js/openlayers.js' => array(
- 'weight' => -2
- )
- );
- $build['#attached']['css'] = array(
- drupal_get_path('module', 'openlayers') . '/css/openlayers.css'
- );
-
- // Currently the restricted extent of maps is always given in EPSG:3857 so
- // this projection needs to be available in the client for all restricted
- // maps. Using EPSG:4326 instead would likely be better.
- if(array_key_exists('restrict', $map['center']) && (boolean)$map['center']['restrict']['restrictextent']){
- $build['#attached']['js'][] = array(
- 'data' => openlayers_add_js_projection_definition(openlayers_get_projection_by_identifier('EPSG:3857')),
- 'type' => 'setting',
- );
- }
-
- $build['#attached']['js'][] = array(
- 'data' => openlayers_add_js_projection_definition(openlayers_get_projection_by_identifier($map['projection'])),
- 'type' => 'setting',
- );
- $build['#attached']['js'][] = array(
- 'data' => openlayers_add_js_projection_definition(openlayers_get_projection_by_identifier($map['displayProjection'])),
- 'type' => 'setting',
- );
-
- $build['#attached']['libraries_load'][] = array('proj4js');
-
- foreach ($map['layers'] as $layer_name => $layer_object) {
- $layer_object->render($map);
-
- if(in_array($map['projection'], $layer_object->data['projection'])){
- $map['layers'][$layer_name]->data['projection'] = $map['projection'];
- } else {
- // Client is able to reproject any possible projection because their definitions need to be
- // known to be able to set up a layer with a certain projection. Thus choice does not matter.
- $layerProjectionIdentifier = reset($layer_object->data['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]->data['projection'] = $layerProjectionIdentifier;
- }
-
- // In case the layer offers the same projection as the map, use this and do not provide
- // projection definition to client. Otherwise rely on the client to reproject on the fly.
- // Provide client with projection definition so that it can reproject
- $build['#attached']['js'][] = array(
- 'data' => openlayers_add_js_projection_definition(openlayers_get_projection_by_identifier($map['layers'][$layer_name]->data['projection'])),
- 'type' => 'setting',
- );
-
- // Ensure JavaScript gets proper type.
- $map['layers'][$layer_name]->data['isBaseLayer'] = (boolean)($layer_object->data['isBaseLayer']);
-
-
- $map['layers'][$layer_name] = $layer_object->data;
- $build['#attached'] = array_merge_recursive($build['#attached'], $layer_object->attached());
- }
- foreach ($map['behaviors'] as $behavior_name => $behavior_object) {
- $map['behaviors'][$behavior_name] = $behavior_object->options;
- $build['#attached'] = array_merge_recursive($build['#attached'], $behavior_object->attached());
- }
+ )
+ );
- $build['#attached']['js'][] = array(
- 'data' => array('openlayers' => array('maps' => array($map['id'] => $map))),
- 'type' => 'setting',
- );
- $build['#map'] = $map['map_name'];
+ if ($map->getOption('contextualLinks') == FALSE) {
+ unset($build['contextual_links']);
}
- return $build;
-}
-/**
- * Load projection transformations in case OpenLayers does not support projections in use natively
- * @param openlayers_projection $projection
- */
-function openlayers_add_js_projection_definition(openlayers_projection $projection) {
- $openlayers_natively_supported = array('EPSG:4326', 'EPSG:900913');
- // Only load Proj4js if projection not supported by OpenLayers anyway
- if (!in_array($projection->identifier, $openlayers_natively_supported)) {
- return proj4js_load_definition_js_settings($projection->identifier, $projection->getDefinition());
- }
+ return $build;
}
-/**
- * Render a map by name
- *
- * Given a map name render it into a full map object.
- *
- * @ingroup openlayers_api
- *
- * @param $map
- * Name of the map
- * @return
- * Map HTML.
- */
-function openlayers_render_map($map = '') {
-
- // If it's an array, then we have been passed the map data array
- if (is_array($map)) {
- $build = openlayers_render_map_data($map);
- return render($build);
- }
-
- // If it's a string, then we are passing a map name instead of the whole map object
- // so we need to load the object
- 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);
- }
- }
-
- $build = openlayers_render_map_data($map->data);
+function openlayers_render_map(openlayers_map $map) {
+ $build = openlayers_render_build_map($map);
return render($build);
}
/**
- * Get layer object
- *
- * @ingroup openlayers_api
- * @return openlayers_layer_type|FALSE
- * array of layer info
- */
-function openlayers_get_layer_object($layer, $map = array()) {
- ctools_include('plugins');
-
- // Static cache because this function will possibly be called in big loops
- static $layer_types;
- if (!isset($layer_types)) {
- $layer_types = openlayers_layer_types();
- }
-
- $layer->title = t($layer->title);
- $layer->description = t($layer->description);
-
- // Attempt to get ctool class
- 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;
- }
-}
-
-/**
- * Menu loader for layers. (%openlayers_layer)
- * @ingroup openlayers_api
- *
- * @param $name
- * Layer name
- * @param $reset
- * Boolean whether to reset cache or not
- * @return openlayers_layer_type|FALSE
- * Layer export
- */
-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;
- }
-}
-
-/**
- * Get all openlayers layers as objects.
- * @ingroup openlayers_api
- *
- * @param $reset
- * Boolean whether to reset cache or not
- * @return array
- * array of layer info
- */
-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');
-}
-
-/**
- * Check the plugin definition of a layer.
- * Some field *MUST* be there to work correctly with OL.
- *
- * @ingroup openlayers_api
- * @param $definition
- * @return bool
+ * Implements hook_libraries_info().
*/
-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'),
+function openlayers_libraries_info() {
+ $libraries['openlayers3'] = array(
+ 'name' => 'OpenLayers3',
+ 'vendor url' => 'http://openlayers.org/',
+ 'download url' => 'TODO',
+ 'version arguments' => array(
+ 'file' => 'build/ol.js',
+ 'pattern' => '@Version: (.*)@',
+ 'lines' => 3,
+ ),
+ 'files' => array(
+ 'js' => array('closure-library/closure/goog/base.js', 'build/ol-deps.js', 'build/ol.js'),
+ 'css' => array('css/ol.css')
+ ),
+ 'integration files' => array(
+ 'openlayers' => array(
+ 'js' => array('js/openlayers.js'),
+ 'css' => array('css/openlayers.css' => array('weight' => 10))
+ ),
+ ),
);
- 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 !type. 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;
+ return $libraries;
}
/**
- * Check the plugin definition of a behavior.
- * Some field *MUST* be there to work correctly with OL.
+ * Implements hook_element_info().
*
- * @ingroup openlayers_api
- * @param $definition
- * @return bool
+ * @return array
*/
-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'),
+function openlayers_element_info() {
+ return array(
+ 'openlayers' => array(
+ '#input' => FALSE,
+ '#tree' => TRUE,
+ '#process' => array('openlayers_element_process_callback'),
+ '#theme_wrappers' => array('form_element')
+ )
);
-
- 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 !behavior. 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;
}
-
-/**
- * Check layer to determine whether it has all the
- * necessary attributes to be rendered. This is necessary
- * because of API changes, and is a consolidation from other
- * layer-error-checking in this module
- *
- * @param $layer
- * Layer object
- * @param $projection
- * Projection number (EPSG) to check compatibility with
- * @param $strict
- * reject invalid layers
- * @return boolean
- * layer validity if strict is set, otherwise always true
- */
-function openlayers_layer_sanity_check($layer, $projection = FALSE, $strict = FALSE) {
- // Handle layers after they've been rendered for a map
- $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
- Drupal log 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
- Drupal log 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,
- // TODO: $map is not defined.
- '%map_proj' => $map['projection'],
- )
+function openlayers_element_process_callback($element, &$form_state) {
+ if (is_string($element['#map'])) {
+ $map = openlayers_object_load('map', $element['#map']);
+ $build = openlayers_render_map($map);
+ $element['map'] = array(
+ '#markup' => $build
);
- return !$strict;
- }
-
- return TRUE;
-}
-
-/**
- * Delete a layer object from the database.
- *
- * @ingroup openlayers_api
- *
- * @param $layer
- * String identifier of a layer or layer object with name.
- * @return
- * The results of DB delete.
- */
-function openlayers_layer_delete($layer) {
- return openlayers_object_delete($layer, 'layer');
-}
-
-/**
- * Get all layer types.
- *
- * @ingroup openlayers_api
- *
- * @param $reset
- * Boolean whether to reset cache or not.
- * @return
- * Array of layer type info.
- */
-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');
-}
-
-/**
- * Confirm that an object is not disabled.
- *
- * @ingroup openlayers_api
- *
- * @param Object $object
- * An object -- a layer, behavior, style or map.
- *
- * @return Boolean
- * Returns TRUE if the object is not disabled.
- */
-function openlayers_object_enabled($object) {
- return (!isset($object->disabled) || !$object->disabled);
-}
-
-/**
- * Menu loader for layer types.
- *
- * @ingroup openlayers_api
- *
- * @param $name
- * String identifier of layer type.
- * @param $reset
- * Boolean whether to reset cache or not.
- * @return openlayers_layer_type
- * An instantiated layer type object or FALSE if not found.
- */
-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;
+ return $element;
}
/**
- * Get all behaviors.
- *
- * @ingroup openlayers_api
- *
- * @param $reset
- * Boolean whether to reset cache or not.
- * @return
- * Array of behavior info.
+ * Implements hook_block_info().
*/
-function openlayers_behaviors($reset = FALSE, $include_disabled = FALSE) {
- ctools_include('plugins');
- $behaviors = ctools_get_plugins('openlayers', 'behaviors');
+function openlayers_block_info() {
+ ctools_include('export');
+ $all_maps = ctools_export_crud_load_all('openlayers_maps');
+ $blocks = array();
- if (!$include_disabled) {
- $behaviors = array_filter($behaviors, 'openlayers_object_enabled');
+ foreach ($all_maps as $key => $map) {
+ $map = openlayers_object_load('map', $map->machine_name);
+ if ($map->getOption('provideBlock', 1)) {
+ $blocks[$key]['info'] = t('OpenLayers block for ' . $map->name);
+ }
}
- return array_filter($behaviors, 'openlayers_behavior_definition_check');
-
+ return $blocks;
}
/**
- * Get all openlayers styles.
- *
- * @ingroup openlayers_api
- *
- * @param $reset
- * Boolean whether to reset cache or not.
- * @return
- * Array of all available styles.
+ * Implements hook_block_view().
*/
-function openlayers_styles($reset = FALSE, $include_disabled = FALSE) {
+function openlayers_block_view($delta = '') {
ctools_include('export');
- if ($reset) {
- ctools_export_load_object_reset('openlayers_styles');
- }
-
- $styles = ctools_export_load_object('openlayers_styles', 'all', array());
+ $block = array();
- if (!$include_disabled) {
- $styles = array_filter($styles, 'openlayers_object_enabled');
+ if ($map = openlayers_object_load('map', $delta)) {
+ if ($map->getOption('provideBlock', 1)) {
+ $block['subject'] = $map->name;
+ $block['content'] = openlayers_render_map($map);
+ }
}
- return $styles;
-}
-
-/**
- * Load a style object by name.
- *
- * This function can also be used as a
- * menu loader for a style.
- *
- * @ingroup openlayers_api
- *
- * @param $name
- * The string identifier of the style.
- * @param $reset
- * Boolean whether to reset the cache or not.
- * @return
- * A style object or FALSE if not found.
- */
-function openlayers_style_load($name, $reset = FALSE) {
- $styles = openlayers_styles($reset);
- return !empty($styles[$name]) ? $styles[$name] : FALSE;
-}
-
-/**
- * Save style.
- *
- * @ingroup openlayers_api
- *
- * @param $style
- * The style object to save.
- * @return
- * The results of DB write or FALSE if no name.
- */
-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;
+ return $block;
}
-
-/**
- * Delete a style object from the database.
- *
- * @ingroup openlayers_api
- *
- * @param $style
- * String identifier of a style or style object with name.
- * @return
- * The results of DB delete.
- */
-function openlayers_style_delete($style) {
- return openlayers_object_delete($style, 'style');
-}
-
-/**
- * Get maps from DB or code, via cache.
- *
- * @ingroup openlayers_api
- *
- * @param $reset
- * Boolean whether to reset or not.
- * @return
- * Return array of maps.
- */
-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;
-}
-
-/**
- * Given a map name, get full map object.
- *
- * This function can also be used as a
- * menu loader for a style.
- *
- * @ingroup openlayers_api
- *
- * @param $name
- * String identifier of the map.
- * @param $reset
- * Boolean whether to reset cache.
- * @return
- * map object or FALSE if not found.
- */
-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;
- }
-}
-
-/**
- * Save a map object to the database.
- *
- * @ingroup openlayers_api
- *
- * @param $map
- * map object.
- * @return
- * The results of DB write or FALSE if no name.
- */
-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;
-}
-
-/**
- * Delete a map object from the database.
- *
- * @ingroup openlayers_api
- *
- * @param $map
- * String identifier of a map or map object with name.
- * @return
- * The results of DB delete.
- */
-function openlayers_map_delete($map) {
- return openlayers_object_delete($map, 'map');
-}
-
-/**
- * Get map options in an array suitable for a FormAPI element.
- *
- * @ingroup openlayers_api
- *
- * @param $reset
- * Boolean whether to reset or not.
- * @return
- * Return array of formatted data.
- */
-function openlayers_map_options($reset = FALSE) {
- $maps = openlayers_maps($reset);
- $options = array();
- foreach ($maps as $map) {
- $options[$map->name] = $map->title;
- }
- return $options;
-}
-
-/**
- * Delete an object from the database.
- *
- * @ingroup openlayers_api
- *
- * @param $ol_object
- * String identifier of an object or the object with name.
- * @param $type
- * Type of object to delete. The options are the following:
- * - 'layer'
- * - 'style'
- * = 'map'
- * @return
- * The results of the DB delete.
- */
-function openlayers_object_delete($ol_object, $type) {
- // Check for object or name
- $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();
- }
-}
-
-/**
- * Checks map array for incompatibilities or errors.
- *
- * @ingroup openlayers_api
- *
- * @param $map
- * Map array
- * @param $log_errors
- * Boolean whether to log errors.
- * @return
- * FALSE if passed. Array of descriptive errors if fail.
- */
-function openlayers_error_check_map($map, $log_errors = TRUE) {
- $errors = array();
-
- // Check for layers
- if (!is_array($map['layers'])) {
- $errors[] = t('Map contains no renderable layers.');
- }
- else {
- // Check layer projections
- foreach ($map['layers'] as $layer) {
- openlayers_layer_sanity_check(
- array('data' => $layer),
- $map['projection'],
- TRUE);
- }
- }
-
- // Check if any errors found to log
- if (count($errors) > 0 && $log_errors) {
- // Log the Error(s)
- watchdog('openlayers', implode(', ', $errors), array(), WATCHDOG_ERROR);
- }
-
- // Check if errors and return
- return (count($errors) > 0) ? $errors : FALSE;
-}
-
-/**
- * Models a projection, a description of a coordinate system.
- */
-class openlayers_projection {
- /**
- * @var String Opaque primary key (should not be exposed but ctools API doesn't allow for a more rigid structure)
- */
- public $identifier;
-
- /**
- * @var String proj4 definition for on-the-fly reprojections of vector data.
- */
- private $definition;
-
- /**
- * @var number Leftmost boundary where coordinate system is valid
- */
- private $projectedextentleft;
- /**
- * @var number Bottommost boundary where coordinate system is valid
- */
- private $projectedextentbottom;
- /**
- * @var number Rightmost boundary where coordinate system is valid
- */
- private $projectedextentright;
- /**
- * @var number Topmost boundary where coordinate system is valid
- */
- 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;
- }
-
- /**
- * @return string Textual representation for the user.
- */
- public function getLocalizedMessage() {
- return $this->identifier;
- }
-
- /**
- * @return array Boundaries of projection in projected coordinates
- */
- public function getProjectedExtent() {
- return array_map('floatval', array($this->projectedextentleft, $this->projectedextentbottom, $this->projectedextentright, $this->projectedextenttop));
- }
-
- /**
- * @return String Proj4 style definition
- */
- public function getDefinition() {
- return $this->definition;
- }
-}
-
-/**
- * @param stdClass $record Object as returned by ctools_export_crud_load for type openlayers_projections
- * @return openlayers_projection
- */
-function openlayers_projection_from_record($record) {
- return new openlayers_projection($record->identifier, $record->definition,
- $record->projectedextentleft, $record->projectedextentbottom, $record->projectedextentright, $record->projectedextenttop);
-}
-
-/**
- * @param String $authority Organization who defined the code
- * @param String $code Projection identifier
- * @return openlayers_projection
- */
-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];
-}
-
-/**
- * @param String $identifier Identifier, such as “EPSG:4326”
- * @return openlayers_projection
- */
-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)]);
-}
-
-/**
- * @return array
- */
-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;
-}
-
-/**
- * Rerenders form part “Layers & Styles” when map projections changes
- * @param array $form
- * @param array $form_state
- * @return array Form part to rerender
- */
-function openlayers_map_layerlist(&$form, &$form_state) {
- module_load_include('inc', 'openlayers_ui', '/include/openlayers_ui.theme');
-
- // Remove group property as Drupal otherwise returns NULL instead of the rendered form part
- unset($form['layerstyles']['#group']);
- // Force a diffent, fixed identifier so that the form part can reliably replaced
- $form['layerstyles']['#id']= 'edit-layerstyles';
- // Rerender the form part
- return $form['layerstyles'];
-}
-
-/**
- * Get extent given projection
- *
- * Returns standard world-max-extents for common projections.
- * Layers implementing other projections and subsets of the
- * world should define their maxExtent in the layer array.
- *
- * @ingroup openlayers_api
- *
- * @param $authority
- * String Organization code, such as EPSG.
- * @param $projection
- * String of the projection value, such as 4326.
- * @return
- * Array of maxExtent in OpenLayers toArray() format.
- */
-function openlayers_get_extent($authority, $projection) {
- // Use projected extend from openlayers_projection instead but keep this function for now as it's marked as API
- return openlayers_get_projection($authority, $projection)->getProjectedExtent();
-}
-
-/**
- * Get resolution given projection
- *
- * Returns a default set of resolutions for standard
- * TMS, WMS, etc servers serving up common projections.
- * Layers supporting less common projections and resolutions
- * can easily define custom resolutions arrays.
- *
- * @ingroup openlayers_api
- *
- * @param $projection
- * String specifying which projection this should take, like EPSG:900913.
- * @param $zoom_start
- * Integer of first zoom level, default 0.
- * @param $zoom_end
- * Integer of last zoom level, default FALSE.
- * @return
- * Array of resolutions.
- */
-function openlayers_get_resolutions($projection, $zoom_start = 0, $zoom_end = FALSE) {
- // TODO This is conceptually flawed and should not exist. Resolutions depend on the server in use in combination with the tile size.
- switch ($projection) {
- case 'EPSG:900913':
- // 16 zoom levels, taken from
- // openlayers.org TMS map
- $res = array(
- 156543.0339,
- 78271.51695,
- 39135.758475,
- 19567.8792375,
- 9783.93961875,
- 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':
- // 16 zoom levels, taken from
- // openlayers.org default WMS map
- $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,
- 0.0000858306884765625,
- 0.00004291534423828125,
- 0.000021457672119140625,
- 0.000010728836059570312,
- );
- break;
- default:
- $res = array();
- break;
- }
- $length = ($zoom_end == FALSE) ? NULL : $zoom_end - $zoom_start;
- // By default this will not actually clip the array
- $resolutions = array_slice($res, $zoom_start, $length);
-
- return $resolutions;
-}
-
-/**
- * We define base classes in the core module.
- * All other parent classes can be autoloaded through ctools.
- */
-class openlayers_behavior {
- var $options;
-
- protected $map;
-
- function __construct($options = array(), $map = array()) {
- $this->options = $options + $this->options_init();
- $this->map = $map;
- }
-
- /*
- * @return array of JavaScript functions required to be defined
- * in order for this function to work
- */
- function js_dependency() {
- return array();
- }
-
- function options_init() {
- return array();
- }
-
- /*
- * @param $defaults default values for the form as an array
- * @return a FormAPI form
- */
- function options_form($defaults = array()) {
- return array();
- }
-
- function attached() {
- return array();
- }
-
- function render(&$map) {}
-}
-
-/**
- * We define base classes in the core module.
- * All other parent classes can be autoloaded through ctools.
- */
-class openlayers_layer_type {
-
- /**
- * Stores the options for this layer.
- * @var array
- */
- public $data = array();
-
- /**
- * Set configuration and store map.
- *
- * @param stdClass $layer
- * Configuration object with the options for the layer.
- * @param $map
- * Array with the current 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};
- }
- }
-
- // Extend options with the defaults.
- $this->data += $this->options_init();
- }
-
- /**
- * @return array
- * List of all projections that are supported by the layer.
- */
- public function getProjections() {
- $projections = array();
- // TODO Ignore incomplete data until cause is fixed (projection for every layer set during migration)
- if (isset($this->data['projection'])) {
- foreach ($this->data['projection'] as $projection) {
- $projections[] = openlayers_get_projection_by_identifier($projection);
- }
- }
- return $projections;
- }
-
- /**
- * Provides the default options for the layer.
- *
- * @return
- * An associative array with the default options.
- */
- function options_init() {
- return array(
- 'layer_type' => get_class($this),
- 'isBaseLayer' => TRUE,
- // TODO: Remove hard-coded resolutions
- 'projection' => array('EPSG:900913'),
- 'serverResolutions' => openlayers_get_resolutions('EPSG:900913'),
- 'resolutions' => openlayers_get_resolutions('EPSG:900913'),
- 'base_url' => NULL,
- 'transitionEffect' => 'resize',
- 'weight' => 0
- );
- }
-
- /**
- * Options form to configure layer instance options.
- *
- * @return
- * Array with form elements.
- */
- 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
- ),
- );
- }
-
- /**
- * Validate the options_form().
- *
- * @param array $default
- */
- function options_form_validate($form, &$form_state) {
-
- }
-
- /**
- * Submit the options_form().
- *
- * @param array $form
- * @param array $form_state
- */
- function options_form_submit($form, &$form_state) {
- $form_state['values']['data']['projection'] = array_keys($form_state['values']['data']['projection']);
- // TODO Resolutions should be processed only in layers
- // that provide a form field for it.
- $form_state['values']['data']['resolutions'] = array_map('floatval', array_values($form_state['values']['data']['resolutions']));
- }
-
- /**
- * Options form to configure layer-type-wide options.
- *
- * @return
- * Array with form elements.
- */
- function settings_form() {
- return array();
- }
-
- function attached() {
- return array();
- }
-
- /**
- * Render the layer and return the layer options.
- *
- * Has no return value.
- *
- * @param $map
- */
- function render(&$map) {}
-
-}
-
-/**
- * Implements hook_ctools_plugin_api().
- */
-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);
- }
-}
-
-/**
- * Implements hook_openlayers_behaviors().
- */
-function openlayers_openlayers_behaviors() {
- module_load_include('inc', 'openlayers', 'includes/openlayers.behaviors');
- return _openlayers_openlayers_behaviors();
-}
-
-/**
- * Implements hook_openlayers_layer_types().
- */
-function openlayers_openlayers_layer_types() {
- module_load_include('inc', 'openlayers', 'includes/openlayers.layer_types');
- return _openlayers_openlayers_layer_types();
-}
-
-/**
- * Implements hook_openlayers_layers().
- */
-function openlayers_openlayers_layers() {
- module_load_include('inc', 'openlayers', 'includes/openlayers.layers');
- return _openlayers_openlayers_layers();
-}
-
-/**
- * Implements hook_openlayers_projections().
- */
-function openlayers_openlayers_projections() {
- module_load_include('inc', 'openlayers', 'includes/openlayers.projections');
- return _openlayers_openlayers_projections();
-}
-
-/**
- * Implements hook_openlayers_styles().
- */
-function openlayers_openlayers_styles() {
- module_load_include('inc', 'openlayers', 'includes/openlayers.styles');
- return _openlayers_openlayers_styles();
-}
-
-/**
- * Implements hook_openlayers_maps().
- */
-function openlayers_openlayers_maps() {
- module_load_include('inc', 'openlayers', 'includes/openlayers.maps');
- return _openlayers_openlayers_maps();
-}
-
-/**
- * Implements hook_boxes_plugins().
- */
-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'
- )
- )
- );
-}
-
-/**
- * Implements hook_quicktabs_contents().
- */
-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;
-}
-
-/**
- * Implements hook_libraries_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;
-}
-
-/**
- * Implements hook_element_info().
- *
- * @return array
- */
-function openlayers_element_info() {
- return array(
- 'openlayers' => array(
- '#pre_render' => array('openlayers_element_pre_render_callback'),
- '#theme_wrappers' => array('form_element')
- )
- );
-}
-
-/**
- * Callback.
- *
- * @param $element
- * @return mixed
- */
-function openlayers_element_pre_render_callback($element) {
- if (is_string($element['#map'])) {
- $map = openlayers_map_load($element['#map']);
- $element += openlayers_render_map_data($map->data);
- }
-
- return $element;
-}
-
diff --git a/plugins/behaviors/openlayers_behavior_argparser.inc b/plugins/behaviors/openlayers_behavior_argparser.inc
deleted file mode 100644
index 302b969fe4c07abc83674cff5f6fc186b6f35c1e..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_argparser.inc
+++ /dev/null
@@ -1,42 +0,0 @@
- FALSE,
- );
- }
-
- function js_dependency() {
- return array('OpenLayers.Control.ArgParser');
- }
-
- function options_form($defaults = array()) {
- return array(
- 'anchor' => array(
- '#type' => 'checkbox',
- '#title' => t('Anchor'),
- '#description' => t('Permalink is in the form of an anchor (#) instead of a query (?).'),
- '#default_value' => (isset($defaults['anchor'])) ? $defaults['anchor'] : FALSE,
- ),
- );
- }
-
- function attached() {
- return array(
- 'js' => array(
- drupal_get_path('module', 'openlayers') . '/plugins/behaviors/openlayers_behavior_argparser.js'
- )
- );
- }
-}
diff --git a/plugins/behaviors/openlayers_behavior_argparser.js b/plugins/behaviors/openlayers_behavior_argparser.js
deleted file mode 100644
index f16bec0aea904c7db2fb65938a592db7392a3669..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_argparser.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * @file
- * JS Implementation of OpenLayers behavior.
- */
-
-/**
- * ArgParser Behavior. Implements the ArgParser OpenLayers
- * Control.
- */
-Drupal.openlayers.addBehavior('openlayers_behavior_argparser', function (data, options) {
- Drupal.openlayers.addControl(data.openlayers, 'ArgParser', options);
-});
diff --git a/plugins/behaviors/openlayers_behavior_attribution.inc b/plugins/behaviors/openlayers_behavior_attribution.inc
deleted file mode 100644
index 51995858620384224f5912dde2a14284042a124d..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_attribution.inc
+++ /dev/null
@@ -1,42 +0,0 @@
- '',
- );
- }
-
- function js_dependency() {
- return array('OpenLayers.Control.Attribution');
- }
-
- function options_form($defaults = array()) {
- return array(
- 'separator' => array(
- '#type' => 'textfield',
- '#title' => t('separator'),
- '#description' => t('For multiple layers that need attribution, provide a separation string.'),
- '#default_value' => (isset($defaults['separator'])) ? $defaults['separator'] : FALSE,
- ),
- );
- }
-
- function attached() {
- return array(
- 'js' => array(
- drupal_get_path('module', 'openlayers') . '/plugins/behaviors/openlayers_behavior_attribution.js'
- )
- );
- }
-}
diff --git a/plugins/behaviors/openlayers_behavior_attribution.js b/plugins/behaviors/openlayers_behavior_attribution.js
deleted file mode 100644
index 1be8655e27459ccef44258a55e8f3496ecd97857..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_attribution.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * @file
- * JS Implementation of OpenLayers behavior.
- */
-
-/**
- * Attribution Behavior. Implements the Attribution OpenLayers
- * Control.
- */
-Drupal.openlayers.addBehavior('openlayers_behavior_attribution', function (data, options) {
- Drupal.openlayers.addControl(data.openlayers, 'Attribution', options);
-});
diff --git a/plugins/behaviors/openlayers_behavior_boxselect.inc b/plugins/behaviors/openlayers_behavior_boxselect.inc
deleted file mode 100644
index d06aecddc7138540bfc36d7b06cb4de32260da43..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_boxselect.inc
+++ /dev/null
@@ -1,40 +0,0 @@
- '',
- );
- }
-
- function js_dependency() {
- return array(
- 'OpenLayers.Control.DrawFeature',
- 'OpenLayers.Layer.Vector',
- 'OpenLayers.Handler.RegularPolygon'
- );
- }
-
- function options_form($defaults = array()) {
- return array(
- );
- }
-
- function attached() {
- return array(
- 'js' => array(
- drupal_get_path('module', 'openlayers') . '/plugins/behaviors/openlayers_behavior_boxselect.js'
- ),
- );
- }
-}
diff --git a/plugins/behaviors/openlayers_behavior_boxselect.js b/plugins/behaviors/openlayers_behavior_boxselect.js
deleted file mode 100644
index 19404b3123fb222654e174da4a85061a0babbed3..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_boxselect.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @file
- * JS Implementation of OpenLayers behavior.
- */
-
-// Not the best, but gets around scoping;
-var selections_layer;
-
-/**
- * Box Select Behavior. Allows user to select a bounding box.
- *
- * TODO: This is currently hard coded for the center UI form.
- */
-Drupal.openlayers.addBehavior('openlayers_behavior_boxselect', function (data, options) {
- // Callback to set extent into a specific form item.
- function setRestrictedExtent(box) {
- var bounding_box = box.geometry.getBounds().toBBOX();
- jQuery('#edit-center-restrict-restrictedextent').val(bounding_box);
-
- // Check box
- if (!(jQuery('#restrictextent').attr('checked'))) {
- jQuery('#restrictextent')
- .attr('checked', 'checked')
- .trigger('change');
- }
-
- // Remove any other features.
- jQuery(selections_layer.features).each(function(index, feature) {
- if (feature != box) {
- selections_layer.features[index].destroy();
- }
- });
- }
-
- // Create layer to draw with and handle events.
- var selections_layer = new OpenLayers.Layer.Vector('Temporary Box Layer');
- var control = new OpenLayers.Control.DrawFeature(selections_layer,
- OpenLayers.Handler.RegularPolygon, {
- featureAdded: setRestrictedExtent
- }
- );
- control.handler.setOptions({
- 'keyMask': OpenLayers.Handler.MOD_SHIFT,
- 'sides': 4,
- 'irregular': true
- });
- control.events.on({'featureAdded': this.setRestrictedExtent});
- data.openlayers.addLayer(selections_layer);
- data.openlayers.addControl(control);
-
- // If there already is a value, then update the map appropriately.
- if (jQuery('#edit-center-restrict-restrictedextent').val()) {
- bounds = jQuery('#edit-center-restrict-restrictedextent').val();
- geometry = new OpenLayers.Bounds.fromString(bounds).toGeometry();
- feature = new OpenLayers.Feature.Vector(geometry);
- selections_layer.addFeatures([feature]);
- }
- control.activate();
-});
diff --git a/plugins/behaviors/openlayers_behavior_cluster.inc b/plugins/behaviors/openlayers_behavior_cluster.inc
deleted file mode 100644
index 0a14e4710a9d09ce0b094bae53c65c5aeb4c3077..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_cluster.inc
+++ /dev/null
@@ -1,292 +0,0 @@
- array(),
- 'distance' => '20',
- 'threshold' => NULL,
- 'display_cluster_numbers' => TRUE,
- 'middle_lower_bound' => '15',
- 'middle_upper_bound' => '50',
- 'low_color' => 'rgb(141, 203, 61)',
- 'low_stroke_color' => 'rgb(141, 203, 61)',
- 'low_opacity' => '0.8',
- 'low_point_radius' => '10',
- 'low_label_outline' => '1',
- 'middle_color' => 'rgb(49, 190, 145)',
- 'middle_stroke_color' => 'rgb(49, 190, 145)',
- 'middle_opacity' => '0.8',
- 'middle_point_radius' => '16',
- 'middle_label_outline' => '1',
- 'high_color' => 'rgb(35, 59, 177)',
- 'high_stroke_color' => 'rgb(35, 59, 177)',
- 'high_opacity' => '0.8',
- 'high_point_radius' => '22',
- 'high_label_outline' => '1',
- 'label_low_color' => '#000000',
- 'label_low_opacity' => '0.8',
- 'label_middle_color' => '#000000',
- 'label_middle_opacity' => '0.8',
- 'label_high_color' => '#000000',
- 'label_high_opacity' => '0.8',
- );
- }
-
- /**
- * OpenLayers library dependency.
- */
- function js_dependency() {
- return array('OpenLayers.Strategy.Cluster');
- }
-
- /**
- * Provide form for configurations per map.
- */
- function options_form($defaults = array()) {
- // Only prompt for vector layers
- $vector_layers = array();
- foreach ($this->map['layers'] as $id => $name) {
- $layer = openlayers_layer_load($id);
- if (isset($layer->data['vector']) && $layer->data['vector'] == TRUE) {
- $vector_layers[$id] = $name;
- }
- }
-
- return array(
- 'clusterlayer' => array(
- '#title' => t('Layers'),
- '#type' => 'checkboxes',
- '#options' => $vector_layers,
- '#description' => t('Select layers to cluster.'),
- '#default_value' => isset($defaults['clusterlayer']) ?
- $defaults['clusterlayer'] : array(),
- ),
- 'distance' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['distance'])) ?
- $defaults['distance'] : 20,
- '#size' => 5,
- '#title' => t('Distance'),
- '#description' => t('Pixel distance between features that should ' .
- 'be considered a single cluster'),
- ),
- 'threshold' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['threshold'])) ?
- $defaults['threshold'] : NULL,
- '#size' => 5,
- '#title' => t('Threshold'),
- '#description' => t('Optional threshold below which original ' .
- 'features will be added to the layer instead of clusters'),
- ),
- 'display_cluster_numbers' => array(
- '#type' => 'checkbox',
- '#title' => t('Display numbers in clusters?'),
- '#default_value' => isset($defaults['display_cluster_numbers']) ? $defaults['display_cluster_numbers'] : TRUE
- ),
- 'middle_lower_bound' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['middle_lower_bound'])) ?
- $defaults['middle_lower_bound'] : 15,
- '#size' => 5,
- '#title' => t('Middle lower bound'),
- '#description' => t(''),
- ),
- 'middle_upper_bound' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['middle_upper_bound'])) ?
- $defaults['middle_upper_bound'] : 50,
- '#size' => 5,
- '#title' => t('Middle upper bound'),
- '#description' => t(''),
- ),
- 'low_color' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['low_color'])) ?
- $defaults['low_color'] : 'rgb(141, 203, 61)',
- '#size' => 5,
- '#title' => t('Low color'),
- '#description' => t(''),
- ),
- 'low_stroke_color' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['low_stroke_color'])) ?
- $defaults['low_stroke_color'] : 'rgb(141, 203, 61)',
- '#size' => 5,
- '#title' => t('Low stroke color'),
- '#description' => t(''),
- ),
- 'low_opacity' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['low_opacity'])) ?
- $defaults['low_opacity'] : '0.8',
- '#size' => 5,
- '#title' => t('Low opacity'),
- '#description' => t(''),
- ),
- 'low_point_radius' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['low_point_radius'])) ?
- $defaults['low_point_radius'] : '10',
- '#size' => 5,
- '#title' => t('Low point radius'),
- '#description' => t(''),
- ),
- 'low_label_outline' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['low_label_outline'])) ?
- $defaults['low_label_outline'] : '1',
- '#size' => 5,
- '#title' => t('Low label outline'),
- '#description' => t(''),
- ),
- 'middle_color' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['middle_color'])) ?
- $defaults['middle_color'] : 'rgb(49, 190, 145)',
- '#size' => 5,
- '#title' => t('Middle color'),
- '#description' => t(''),
- ),
- 'middle_stroke_color' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['middle_stroke_color'])) ?
- $defaults['middle_stroke_color'] : 'rgb(49, 190, 145)',
- '#size' => 5,
- '#title' => t('Middle stroke color'),
- '#description' => t(''),
- ),
- 'middle_opacity' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['middle_opacity'])) ?
- $defaults['middle_opacity'] : '0.8',
- '#size' => 5,
- '#title' => t('Middle opacity'),
- '#description' => t(''),
- ),
- 'middle_point_radius' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['middle_point_radius'])) ?
- $defaults['middle_point_radius'] : '16',
- '#size' => 5,
- '#title' => t('Middle point radius'),
- '#description' => t(''),
- ),
- 'middle_label_outline' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['middle_label_outline'])) ?
- $defaults['middle_label_outline'] : '1',
- '#size' => 5,
- '#title' => t('Middle label outline'),
- '#description' => t(''),
- ),
- 'high_color' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['high_color'])) ?
- $defaults['high_color'] : 'rgb(35, 59, 177)',
- '#size' => 5,
- '#title' => t('High color'),
- '#description' => t(''),
- ),
- 'high_stroke_color' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['high_stroke_color'])) ?
- $defaults['high_stroke_color'] : 'rgb(35, 59, 177)',
- '#size' => 5,
- '#title' => t('High stroke color'),
- '#description' => t(''),
- ),
- 'high_opacity' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['high_opacity'])) ?
- $defaults['high_opacity'] : '0.8',
- '#size' => 5,
- '#title' => t('High opacity'),
- '#description' => t(''),
- ),
- 'high_point_radius' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['high_point_radius'])) ?
- $defaults['high_point_radius'] : '22',
- '#size' => 5,
- '#title' => t('High point radius'),
- '#description' => t(''),
- ),
- 'high_label_outline' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['high_label_outline'])) ?
- $defaults['high_label_outline'] : '1',
- '#size' => 5,
- '#title' => t('High label outline'),
- '#description' => t(''),
- ),
- 'label_low_color' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['label_low_color'])) ?
- $defaults['label_low_color'] : '#000000',
- '#size' => 5,
- '#title' => t('Text low color'),
- '#description' => t(''),
- ),
- 'label_low_opacity' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['label_low_opacity'])) ?
- $defaults['label_low_opacity'] : '0.8',
- '#size' => 5,
- '#title' => t('Text low opacity'),
- '#description' => t(''),
- ),
- 'label_middle_color' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['label_middle_color'])) ?
- $defaults['label_middle_color'] : '#000000',
- '#size' => 5,
- '#title' => t('Text middle color'),
- '#description' => t(''),
- ),
- 'label_middle_opacity' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['label_middle_opacity'])) ?
- $defaults['label_middle_opacity'] : '0.8',
- '#size' => 5,
- '#title' => t('Text middle opacity'),
- '#description' => t(''),
- ),
- 'label_high_color' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['label_high_color'])) ?
- $defaults['label_high_color'] : '#000000',
- '#size' => 5,
- '#title' => t('Text high color'),
- '#description' => t(''),
- ),
- 'label_high_opacity' => array(
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['label_high_opacity'])) ?
- $defaults['label_high_opacity'] : '0.8',
- '#size' => 5,
- '#title' => t('Text high opacity'),
- '#description' => t(''),
- ),
- );
- }
-
- function attached() {
- return array(
- 'js' => array(
- drupal_get_path('module', 'openlayers') . '/plugins/behaviors/openlayers_behavior_cluster.js'
- ),
- );
- }
-}
diff --git a/plugins/behaviors/openlayers_behavior_cluster.js b/plugins/behaviors/openlayers_behavior_cluster.js
deleted file mode 100644
index 549857108580c82eee36f89bbc733d2906bd9e1b..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_cluster.js
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- * @file
- * OpenLayers Behavior implementation for clustering.
- */
-
-/**
- * OpenLayers Cluster Behavior.
- */
-Drupal.openlayers.addBehavior('openlayers_behavior_cluster', function (data, options) {
- var map = data.openlayers;
- var layers = [];
- for (var i in options.clusterlayer) {
- var selectedLayer = map.getLayersBy('drupalID', options.clusterlayer[i]);
- if (selectedLayer[0] instanceof OpenLayers.Layer.Vector) {
- layers.push(selectedLayer[0]);
- }
- }
-
- // Cluster chosen layers
- jQuery(layers).each(function(index, layer){
- var cluster = new OpenLayers.Strategy.Cluster(options);
- layer.addOptions({ 'strategies': [cluster] });
- cluster.setLayer(layer);
- cluster.features = layer.features.slice();
- cluster.activate();
- cluster.cluster();
-
- var showLabel = "";
- if (options.display_cluster_numbers) {
- showLabel = "${count}";
- }
-
- // Define styleMap rules, which set pointRadius size, color and labeling
- // based on the number of points in each cluster.
- var style = new OpenLayers.Style();
-
- // Style for an individual feature (which is not clustered)
- var ruleIndividual = new OpenLayers.Rule({
- filter: new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.LESS_THAN,
- property: "count",
- value: 2
- }),
- // Apply the style you've selected for this layer for the individual points
- symbolizer: layer.styleMap.styles["default"].defaultStyle
- });
- // Define three rules to style the cluster features.
- var ruleSmall = new OpenLayers.Rule({
- filter: new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.BETWEEN,
- property: "count",
- lowerBoundary: 2,
- upperBoundary: options.middle_lower_bound
- }),
- symbolizer: {
- fillColor: options.low_color,
- strokeColor: options.low_stroke_color,
- fillOpacity: options.low_opacity,
- pointRadius: options.low_point_radius,
- label: showLabel,
- labelOutlineWidth: options.low_label_outline,
- fontColor: options.label_low_color,
- fontOpacity: options.label_low_opacity,
- fontSize: "12px"
- }
- });
- var ruleMedium = new OpenLayers.Rule({
- filter: new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.BETWEEN,
- property: "count",
- lowerBoundary: options.middle_lower_bound,
- upperBoundary: options.middle_upper_bound
- }),
- symbolizer: {
- fillColor: options.middle_color,
- strokeColor: options.middle_stroke_color,
- fillOpacity: options.middle_opacity,
- pointRadius: options.middle_point_radius,
- label: showLabel,
- labelOutlineWidth: options.middle_label_outline,
- fontColor: options.label_middle_color,
- fontOpacity: options.label_middle_opacity,
- fontSize: "12px"
- }
- });
- var ruleBig = new OpenLayers.Rule({
- filter: new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.GREATER_THAN,
- property: "count",
- value: options.middle_upper_bound
- }),
- symbolizer: {
- fillColor: options.high_color,
- strokeColor: options.high_stroke_color,
- fillOpacity: options.high_opacity,
- pointRadius: options.high_point_radius,
- label: showLabel,
- labelOutlineWidth: options.high_label_outline,
- fontColor: options.label_high_color,
- fontOpacity: options.label_high_opacity,
- fontSize: "12px"
- }
- });
- var ruleElse = new OpenLayers.Rule({
- filter: new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.EQUAL_TO,
- property: "count",
- value: undefined
- }),
- symbolizer: layer.styleMap.styles["default"].defaultStyle,
- elseFilter: true
- });
-
- style.addRules([ruleIndividual, ruleSmall, ruleMedium, ruleBig, ruleElse]);
- var styleMap = new OpenLayers.StyleMap(style);
-
- layer.styleMap = styleMap;
- layer.redraw();
- });
-});
-
-/**
- * Override of callback used by 'popup' behaviour to support clusters
- */
-Drupal.theme.openlayersPopup = function (feature) {
- if (feature.cluster) {
- var output = '';
- var visited = []; // to keep track of already-visited items
- var classes = [];
-
- for (var i = 0; i < feature.cluster.length; i++) {
- var pf = feature.cluster[i]; // pseudo-feature
- if (typeof pf.drupalFID != 'undefined') {
- var mapwide_id = feature.layer.drupalID + pf.drupalFID;
- if (mapwide_id in visited) continue;
- visited[mapwide_id] = true;
- }
-
- classes = ['openlayers-popup', 'openlayers-popup-feature'];
- if (i == 0) {
- classes.push('first');
- }
- if (i == (feature.cluster.length - 1)) {
- classes.push('last');
- }
-
- output += '
';
- }
-
- return output;
-};
-
-/**
- * OpenLayers Tooltip Behavior
- */
-Drupal.openlayers.addBehavior('openlayers_behavior_tooltip', function (data, options) {
- var map = data.openlayers;
- var layers = [];
-
- // For backwards compatiability, if layers is not
- // defined, then include all vector layers
- if (typeof options.layers == 'undefined' || options.layers.length == 0) {
- layers = map.getLayersByClass('OpenLayers.Layer.Vector');
- }
- else {
- for (var i in options.layers) {
- var selectedLayer = map.getLayersBy('drupalID', options.layers[i]);
- if (typeof selectedLayer[0] != 'undefined') {
- layers.push(selectedLayer[0]);
- }
- }
- }
-
- // if only 1 layer exists, do not add as an array. Kind of a
- // hack, see https://drupal.org/node/1393460
- if (layers.length == 1) {
- layers = layers[0];
- }
-
- // Define feature select events for selected layers.
- var popupSelect = new OpenLayers.Control.SelectFeature(layers,
- {
- hover: true,
- clickout: false,
- multiple: false,
- onSelect: function(feature) {
- // Create FramedCloud popup for tooltip.
- var output = Drupal.theme('openlayersTooltip', feature);
- if (typeof output != 'undefined') {
- popup = new OpenLayers.Popup.FramedCloud(
- 'tooltip',
- feature.geometry.getBounds().getCenterLonLat(),
- null,
- output,
- null,
- true
- );
- feature.popup = popup;
- feature.layer.map.addPopup(popup);
- Drupal.attachBehaviors();
- }
- },
- onUnselect: function(feature) {
- // Remove popup.
- if (typeof feature.popup != 'undefined') {
- feature.layer.map.removePopup(feature.popup);
- feature.popup.destroy();
- feature.popup = null;
- }
- }
- }
- );
- popupSelect.handlers['feature'].stopDown = false;
- popupSelect.handlers['feature'].stopUp = false;
-
- // Actiate the popups
- map.addControl(popupSelect);
- popupSelect.activate();
-});
diff --git a/plugins/behaviors/openlayers_behavior_touch_navigation.inc b/plugins/behaviors/openlayers_behavior_touch_navigation.inc
deleted file mode 100644
index a8065748b5a4d014ab0074b44417883f9d4e1dd1..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_touch_navigation.inc
+++ /dev/null
@@ -1,42 +0,0 @@
- FALSE,
- );
- }
-
- function js_dependency() {
- return array('OpenLayers.Control.TouchNavigation');
- }
-
- function options_form($defaults = array()) {
- return array(
- 'documentDrag' => array(
- '#type' => 'checkbox',
- '#title' => t('Document Drag'),
- '#description' => t('Allow panning of the map by dragging outside map viewport.'),
- '#default_value' => isset($defaults['documentDrag']) ? $defaults['documentDrag'] : FALSE
- ),
- );
- }
-
- function attached() {
- return array(
- 'js' => array(
- drupal_get_path('module', 'openlayers') . '/plugins/behaviors/openlayers_behavior_touch_navigation.js'
- )
- );
- }
-}
diff --git a/plugins/behaviors/openlayers_behavior_touch_navigation.js b/plugins/behaviors/openlayers_behavior_touch_navigation.js
deleted file mode 100644
index 6ad4ccf30792862529ca3c53139c8db6e60cf65e..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_touch_navigation.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * @file
- * JS Implementation of OpenLayers behavior.
- */
-
-/**
- * Touch Navigation Behavior
- */
-Drupal.openlayers.addBehavior('openlayers_behavior_touch_navigation', function (data, options) {
- options.documentDrag = !!options.documentDrag;
- Drupal.openlayers.addControl(data.openlayers, 'TouchNavigation', options);
-});
diff --git a/plugins/behaviors/openlayers_behavior_zoombox.inc b/plugins/behaviors/openlayers_behavior_zoombox.inc
deleted file mode 100644
index e697048074458d2faa08916e2a5c8b4a28d54b96..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_zoombox.inc
+++ /dev/null
@@ -1,27 +0,0 @@
- '',
- );
- }
-
- function attached() {
- return array(
- 'js' => array(
- drupal_get_path('module', 'openlayers') . '/plugins/behaviors/openlayers_behavior_zoombox.js'
- )
- );
- }
-}
diff --git a/plugins/behaviors/openlayers_behavior_zoombox.js b/plugins/behaviors/openlayers_behavior_zoombox.js
deleted file mode 100644
index bb468d601db81b605f74b720701c5c472759367a..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_zoombox.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @file
- * JS Implementation of OpenLayers behavior.
- */
-
-/**
- * Zoom Box Behavior
- */
-Drupal.openlayers.addBehavior('openlayers_behavior_zoombox', function (data, options) {
- Drupal.openlayers.addControl(data.openlayers, 'ZoomBox');
-});
diff --git a/plugins/behaviors/openlayers_behavior_zoompanel.inc b/plugins/behaviors/openlayers_behavior_zoompanel.inc
deleted file mode 100644
index 0db5958b936029be130515d1515652d501236ccb..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_zoompanel.inc
+++ /dev/null
@@ -1,27 +0,0 @@
- '',
- );
- }
-
- function attached() {
- return array(
- 'js' => array(
- drupal_get_path('module', 'openlayers') . '/plugins/behaviors/openlayers_behavior_zoompanel.js'
- )
- );
- }
-}
diff --git a/plugins/behaviors/openlayers_behavior_zoompanel.js b/plugins/behaviors/openlayers_behavior_zoompanel.js
deleted file mode 100644
index 2018cf701306f83d243138e9f411a5a9f4c19b50..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_zoompanel.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @file
- * JS Implementation of OpenLayers behavior.
- */
-
-/**
- * ZoomPanel Behavior
- */
-Drupal.openlayers.addBehavior('openlayers_behavior_zoompanel', function (data, options) {
- Drupal.openlayers.addControl(data.openlayers, 'ZoomPanel');
-});
diff --git a/plugins/behaviors/openlayers_behavior_zoomtolayer.inc b/plugins/behaviors/openlayers_behavior_zoomtolayer.inc
deleted file mode 100644
index 73075a67ca8a21aaf8fafa2e132ee0e0982bfb57..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_zoomtolayer.inc
+++ /dev/null
@@ -1,53 +0,0 @@
- '5',
- 'zoomtolayer_scale' => 1,
- );
- }
-
- function options_form($defaults = array()) {
- return array(
- 'zoomtolayer' => array(
- '#type' => 'checkboxes',
- '#options' => $this->map['layers'],
- '#description' => t('Select layer(s) to which to zoom when the map is loaded.'),
- '#default_value' => isset($defaults['zoomtolayer']) ? $defaults['zoomtolayer'] : array(),
- ),
- 'point_zoom_level' => array(
- '#title' => t('Point Zoom Level'),
- '#type' => 'textfield',
- '#default_value' => (isset($defaults['point_zoom_level'])) ?
- $defaults['point_zoom_level'] : 5,
- '#size' => 5,
- ),
- 'zoomtolayer_scale' => array(
- '#title' => t('Zoom to Layer Scale'),
- '#type' => 'textfield',
- '#size' => 5,
- '#description' => t('Additional scaling to apply to the calculated bounds before zooming. See OpenLayers docs.'),
- '#default_value' => isset($defaults['zoomtolayer_scale']) ? $defaults['zoomtolayer_scale'] : 1
- ),
- );
- }
-
- function attached() {
- return array(
- 'js' => array(
- drupal_get_path('module', 'openlayers') . '/plugins/behaviors/openlayers_behavior_zoomtolayer.js'
- )
- );
- }
-}
diff --git a/plugins/behaviors/openlayers_behavior_zoomtolayer.js b/plugins/behaviors/openlayers_behavior_zoomtolayer.js
deleted file mode 100644
index db8506b03435b4c1ecf73700aab9dd5109594dbf..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_zoomtolayer.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * @file
- * JS Implementation of OpenLayers behavior.
- */
-
-/**
- * OpenLayers Zoom to Layer Behavior.
- *
- * Zooms to the data extent of the selected layers.
- */
-Drupal.openlayers.addBehavior('openlayers_behavior_zoomtolayer', function (data, options) {
- var map = data.openlayers;
- var zoomtolayer_scale = parseInt(options.zoomtolayer_scale, 10);
- var point_zoom_level = parseInt(options.point_zoom_level, 10);
-
- var layers = map.getLayersBy('drupalID', {
- test: function(id) {
- for (var i in options.zoomtolayer) {
- if (options.zoomtolayer[i] == id) {
- return true;
- }
- }
- return false;
- }
- });
-
- // Combined extent of all layers.
- var fullExtent = undefined;
-
- // Go through selected layers to get full extent.
- jQuery(layers).each(function(index, layer) {
- accumulate_extent(layer);
-
- if (layer instanceof OpenLayers.Layer.Vector) {
- // This should not register the handler in case no data is available.
- if (layer.getDataExtent() === null) {
- // Try again to determine the extent after layer has loaded.
- layer.events.register('loadend', layer, handle_loadend_once);
- }
- }
- });
- // Zoom if some data was sychronously loaded.
- show_extent_if_determined();
-
- /**
- * Handler for loadend event of layer that is still loading.
- */
- function handle_loadend_once(event) {
- var layer = event.object;
- layer.events.unregister('loadend', layer, handle_loadend_once);
-
- accumulate_extent(layer);
- // Zoom if bound have been determined.
- show_extent_if_determined();
- }
-
- /**
- * Add data extent of layer to total data extent.
- */
- function accumulate_extent(layer){
- var layerextent = layer.getDataExtent();
- if (fullExtent instanceof OpenLayers.Bounds) {
- fullExtent.extend(layerextent);
- }
- else if (layerextent instanceof OpenLayers.Bounds) {
- fullExtent = layerextent;
- }
- }
-
- /**
- * Zooms map if bounds are at least partially known.
- */
- function show_extent_if_determined(){
- if(fullExtent instanceof OpenLayers.Bounds){
- if (fullExtent.getWidth()===0 && fullExtent.getHeight()===0) {
- // If extent is a single point,
- // zoom in with point_zoom_level option.
- map.setCenter(fullExtent.getCenterLonLat(), point_zoom_level)
- } else {
- var scaled = fullExtent.scale(zoomtolayer_scale);
- map.zoomToExtent(scaled);
- if(!map.getExtent().contains(scaled)){
- // OpenLayers silently ignores zoom in case the date line would need
- // to be displayed more than once. Move map to where the data is at
- // least.
- map.setCenter(scaled.getCenterLonLat());
- }
- }
- }
- }
-});
diff --git a/plugins/behaviors/openlayers_behavior_zoomtomaxextent.inc b/plugins/behaviors/openlayers_behavior_zoomtomaxextent.inc
deleted file mode 100644
index f0c050cae13ac995a28b002988ecc92cdf1cf350..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_zoomtomaxextent.inc
+++ /dev/null
@@ -1,27 +0,0 @@
- '',
- );
- }
-
- function attached() {
- return array(
- 'js' => array(
- drupal_get_path('module', 'openlayers') . '/plugins/behaviors/openlayers_behavior_zoomtomaxextent.js'
- )
- );
- }
-}
diff --git a/plugins/behaviors/openlayers_behavior_zoomtomaxextent.js b/plugins/behaviors/openlayers_behavior_zoomtomaxextent.js
deleted file mode 100644
index 24f3e058fb45ed0423e8eec20df09b066a1313c7..0000000000000000000000000000000000000000
--- a/plugins/behaviors/openlayers_behavior_zoomtomaxextent.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * @file
- * JS Implementation of OpenLayers behavior.
- */
-
-/**
- * Zoom Max Extent Behavior
- */
-Drupal.openlayers.addBehavior('openlayers_behavior_zoomtomaxextent', function (data, options) {
- options.allowSelection = options.allowSelection || true;
- var panel = Drupal.openlayers.addControl(data.openlayers, 'Panel', options);
-
- var button = new OpenLayers.Control.ZoomToMaxExtent();
- panel.addControls([button]);
-});
diff --git a/plugins/boxes/openlayers_simple.inc b/plugins/boxes/openlayers_simple.inc
deleted file mode 100644
index 5126f632eabfdd6454c62c066ffb8d4d18741210..0000000000000000000000000000000000000000
--- a/plugins/boxes/openlayers_simple.inc
+++ /dev/null
@@ -1,47 +0,0 @@
- ''
- );
- }
-
- /**
- * Implementation of boxes_content::options_form().
- */
- public function options_form(&$form_state) {
- $form = array();
- // Map objects
- $form['map'] = array(
- '#type' => 'select',
- '#title' => t('Map'),
- '#description' => t('This is map that will be used to render the view.'),
- '#options' => openlayers_map_options(),
- '#default_value' => $this->options['map'] ?
- $this->options['map'] : variable_get('openlayers_default_map', 'default'),
- );
- return $form;
- }
-
- /**
- * Implementation of boxes_content::options_form().
- */
- public function render() {
- $title = isset($this->title) ? check_plain($this->title) : NULL;
- $map = openlayers_map_load($this->options['map']);
-
- return array(
- 'delta' => $this->delta, // Crucial.
- 'title' => $title,
- 'subject' => $title,
- 'content' => openlayers_render_map($map, $map->name)
- );
- }
-}
diff --git a/plugins/content_types/icon_openlayers_map.png b/plugins/content_types/icon_openlayers_map.png
deleted file mode 100644
index 21616fc244b733dc37afd008df1a9d283743f80f..0000000000000000000000000000000000000000
Binary files a/plugins/content_types/icon_openlayers_map.png and /dev/null differ
diff --git a/plugins/content_types/openlayers_map.inc b/plugins/content_types/openlayers_map.inc
deleted file mode 100644
index 068955ce34fbf0483e583b6e63064d391a4094c3..0000000000000000000000000000000000000000
--- a/plugins/content_types/openlayers_map.inc
+++ /dev/null
@@ -1,66 +0,0 @@
- t('OpenLayers Map'),
- 'content type' => 'openlayers_openlayers_map_content_type_content_types',
- 'render callback' => 'openlayers_map_content_type_render',
- );
-}
-
-/**
- * Return all content types available.
- */
-function openlayers_openlayers_map_content_type_content_types($plugin) {
- $types = array();
- $maps = openlayers_maps();
-
- foreach ($maps as $map) {
- $types[$map->name] = array(
- 'map' => $map->name,
- 'title' => $map->title,
- 'description' => $map->description,
- 'category' => t('OpenLayers Maps'),
- 'icon' => 'icon_openlayers_map.png',
- );
- }
-
- return $types;
-}
-
-/**
- * Run-time rendering of the body of the block.
- *
- * @param $subtype
- * @param $conf
- * Configuration as done at admin time.
- * @param $args
- * @param $context
- * Context - in this case we don't have any.
- *
- * @return
- * An object with at least title and content members.
- */
-function openlayers_map_content_type_render($subtype, $conf, $args, $context) {
- $map = openlayers_map_load($subtype);
-
- $block = new stdClass();
- $block->title = $map->title;
- $block->content = openlayers_render_map($map);
-
- return $block;
-}
-
-/**
- * Empty form so we can have the default override title.
- */
-function openlayers_openlayers_map_content_type_edit_form($form, &$form_state) {
- // Does nothing!
- return $form;
-}
diff --git a/plugins/layer_types/openlayers_layer_type_bing.inc b/plugins/layer_types/openlayers_layer_type_bing.inc
deleted file mode 100644
index 3c542a2bdf49cdfa400160fd6cd3c96bcbba1b68..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_bing.inc
+++ /dev/null
@@ -1,104 +0,0 @@
-language;
- $culture = variable_get('openlayers_layers_bing_language', '');
-
- // Bing does not provide imagery for a language without a country code.
- // Best guess is to double-up on the language code ('fr' becomes 'fr-FR').
- // This methods succeeds for all but Dutch (Belgium) 'nl-BE'.
- // See http://msdn.microsoft.com/en-us/library/hh441729.aspx
- $lang = $lang . '-' . strtoupper ($lang);
-
- return array(
- 'layer_handler' => 'bing',
- 'key' => variable_get('openlayers_layers_bing_api', ''),
- 'type' => 'Road',
- 'culture' => $culture == '' ? $lang : $culture,
- ) + parent::options_init();
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- $warning = (!variable_get('openlayers_layers_bing_api', FALSE)) ?
- array('#value' => t('WARNING: Your Bing API key is not set.
- Map including Bing layers will break until it is set correctly.')
- ) : NULL;
-
- $bing_layer_types = array(
- 'Road' => 'Road',
- 'AerialWithLabels' => 'Hybrid',
- 'Aerial' => 'Aerial',
- );
-
- return array(
- 'type' => array(
- '#title' => t('Bing Layer Type'),
- '#type' => 'select',
- '#default_value' => isset($this->data['type']) ?
- $this->data['type'] : 'Road',
- '#options' => $bing_layer_types
- ),
- $warning
- );
- }
-
- /**
- * Layer-type-wide settings form
- */
- function settings_form() {
- return array(
- 'openlayers_layers_bing_api' => array(
- '#type' => 'textfield',
- '#title' => t('Bing API Key'),
- '#default_value' => variable_get('openlayers_layers_bing_api', ''),
- '#description' => t('Get a MS Bing API Key',
- array('@microsoft' => 'http://bingmapsportal.com'))
- ),
- 'openlayers_layers_bing_language' => array(
- '#type' => 'textfield',
- '#title' => t('Culture'),
- '#description' => t(' The culture parameter provides the strings in
- the language of the culture for geographic place names, map labels,
- and route instructions. By default, Bing Maps REST Services will
- determine the culture automatically. Only use this is you
- want to force a specific language. Please see
- this list of supported culture codes.',
- array('!url' => 'http://msdn.microsoft.com/en-us/library/hh441729.aspx')
- ),
- '#default_value' => variable_get('openlayers_layers_bing_language', ''),
- ),
- );
-
- }
-
- /**
- * Render.
- */
- function render(&$map) {
- static $bing_maps_included;
-
- if (!isset($bing_maps_included)) {
- drupal_add_js(drupal_get_path('module', 'openlayers') .
- '/plugins/layer_types/openlayers_layer_type_bing.js');
- $bing_maps_included = TRUE;
- }
- }
-}
diff --git a/plugins/layer_types/openlayers_layer_type_bing.js b/plugins/layer_types/openlayers_layer_type_bing.js
deleted file mode 100644
index 9bbc6d2e6a91c5bad8ee8118ec3975228e984205..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_bing.js
+++ /dev/null
@@ -1,15 +0,0 @@
-
-/**
- * Process MS Bing Layers
- *
- * @param layerOptions
- * Object of options.
- * @param mapid
- * Map ID.
- * @return
- * Valid OpenLayers layer.
- */
-Drupal.openlayers.layer.bing = function(title, map, options) {
- options.projection = new OpenLayers.Projection(options.projection);
- return new OpenLayers.Layer.Bing(options);
-};
diff --git a/plugins/layer_types/openlayers_layer_type_cloudmade.inc b/plugins/layer_types/openlayers_layer_type_cloudmade.inc
deleted file mode 100644
index 9c606d8c4c16d220fbe4842760be3177c500cdfb..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_cloudmade.inc
+++ /dev/null
@@ -1,90 +0,0 @@
- 'cloudmade',
- 'key' => variable_get('openlayers_layers_cloudmade_api', ''),
- ) + parent::options_init();
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- $warning = (!variable_get('openlayers_layers_cloudmade_js', FALSE) ||
- !variable_get('openlayers_layers_cloudmade_api', FALSE)) ?
- array(
- '#value' => t('WARNING: Your CloudMade API key or
- Javascript location is not set. Map including CloudMade layers
- will break until they are set correctly.')
- )
- : NULL;
- return array(
- 'styleId' => array(
- '#type' => 'textfield',
- '#title' => t('Style ID'),
- '#description' => t('Enter the numeric Style ID for a Map Style from CloudMade. You can usually find the Style ID in the lower right hand corner of each Map Style box.'),
- '#default_value' => isset($this->data['styleId']) ?
- $this->data['styleId'] : ''
- ),
- $warning
- );
- }
-
- /**
- * Layer-type-wide settings form
- */
- function settings_form() {
- return array(
- 'openlayers_layers_cloudmade_api' => array(
- '#type' => 'textfield',
- '#title' => t('CloudMade API Key'),
- '#default_value' => variable_get('openlayers_layers_cloudmade_api', ''),
- '#description' => t('Get a CloudMade account and API Key',
- array('@cloudmade' => 'http://cloudmade.com/user/show'))
- ),
- 'openlayers_layers_cloudmade_js' => array(
- '#type' => 'textfield',
- '#title' => t('CloudMade Javascript Location'),
- '#default_value' => variable_get('openlayers_layers_cloudmade_js', ''),
- '#description' => t('The Drupal path or full URL to the location of the ' .
- 'Cloudmade OpenLayers Javascript library',
- array('@url' => 'http://developers.cloudmade.com/projects/show/openlayers-api')),
- ),
- );
- }
-
- /**
- * Render.
- */
- function render(&$map) {
- static $cloudmade_maps_included;
-
- if (!isset($cloudmade_maps_included)) {
- drupal_add_js(drupal_get_path('module', 'openlayers') .
- '/plugins/layer_types/openlayers_layer_type_cloudmade.js');
- $path = variable_get('openlayers_layers_cloudmade_js', '');
- if (valid_url($path, TRUE)) {
- // TODO: could be collapsed, removing the if-else
- drupal_add_js($path, 'external');
- }
- else {
- drupal_add_js($path);
- }
- $cloudmade_maps_included = TRUE;
- }
- }
-}
diff --git a/plugins/layer_types/openlayers_layer_type_cloudmade.js b/plugins/layer_types/openlayers_layer_type_cloudmade.js
deleted file mode 100644
index 9a04b983f644291bb1dc09216627ad29c6fce131..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_cloudmade.js
+++ /dev/null
@@ -1,14 +0,0 @@
-
-/**
- * Process CloudMade Layers
- *
- * @param layerOptions
- * Object of options.
- * @param map
- * Reference to OpenLayers object.
- * @return
- * Valid OpenLayers layer.
- */
-Drupal.openlayers.layer.cloudmade = function(title, map, options) {
- return new OpenLayers.Layer.CloudMade(title, options);
-};
diff --git a/plugins/layer_types/openlayers_layer_type_dummy.inc b/plugins/layer_types/openlayers_layer_type_dummy.inc
deleted file mode 100644
index 2283fc5f54a1bba2cd0ef013f67693706a06854a..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_dummy.inc
+++ /dev/null
@@ -1,37 +0,0 @@
- 'dummy',
- 'vector' => TRUE,
- ) + parent::options_init();
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- return array();
- }
-
- /**
- * Render.
- */
- function render(&$map) {
- drupal_add_js(drupal_get_path('module', 'openlayers') .
- '/plugins/layer_types/openlayers_layer_type_dummy.js');
- }
-}
-
diff --git a/plugins/layer_types/openlayers_layer_type_dummy.js b/plugins/layer_types/openlayers_layer_type_dummy.js
deleted file mode 100644
index f188c15c9f875f37a5b6a8a72fa802a75a871c46..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_dummy.js
+++ /dev/null
@@ -1,7 +0,0 @@
-
-/**
- * OpenLayers Dummy Layer Handler
- */
-Drupal.openlayers.layer.dummy = function(title, map, options) {
- return new OpenLayers.Layer(title, options);
-};
diff --git a/plugins/layer_types/openlayers_layer_type_geojson.inc b/plugins/layer_types/openlayers_layer_type_geojson.inc
deleted file mode 100644
index 070e18179854829037efe659682e7210603eab0e..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_geojson.inc
+++ /dev/null
@@ -1,116 +0,0 @@
- 'openlayers_layer_type_geojson',
- 'layer_handler' => 'geojson',
- 'projection' => array('EPSG:4326'),
- 'serverResolutions' => openlayers_get_resolutions('EPSG:4326'),
- 'isBaseLayer' => FALSE,
- 'vector' => TRUE,
- 'geojson_data' => '',
- 'useBBOX' => FALSE,
- ) + parent::options_init();
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- return array(
- 'url' => array(
- '#type' => 'textfield',
- '#title' => t('URL'),
- '#description' => t('The URL of the GeoJSON file. This can be a Drupal path as well, as it will get run through the Drupal url() function.',
- array('!url' => 'http://api.drupal.org/api/drupal/includes--common.inc/function/url')),
- '#maxlength' => 1024,
- '#default_value' => isset($this->data['url']) ? $this->data['url'] : '',
- ),
- 'useBBOX' => array(
- '#type' => 'checkbox',
- '#title' => t('Use Bounding Box Strategy'),
- '#description' => t('Bounding Box strategy will add a query string onto the GeoJSON URL, which means that only data in the viewport of the map will be loaded. This can be helpful if you have lots of data coming from the feed.'),
- '#default_value' => isset($this->data['useBBOX']) ? $this->data['useBBOX'] : FALSE,
- ),
- //see http://dev.openlayers.org/docs/files/OpenLayers/Strategy/BBOX-js.html#OpenLayers.Strategy.BBOX.resFactor
- 'resFactor' => array(
- '#type' => 'textfield',
- '#title' => t('Bounding Box resFactor'),
- '#description' => t('Used to determine when previously requested features are invalid (set to 1 if unsure).
- The resFactor will be compared to the resolution of the previous request to the current map resolution.
- If resFactor > (old / new) and 1/resFactor < (old / new).
-
-
If you set a resFactor of 1, data will be requested every time the resolution changes.
-
If you set a resFactor of 3, data will be requested if the old resolution is 3 times the new, or if the new is 3 times the old.
-
If the old bounds do not contain the new bounds new data will always be requested (with or without considering resFactor).
-
- '),
- '#default_value' => isset($this->data['resFactor']) ? $this->data['resFactor'] : 1
- ),
- //see http://dev.openlayers.org/docs/files/OpenLayers/Strategy/BBOX-js.html#OpenLayers.Strategy.BBOX.ratio
- 'ratio' => array(
- '#type' => 'textfield',
- '#title' => t('Bounding Box ratio'),
- '#description' => t('The ratio of the data bounds to the viewport bounds (in each dimension). Default is 3.'),
- '#default_value' => isset($this->data['ratio']) ? $this->data['ratio'] : 3
- ),
- 'preload' => array(
- '#type' => 'checkbox',
- '#title' => t('Preload layer'),
- '#description' => t('Load data before layer is made visible. Useful when you want to avoid having to wait for an Ajax call to load the data'),
- '#default_value' => isset($this->data['preload']) ? $this->data['preload'] : FALSE,
- ),
- 'useScript' => array(
- '#type' => 'checkbox',
- '#title' => t('Use Script Method'),
- '#description' => t('Avoid 405 error and XSS issues load data from another server with ajax'),
- '#default_value' => isset($this->data['useScript']) ? $this->data['useScript'] : FALSE,
- ),
- 'callbackKey' => array(
- '#type' => 'textfield',
- '#title' => t('Script Callback Key'),
- '#description' => t('Key returned by callback along with geoJSON'),
- '#default_value' => isset($this->data['callbackKey']) ? $this->data['callbackKey'] : NULL
- ),
- 'geojson_data' => array(
- '#type' => 'textarea',
- '#title' => t('GeoJSON Data'),
- '#description' => t('Paste raw GeoJSON data here. It is better to use a URL. This is provided for very simple use cases like one or two features. If there is data here, it will override the URL above.'),
- '#default_value' => isset($this->data['geojson_data']) ? $this->data['geojson_data'] : '',
- ),
- );
- }
-
- /**
- * Render.
- */
- function render(&$map) {
- if (isset($map['views_arguments'])) {
- foreach ((array) $map['views_arguments'] as $name => $value) {
- $this->data['url'] = str_replace("[{$name}]", $value, $this->data['url']);
- }
- }
-
- if (module_exists('facetapi') && (isset($_GET['f']))) {
- $this->data['url'] = !empty($this->data['url']) ? file_create_url($this->data['url'], array('query' => array('f' => $_GET['f']))) : '';
- }
- else {
- $this->data['url'] = !empty($this->data['url']) ? file_create_url($this->data['url']) : '';
- }
-
- drupal_add_js(drupal_get_path('module', 'openlayers')
- . '/plugins/layer_types/openlayers_layer_type_geojson.js');
- }
-}
diff --git a/plugins/layer_types/openlayers_layer_type_geojson.js b/plugins/layer_types/openlayers_layer_type_geojson.js
deleted file mode 100644
index 569de80d189c4827dba6ab096f4d90abad86b956..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_geojson.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * @file
- * Layer handler for GeoJSON layers
- */
-
-/**
- * Openlayer layer handler for KML layer
- */
-Drupal.openlayers.layer.geojson = function(title, map, options) {
- var features = null;
- options.projection = new OpenLayers.Projection(options.projection);
- options.styleMap = Drupal.openlayers.getStyleMap(map, options.drupalID);
-
- // GeoJSON Projection handling
- var geojson_options = {
- 'internalProjection': new OpenLayers.Projection(map.projection),
- 'externalProjection': options.projection
- };
-
- // If GeoJSON data is provided with the layer, use that. Otherwise
- // check if BBOX, then finally use AJAX method.
- if (options.geojson_data) {
- var layer = new OpenLayers.Layer.Vector(title, options);
-
- // Read data in.
- features = new OpenLayers.Format.GeoJSON(geojson_options).read(options.geojson_data);
- if (features) {
- // If not array (ie only one feature)
- if (features.constructor != Array) {
- features = [features];
- }
- }
-
- // Add features, if needed
- if (features) {
- layer.addFeatures(features);
- layer.events.triggerEvent('loadend');
- }
- }
- else {
- // @todo Add more strategies. Paging strategy would be really interesting
- // to use with views_geojson.
- // @see http://dev.openlayers.org/releases/OpenLayers-2.12/doc/apidocs/files/OpenLayers/Strategy/Paging-js.html
- if (options.useBBOX) {
- // BBOX strategy.
- // @see http://dev.openlayers.org/releases/OpenLayers-2.12/doc/apidocs/files/OpenLayers/Strategy/BBOX-js.html
- var strategy = new OpenLayers.Strategy.BBOX(options);
- /*
- * We override the triggerRead of the strategy so we can add a zoom=thecurrentzoomlevel in the URL
- * This is used by the geocluster module http://drupal.org/project/geocluster
- */
- strategy.triggerRead =
- function(options) {
- if (this.response && !(options && options.noAbort === true)) {
- this.layer.protocol.abort(this.response);
- this.layer.events.triggerEvent("loadend");
- }
- this.layer.events.triggerEvent("loadstart");
- options.params = new Array();
- options.params['zoom'] = options.object.map.zoom;
- this.response = this.layer.protocol.read(
- OpenLayers.Util.applyDefaults({
- filter: this.createFilter(),
- callback: this.merge,
- scope: this
- }, options));
- };
- options.strategies = [strategy];
- }
- else {
- // Fixed strategy.
- // @see http://dev.openlayers.org/releases/OpenLayers-2.12/doc/apidocs/files/OpenLayers/Strategy/Fixed-js.html
- if (options.preload) {
- options.strategies = [new OpenLayers.Strategy.Fixed({preload: true})];
- }
- else {
- options.strategies = [new OpenLayers.Strategy.Fixed()];
- }
- }
- if(options.useScript){
- //use Script protocol to get around xss issues and 405 error
- options.protocol = new OpenLayers.Protocol.Script({
- url: options.url,
- callbackKey: options.callbackKey,
- callbackPrefix: "callback:",
- filterToParams: function(filter, params) {
- // example to demonstrate BBOX serialization
- if (filter.type === OpenLayers.Filter.Spatial.BBOX) {
- params.bbox = filter.value.toArray();
- if (filter.projection) {
- params.bbox.push(filter.projection.getCode());
- }
- }
- return params;
- }
- });
- }
- else{
- options.protocol = new OpenLayers.Protocol.HTTP({
- url: options.url,
- format: new OpenLayers.Format.GeoJSON()
- });
- }
- var layer = new OpenLayers.Layer.Vector(title, options);
- }
-
- return layer;
-};
diff --git a/plugins/layer_types/openlayers_layer_type_google.inc b/plugins/layer_types/openlayers_layer_type_google.inc
deleted file mode 100644
index f4e962862eb5e5387c4bedcf8aff5d48196047af..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_google.inc
+++ /dev/null
@@ -1,161 +0,0 @@
- 'google',
- 'animationEnabled' => TRUE,
- 'sphericalMercator' => TRUE,
- 'numZoomLevels' => 21
- ) + parent::options_init();
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- $google_layer_types = array(
- 'hybrid' => 'Hybrid',
- 'normal' => 'Normal',
- 'satellite' => 'Satellite',
- 'physical' => 'Physical',
- );
- return array(
- 'type' => array(
- '#title' => t('Google Layer Type'),
- '#type' => 'select',
- '#default_value' => isset($this->data['type']) ? $this->data['type'] : 'normal',
- '#options' => $google_layer_types
- ),
- 'numZoomLevels' => array(
- '#type' => 'textfield',
- '#title' => t('Number of Zoom Levels'),
- '#description' => t('Satellite and hybrid maps are occasionally
- unavailable at higher zoom levels.'),
- '#default_value' => isset($this->data['numZoomLevels']) ?
- $this->data['numZoomLevels'] : '21'
- ),
- 'animationEnabled' => array(
- '#type' => 'checkbox',
- '#title' => t('Animation Enabled'),
- '#description' => t('This enables the Google Maps API zooming animation.
- If you are having issues with your Google layer, it may be helpful
- to turn this off.'),
- '#default_value' => isset($this->data['animationEnabled']) ?
- $this->data['animationEnabled'] : TRUE
- ),
- );
- }
-
- /**
- * Layer-type-wide settings form
- */
- function settings_form() {
- return array(
- 'openlayers_google_version' => array(
- '#type' => 'select',
- '#title' => t('Google Maps API version'),
- '#description' => t('If you use Google Maps v3, an API key is not necessary.'),
- '#options' => array(
- '2' => t('v2'),
- '3.5' => t('v3.5'),
- ),
- '#default_value' => variable_get('openlayers_google_version', '3.5'),
- ),
- 'openlayers_layers_google_mapdomain' => array(
- '#type' => 'select',
- '#options' => array(
- 'maps.google.com' => 'maps.google.com',
- 'maps.googleapis.com' => 'maps.googleapis.com',
- ),
- '#title' => t('Google map default domain'),
- '#default_value' => variable_get('openlayers_layers_google_mapdomain', 'maps.google.com'),
- '#description' => t('Select the Google Map default domain. maps.googleapis.com is cookie-free.')
- ),
- 'openlayers_layers_google_api' => array(
- '#type' => 'textfield',
- '#title' => t('Google API Key'),
- '#default_value' => variable_get('openlayers_layers_google_api', ''),
- '#description' => t('Obtain an API key from Google for your domain',
- array('@google' => 'http://code.google.com/apis/maps/signup.html'))
- ),
- 'openlayers_layers_google_language' => array(
- '#type' => 'textfield',
- '#title' => t('Language'),
- '#description' => t('This will set the language used
- for the interface (like attribution) as well as tiles,
- as supported by Google. By default, Google Map API will
- determine the language automatically. Only use this is you
- want to force a specific language. Please see
- this list of languages.',
- array('!url' => 'http://sites.google.com/site/tomihasa/google-language-codes')
- ),
- '#default_value' => variable_get('openlayers_layers_google_language', ''),
- ),
- 'openlayers_layers_google_libraries' => array(
- '#type' => 'textfield',
- '#title' => t('Google Maps Libraries'),
- '#description' => t('Insert name of libraries delemited by comma without whitespaces.
- This will determine which libraries will be included in Google Map API v3 js file.'
- ),
- '#default_value' => variable_get('openlayers_layers_google_libraries', ''),
- '#states' => array(
- // Show the settings if 'openlayers_google_version' has been selected for '3.5'.
- 'visible' => array(
- ':input[name="openlayers_layer_type_google[settings][openlayers_google_version]"]' => array('value' => '3.5'),
- ),
- ),
- ),
- );
- }
-
- /**
- * Render.
- */
- function render(&$map) {
- global $language;
- static $google_maps_included;
-
- if (!isset($google_maps_included)) {
- // Include files.
- drupal_add_js(drupal_get_path('module', 'openlayers') .
- '/plugins/layer_types/openlayers_layer_type_google.js');
-
- $mapdomain = variable_get('openlayers_layers_google_mapdomain', 'maps.google.com');
- $version = variable_get('openlayers_google_version', '3.5');
-
- if ($version == '2') {
- // Create URL for google include
- $url = '//' . $mapdomain . '/maps?file=api&sensor=false&v=' . $version;
- $key = variable_get('openlayers_layers_google_api', variable_get('googlemap_api_key', ''));
- $url .= !empty($key) ? '&key=' . $key : '';
- }
- else {
- // Create URL for google include
- $url = '//' . $mapdomain . '/maps/api/js?sensor=false&v=' . $version;
- }
-
- $lang = variable_get('openlayers_layers_google_language', '');
- $lang == '' ? $language->language : $lang;
- // Google v2 uses hl and v3 uses language
- $url .= !empty($lang) ? '&hl=' . $lang : '';
- $url .= !empty($lang) ? '&language=' . $lang : '';
-
- $libraries = variable_get('openlayers_layers_google_libraries', '');
- $url .= !empty($libraries) ? '&libraries=' . $libraries : '';
-
- drupal_add_js($url, 'external');
- $google_maps_included = TRUE;
- }
- }
-}
diff --git a/plugins/layer_types/openlayers_layer_type_google.js b/plugins/layer_types/openlayers_layer_type_google.js
deleted file mode 100644
index c681f04fb1505e0b93f42887d1fc67c4e016ab1b..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_google.js
+++ /dev/null
@@ -1,25 +0,0 @@
-
-/**
- * Process Google Layers
- *
- * @param layerOptions
- * Object of options.
- * @param map
- * Reference to OpenLayers object.
- * @return
- * Valid OpenLayers layer.
- */
-Drupal.openlayers.layer.google = function(title, map, options) {
- // if G_ vars exists we're using gmap v2
- var google_type_map = {
- 'normal': window['G_NORMAL_MAP'] || null,
- 'satellite': window['G_SATELLITE_MAP'] || google.maps.MapTypeId.SATELLITE,
- 'hybrid': window['G_HYBRID_MAP'] || google.maps.MapTypeId.HYBRID,
- 'physical': window['G_PHYSICAL_MAP'] || google.maps.MapTypeId.TERRAIN
- };
-
- options.type = google_type_map[options.type];
- options.projection = new OpenLayers.Projection(options.projection);
-
- return new OpenLayers.Layer.Google(title, options);
-};
diff --git a/plugins/layer_types/openlayers_layer_type_gpx.inc b/plugins/layer_types/openlayers_layer_type_gpx.inc
deleted file mode 100644
index 8ed42a7ee70d275e42b1ced489c1eaeb1e182fd7..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_gpx.inc
+++ /dev/null
@@ -1,190 +0,0 @@
- 'gpx',
- 'projection' => array('EPSG:4326'),
- 'resolutions' => openlayers_get_resolutions('EPSG:4326'),
- 'serverResolutions' => openlayers_get_resolutions('EPSG:4326'),
- 'maxExtent' => openlayers_get_extent('EPSG', '4326'),
- 'isBaseLayer' => FALSE,
- 'vector' => TRUE,
- 'formatOptions' => array(
- 'extractWaypoints' => TRUE,
- 'extractRoutes' => TRUE,
- 'extractTracks' => TRUE,
- 'extractAttributes' => TRUE,
- ),
- 'file' => '',
- ) + parent::options_init();
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- return array(
- 'method' => array(
- '#type' => 'select',
- '#options' => array(
- '' => 'Choose the method',
- 'url' => 'Provides an URL',
- 'file' => 'Upload a file',
- 'raw' => 'Write GPX'
- ),
- '#default_value' => isset($this->data['method']) ?
- $this->data['method'] : '',
- ),
- 'url' => array(
- '#type' => 'textfield',
- '#title' => t('URL'),
- '#description' => t('The URL of the GPX file.'),
- '#maxlength' => 2083,
- '#default_value' => isset($this->data['url']) ?
- $this->data['url'] : '',
- '#states' => array(
- 'visible' => array(
- ':input[name="openlayers_layer_type_gpx[method]"]' => array('value' => 'url'),
- )
- )
- ),
- 'file' => array(
- '#name' => 'files[imagelayer]',
- '#type' => 'managed_file',
- '#title' => t('GPX file'),
- '#default_value' => isset($this->data['file']) ? $this->data['file'] : '',
- '#upload_location' => 'public://',
- '#upload_validators' => array(
- 'file_validate_extensions' => array('gpx')
- ),
- '#states' => array(
- 'visible' => array(
- ':input[name="openlayers_layer_type_gpx[method]"]' => array('value' => 'file'),
- )
- )
- ),
- 'raw' => array(
- '#type' => 'textarea',
- '#title' => t('Raw GPX'),
- '#description' => t('Copy your GPX in this textarea. Don\'t forget that this is not intented to have a big length.'),
- '#default_value' => isset($this->data['raw']) ?
- $this->data['raw'] : '',
- '#states' => array(
- 'visible' => array(
- ':input[name="openlayers_layer_type_gpx[method]"]' => array('value' => 'raw'),
- )
- )
- ),
- 'formatOptions' => array(
- 'extractWaypoints' => array(
- '#type' => 'checkbox',
- '#title' => t('Extract Waypoints'),
- '#description' => t('Extract waypoints from GPX.'),
- '#default_value' => isset(
- $this->data['formatOptions']['extractWaypoints']) ?
- $this->data['formatOptions']['extractWaypoints'] : TRUE,
- ),
- 'extractTracks' => array(
- '#type' => 'checkbox',
- '#title' => t('Extract Tracks'),
- '#description' => t('Extract tracks from GPX.'),
- '#default_value' => isset(
- $this->data['formatOptions']['extractTracks']) ?
- $this->data['formatOptions']['extractTracks'] : TRUE,
- ),
- 'extractRoutes' => array(
- '#type' => 'checkbox',
- '#title' => t('Extract Routes'),
- '#description' => t('Extract routes from GPX.'),
- '#default_value' => isset(
- $this->data['formatOptions']['extractRoutes']) ?
- $this->data['formatOptions']['extractRoutes'] : TRUE,
- ),
- 'extractAttributes' => array(
- '#type' => 'checkbox',
- '#title' => t('Extract Attributes'),
- '#description' => t('Extract attributes from GPX.'),
- '#default_value' => isset(
- $this->data['formatOptions']['extractAttributes']) ?
- $this->data['formatOptions']['extractAttributes'] : TRUE,
- ),
- ),
- );
- }
-
- /*
- * The file is mandatory.
- */
- function options_form_validate($form, &$form_state) {
- $method = $form_state['data']['method'];
-
- if (empty($form_state['data'][$method])) {
- form_set_error($form_state['data']['layer_type'] . '][' . $method, 'The field cannot be empty');
- }
-
- if ($method == 'file') {
- if ($file = file_load($form_state['data']['file'])) {
- // TODO Why nothing here?
- }
- else {
- form_set_error($form_state['data']['layer_type'] . '][' . $method, 'Cannot access the file.');
- }
- }
-
- $form_state['data']['formatOptions']['extractWaypoints'] = $form_state['data']['formatOptions']['extractWaypoints']!=0?TRUE:FALSE;
- $form_state['data']['formatOptions']['extractRoutes'] = $form_state['data']['formatOptions']['extractRoutes']!=0?TRUE:FALSE;
- $form_state['data']['formatOptions']['extractTracks'] = $form_state['data']['formatOptions']['extractTracks']!=0?TRUE:FALSE;
- $form_state['data']['formatOptions']['extractAttributes'] = $form_state['data']['formatOptions']['extractAttributes']!=0?TRUE:FALSE;
- }
-
- /**
- * hook_submit() of the form.
- */
- function options_form_submit($form, &$form_state) {
- parent::options_form_submit($form, $form_state);
- global $user;
-
- $item = $form_state['item'];
- if (isset($item->data['file']) && $file = file_load($item->data['file'])) {
- file_delete($file);
- }
-
- if (isset($form_state['values']['data']['file']) && $file = file_load($form_state['values']['data']['file'])) {
- $file->status = FILE_STATUS_PERMANENT;
- file_save($file);
- file_usage_add($file, 'openlayers', 'layer_type', $user->uid);
- $form_state['values']['data']['url'] = file_create_url($file->uri);
- }
- }
-
- /*
- * What to do when we delete the layer: delete the file.
- */
- function delete($item) {
- if (is_numeric($item->data['file']) && $item->data['file'] > 0) {
- $file = file_load($item->data['file']);
- file_delete($file);
- }
- }
-
- /**
- * Render.
- */
- function render(&$map) {
- $this->data['url'] = !empty($this->data['url']) ? file_create_url($this->data['url']) : '';
- drupal_add_js(drupal_get_path('module', 'openlayers')
- . '/plugins/layer_types/openlayers_layer_type_gpx.js');
- }
-}
diff --git a/plugins/layer_types/openlayers_layer_type_gpx.js b/plugins/layer_types/openlayers_layer_type_gpx.js
deleted file mode 100644
index 576d3dc2f43c9cd63edf0511dc9f79ba4a52df92..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_gpx.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * @file
- * Layer handler for KML layers
- */
-
-/**
- * Openlayer layer handler for GPX layer
- */
-Drupal.openlayers.layer.gpx = function(title, map, options) {
- return new OpenLayers.Layer.Vector(title, {
- drupalID: options.drupalID,
- strategies: [new OpenLayers.Strategy.Fixed()],
- protocol: new OpenLayers.Protocol.HTTP({
- url: options.url,
- format: new OpenLayers.Format.GPX(options.formatOptions)
- }),
- styleMap: Drupal.openlayers.getStyleMap(map, options.drupalID),
- projection: new OpenLayers.Projection("EPSG:4326")
- });
-};
diff --git a/plugins/layer_types/openlayers_layer_type_image.inc b/plugins/layer_types/openlayers_layer_type_image.inc
deleted file mode 100644
index d3e5c444866d7687f2749b5d2a65e3086d09a859..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_image.inc
+++ /dev/null
@@ -1,158 +0,0 @@
- 'image',
- 'file' => NULL,
- 'image_style' => NULL,
- 'opacity' => 1,
- 'factors' => array(
- 'x' => 1,
- 'y' => 1
- ),
- 'numZoomLevels' => 1
- ) + parent::options_init();
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- return array(
- 'file' => array(
- '#name' => 'files[imagelayer]',
- '#type' => 'managed_file',
- '#title' => t('Image'),
- '#default_value' => isset($this->data['file']) ? $this->data['file'] : '',
- '#upload_location' => 'public://',
- ),
- 'image_style' => array(
- '#type' => 'select',
- '#options' => array(''=> 'None (original image)') + image_style_options(FALSE),
- '#default_value' => isset($this->data['image_style']) ? $this->data['image_style'] : NULL,
- '#description' => t('Apply an image style.'),
- ),
- 'factors' => array(
- '#tree' => TRUE,
- 'x' => array(
- '#title' => 'Width divider',
- '#type' => 'textfield',
- '#default_value' => isset($this->data['factors']['x']) ? $this->data['factors']['x'] : 1,
- '#description' => t('Width divider.'),
- ),
- 'y' => array(
- '#title' => 'Height divider',
- '#type' => 'textfield',
- '#default_value' => isset($this->data['factors']['y']) ? $this->data['factors']['y'] : 1,
- '#description' => t('Height divider.'),
- ),
- ),
- 'maxExtent' => array(
- '#type' => 'textfield',
- '#title' => t('Max Extent'),
- '#default_value' => isset($this->data['maxExtent']) ? implode(', ', $this->data['maxExtent']) : '',
- '#description' => t('Should consist of four values (left, bottom, right, top). The maximum extent for the layer. Image is stretched to cover whole map if left empty.'),
- ),
- 'numZoomLevels' => array(
- '#title' => 'Zoomlevels',
- '#type' => 'textfield',
- '#default_value' => isset($this->data['numZoomLevels']) ? $this->data['numZoomLevels'] : 1
- ),
- );
- }
-
- /**
- * hook_validate() of the form.
- */
- function options_form_validate($form, &$form_state) {
- parent::options_form_validate($form, $form_state);
- $form_state['data']['numZoomLevels'] = intVal($form_state['data']['numZoomLevels']);
- $form_state['data']['factors']['x'] = intVal($form_state['data']['factors']['x']);
- $form_state['data']['factors']['y'] = intVal($form_state['data']['factors']['y']);
-
- if ($file = file_load($form_state['data']['file'])) {
- // Do something with the file if needed.
- } else {
- form_set_error($form_state['data']['layer_type'].'][file', 'Cannot access the file.');
- }
- }
-
- /**
- * hook_submit() of the form.
- */
- function options_form_submit($form, &$form_state) {
- parent::options_form_submit($form, $form_state);
- global $user;
-
- $item = $form_state['item'];
- if (isset($item->data['file']) && $file = file_load($item->data['file'])) {
- file_delete($file);
- }
-
- if (isset($form_state['values']['data']['file']) && $file = file_load($form_state['values']['data']['file'])) {
- $file->status = FILE_STATUS_PERMANENT;
- file_save($file);
- file_usage_add($file, 'openlayers', 'openlayers_layer_type', $user->uid);
- }
-
- $style = $form_state['values']['data']['image_style'];
-
- if (!empty($style)) {
- $uri = image_style_path($style, $file->uri);
- image_style_create_derivative(image_style_load($style), $file->uri, $uri);
- } else {
- $uri = $file->uri;
- }
-
- $infos = image_get_info($uri);
- $form_state['values']['data']['size'] = array();
- $form_state['values']['data']['size']['w'] = $infos['width'];
- $form_state['values']['data']['size']['h'] = $infos['height'];
- $form_state['values']['data']['maxExtent'] = array_map('floatval', explode(",", $form_state['values']['data']['maxExtent']));
- if(count($form_state['values']['data']['maxExtent'])!==4){
- // Ignore invalid input.
- $form_state['values']['data']['maxExtent'] = NULL;
- }
- }
-
- /*
- * What to do when we delete the layer: delete the file.
- */
- function delete($item) {
- $file = file_load($item->data['file']);
- file_delete($file);
- }
-
- /**
- * Render.
- */
- function render(&$map) {
- if (isset($this->data['file'])) {
- if ($file = file_load($this->data['file'])) {
- $this->data['file'] = array();
- if (!empty($this->data['image_style'])) {
- $this->data['file'] = image_style_url($this->data['image_style'] ,$file->uri);
- } else {
- $this->data['file'] = file_create_url($file->uri);
- }
- unset($this->data['image_style']);
-
- drupal_add_js(drupal_get_path('module', 'openlayers') .
- '/plugins/layer_types/openlayers_layer_type_image.js');
- }
- }
- }
-}
diff --git a/plugins/layer_types/openlayers_layer_type_image.js b/plugins/layer_types/openlayers_layer_type_image.js
deleted file mode 100644
index 88b2fd94ca26d4aa8eadb9a470e363e43a9f0b2b..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_image.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * OpenLayers Image Layer Handler
- */
-Drupal.openlayers.layer.image = function(title, map, options) {
- var maxExtent;
- if (options.maxExtent === null) {
- // Stretch image to cover whole map if not specified.
- maxExtent = map.maxExtent;
- } else {
- maxExtent = options.maxExtent;
- }
-
- return new OpenLayers.Layer.Image(
- title,
- options.file,
- OpenLayers.Bounds.fromArray(maxExtent),
- new OpenLayers.Size(options.size.w/options.factors.x, options.size.h/options.factors.y),
- {
- drupalID: options.drupalID,
- numZoomLevels: options.numZoomLevels,
- opacity: options.opacity,
- projection: new OpenLayers.Projection(options.projection),
- transitionEffect: options.transitionEffect,
- isBaseLayer: options.isBaseLayer,
- attribution: options.attribution
- }
- );
-};
diff --git a/plugins/layer_types/openlayers_layer_type_kml.inc b/plugins/layer_types/openlayers_layer_type_kml.inc
deleted file mode 100644
index ce854bea480cf18962227a9650ce51f7151a462f..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_kml.inc
+++ /dev/null
@@ -1,189 +0,0 @@
- 'kml',
- 'projection' => array('EPSG:4326'),
- 'resolutions' => openlayers_get_resolutions('EPSG:4326'),
- 'serverResolutions' => openlayers_get_resolutions('EPSG:4326'),
- 'maxExtent' => openlayers_get_extent('EPSG', '4326'),
- 'isBaseLayer' => FALSE,
- 'vector' => TRUE,
- 'formatOptions' => array(
- 'extractStyles' => TRUE,
- 'extractAttributes' => TRUE,
- 'extractTracks' => FALSE,
- ),
- 'file' => '',
- 'attribution' => '',
- ) + parent::options_init();
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- return array(
- 'method' => array(
- '#type' => 'select',
- '#options' => array(
- '' => 'Choose the method',
- 'url' => 'Provides an URL',
- 'file' => 'Upload a file',
- 'raw' => 'Write KML'
- ),
- '#default_value' => isset($this->data['method']) ?
- $this->data['method'] : '',
- ),
- 'url' => array(
- '#type' => 'textfield',
- '#title' => t('URL'),
- '#description' => t('The URL of the KML file.'),
- '#maxlength' => 2083,
- '#default_value' => isset($this->data['url']) ?
- $this->data['url'] : '',
- '#states' => array(
- 'visible' => array(
- ':input[name="openlayers_layer_type_kml[method]"]' => array('value' => 'url'),
- )
- )
- ),
- 'file' => array(
- '#name' => 'files[imagelayer]',
- '#type' => 'managed_file',
- '#title' => t('KML file'),
- '#default_value' => isset($this->data['file']) ? $this->data['file'] : '',
- '#upload_location' => 'public://',
- '#upload_validators' => array(
- 'file_validate_extensions' => array('kml')
- ),
- '#states' => array(
- 'visible' => array(
- ':input[name="openlayers_layer_type_kml[method]"]' => array('value' => 'file'),
- )
- )
- ),
- 'raw' => array(
- '#type' => 'textarea',
- '#title' => t('Raw KML'),
- '#description' => t('Copy your KML in this textarea. Don\'t forget that this is not intented to have a big length.'),
- '#default_value' => isset($this->data['raw']) ?
- $this->data['raw'] : '',
- '#states' => array(
- 'visible' => array(
- ':input[name="openlayers_layer_type_kml[method]"]' => array('value' => 'raw'),
- )
- )
- ),
- 'formatOptions' => array(
- 'extractStyles' => array(
- '#type' => 'checkbox',
- '#title' => t('Extract Styles'),
- '#description' => t('Extract styles from KML.'),
- '#default_value' => isset(
- $this->data['formatOptions']['extractStyles']) ?
- $this->data['formatOptions']['extractStyles'] : TRUE,
- ),
- 'extractTracks' => array(
- '#type' => 'checkbox',
- '#title' => t('Extract Tracks'),
- '#description' => t('Extract tracks from KML.'),
- '#default_value' => isset(
- $this->data['formatOptions']['extractTracks']) ?
- $this->data['formatOptions']['extractTracks'] : TRUE,
- ),
- 'extractAttributes' => array(
- '#type' => 'checkbox',
- '#title' => t('Extract Attributes'),
- '#description' => t('Extract attributes from KML.'),
- '#default_value' => isset(
- $this->data['formatOptions']['extractAttributes']) ?
- $this->data['formatOptions']['extractAttributes'] : TRUE,
- ),
- ),
- 'attribution' => array(
- '#type' => 'textfield',
- '#title' => t('Attribution'),
- '#default_value' => isset($this->data['attribution']) ?
- $this->data['attribution'] : '',
- ),
- );
- }
-
- /*
- * The file is mandatory.
- */
- function options_form_validate($form, &$form_state) {
- $method = $form_state['data']['method'];
-
- if (empty($form_state['data'][$method])) {
- form_set_error($form_state['data']['layer_type'] . '][' . $method, 'The field cannot be empty');
- }
-
- if ($method == 'file') {
- if ($file = file_load($form_state['data']['file'])) {
- // TODO Why nothing here?
- }
- else {
- form_set_error($form_state['data']['layer_type'] . '][' . $method, 'Cannot access the file.');
- }
- }
-
- $form_state['data']['formatOptions']['extractStyles'] = $form_state['data']['formatOptions']['extractStyles']!=0?TRUE:FALSE;
- $form_state['data']['formatOptions']['extractAttributes'] = $form_state['data']['formatOptions']['extractAttributes']!=0?TRUE:FALSE;
- $form_state['data']['formatOptions']['extractTracks'] = $form_state['data']['formatOptions']['extractTracks']!=0?TRUE:FALSE;
-
- $form_state['data']['attribution'] = isset($form_state['data']['attribution']) ? filter_xss($form_state['data']['attribution']) : '';
- }
-
- /**
- * hook_submit() of the form.
- */
- function options_form_submit($form, &$form_state) {
- parent::options_form_submit($form, $form_state);
- global $user;
-
- $item = $form_state['item'];
- if (isset($item->data['file']) && $file = file_load($item->data['file'])) {
- file_delete($file);
- }
-
- if (isset($form_state['values']['data']['file']) && $file = file_load($form_state['values']['data']['file'])) {
- $file->status = FILE_STATUS_PERMANENT;
- file_save($file);
- file_usage_add($file, 'openlayers', 'layer_type', $user->uid);
- $form_state['values']['data']['url'] = file_create_url($file->uri);
- }
- }
-
- /*
- * What to do when we delete the layer: delete the file.
- */
- function delete($item) {
- if (is_numeric($item->data['file']) && $item->data['file'] > 0) {
- $file = file_load($item->data['file']);
- file_delete($file);
- }
- }
-
- /**
- * Render.
- */
- function render(&$map) {
- $this->data['url'] = !empty($this->data['url']) ? file_create_url($this->data['url']) : '';
- drupal_add_js(drupal_get_path('module', 'openlayers')
- . '/plugins/layer_types/openlayers_layer_type_kml.js');
- }
-}
diff --git a/plugins/layer_types/openlayers_layer_type_kml.js b/plugins/layer_types/openlayers_layer_type_kml.js
deleted file mode 100644
index 5d59de5469218c29c956175f8088eb86d890ec42..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_kml.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * @file
- * Layer handler for KML layers
- */
-
-/**
- * Openlayer layer handler for KML layer
- */
-Drupal.openlayers.layer.kml = function(title, map, options) {
-
- var layer = new OpenLayers.Layer.Vector(title, {
- name: options.name,
- drupalID: options.drupalID,
- layer_handler: options.layer_handler,
- styleMap: Drupal.openlayers.getStyleMap(map, options.drupalID),
- attribution: options.attribution
- });
-
- // KML Projection handling and formating options
- var kml_options = options.formatOptions;
- kml_options.internalProjection = new OpenLayers.Projection(map.projection);
- kml_options.externalProjection = new OpenLayers.Projection(options.projection);
-
- if (options.method == 'file' || options.method == 'url') {
- var uri = options.url;
- // Use an AJAX like call to get data from URL
- OpenLayers.Request.GET({
- url: uri,
- success: function (response) {
- if(response.status===0 && response.responseXML===null){
- Drupal.openlayers.console.error("Failed to load KML layer (probably due to same origin policy)", uri);
- } else {
- addFeatures(response.responseText, kml_options);
- }
- },
- failure: function (response) {
- Drupal.openlayers.console.error("Failed to load KML layer", uri, reponse);
- }
- });
- }
-
- if (options.method == 'raw') {
- addFeatures(options.raw, kml_options);
- }
-
- function addFeatures(kml, options) {
- var format = new OpenLayers.Format.KML(options);
- var features = format.read(kml);
- // Add features, if needed
- if (features) {
- layer.addFeatures(features);
- layer.events.triggerEvent('loadend');
- }
- }
-
- return layer;
-};
diff --git a/plugins/layer_types/openlayers_layer_type_maptiler.inc b/plugins/layer_types/openlayers_layer_type_maptiler.inc
deleted file mode 100644
index 4c2d403db75344df7007245c61faa040efe7d5b4..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_maptiler.inc
+++ /dev/null
@@ -1,79 +0,0 @@
- 'png',
- 'layer_handler' => 'maptiler',
- 'zoomOffset' => 0,
- ) + parent::options_init();
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- return array(
- 'base_url' => array(
- '#type' => 'textfield',
- '#title' => t('Base URL'),
- '#default_value' => isset($this->data['base_url']) ?
- $this->data['base_url'] : ''
- ),
- 'type' => array(
- '#type' => 'select',
- '#options' => array(
- 'jpg' => 'JPG',
- 'png' => 'PNG'
- ),
- '#default_value' => isset($this->data['type']) ?
- $this->data['type'] : 'png'
- ),
- 'resolutions' => array(
- '#type' => 'select',
- '#multiple' => TRUE,
- '#options' => array_combine(
- array_map('strval', openlayers_get_resolutions('EPSG:900913')),
- range(0, 21)
- ),
- '#title' => t('Zoom Level Range'),
- '#default_value' => isset($this->data['resolutions']) ?
- $this->data['resolutions'] :
- array_map('strval', openlayers_get_resolutions('EPSG:900913'))
- ),
- 'zoomOffset' => array(
- '#type' => 'textfield',
- '#title' => t('Zoom offset'),
- '#default_value' => isset($this->data['zoomOffset']) ?
- $this->data['zoomOffset'] : 0,
- '#description' => t('If your cache has more zoom levels than you want to provide access to with this layer, supply a zoomOffset. This zoom offset is added to the current map zoom level to determine the level for a requested tile. For example, if you supply a zoomOffset of 3, when the map is at the zoom 0, tiles will be requested from level 3 of your cache. Default is 0 (assumes cache level and map zoom are equivalent). Using zoomOffset is an alternative to setting serverResolutions if you only want to expose a subset of the server resolutions.'),
- ),
- );
- }
-
- function options_form_submit($form, &$form_state) {
- parent::options_form_submit($form, $form_state);
- $form_state['values']['data']['base_url'] = explode("\n", $form_state['values']['data']['base_url']);
- $form_state['values']['data']['resolutions'] = array_map('floatval', array_values($form_state['values']['data']['resolutions']));
- $form_state['values']['data']['zoomOffset'] = intval($form_state['values']['data']['zoomOffset'], 10);
- }
-
- /**
- * Render.
- */
- function render(&$map) {
- drupal_add_js(drupal_get_path('module', 'openlayers') .
- '/plugins/layer_types/openlayers_layer_type_maptiler.js');
- }
-}
diff --git a/plugins/layer_types/openlayers_layer_type_maptiler.js b/plugins/layer_types/openlayers_layer_type_maptiler.js
deleted file mode 100644
index 1526ae2002cc5128a24d97ff27b67075752c6652..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_maptiler.js
+++ /dev/null
@@ -1,29 +0,0 @@
-
-/**
- * @file
- * Layer handler for TMS layers
- */
-
-/**
- * Openlayer layer handler for TMS layer
- */
-Drupal.openlayers.layer.maptiler = function(title, map, options) {
- if (OpenLayers.Util.isArray(options.maxExtent)) {
- options.maxExtent = OpenLayers.Bounds.fromArray(options.maxExtent);
- }
-
- options.getURL = function(bounds) {
- var res = this.map.getResolution();
- var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
- var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h));
- var z = this.map.getZoom();
- if (x >= 0 && y >= 0) {
- return this.url + z + "/" + x + "/" + y + "." + this.type;
- } else {
- return "http://www.maptiler.org/img/none.png";
- }
- }
-
- options.projection = new OpenLayers.Projection(options.projection);
- return new OpenLayers.Layer.TMS(title, options.base_url, options);
-};
diff --git a/plugins/layer_types/openlayers_layer_type_osm.inc b/plugins/layer_types/openlayers_layer_type_osm.inc
deleted file mode 100644
index ee20816f8be5d8259560f045311cd26e3eebd42f..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_osm.inc
+++ /dev/null
@@ -1,73 +0,0 @@
- 'osm',
- 'type' => 'png',
- ) + parent::options_init();
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- return array(
- 'serverResolutions' => array(
- '#type' => 'select',
- '#multiple' => TRUE,
- '#description' => t('Only set this if you need a very specific resolution.'),
- '#options' => array_combine(
- array_map('strval', openlayers_get_resolutions('EPSG:900913')),
- range(0, 21)),
- '#title' => t('Zoom Level Range'),
- '#default_value' => isset($this->data['serverResolutions']) ?
- array_map('strval', $this->data['serverResolutions']) : NULL,
- ),
- 'resolutions' => array(
- '#type' => 'select',
- '#multiple' => TRUE,
- '#description' => t('Only set this if you need a very specific resolution.'),
- '#options' => array_combine(
- array_map('strval', openlayers_get_resolutions('EPSG:900913')),
- range(0, 21)),
- '#title' => t('Zoom Level Range'),
- '#default_value' => isset($this->data['resolutions']) ?
- array_map('strval', $this->data['resolutions']) : array(),
- ),
- 'url' => array(
- '#type' => 'textarea',
- '#title' => t('Base URL (template)'),
- '#default_value' => !empty($this->data['url']) ? implode("\n", (array) $this->data['url']) : '',
- '#maxlength' => 2083,
- '#description' => t('This is the base URL template for the XYZ layer. It should be something similar to http://example.com/tiles/1.0.0/layer_name/${z}/${x}/${y}.png.'),
- ),
- );
- }
-
- function options_form_validate($form, &$form_state) {
- $form_state['data']['url'] = explode("\n", $form_state['data']['url']);
- $form_state['data']['serverResolutions'] = array_map('floatval', array_values($form_state['data']['serverResolutions']));
- $form_state['data']['resolutions'] = array_map('floatval', array_values($form_state['data']['resolutions']));
- }
-
-
- /**
- * Render.
- */
- function render(&$map) {
- drupal_add_js(drupal_get_path('module', 'openlayers') .
- '/plugins/layer_types/openlayers_layer_type_osm.js');
- }
-}
diff --git a/plugins/layer_types/openlayers_layer_type_osm.js b/plugins/layer_types/openlayers_layer_type_osm.js
deleted file mode 100644
index 6f9b029617d08b7d8ff6430b69373d2ba9088644..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_osm.js
+++ /dev/null
@@ -1,12 +0,0 @@
-
-/**
- * @file
- * Layer handler for OSM layers
- */
-
-/**
- * Openlayer layer handler for OSM layer
- */
-Drupal.openlayers.layer.osm = function(title, map, options) {
- return new OpenLayers.Layer.OSM(title, options.url, options);
-};
diff --git a/plugins/layer_types/openlayers_layer_type_pointgrid.inc b/plugins/layer_types/openlayers_layer_type_pointgrid.inc
deleted file mode 100644
index 1f658bde9eef817400f0fe52a53d927ac4660e39..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_pointgrid.inc
+++ /dev/null
@@ -1,86 +0,0 @@
- 'pointgrid',
- 'vector' => TRUE,
- 'dx' => 100,
- 'dy' => 100,
- 'ratio' => 1.5,
- 'maxFeatures' => 250,
- 'rotation' => 0
- ) + parent::options_init();
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- return array(
- 'dx' => array(
- '#type' => 'textfield',
- '#title' => t('X-axis point grid spacing'),
- '#default_value' => !empty($this->data['dx']) ? $this->data['dx'] : 100,
- '#maxlength' => 10,
- '#description' => t('Point grid spacing in the x-axis direction (map units).'),
- ),
- 'dy' => array(
- '#type' => 'textfield',
- '#title' => t('Y-axis point grid spacing'),
- '#default_value' => !empty($this->data['dy']) ? $this->data['dy'] : 100,
- '#maxlength' => 10,
- '#description' => t('Point grid spacing in the y-axis direction (map units).'),
- ),
- 'ratio' => array(
- '#type' => 'textfield',
- '#title' => t('Ratio of the desired grid size to the map viewport size.'),
- '#default_value' => !empty($this->data['ratio']) ? $this->data['ratio'] : 1.5,
- '#maxlength' => 10,
- '#description' => t('Ratio of the desired grid size to the map viewport size. Default is 1.5. Larger ratios mean the grid is recalculated less often while panning. The maxFeatures setting has precedence when determining grid size.'),
- ),
- 'maxFeatures' => array(
- '#type' => 'textfield',
- '#title' => t('The maximum number of points to generate in the grid.'),
- '#default_value' => !empty($this->data['maxFeatures']) ? $this->data['maxFeatures'] : 250,
- '#maxlength' => 10,
- '#description' => t('The maximum number of points to generate in the grid. Default is 250.'),
- ),
- 'rotation' => array(
- '#type' => 'textfield',
- '#title' => t('Grid rotation (in degrees clockwise from the positive x-axis).'),
- '#default_value' => !empty($this->data['rotation']) ? $this->data['rotation'] : 0,
- '#maxlength' => 10,
- '#description' => t('Grid rotation (in degrees clockwise from the positive x-axis). Default is 0.'),
- ),
- );
- }
-
- function options_form_validate($form, &$form_state) {
- $form_state['data']['dx'] = (int) $form_state['data']['dx'];
- $form_state['data']['dy'] = (int) $form_state['data']['dy'];
- $form_state['data']['ratio'] = (float) $form_state['data']['ratio'];
- $form_state['data']['maxFeatures'] = (int) $form_state['data']['maxFeatures'];
- $form_state['data']['rotation'] = (int) $form_state['data']['rotation'];
- }
-
- /**
- * Render.
- */
- function render(&$map) {
- drupal_add_js(drupal_get_path('module', 'openlayers') .
- '/plugins/layer_types/openlayers_layer_type_pointgrid.js');
- }
-}
-
diff --git a/plugins/layer_types/openlayers_layer_type_pointgrid.js b/plugins/layer_types/openlayers_layer_type_pointgrid.js
deleted file mode 100644
index 4519c18f31e9426e0cc54fac69762aaf0a3efa29..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_pointgrid.js
+++ /dev/null
@@ -1,19 +0,0 @@
-
-/**
- * OpenLayers PointGrid Layer Handler
- */
-Drupal.openlayers.layer.pointgrid = function(title, map, options) {
-
- return new OpenLayers.Layer.PointGrid({
- name: options.name,
- drupalID: options.drupalID,
- layer_handler: options.layer_handler,
- styleMap: Drupal.openlayers.getStyleMap(map, options.drupalID),
- dx: options.dx,
- dy: options.dy,
- ratio: options.ratio,
- maxFeatures: options.maxFeatures,
- rotation: options.rotation
- });
-
-};
diff --git a/plugins/layer_types/openlayers_layer_type_raw.inc b/plugins/layer_types/openlayers_layer_type_raw.inc
deleted file mode 100644
index 93a6a5798cb52c7802cfb82d0bbe4127ede4539a..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_raw.inc
+++ /dev/null
@@ -1,40 +0,0 @@
- 'openlayers_raw',
- 'vector' => TRUE,
- 'isBaseLayer' => FALSE,
- ) + parent::options_init();
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- return array();
- }
-
- /**
- * Render.
- */
- function render(&$map) {
- drupal_add_js(drupal_get_path('module', 'openlayers') .
- '/plugins/layer_types/openlayers_layer_type_raw.js');
- // $features = ;
- // $this->data['features'] = $features;
- }
-}
-
diff --git a/plugins/layer_types/openlayers_layer_type_raw.js b/plugins/layer_types/openlayers_layer_type_raw.js
deleted file mode 100644
index 2e226c8685e8b96b8a683e40c5330f86fc738278..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_raw.js
+++ /dev/null
@@ -1,20 +0,0 @@
-
-/**
- * OpenLayers Raw Layer Handler
- */
-Drupal.openlayers.layer.openlayers_raw = function(title, map, options) {
- options.options = options.options || {};
-
- // Note, so that we do not pass all the features along to the Layer
- // options, we use the options.options to give to Layer
- options.options.drupalID = options.drupalID;
- options.options.styleMap = Drupal.openlayers.getStyleMap(map, options.drupalID);
-
- var layer = new OpenLayers.Layer.Vector(title, options.options);
-
- if (options.features) {
- Drupal.openlayers.addFeatures(map, layer, options.features);
- }
-
- return layer;
-};
diff --git a/plugins/layer_types/openlayers_layer_type_tms.inc b/plugins/layer_types/openlayers_layer_type_tms.inc
deleted file mode 100644
index 211cdfa79ac1e9660dbfc160dfa007d036550c6b..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_tms.inc
+++ /dev/null
@@ -1,118 +0,0 @@
- 'tms',
- 'type' => 'png',
- 'maptiler' => FALSE,
- 'serviceVersion' => '1.0.0',
- 'wrapDateLine' => FALSE,
- 'zoomOffset' => 0,
- 'url' => ''
- ) + parent::options_init();
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- return array(
- 'url' => array(
- '#type' => 'textarea',
- '#title' => t('Base URL'),
- '#default_value' => !empty($this->data['url']) ? implode("\n", $this->data['url']) : '',
- '#description' => t('This is the base URL of the TMS service. For example, if this was your tile scheme URL: http://example.com/tms/1.0.0/layer_name/{z}/{y}/{x}.png, then http://example.com/tms/ would be the Base URL.'),
- ),
- 'layername' => array(
- '#type' => 'textfield',
- '#title' => t('Layer Name'),
- '#default_value' => isset($this->data['layername']) ?
- $this->data['layername'] : '',
- '#description' => t('This is the base URL of the TMS service. For example, if this was your tile scheme URL: http://example.com/tms/1.0.0/layer_name/{z}/{y}/{x}.png, then layer_name would be the Layer Name.'),
- ),
- 'type' => array(
- '#type' => 'select',
- '#title' => t('File Format'),
- '#options' => array(
- 'png' => 'png',
- 'jpg' => 'jpg',
- 'jpeg' => 'jpeg'),
- '#default_value' => isset($this->data['type']) ?
- $this->data['type'] : 'png'
- ),
- 'resolutions' => array(
- '#type' => 'select',
- '#multiple' => TRUE,
- '#options' => array_combine(
- array_map('strval', openlayers_get_resolutions('EPSG:900913')),
- range(0, 21)
- ),
- '#title' => t('Zoom Level Range'),
- '#default_value' => isset($this->data['resolutions']) ?
- $this->data['resolutions'] :
- array_map('strval', openlayers_get_resolutions('EPSG:900913')),
- '#description' => t('The available zoom levels for the tiles.'),
- ),
- 'wrapDateLine' => array(
- '#type' => 'checkbox',
- '#title' => t('Wrap Dateline'),
- '#default_value' => isset($this->data['wrapDateLine']) ?
- $this->data['wrapDateLine'] : FALSE,
- '#description' => t('Wrapping the dateline will cause the map to appear to repeat itself when going east or west. This may not be supported by all tilesets.'),
- ),
- 'serviceVersion' => array(
- '#type' => 'textfield',
- '#title' => t('Service version for tile requests'),
- '#default_value' => isset($this->data['serviceVersion']) ?
- $this->data['serviceVersion'] : '',
- '#description' => t('Service version for tile requests. Default is “1.0.0”.'),
- ),
- 'zoomOffset' => array(
- '#type' => 'textfield',
- '#title' => t('Zoom offset'),
- '#default_value' => isset($this->data['zoomOffset']) ?
- $this->data['zoomOffset'] : 0,
- '#description' => t('If your cache has more zoom levels than you want to provide access to with this layer, supply a zoomOffset. This zoom offset is added to the current map zoom level to determine the level for a requested tile. For example, if you supply a zoomOffset of 3, when the map is at the zoom 0, tiles will be requested from level 3 of your cache. Default is 0 (assumes cache level and map zoom are equivalent). Using zoomOffset is an alternative to setting serverResolutions if you only want to expose a subset of the server resolutions.'),
- ),
- 'maptiler' => array(
- '#type' => 'checkbox',
- '#title' => t('Rewrite the getUrl method for MapTiler ?'),
- '#default_value' => isset($this->data['maptiler']) ?
- $this->data['maptiler'] : FALSE,
- '#description' => t('MapTiler is using a custom getUrl method to get it\'s tiles'),
- ),
- );
- }
-
- function options_form_validate($form, &$form_state) {
- }
-
- function options_form_submit($form, &$form_state) {
- parent::options_form_submit($form, $form_state);
- $form_state['values']['data']['url'] = explode("\n", $form_state['values']['data']['url']);
- $form_state['values']['data']['resolutions'] = array_map('floatval', array_values($form_state['values']['data']['resolutions']));
- $form_state['values']['data']['wrapDateLine'] = (bool) $form_state['values']['data']['wrapDateLine'];
- $form_state['values']['data']['zoomOffset'] = intval($form_state['values']['data']['zoomOffset'], 10);
- $form_state['values']['data']['maptiler'] = (bool) $form_state['values']['data']['maptiler'];
- }
-
- /**
- * Render.
- */
- function render(&$map) {
- drupal_add_js(drupal_get_path('module', 'openlayers') .
- '/plugins/layer_types/openlayers_layer_type_tms.js');
- }
-}
diff --git a/plugins/layer_types/openlayers_layer_type_tms.js b/plugins/layer_types/openlayers_layer_type_tms.js
deleted file mode 100644
index 09de056d8a5cfcf2aa214fd2077a26b5d27c20ba..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_tms.js
+++ /dev/null
@@ -1,31 +0,0 @@
-
-/**
- * @file
- * Layer handler for TMS layers
- */
-
-/**
- * Openlayer layer handler for TMS layer
- */
-Drupal.openlayers.layer.tms = function(title, map, options) {
- if (OpenLayers.Util.isArray(options.maxExtent)) {
- options.maxExtent = OpenLayers.Bounds.fromArray(options.maxExtent);
- }
-
- if (options.maptiler == true) {
- options.getURL = function(bounds) {
- var res = this.map.getResolution();
- var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
- var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h));
- var z = this.map.getZoom();
- if (x >= 0 && y >= 0) {
- return this.url + z + "/" + x + "/" + y + "." + this.type;
- } else {
- return "http://www.maptiler.org/img/none.png";
- }
- }
- }
-
- options.projection = new OpenLayers.Projection(options.projection);
- return new OpenLayers.Layer.TMS(title, options.url, options);
-};
diff --git a/plugins/layer_types/openlayers_layer_type_wms.inc b/plugins/layer_types/openlayers_layer_type_wms.inc
deleted file mode 100644
index d556d906f811f16c49ef5f715931ee627a1ca7ac..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_wms.inc
+++ /dev/null
@@ -1,129 +0,0 @@
- 'wms',
- ) + parent::options_init();
-
- // Discard hard-codes resolution because the client can calculate them usually
- unset($options['serverResolutions']);
- unset($options['maxExtent']);
- unset($options['resolutions']);
-
- return $options;
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- return array(
- 'base_url' => array(
- '#type' => 'textfield',
- '#title' => t('Base URL'),
- '#maxlength' => 2083,
- '#default_value' => isset($this->data['base_url']) ?
- $this->data['base_url'] : ''
- ),
-
- // TODO: swap terms
- 'params' => array(
- // TODO: validate the field, only positive integers shall be allowed
- 'buffer' => array(
- '#type' => 'textfield',
- '#default_value' => isset($this->data['params']['buffer']) ?
- $this->data['params']['buffer'] : 2,
- '#title' => t('Buffer'),
- '#description' => t('Used only when not in single-tile mode, this specifies umber of extra rows and colums of tiles on each side which will surround the minimum grid tiles to cover the map')
- ),
- // TODO: validate the field, only positive numbers shall be allowed
- // numbers below 1 might also not make much sense
- 'ratio' => array(
- '#type' => 'textfield',
- '#default_value' => isset($this->data['params']['ratio']) ?
- $this->data['params']['ratio'] : 1.5,
- '#title' => t('Ratio'),
- '#description' => t('Used only when in single-tile mode, this specifies the ratio of the size of the single tile to the size of the map')
- ),
- 'singleTile' => array(
- '#type' => 'checkbox',
- '#default_value' => isset($this->data['params']['singleTile']) ?
- $this->data['params']['singleTile'] : FALSE,
- '#title' => t('Single tile'),
- '#description' => t('Check to make this layer untiled')
- )
- ),
- 'options' => array(
- 'TRANSPARENT' => array(
- '#type' => 'checkbox',
- '#default_value' => isset($this->data['options']['TRANSPARENT']) ?
- $this->data['options']['TRANSPARENT'] : FALSE,
- '#return_value' => 'true',
- '#title' => t('Transparent'),
- '#description' => t('When a PNG, make the background color transparent')
- ),
- 'exceptions' => array(
- '#type' => 'select',
- '#title' => t('Exceptions'),
- '#options' => array(
- 'application/vnd.ogc.se_xml' => 'application/vnd.ogc.se_xml',
- 'application/vnd.ogc.se_inimage' => 'application/vnd.ogc.se_inimage'),
- '#default_value' => isset($this->data['options']['exceptions']) ?
- $this->data['options']['exceptions'] : 'application/vnd.ogc.se_inimage',
- '#description' => t('Select the exception handler')
- ),
- 'format' => array(
- '#type' => 'select',
- '#title' => t('File Format'),
- '#options' => array(
- 'image/png' => 'image/png',
- 'image/gif' => 'image/gif',
- 'image/jpeg' => 'image/jpeg'),
- '#default_value' => isset($this->data['options']['format']) ?
- $this->data['options']['format'] : 'image/png'
- ),
- 'layers' => array(
- '#type' => 'textarea',
- '#title' => t('Layers'),
- // TODO: Should be required to be non-empty as not having a layer leads to invalid requests
- '#default_value' => !empty($this->data['options']['layers']) ?
- implode("\r\n", $this->data['options']['layers']) : '',
- '#description' => t('Specifies which layers to show. One per line.')
- ),
- 'styles' => array(
- '#type' => 'textfield',
- '#title' => t('Styles'),
- '#default_value' => isset($this->data['options']['styles']) ?
- $this->data['options']['styles'] : ''
- ),
- ),
- );
- }
-
- /**
- * hook_validate()
- */
- function options_form_validate($form, &$form_state) {
- $form_state['data']['options']['layers'] = explode("\r\n", $form_state['data']['options']['layers']);
- }
-
- /**
- * Render.
- */
- function render(&$map) {
- drupal_add_js(drupal_get_path('module', 'openlayers') .
- '/plugins/layer_types/openlayers_layer_type_wms.js');
- }
-}
diff --git a/plugins/layer_types/openlayers_layer_type_wms.js b/plugins/layer_types/openlayers_layer_type_wms.js
deleted file mode 100644
index 0ebc31b9de383e8019ef17637a5c681e7c6e1fa2..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_wms.js
+++ /dev/null
@@ -1,38 +0,0 @@
-
-/**
- * @file
- * Layer handler for WMS layers
- */
-
-/**
- * Openlayer layer handler for WMS layer
- */
-Drupal.openlayers.layer.wms = function(title, map, options) {
- /* TODO: have PHP take care of the casts here, not JS! */
- if (options.params.buffer) {
- options.params.buffer = parseInt(options.params.buffer, 10);
- }
- if (options.params.ratio) {
- options.params.ratio = parseFloat(options.params.ratio);
- }
-
- options.params.drupalID = options.drupalID;
-
- // Set isBaseLayer explicitly so that OpenLayers does not guess from transparency
- options.params.isBaseLayer = Boolean(options.isBaseLayer);
-
- // Convert to representation that match with WMS specification
- var optionsClone = jQuery.extend(true, {}, options.options);
- if(optionsClone.hasOwnProperty("TRANSPARENT") && optionsClone.TRANSPARENT===0){
- optionsClone.TRANSPARENT = "FALSE";
- }
- if(optionsClone.hasOwnProperty("TRANSPARENT") && optionsClone.TRANSPARENT===1){
- optionsClone.TRANSPARENT = "FALSE";
- }
-
- var paramsClone = jQuery.extend(true, {}, options.params);
- // OpenLayers can calculate the resolutions usually if provided with the number of zoom levels and tile sizes
- paramsClone.numZoomLevels=18;
-
- return new OpenLayers.Layer.WMS(title, options.base_url, optionsClone, paramsClone);
-};
diff --git a/plugins/layer_types/openlayers_layer_type_wmts.inc b/plugins/layer_types/openlayers_layer_type_wmts.inc
deleted file mode 100644
index 64b03b06493279f88bdae2fab2776a48c3f52422..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_wmts.inc
+++ /dev/null
@@ -1,148 +0,0 @@
- 'wmts',
- ) + parent::options_init();
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- return array(
- 'url' => array(
- '#type' => 'textarea',
- '#title' => t('Base URL (template)'),
- '#default_value' => !empty($this->data['url']) ? implode("\n", (array) $this->data['url']) : '',
- '#maxlength' => 2083,
- '#description' => t('The base URL or request URL template for the WMTS service. Must be provided.'),
- ),
- 'layer' => array(
- '#type' => 'textfield',
- '#title' => t('Layer Name'),
- '#default_value' => isset($this->data['layer']) ? $this->data['layer'] : '',
- '#description' => t('The layer identifier advertised by the WMTS service. Must be provided.'),
- ),
- 'style' => array(
- '#type' => 'textfield',
- '#title' => t('Style'),
- '#default_value' => isset($this->data['style']) ? $this->data['style'] : '',
- '#description' => t('One of the advertised layer styles.'),
- ),
- 'attribution' => array(
- '#type' => 'textfield',
- '#title' => t('Attribution'),
- '#default_value' => isset($this->data['attribution']) ? $this->data['attribution'] : '',
- '#description' => t('Attribution text, displayed when the attribution behavior has been added to the map.'),
- ),
- 'matrixSet' => array(
- '#type' => 'textfield',
- '#title' => t('Matrix Set'),
- '#default_value' => isset($this->data['matrixSet']) ? $this->data['matrixSet'] : '',
- '#description' => t('One of the advertised matrix set identifiers. Must be provided.'),
- ),
- 'matrixIdsAuto' => array(
- '#type' => 'checkbox',
- '#default_value' => isset($this->data['matrixIdsAuto']) ?
- $this->data['matrixIdsAuto'] : TRUE,
- '#title' => t('Auto-generate matrix identifiers.'),
- '#description' => t('Generate identifiers in the format [matrixSet]:[zoomLevel]. Use this options for Geoserver WMTS tiles. Overwrites explicit matrix IDs specified above.'),
- ),
- 'matrixIds' => array(
- '#type' => 'textfield',
- '#title' => t('Matrix IDs'),
- '#default_value' => isset($this->data['matrixIds']) ? implode(',', $this->data['matrixIds']) : '',
- '#description' => t('Matrix identifiers per zoom level. Comma separated. Leave empty to use zoom level as identifier.'),
- '#states' => array(
- 'invisible' => array(
- ':input[name*="matrixIdsAuto"]' => array('checked' => TRUE),
- ),
- ),
- ),
- 'format' => array(
- '#type' => 'select',
- '#title' => t('Tile format'),
- '#options' => array(
- 'image/png' => 'image/png',
- 'image/gif' => 'image/gif',
- 'image/jpeg' => 'image/jpeg'
- ),
- '#default_value' => isset($this->data['format']) ? $this->data['format'] : 'image/jpeg',
- '#description' => t('The image MIME type. Default is "image/jpeg".'),
- ),
- 'formatSuffix' => array(
- '#type' => 'textfield',
- '#title' => t('Format Suffix'),
- '#default_value' => isset($this->data['formatSuffix']) ? $this->data['formatSuffix'] : '',
- '#description' => t('For REST request encoding, an image format suffix must be included in the request. If not provided, the suffix will be derived from the format property.'),
- ),
- 'maxExtent' => array(
- '#type' => 'textfield',
- '#title' => t('Max Extent'),
- '#default_value' => isset($this->data['maxExtent']) ? implode(', ', $this->data['maxExtent']) : '',
- '#description' => t('Should consist of four values (left, bottom, right, top). The maximum extent for the layer.'),
- ),
- 'resolutions' => array(
- '#type' => 'textfield',
- '#title' => t('Resolutions'),
- '#default_value' => isset($this->data['resolutions']) ? $this->data['resolutions'] : '',
- '#description' => t('A list of map resolutions (map units per pixel) in descending order.'),
- '#maxlength' => 400
- ),
- 'serverResolutions' => array(
- '#type' => 'textfield',
- '#title' => t('Server Resoultions'),
- '#default_value' => isset($this->data['serverResolutions']) ? $this->data['serverResolutions'] : '',
- '#description' => t('A list of all resolutions available on the server. Only set this property if the map resolutions differ from the server.'),
- '#maxlength' => 400
- ),
- 'requestEncoding' => array(
- '#type' => 'select',
- '#title' => t('Request encoding'),
- '#options' => array('KVP' => 'KVP', 'REST' => 'REST'),
- '#default_value' => isset($this->data['requestEncoding']) ? $this->data['requestEncoding'] : '',
- ),
- );
- }
-
- function options_form_validate($form, &$form_state) {
- //parent::options_form_validate($form, $form_state);
- $form_state['data']['resolutions'] = array_map('floatval', explode(' ', $form_state['data']['resolutions']));
- $form_state['data']['serverResolutions'] = array_map('floatval', explode(' ', $form_state['data']['serverResolutions']));
- if (empty($form_state['data']['matrixIds'])) {
- $form_state['data']['matrixIds'] = NULL;
- } else {
- $form_state['data']['matrixIds'] = array_map('trim', explode(',', $form_state['data']['matrixIds']));
- }
- $form_state['data']['url'] = explode("\n", $form_state['data']['url']);
- $form_state['data']['maxExtent'] = array_map('floatval', explode(",", $form_state['data']['maxExtent']));
- if (empty($form_state['data']['formatSuffix'])) {
- $form_state['data']['formatSuffix'] = NULL;
- }
- }
-
- function options_form_submit($form, &$form_state) {
- //parent::options_form_submit($form, $form_state);
- }
-
- /**
- * Render.
- */
- function render(&$map) {
- drupal_add_js(drupal_get_path('module', 'openlayers') .
- '/plugins/layer_types/openlayers_layer_type_wmts.js');
- }
-}
diff --git a/plugins/layer_types/openlayers_layer_type_wmts.js b/plugins/layer_types/openlayers_layer_type_wmts.js
deleted file mode 100644
index 687f26940f71c03da9a1ddaeac9cb1f856a99860..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_wmts.js
+++ /dev/null
@@ -1,48 +0,0 @@
-
-/**
- * @file
- * Layer handler for WMTS layers
- */
-
-/**
- * Openlayer layer handler for WMTS layer
- */
-Drupal.openlayers.layer.wmts = function(title, map, options) {
-
- var layer_options = {
- drupalID: options.drupalID,
- name: title,
- attribution: options.attribution,
- layer: options.layer,
- requestEncoding: options.requestEncoding,
- url: options.url,
- style: options.style,
- matrixSet: options.matrixSet,
- format: options.format,
- formatSuffix: options.formatSuffix,
- isBaseLayer: options.isBaseLayer
- };
-
- if (options.matrixIdsAuto) {
- layer_options.matrixIds = new Array(26);
- for (var i=0; i<26; ++i) {
- layer_options.matrixIds[i] = options.matrixSet + ":" + i;
- }
- } else if (options.matrixIds) {
- layer_options.matrixIds = options.matrixIds;
- }
-
- if (OpenLayers.Util.isArray(options.maxExtent)) {
- layer_options.maxExtent = OpenLayers.Bounds.fromArray(options.maxExtent);
- }
-
- if (options.resolutions) {
- layer_options.resolutions = jQuery.parseJSON('['+options.resolutions+']');
- }
-
- if (options.serverResolutions) {
- layer_options.serverResolutions = jQuery.parseJSON('['+options.serverResolutions+']');
- }
-
- return new OpenLayers.Layer.WMTS(layer_options);
-};
diff --git a/plugins/layer_types/openlayers_layer_type_xyz.inc b/plugins/layer_types/openlayers_layer_type_xyz.inc
deleted file mode 100644
index d084ee86c970a62f117295724f9e9b17a483524c..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_xyz.inc
+++ /dev/null
@@ -1,93 +0,0 @@
- 'xyz',
- 'sphericalMercator' => TRUE,
- 'wrapDateLine' => FALSE,
- 'zoomOffset' => 0,
- 'resolutions' => array_slice(openlayers_get_resolutions('EPSG:900913'), 0, 18)
- ) + parent::options_init();
- }
-
- /**
- * Options form which generates layers
- */
- function options_form($defaults = array()) {
- return array(
- 'url' => array(
- '#type' => 'textarea',
- '#title' => t('Base URL (template)'),
- '#default_value' => !empty($this->data['url']) ? implode("\n", (array) $this->data['url']) : '',
- '#maxlength' => 2083,
- '#description' => t('This is the base URL template for the XYZ layer. It should be something similar to http://example.com/tiles/1.0.0/layer_name/${z}/${x}/${y}.png.'),
- ),
- 'serverResolutions' => array(
- '#type' => 'select',
- '#multiple' => TRUE,
- '#description' => t('Only set this if you need to request very specific resolutions from the server.'),
- '#options' => array_combine(
- array_map('strval', openlayers_get_resolutions('EPSG:900913')),
- range(0, 21)),
- '#title' => t('Server Zoom Level Range'),
- '#default_value' => isset($this->data['serverResolutions']) ?
- array_map('strval', $this->data['serverResolutions']) : array(),
- ),
- 'resolutions' => array(
- '#type' => 'select',
- '#multiple' => TRUE,
- '#description' => t('Only set this if you need a very specific resolution.'),
- '#options' => array_combine(
- array_map('strval', openlayers_get_resolutions('EPSG:900913')),
- range(0, 21)),
- '#title' => t('Zoom Level Range'),
- '#default_value' => isset($this->data['resolutions']) ?
- array_map('strval', $this->data['resolutions']) : array(),
- ),
- 'zoomOffset' => array(
- '#type' => 'select',
- '#description' => t('Zoom offset.'),
- '#options' => array_combine(
- range(0, 21),
- range(0, 21)),
- '#title' => t('Zoom offset'),
- '#default_value' => isset($this->data['zoomOffset']) ?
- $this->data['zoomOffset'] : array(),
- ),
- 'wrapDateLine' => array(
- '#type' => 'checkbox',
- '#title' => t('Wrap Date Line'),
- '#default_value' => isset($this->data['wrapDateLine']) ? $this->data['wrapDateLine'] : FALSE,
- '#description' => t('This allows the user to continually pan left and right as the tiles will repeat themselves. Note that this option is known to not work well with the 2.10 OL library.'),
- ),
- );
- }
-
- function options_form_validate($form, &$form_state) {
- $form_state['data']['url'] = explode("\n", $form_state['data']['url']);
- $form_state['data']['serverResolutions'] = array_map('floatval', array_values($form_state['data']['serverResolutions']));
- $form_state['data']['resolutions'] = array_map('floatval', array_values($form_state['data']['resolutions']));
- $form_state['data']['zoomOffset'] = (int) $form_state['data']['zoomOffset'];
- }
-
- function attached() {
- return array(
- 'js' => array(
- drupal_get_path('module', 'openlayers') . '/plugins/layer_types/openlayers_layer_type_xyz.js'
- )
- );
- }
-}
diff --git a/plugins/layer_types/openlayers_layer_type_xyz.js b/plugins/layer_types/openlayers_layer_type_xyz.js
deleted file mode 100644
index 5b430ff14e55f92b21ff692d9df4c1f220a3c104..0000000000000000000000000000000000000000
--- a/plugins/layer_types/openlayers_layer_type_xyz.js
+++ /dev/null
@@ -1,35 +0,0 @@
-
-/**
- * @file
- * Layer handler for XYZ layers
- */
-
-/**
- * Openlayer layer handler for XYZ layer
- */
-Drupal.openlayers.layer.xyz = function(title, map, options) {
- if (OpenLayers.Util.isArray(options.maxExtent)) {
- options.maxExtent = OpenLayers.Bounds.fromArray(options.maxExtent);
- }
-
- // Legacy goodnes
- if (typeof options.base_url == 'string' && typeof options.url == 'undefined') {
- options.url = options.base_url;
- }
-
- // Server resolutions are very particular in OL 2.11
- var r = options.serverResolutions;
- if (r == null || typeof r == 'undefined' || r.length == 0) {
- options.serverResolutions = null;
- }
-
- // Wrap Date Line does not seem to work for 2.10. This may
- // have something to do with our extent definitions.
- if (OpenLayers.VERSION_NUMBER.indexOf('2.10') >= 0) {
- options.wrapDateLine = null;
- }
-
- options.projection = new OpenLayers.Projection(options.projection);
-
- return new OpenLayers.Layer.XYZ(title, options.url, options);
-};
diff --git a/plugins/openlayers/control/openlayers_control_attribution.inc b/plugins/openlayers/control/openlayers_control_attribution.inc
new file mode 100644
index 0000000000000000000000000000000000000000..4c3d29ddf5e022979b3a5aec6bd60def5ca46464
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_attribution.inc
@@ -0,0 +1,24 @@
+ array(
+ 'class' => 'openlayers_control_attribution',
+ )
+ );
+}
+
+class openlayers_control_attribution extends openlayers_control {
+
+ function options_form() {
+ return array(
+ 'collapsible' => array(
+ '#type' => 'checkbox',
+ '#title' => t('Collapsible'),
+ '#default_value' => $this->getOption('collapsible'),
+ '#description' => t(''),
+ ),
+ );
+ }
+
+}
diff --git a/plugins/openlayers/control/openlayers_control_attribution.js b/plugins/openlayers/control/openlayers_control_attribution.js
new file mode 100644
index 0000000000000000000000000000000000000000..cab0e7d92d5eab5308d75b67190c11bc107ab3fa
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_attribution.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_control_attribution = function(options) {
+ return new ol.control.Attribution(options);
+}
diff --git a/plugins/openlayers/control/openlayers_control_defaults.inc b/plugins/openlayers/control/openlayers_control_defaults.inc
new file mode 100644
index 0000000000000000000000000000000000000000..3453886c1854aee125acddced3e3f89e40b35c12
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_defaults.inc
@@ -0,0 +1,14 @@
+ array(
+ 'class' => 'openlayers_control_defaults',
+ )
+ );
+}
+
+class openlayers_control_defaults extends openlayers_control {
+
+
+}
diff --git a/plugins/openlayers/control/openlayers_control_defaults.js b/plugins/openlayers/control/openlayers_control_defaults.js
new file mode 100644
index 0000000000000000000000000000000000000000..7fb88c0b144f0aecf90425a77f1cfc1ad36335a9
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_defaults.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_control_defaults = function(options) {
+ return new ol.control.defaults();
+}
diff --git a/plugins/openlayers/control/openlayers_control_fullscreen.inc b/plugins/openlayers/control/openlayers_control_fullscreen.inc
new file mode 100644
index 0000000000000000000000000000000000000000..1d24aaf46f0c29eeef42bf09f6e67adc9dcdfcac
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_fullscreen.inc
@@ -0,0 +1,14 @@
+ array(
+ 'class' => 'openlayers_control_fullscreen',
+ )
+ );
+}
+
+class openlayers_control_fullscreen extends openlayers_control {
+
+
+}
diff --git a/plugins/openlayers/control/openlayers_control_fullscreen.js b/plugins/openlayers/control/openlayers_control_fullscreen.js
new file mode 100644
index 0000000000000000000000000000000000000000..2b1e38ea0972f6b19ed60055c0c85b0bab4acc05
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_fullscreen.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_control_fullscreen = function(options) {
+ return new ol.control.FullScreen(options);
+}
diff --git a/plugins/openlayers/control/openlayers_control_mouseposition.inc b/plugins/openlayers/control/openlayers_control_mouseposition.inc
new file mode 100644
index 0000000000000000000000000000000000000000..1e142a95ee8d464d077dab8ae24542feb54ada30
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_mouseposition.inc
@@ -0,0 +1,30 @@
+ array(
+ 'class' => 'openlayers_control_mouseposition',
+ )
+ );
+}
+
+class openlayers_control_mouseposition extends openlayers_control {
+
+ function options_form() {
+ return array(
+ 'target' => array(
+ '#type' => 'textfield',
+ '#title' => t('ID of the element.'),
+ '#default_value' => $this->getOption('target'),
+ '#description' => t(''),
+ ),
+ 'undefinedHTML' => array(
+ '#type' => 'textfield',
+ '#title' => t('undefinedHTML'),
+ '#default_value' => $this->getOption('undefinedHTML'),
+ '#description' => t('Markup for undefined coordinates. Default is an empty string.'),
+ ),
+ );
+ }
+
+}
diff --git a/plugins/openlayers/control/openlayers_control_mouseposition.js b/plugins/openlayers/control/openlayers_control_mouseposition.js
new file mode 100644
index 0000000000000000000000000000000000000000..1f97b6c1ea75b598eb850359f1e0052158564afc
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_mouseposition.js
@@ -0,0 +1,5 @@
+Drupal.openlayers.openlayers_control_mouseposition = function(options) {
+ options.coordinateFormat = ol.coordinate.createStringXY(4);
+ //options.projection = 'EPSG:4326';
+ return new ol.control.MousePosition(options);
+}
diff --git a/plugins/openlayers/control/openlayers_control_rotate.inc b/plugins/openlayers/control/openlayers_control_rotate.inc
new file mode 100644
index 0000000000000000000000000000000000000000..4b52c25254535c9b23bc8d4aba22b192c6f2d67e
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_rotate.inc
@@ -0,0 +1,14 @@
+ array(
+ 'class' => 'openlayers_control_rotate',
+ )
+ );
+}
+
+class openlayers_control_rotate extends openlayers_control {
+
+
+}
diff --git a/plugins/openlayers/control/openlayers_control_rotate.js b/plugins/openlayers/control/openlayers_control_rotate.js
new file mode 100644
index 0000000000000000000000000000000000000000..3036d1c170debfe3d415f6e95a4e2b1053a32e67
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_rotate.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_control_rotate = function(map, options) {
+ return new ol.control.Rotate(options);
+}
diff --git a/plugins/openlayers/control/openlayers_control_scaleline.inc b/plugins/openlayers/control/openlayers_control_scaleline.inc
new file mode 100644
index 0000000000000000000000000000000000000000..9e8880a45feaaf2f99b7aad0c9ed831210fc725a
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_scaleline.inc
@@ -0,0 +1,14 @@
+ array(
+ 'class' => 'openlayers_control_scaleline',
+ )
+ );
+}
+
+class openlayers_control_scaleline extends openlayers_control {
+
+
+}
diff --git a/plugins/openlayers/control/openlayers_control_scaleline.js b/plugins/openlayers/control/openlayers_control_scaleline.js
new file mode 100644
index 0000000000000000000000000000000000000000..3d7f2f782050ee4cf330fd51a981c16f1917d9c3
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_scaleline.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_control_scaleline = function(map, options) {
+ return new ol.control.ScaleLine(options);
+}
diff --git a/plugins/openlayers/control/openlayers_control_zoom.inc b/plugins/openlayers/control/openlayers_control_zoom.inc
new file mode 100644
index 0000000000000000000000000000000000000000..dd903108f47160307ca74c77e03638b977c36bbe
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_zoom.inc
@@ -0,0 +1,14 @@
+ array(
+ 'class' => 'openlayers_control_zoom',
+ )
+ );
+}
+
+class openlayers_control_zoom extends openlayers_control {
+
+
+}
diff --git a/plugins/openlayers/control/openlayers_control_zoom.js b/plugins/openlayers/control/openlayers_control_zoom.js
new file mode 100644
index 0000000000000000000000000000000000000000..f56b5f9872fe296a5f98034a9b40a22375ed8e72
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_zoom.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_control_zoom = function(map, options) {
+ return new ol.control.Zoom(options);
+}
diff --git a/plugins/openlayers/control/openlayers_control_zoomslider.inc b/plugins/openlayers/control/openlayers_control_zoomslider.inc
new file mode 100644
index 0000000000000000000000000000000000000000..605b10da04de235572fc42ccb6662d3901cc5405
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_zoomslider.inc
@@ -0,0 +1,14 @@
+ array(
+ 'class' => 'openlayers_control_zoomslider',
+ )
+ );
+}
+
+class openlayers_control_zoomslider extends openlayers_control {
+
+
+}
diff --git a/plugins/openlayers/control/openlayers_control_zoomslider.js b/plugins/openlayers/control/openlayers_control_zoomslider.js
new file mode 100644
index 0000000000000000000000000000000000000000..12f39dff529c745e8d5a91e396c88edbf26dc331
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_zoomslider.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_control_zoomslider = function(options) {
+ return new ol.control.ZoomSlider(options);
+}
diff --git a/plugins/openlayers/control/openlayers_control_zoomtoextent.inc b/plugins/openlayers/control/openlayers_control_zoomtoextent.inc
new file mode 100644
index 0000000000000000000000000000000000000000..641ad11185f11ad5eb0425bbd28e2c2dbdc9e0e8
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_zoomtoextent.inc
@@ -0,0 +1,14 @@
+ array(
+ 'class' => 'openlayers_control_zoomtoextent',
+ )
+ );
+}
+
+class openlayers_control_zoomtoextent extends openlayers_control {
+
+
+}
diff --git a/plugins/openlayers/control/openlayers_control_zoomtoextent.js b/plugins/openlayers/control/openlayers_control_zoomtoextent.js
new file mode 100644
index 0000000000000000000000000000000000000000..3c801dc3b26a06c7cbb23cb0223e30443223cdd6
--- /dev/null
+++ b/plugins/openlayers/control/openlayers_control_zoomtoextent.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_control_zoomtoextent = function(options) {
+ return new ol.control.ZoomToExtent(options);
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_doubleclickzoom.inc b/plugins/openlayers/interaction/openlayers_interaction_doubleclickzoom.inc
new file mode 100644
index 0000000000000000000000000000000000000000..0c4a538aaca73720a6713a3b4a11e4b915578d0b
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_doubleclickzoom.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_doubleclickzoom',
+ )
+ );
+}
+
+class openlayers_interaction_doubleclickzoom extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_doubleclickzoom.js b/plugins/openlayers/interaction/openlayers_interaction_doubleclickzoom.js
new file mode 100644
index 0000000000000000000000000000000000000000..977e4f0c9848134b0c7c095840fbb2f308e55cea
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_doubleclickzoom.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_interaction_doubleclickzoom = function(options) {
+ return new ol.interaction.DoubleClickZoom(options);
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_draganddrop.inc b/plugins/openlayers/interaction/openlayers_interaction_draganddrop.inc
new file mode 100644
index 0000000000000000000000000000000000000000..6737c95c11d3eb983ef7d136b97e1352aa7467fb
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_draganddrop.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_draganddrop',
+ )
+ );
+}
+
+class openlayers_interaction_draganddrop extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_draganddrop.js b/plugins/openlayers/interaction/openlayers_interaction_draganddrop.js
new file mode 100644
index 0000000000000000000000000000000000000000..f9daad762f4f7f6f850cf35a5ec668f0f054048b
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_draganddrop.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_interaction_draganddrop = function(options) {
+ return new ol.interaction.DragAndDrop(options);
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_dragbox.inc b/plugins/openlayers/interaction/openlayers_interaction_dragbox.inc
new file mode 100644
index 0000000000000000000000000000000000000000..162fb9cf472fc0c48f2e598d9beb7f4668b982c7
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_dragbox.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_dragbox',
+ )
+ );
+}
+
+class openlayers_interaction_dragbox extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_dragbox.js b/plugins/openlayers/interaction/openlayers_interaction_dragbox.js
new file mode 100644
index 0000000000000000000000000000000000000000..8909f630c47f960105b856cf490f265c89b52fb7
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_dragbox.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_interaction_dragbox = function(options) {
+ return new ol.interaction.DragBox(options);
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_dragpan.inc b/plugins/openlayers/interaction/openlayers_interaction_dragpan.inc
new file mode 100644
index 0000000000000000000000000000000000000000..329ff22bdaded4e920187e6f142f501a32fbaa9c
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_dragpan.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_dragpan',
+ )
+ );
+}
+
+class openlayers_interaction_dragpan extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_dragpan.js b/plugins/openlayers/interaction/openlayers_interaction_dragpan.js
new file mode 100644
index 0000000000000000000000000000000000000000..2f87265e2ca4c57c38e199e3bbe71fb44d19d91d
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_dragpan.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_interaction_dragpan = function(options) {
+ return new ol.interaction.DragPan({kinetic: new ol.Kinetic(-0.005, 0.05, 100)});
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_dragrotate.inc b/plugins/openlayers/interaction/openlayers_interaction_dragrotate.inc
new file mode 100644
index 0000000000000000000000000000000000000000..44ac33b76d77829f7339fd07b6da4e939777ddd1
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_dragrotate.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_dragrotate',
+ )
+ );
+}
+
+class openlayers_interaction_dragrotate extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_dragrotate.js b/plugins/openlayers/interaction/openlayers_interaction_dragrotate.js
new file mode 100644
index 0000000000000000000000000000000000000000..520a658ae542f05c5d6e943e9509d89f2d565638
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_dragrotate.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_interaction_dragrotate = function(options) {
+ return new ol.interaction.DragRotate(options);
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_dragrotateandzoom.inc b/plugins/openlayers/interaction/openlayers_interaction_dragrotateandzoom.inc
new file mode 100644
index 0000000000000000000000000000000000000000..13f26e0de2f58e5884bed3ed394fc0044d531195
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_dragrotateandzoom.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_dragrotateandzoom',
+ )
+ );
+}
+
+class openlayers_interaction_dragrotateandzoom extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_dragrotateandzoom.js b/plugins/openlayers/interaction/openlayers_interaction_dragrotateandzoom.js
new file mode 100644
index 0000000000000000000000000000000000000000..cb66df723a495b1c06dd228f31950251c300cfb0
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_dragrotateandzoom.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_interaction_dragrotateandzoom = function(options) {
+ return new ol.interaction.DragRotateAndZoom(options);
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_dragzoom.inc b/plugins/openlayers/interaction/openlayers_interaction_dragzoom.inc
new file mode 100644
index 0000000000000000000000000000000000000000..38b8e5bdcf135af073bd2498c67a607df56b97f5
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_dragzoom.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_dragzoom',
+ )
+ );
+}
+
+class openlayers_interaction_dragzoom extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_dragzoom.js b/plugins/openlayers/interaction/openlayers_interaction_dragzoom.js
new file mode 100644
index 0000000000000000000000000000000000000000..8dfda6a7a3d82a7c886d959dab2904dafe42012b
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_dragzoom.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_interaction_dragzoom = function(options) {
+ return new ol.interaction.DragZoom(options);
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_draw.inc b/plugins/openlayers/interaction/openlayers_interaction_draw.inc
new file mode 100644
index 0000000000000000000000000000000000000000..2a49fc951b013ad72165ca220b621c53d343d47f
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_draw.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_draw',
+ )
+ );
+}
+
+class openlayers_interaction_draw extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_draw.js b/plugins/openlayers/interaction/openlayers_interaction_draw.js
new file mode 100644
index 0000000000000000000000000000000000000000..2e2820c733b47606b24e9429fd7c712f388f62f8
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_draw.js
@@ -0,0 +1,31 @@
+Drupal.openlayers.openlayers_interaction_draw = function(options, map) {
+
+ var featureOverlay = new ol.FeatureOverlay({
+ style: new ol.style.Style({
+ fill: new ol.style.Fill({
+ color: 'rgba(255, 255, 255, 0.2)'
+ }),
+ stroke: new ol.style.Stroke({
+ color: '#ffcc33',
+ width: 2
+ }),
+ image: new ol.style.Circle({
+ radius: 7,
+ fill: new ol.style.Fill({
+ color: '#ffcc33'
+ })
+ })
+ })
+ });
+ featureOverlay.setMap(map);
+
+ options.features = featureOverlay.getFeatures();
+ options.type = 'Point';
+
+ map.on('moveend', function(evt){
+ var WKT = new ol.format.WKT();
+ console.log(WKT.writeFeatures(featureOverlay.getFeatures()));
+ });
+
+ return new ol.interaction.Draw(options);
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_keyboardpan.inc b/plugins/openlayers/interaction/openlayers_interaction_keyboardpan.inc
new file mode 100644
index 0000000000000000000000000000000000000000..e0a8a8ece021ba1034f20ed5b537c1df3a1878ce
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_keyboardpan.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_keyboardpan',
+ )
+ );
+}
+
+class openlayers_interaction_keyboardpan extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_keyboardpan.js b/plugins/openlayers/interaction/openlayers_interaction_keyboardpan.js
new file mode 100644
index 0000000000000000000000000000000000000000..e248dd79cc1ae25234aa5782a17ef9db4f026871
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_keyboardpan.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_interaction_keyboardpan = function(options) {
+ return new ol.interaction.KeyboardPan(options);
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_keyboardzoom.inc b/plugins/openlayers/interaction/openlayers_interaction_keyboardzoom.inc
new file mode 100644
index 0000000000000000000000000000000000000000..2d6bd40134e879f8e99edfdb79d3721c9cdef288
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_keyboardzoom.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_keyboardzoom',
+ )
+ );
+}
+
+class openlayers_interaction_keyboardzoom extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_keyboardzoom.js b/plugins/openlayers/interaction/openlayers_interaction_keyboardzoom.js
new file mode 100644
index 0000000000000000000000000000000000000000..e9bbf735f5f888b0e099e43963a991a53141b549
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_keyboardzoom.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_interaction_keyboardzoom = function(options) {
+ return new ol.interaction.KeyboardZoom(options);
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_modify.inc b/plugins/openlayers/interaction/openlayers_interaction_modify.inc
new file mode 100644
index 0000000000000000000000000000000000000000..3b467d5ddd386163b13a81622129430ba1d792e7
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_modify.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_modify',
+ )
+ );
+}
+
+class openlayers_interaction_modify extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_modify.js b/plugins/openlayers/interaction/openlayers_interaction_modify.js
new file mode 100644
index 0000000000000000000000000000000000000000..97459da60cd3322ab735da28c01856b529b2ef44
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_modify.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_interaction_modify = function(options) {
+ return new ol.interaction.Modify(options);
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_mousewheelzoom.inc b/plugins/openlayers/interaction/openlayers_interaction_mousewheelzoom.inc
new file mode 100644
index 0000000000000000000000000000000000000000..afdd90b35da6a9aa6a061f841691aac17da357a8
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_mousewheelzoom.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_mousewheelzoom',
+ )
+ );
+}
+
+class openlayers_interaction_mousewheelzoom extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_mousewheelzoom.js b/plugins/openlayers/interaction/openlayers_interaction_mousewheelzoom.js
new file mode 100644
index 0000000000000000000000000000000000000000..002655a8d6e35cbe8c80a7f35e50856bf2b2493a
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_mousewheelzoom.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_interaction_mousewheelzoom = function(options) {
+ return new ol.interaction.MouseWheelZoom(options);
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_pinchrotate.inc b/plugins/openlayers/interaction/openlayers_interaction_pinchrotate.inc
new file mode 100644
index 0000000000000000000000000000000000000000..75cb8a5fdc59093b0045c5c6fdd2888b070c4428
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_pinchrotate.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_pinchrotate',
+ )
+ );
+}
+
+class openlayers_interaction_pinchrotate extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_pinchrotate.js b/plugins/openlayers/interaction/openlayers_interaction_pinchrotate.js
new file mode 100644
index 0000000000000000000000000000000000000000..eba0be151ab270c55d70f4fa1a00b5156d647dce
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_pinchrotate.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_interaction_pinchrotate = function(options) {
+ return new ol.interaction.PinchRotate(options);
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_pinchzoom.inc b/plugins/openlayers/interaction/openlayers_interaction_pinchzoom.inc
new file mode 100644
index 0000000000000000000000000000000000000000..9d45b56f0aaae416835bed1817c3b3b3f5d1f90e
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_pinchzoom.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_pinchzoom',
+ )
+ );
+}
+
+class openlayers_interaction_pinchzoom extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_pinchzoom.js b/plugins/openlayers/interaction/openlayers_interaction_pinchzoom.js
new file mode 100644
index 0000000000000000000000000000000000000000..2ef4f174ac479af876b262fbc90501bc4c3dffe3
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_pinchzoom.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_interaction_pinchzoom = function(options) {
+ return new ol.interaction.PinchZoom(options);
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_pointer.inc b/plugins/openlayers/interaction/openlayers_interaction_pointer.inc
new file mode 100644
index 0000000000000000000000000000000000000000..b60dd8896eacd787c0fa4385179fc24179d5fe1c
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_pointer.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_pointer',
+ )
+ );
+}
+
+class openlayers_interaction_pointer extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_pointer.js b/plugins/openlayers/interaction/openlayers_interaction_pointer.js
new file mode 100644
index 0000000000000000000000000000000000000000..1551836da5d2236a94ae5a83a7b9ff3ec59fee87
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_pointer.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_interaction_pointer = function(options) {
+ return new ol.interaction.Pointer(options);
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_select.inc b/plugins/openlayers/interaction/openlayers_interaction_select.inc
new file mode 100644
index 0000000000000000000000000000000000000000..2938f62d119ae791dadc53cc7f16d88e8d929a27
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_select.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_interaction_select',
+ )
+ );
+}
+
+class openlayers_interaction_select extends openlayers_interaction {
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_select.js b/plugins/openlayers/interaction/openlayers_interaction_select.js
new file mode 100644
index 0000000000000000000000000000000000000000..1c214e24174c15757ab9f469b26d3b54805418e8
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_select.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_interaction_select = function(options) {
+ return new ol.interaction.Select(options);
+};
diff --git a/plugins/openlayers/interaction/openlayers_interaction_setvalues.inc b/plugins/openlayers/interaction/openlayers_interaction_setvalues.inc
new file mode 100644
index 0000000000000000000000000000000000000000..1f1b0a84d1517d5d4ba2bde5e78975fcf760dc2d
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_setvalues.inc
@@ -0,0 +1,42 @@
+ array(
+ 'class' => 'openlayers_interaction_setvalues',
+ )
+ );
+}
+
+class openlayers_interaction_setvalues extends openlayers_interaction {
+
+ function options_form() {
+ return array(
+ 'latitude' => array(
+ '#type' => 'textfield',
+ '#title' => t('Latitude'),
+ '#default_value' => $this->getOption('latitude'),
+ '#description' => t(''),
+ ),
+ 'longitude' => array(
+ '#type' => 'textfield',
+ '#title' => t('Longitude'),
+ '#default_value' => $this->getOption('longitude'),
+ '#description' => t(''),
+ ),
+ 'rotation' => array(
+ '#type' => 'textfield',
+ '#title' => t('Rotation'),
+ '#default_value' => $this->getOption('rotation', 0),
+ '#description' => t(''),
+ ),
+ 'zoom' => array(
+ '#type' => 'textfield',
+ '#title' => t('Zoom'),
+ '#default_value' => $this->getOption('zoom', 0),
+ '#description' => t(''),
+ ),
+ );
+ }
+
+}
diff --git a/plugins/openlayers/interaction/openlayers_interaction_setvalues.js b/plugins/openlayers/interaction/openlayers_interaction_setvalues.js
new file mode 100644
index 0000000000000000000000000000000000000000..45c5768b7678f6e7f881a6b21541e846e34252ff
--- /dev/null
+++ b/plugins/openlayers/interaction/openlayers_interaction_setvalues.js
@@ -0,0 +1,25 @@
+Drupal.openlayers.openlayers_interaction_setvalues = function(options, map) {
+
+ map.on('moveend', function(evt){
+ var selector = '#' + options.latitude;
+ jQuery(selector).val(map.getView().getCenter()[0]);
+ var selector = '#' + options.longitude;
+ jQuery(selector).val(map.getView().getCenter()[1]);
+ var selector = '#' + options.rotation;
+ jQuery(selector).val(map.getView().getRotation());
+ var selector = '#' + options.zoom;
+ jQuery(selector).val(map.getView().getZoom());
+ });
+
+ map.on('click', function(evt){
+ var coordinate = evt.coordinate;
+ var pan = ol.animation.pan({
+ duration: 2000,
+ source: (map.getView().getCenter())
+ });
+ map.beforeRender(pan);
+ map.getView().setCenter(coordinate);
+ });
+
+ return new ol.interaction.Select(options);
+};
diff --git a/plugins/openlayers/layer/openlayers_layer_heatmap.inc b/plugins/openlayers/layer/openlayers_layer_heatmap.inc
new file mode 100644
index 0000000000000000000000000000000000000000..43f1cff86482c903591fc180b2bf2fbf1015054c
--- /dev/null
+++ b/plugins/openlayers/layer/openlayers_layer_heatmap.inc
@@ -0,0 +1,28 @@
+ array(
+ 'class' => 'openlayers_layer_heatmap',
+ )
+ );
+}
+
+class openlayers_layer_heatmap extends openlayers_layer {
+
+ function options_form($defaults = array()) {
+ return array(
+ 'opacity' => array(
+ '#type' => 'textfield',
+ '#description' => 'Opacity (0, 1). Default is 1.',
+ '#default_value' => $this->getOption('opacity', 1),
+ ),
+ 'preload' => array(
+ '#type' => 'textfield',
+ '#description' => 'Preload. Load low-resolution tiles up to preload levels. By default preload is 0, which means no preloading.',
+ '#default_value' => $this->getOption('preload', 1),
+ )
+ );
+ }
+
+}
diff --git a/plugins/openlayers/layer/openlayers_layer_heatmap.js b/plugins/openlayers/layer/openlayers_layer_heatmap.js
new file mode 100644
index 0000000000000000000000000000000000000000..8d92b97c065b08991457eb41616f8a3d31e70bf0
--- /dev/null
+++ b/plugins/openlayers/layer/openlayers_layer_heatmap.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.layer.heatmap = function(options) {
+ return new ol.layer.Heatmap(options);
+};
diff --git a/plugins/openlayers/layer/openlayers_layer_image.inc b/plugins/openlayers/layer/openlayers_layer_image.inc
new file mode 100644
index 0000000000000000000000000000000000000000..c76fc3180963ce52c61385719228ca6cbbab6f20
--- /dev/null
+++ b/plugins/openlayers/layer/openlayers_layer_image.inc
@@ -0,0 +1,93 @@
+ array(
+ 'class' => 'openlayers_layer_image',
+ )
+ );
+}
+
+class openlayers_layer_image extends openlayers_layer {
+
+ function options_form() {
+ return array(
+ 'file' => array(
+ '#type' => 'managed_file',
+ '#title' => t('Image'),
+ '#default_value' => $this->getOption('file'),
+ '#upload_location' => 'public://',
+ ),
+ 'image_style' => array(
+ '#type' => 'select',
+ '#options' => array(''=> 'None (original image)') + image_style_options(FALSE),
+ '#default_value' => $this->getOption('image_style'),
+ '#description' => t('Apply an image style.'),
+ ),
+ 'factors' => array(
+ '#tree' => TRUE,
+ 'x' => array(
+ '#title' => 'Width divider',
+ '#type' => 'textfield',
+ // Todo: Find a way to replace this properly with getOption() method.
+ '#default_value' => isset($this->options['factors']['x']) ? $this->options['factors']['x'] : 1,
+ '#description' => t('Width divider.'),
+ ),
+ 'y' => array(
+ '#title' => 'Height divider',
+ '#type' => 'textfield',
+ '#default_value' => isset($this->options['factors']['y']) ? $this->options['factors']['y'] : 1,
+ '#description' => t('Height divider.'),
+ ),
+ ),
+ );
+ }
+
+ function options_form_validate($form, &$form_state) {
+ dpm($form_state);
+ if ($file = file_load($form_state['options']['file'])) {
+ // Do something with the file if needed.
+ } else {
+
+ //form_set_error($form_state['item']['options'], 'Cannot access the file.');
+ }
+ }
+
+ /**
+ * hook_submit() of the form.
+ */
+ function options_form_submit($form, &$form_state) {
+ global $user;
+
+ $item = $form_state['item'];
+ if ($item->getOption('file') && $file = file_load($item->getOption('file'))) {
+ file_delete($file);
+ }
+
+ if (isset($form_state['values']['options']['file']) && $file = file_load($form_state['values']['options']['file'])) {
+ $file->status = FILE_STATUS_PERMANENT;
+ file_save($file);
+ file_usage_add($file, 'openlayers', 'openlayers_layer_type', $user->uid);
+ }
+
+ $style = $form_state['values']['options']['image_style'];
+
+ if (!empty($style)) {
+ $uri = image_style_path($style, $file->uri);
+ image_style_create_derivative(image_style_load($style), $file->uri, $uri);
+ } else {
+ $uri = $file->uri;
+ }
+ }
+
+ /*
+ * What to do when we delete the layer: delete the file.
+ */
+ function delete($item) {
+ // todo
+ }
+
+}
+
+
+
diff --git a/plugins/openlayers/layer/openlayers_layer_image.js b/plugins/openlayers/layer/openlayers_layer_image.js
new file mode 100644
index 0000000000000000000000000000000000000000..e5f82f1f3588893c48c58a52216437f501b18ecb
--- /dev/null
+++ b/plugins/openlayers/layer/openlayers_layer_image.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_layer_image = function(options, map) {
+ return new ol.layer.Image(options);
+};
diff --git a/plugins/openlayers/layer/openlayers_layer_tile.inc b/plugins/openlayers/layer/openlayers_layer_tile.inc
new file mode 100644
index 0000000000000000000000000000000000000000..aebc3f53b4b950da840faa8b65517b68cfd2515c
--- /dev/null
+++ b/plugins/openlayers/layer/openlayers_layer_tile.inc
@@ -0,0 +1,40 @@
+ array(
+ 'class' => 'openlayers_layer_tile',
+ )
+ );
+}
+
+class openlayers_layer_tile extends openlayers_layer {
+
+ function options_form($defaults = array()) {
+ return array(
+ 'url' => array(
+ '#type' => 'textarea',
+ '#title' => t('Base URL (template)'),
+ '#default_value' => $this->getOption('url') ? implode("\n", (array) $this->getOption('url')) : '',
+ '#maxlength' => 2083,
+ '#description' => t('This is the base URL template for the XYZ layer. It should be something similar to http://example.com/tiles/1.0.0/layer_name/${z}/${x}/${y}.png.'),
+ ),
+ 'zoomOffset' => array(
+ '#type' => 'select',
+ '#description' => t('Zoom offset.'),
+ '#options' => array_combine(
+ range(0, 21),
+ range(0, 21)),
+ '#title' => t('Zoom offset'),
+ '#default_value' => $this->getOption('zoomOffset')
+ ),
+ 'wrapDateLine' => array(
+ '#type' => 'checkbox',
+ '#title' => t('Wrap Date Line'),
+ '#default_value' => $this->getOption('wrapDateLine'),
+ '#description' => t('This allows the user to continually pan left and right as the tiles will repeat themselves. Note that this option is known to not work well with the 2.10 OL library.'),
+ ),
+ );
+ }
+
+}
diff --git a/plugins/openlayers/layer/openlayers_layer_tile.js b/plugins/openlayers/layer/openlayers_layer_tile.js
new file mode 100644
index 0000000000000000000000000000000000000000..2168ed8d2e1dcba8993cb57b91e3451ecab743d6
--- /dev/null
+++ b/plugins/openlayers/layer/openlayers_layer_tile.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_layer_tile = function(options) {
+ return new ol.layer.Tile(options);
+};
diff --git a/plugins/openlayers/layer/openlayers_layer_vector.inc b/plugins/openlayers/layer/openlayers_layer_vector.inc
new file mode 100644
index 0000000000000000000000000000000000000000..e7c3a9bcd1dc66ec126b6019f6dc2593699fd2c5
--- /dev/null
+++ b/plugins/openlayers/layer/openlayers_layer_vector.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_layer_vector',
+ )
+ );
+}
+
+class openlayers_layer_vector extends openlayers_layer {
+
+}
diff --git a/plugins/openlayers/layer/openlayers_layer_vector.js b/plugins/openlayers/layer/openlayers_layer_vector.js
new file mode 100644
index 0000000000000000000000000000000000000000..4fbafcd9013343c76d0e385a25ab31e231ddd9f7
--- /dev/null
+++ b/plugins/openlayers/layer/openlayers_layer_vector.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_layer_vector = function(options) {
+ return new ol.layer.Vector(options);
+};
diff --git a/plugins/openlayers/map/openlayers_map_map.inc b/plugins/openlayers/map/openlayers_map_map.inc
new file mode 100644
index 0000000000000000000000000000000000000000..d48f094dff41b599285a403dfe04185f03f420e1
--- /dev/null
+++ b/plugins/openlayers/map/openlayers_map_map.inc
@@ -0,0 +1,98 @@
+ array(
+ 'class' => 'openlayers_map_map',
+ )
+ );
+}
+
+class openlayers_map_map extends openlayers_map {
+
+ function options_form() {
+ $form['options']['ui'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Size of the map'),
+ '#tree' => TRUE,
+ 'width' => array(
+ '#type' => 'textfield',
+ '#title' => 'Width',
+ '#default_value' => $this->getOption('width', 'auto'),
+ '#parents' => array('options', 'width'),
+ ),
+ 'height' => array(
+ '#type' => 'textfield',
+ '#title' => 'height',
+ '#default_value' => $this->getOption('height', '300px'),
+ '#parents' => array('options', 'height'),
+ ),
+ 'contextualLinks' => array(
+ '#type' => 'checkbox',
+ '#title' => 'Contextual links',
+ '#description' => t('Enable contextual links on the map.'),
+ '#default_value' => $this->getOption('contextualLinks', TRUE),
+ '#parents' => array('options', 'contextualLinks'),
+ ),
+ 'provideBlock' => array(
+ '#type' => 'checkbox',
+ '#title' => 'Provide Drupal block',
+ '#description' => t('Enable this to enable a block to display the map.'),
+ '#default_value' => $this->getOption('provideBlock', TRUE),
+ '#parents' => array('options', 'provideBlock'),
+ ),
+ );
+
+ $form['options']['view'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('View: center and rotation'),
+ '#tree' => TRUE,
+ );
+
+ if ($this->machine_name != 'map_view_edit_form') {
+ $map = openlayers_object_load('map', 'map_view_edit_form');
+ if ($view = $this->getOption('view')) {
+ $map->options['view'] = $view;
+ }
+
+ $form['options']['view']['map'] = array(
+ '#title' => 'Map',
+ '#markup' => openlayers_render_map($map),
+ );
+ }
+
+ $form['options']['view']['center'] = array(
+ 'lat' => array(
+ '#type' => 'textfield',
+ '#title' => 'Latitude',
+ // Todo: Replace with getOption() method.
+ '#default_value' => isset($this->options['view']['center']['lat']) ? $this->options['view']['center']['lat']:0,
+ '#parents' => array('options', 'view', 'center', 'lat'),
+ ),
+ 'lon' => array(
+ '#type' => 'textfield',
+ '#title' => 'Longitude',
+ '#default_value' => isset($this->options['view']['center']['lon']) ? $this->options['view']['center']['lon']:0,
+ '#parents' => array('options', 'view', 'center', 'lon'),
+ )
+ );
+ $form['options']['view']['rotation'] = array(
+ 'rotation' => array(
+ '#type' => 'textfield',
+ '#title' => 'Rotation',
+ '#default_value' => isset($this->options['view']['rotation']) ? $this->options['view']['rotation']:0,
+ '#parents' => array('options', 'view', 'rotation'),
+ ),
+ );
+ $form['options']['view']['zoom'] = array(
+ 'zoom' => array(
+ '#type' => 'textfield',
+ '#title' => 'Zoom',
+ '#default_value' => isset($this->options['view']['zoom']) ? $this->options['view']['zoom']:0,
+ '#parents' => array('options', 'view', 'zoom'),
+ ),
+ );
+
+ return $form;
+ }
+}
diff --git a/plugins/openlayers/map/openlayers_map_map.js b/plugins/openlayers/map/openlayers_map_map.js
new file mode 100644
index 0000000000000000000000000000000000000000..39d84868d05b93af640ef6cad7bde4fece852ca8
--- /dev/null
+++ b/plugins/openlayers/map/openlayers_map_map.js
@@ -0,0 +1,13 @@
+Drupal.openlayers.openlayers_map_map = function(options) {
+ var projection = ol.proj.get('EPSG:3857');
+
+ options.view = new ol.View({
+ center: [options.view.center.lat, options.view.center.lon],
+ rotation: options.view.rotation,
+ zoom: options.view.zoom,
+ projection: projection,
+ extent: projection.getExtent()
+ });
+
+ return new ol.Map(options);
+};
diff --git a/plugins/openlayers/source/openlayers_source_bingmaps.inc b/plugins/openlayers/source/openlayers_source_bingmaps.inc
new file mode 100644
index 0000000000000000000000000000000000000000..aa38ced45b765f87c58c03813c1c7830e6bceaab
--- /dev/null
+++ b/plugins/openlayers/source/openlayers_source_bingmaps.inc
@@ -0,0 +1,30 @@
+ array(
+ 'class' => 'openlayers_source_bingmaps',
+ )
+ );
+}
+
+class openlayers_source_bingmaps extends openlayers_source {
+
+ function options_form($defaults = array()) {
+ $layer_types = array(
+ 'Road' => 'Road',
+ 'AerialWithLabels' => 'Hybrid',
+ 'Aerial' => 'Aerial',
+ );
+
+ return array(
+ 'type' => array(
+ '#title' => t('Source type'),
+ '#type' => 'select',
+ '#default_value' => isset($this->data['type']) ? $this->data['type'] : 'Road',
+ '#options' => $layer_types
+ )
+ );
+ }
+
+}
diff --git a/plugins/openlayers/source/openlayers_source_bingmaps.js b/plugins/openlayers/source/openlayers_source_bingmaps.js
new file mode 100644
index 0000000000000000000000000000000000000000..7726a7ab141dd6ad76fe1e425b2e9e8a9fe12580
--- /dev/null
+++ b/plugins/openlayers/source/openlayers_source_bingmaps.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.source.bingmaps = function(map, options) {
+ return new ol.source.BingMaps(options);
+};
diff --git a/plugins/openlayers/source/openlayers_source_geojson.inc b/plugins/openlayers/source/openlayers_source_geojson.inc
new file mode 100644
index 0000000000000000000000000000000000000000..bcbc0056ed1a7bae009e24f7bd98e1395f21166c
--- /dev/null
+++ b/plugins/openlayers/source/openlayers_source_geojson.inc
@@ -0,0 +1,49 @@
+ array(
+ 'class' => 'openlayers_source_geojson',
+ )
+ );
+}
+
+class openlayers_source_geojson extends openlayers_source {
+
+ function options_init() {
+ return array(
+ 'data' => array()
+ );
+ }
+
+ function options_form($defaults = array()) {
+ $layer_types = array(
+ 'Road' => 'Road',
+ 'AerialWithLabels' => 'Hybrid',
+ 'Aerial' => 'Aerial',
+ );
+
+ return array(
+ 'type' => array(
+ '#title' => t('Source type'),
+ '#type' => 'select',
+ '#default_value' => isset($this->data['type']) ? $this->data['type'] : 'Road',
+ '#options' => $layer_types
+ )
+ );
+ }
+
+ function settings_form() {
+ return array();
+ }
+
+ function attached() {
+ return array(
+ 'js' => array(
+ drupal_get_path('module', 'openlayers') . '/plugins/source/openlayers_source_geojson.js'
+ )
+ );
+ }
+
+ function render(&$map) {}
+}
diff --git a/plugins/openlayers/source/openlayers_source_geojson.js b/plugins/openlayers/source/openlayers_source_geojson.js
new file mode 100644
index 0000000000000000000000000000000000000000..48b7bef6f82a40488fdba4627be56824f806aa29
--- /dev/null
+++ b/plugins/openlayers/source/openlayers_source_geojson.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.source.geojson = function(map, options) {
+ return new ol.source.GeoJSON(options);
+};
diff --git a/plugins/openlayers/source/openlayers_source_imagestatic.inc b/plugins/openlayers/source/openlayers_source_imagestatic.inc
new file mode 100644
index 0000000000000000000000000000000000000000..ea1fc44b12507de03d72209b4b2fc8d013c35e65
--- /dev/null
+++ b/plugins/openlayers/source/openlayers_source_imagestatic.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_source_imagestatic',
+ )
+ );
+}
+
+class openlayers_source_imagestatic extends openlayers_source {
+
+}
diff --git a/plugins/openlayers/source/openlayers_source_imagestatic.js b/plugins/openlayers/source/openlayers_source_imagestatic.js
new file mode 100644
index 0000000000000000000000000000000000000000..c59e94300ba7de4a20a92ff76ea3dcf92ff8ab4e
--- /dev/null
+++ b/plugins/openlayers/source/openlayers_source_imagestatic.js
@@ -0,0 +1,20 @@
+Drupal.openlayers.openlayers_source_imagestatic = function(options, map) {
+
+ var pixelProjection = new ol.proj.Projection({
+ code: 'pixel',
+ units: 'pixels',
+ extent: [0, 0, 1024, 968]
+ });
+
+ options.imageSize = [1024, 1024];
+ options.projection = pixelProjection;
+ options.imageExtent = pixelProjection.getExtent();
+
+ map.setView(new ol.View({
+ projection: pixelProjection,
+ center: ol.extent.getCenter(pixelProjection.getExtent()),
+ zoom: map.getView().getZoom()
+ }));
+
+ return new ol.source.ImageStatic(options);
+};
diff --git a/plugins/openlayers/source/openlayers_source_mapquest.inc b/plugins/openlayers/source/openlayers_source_mapquest.inc
new file mode 100644
index 0000000000000000000000000000000000000000..06a706a8bc3125411db51a6f3eabaf0081733380
--- /dev/null
+++ b/plugins/openlayers/source/openlayers_source_mapquest.inc
@@ -0,0 +1,30 @@
+ array(
+ 'class' => 'openlayers_source_mapquest',
+ )
+ );
+}
+
+class openlayers_source_mapquest extends openlayers_source {
+
+ function options_form() {
+ $layer_types = array(
+ 'osm' => 'OpenStreetMap',
+ 'sat' => 'Satellite',
+ 'hyb' => 'Hybrid',
+ );
+
+ return array(
+ 'layer' => array(
+ '#title' => t('Source type'),
+ '#type' => 'select',
+ '#default_value' => $this->getOption('layer', 'osm'),
+ '#options' => $layer_types
+ )
+ );
+ }
+
+}
diff --git a/plugins/openlayers/source/openlayers_source_mapquest.js b/plugins/openlayers/source/openlayers_source_mapquest.js
new file mode 100644
index 0000000000000000000000000000000000000000..c202e02d0fa37cc7460c47f0bd2a1fa255cd1bdc
--- /dev/null
+++ b/plugins/openlayers/source/openlayers_source_mapquest.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_source_mapquest = function(options) {
+ return new ol.source.MapQuest(options);
+};
diff --git a/plugins/openlayers/source/openlayers_source_osm.inc b/plugins/openlayers/source/openlayers_source_osm.inc
new file mode 100644
index 0000000000000000000000000000000000000000..9fc2d0d2957923ec50d9c396ae034a7e31c0d717
--- /dev/null
+++ b/plugins/openlayers/source/openlayers_source_osm.inc
@@ -0,0 +1,13 @@
+ array(
+ 'class' => 'openlayers_source_osm',
+ )
+ );
+}
+
+class openlayers_source_osm extends openlayers_source {
+
+}
diff --git a/plugins/openlayers/source/openlayers_source_osm.js b/plugins/openlayers/source/openlayers_source_osm.js
new file mode 100644
index 0000000000000000000000000000000000000000..675a48a8bc37dfc1b14ead9c8150c336da96b10d
--- /dev/null
+++ b/plugins/openlayers/source/openlayers_source_osm.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_source_osm = function(options) {
+ return new ol.source.OSM(options);
+};
diff --git a/plugins/openlayers/source/openlayers_source_tilejson.inc b/plugins/openlayers/source/openlayers_source_tilejson.inc
new file mode 100644
index 0000000000000000000000000000000000000000..b0a475c8667ff6a75ce75175d0d508493e4cf66a
--- /dev/null
+++ b/plugins/openlayers/source/openlayers_source_tilejson.inc
@@ -0,0 +1,23 @@
+ array(
+ 'class' => 'openlayers_source_tilejson',
+ )
+ );
+}
+
+class openlayers_source_tilejson extends openlayers_source {
+
+ function options_form() {
+ return array(
+ 'url' => array(
+ '#title' => t('URL'),
+ '#type' => 'textfield',
+ '#default_value' => $this->getOption('url'),
+ )
+ );
+ }
+
+}
diff --git a/plugins/openlayers/source/openlayers_source_tilejson.js b/plugins/openlayers/source/openlayers_source_tilejson.js
new file mode 100644
index 0000000000000000000000000000000000000000..22b8de646e98703166fe470a6943a80a2fca0d8f
--- /dev/null
+++ b/plugins/openlayers/source/openlayers_source_tilejson.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.openlayers_source_tilejson = function(options) {
+ return new ol.source.TileJSON(options);
+};
diff --git a/plugins/openlayers/source/openlayers_source_xyz.inc b/plugins/openlayers/source/openlayers_source_xyz.inc
new file mode 100644
index 0000000000000000000000000000000000000000..449b9e2e418c15ca77619c8c14e7abd49bdaa3e0
--- /dev/null
+++ b/plugins/openlayers/source/openlayers_source_xyz.inc
@@ -0,0 +1,49 @@
+ array(
+ 'class' => 'openlayers_source_xyz',
+ )
+ );
+}
+
+class openlayers_source_xyz extends openlayers_source {
+
+ function options_init() {
+ return array(
+ 'data' => array()
+ );
+ }
+
+ function options_form($defaults = array()) {
+ $layer_types = array(
+ 'Road' => 'Road',
+ 'AerialWithLabels' => 'Hybrid',
+ 'Aerial' => 'Aerial',
+ );
+
+ return array(
+ 'type' => array(
+ '#title' => t('Source type'),
+ '#type' => 'select',
+ '#default_value' => isset($this->data['type']) ? $this->data['type'] : 'Road',
+ '#options' => $layer_types
+ )
+ );
+ }
+
+ function settings_form() {
+ return array();
+ }
+
+ function attached() {
+ return array(
+ 'js' => array(
+ drupal_get_path('module', 'openlayers') . '/plugins/source/openlayers_source_xyz.js'
+ )
+ );
+ }
+
+ function render(&$map) {}
+}
diff --git a/plugins/openlayers/source/openlayers_source_xyz.js b/plugins/openlayers/source/openlayers_source_xyz.js
new file mode 100644
index 0000000000000000000000000000000000000000..ec4c0626a532267c9bed3912e51c15a3314c062a
--- /dev/null
+++ b/plugins/openlayers/source/openlayers_source_xyz.js
@@ -0,0 +1,3 @@
+Drupal.openlayers.source.xyz = function(map, options) {
+ return new ol.source.XYZ(options);
+};
diff --git a/plugins/quicktabs/QuickMap.inc b/plugins/quicktabs/QuickMap.inc
deleted file mode 100644
index 34e0b3da3e04ad04bced3d13a3feb2f24f1d6def..0000000000000000000000000000000000000000
--- a/plugins/quicktabs/QuickMap.inc
+++ /dev/null
@@ -1,48 +0,0 @@
-settings;
- $form = array();
- $form['map']['map'] = array(
- '#type' => 'select',
- '#title' => t('OpenLayers Map'),
- '#options' => openlayers_map_options(),
- '#default_value' => isset($tab['map']) ? $tab['map'] : '',
- );
- return $form;
- }
-
- public function render($hide_empty = FALSE, $args = array()) {
- if ($this->rendered_content) {
- return $this->rendered_content;
- }
- $output = array();
- $item = $this->settings;
-
- // We should add a JS file here to automatically resize the map when
- // the map is not the default tab.
-
- $map = openlayers_map_load($item['map']);
- $render = openlayers_render_map($map);
-
- $output['#markup'] = $render;
- $this->rendered_content = $output;
- return $output;
- }
-
- public function getAjaxKeys() {
- return array('map');
- }
-
-}
-
diff --git a/tests/data/openlayers_test.json b/tests/data/openlayers_test.json
deleted file mode 100644
index 0dcdf1b8a0a3ad97de22a409e83feffb78a70b67..0000000000000000000000000000000000000000
--- a/tests/data/openlayers_test.json
+++ /dev/null
@@ -1,65 +0,0 @@
-{
- "type": "FeatureCollection",
- "features": [
- {
- "type": "Feature",
- "properties": {
- "name": "Feature 01",
- "description": "Just testing things..."
- },
- "geometry": {
- "type": "Point",
- "coordinates": [
- 86.8359375,
- 50.80078125
- ]
- },
- "crs": {
- "type": "name",
- "properties": {
- "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
- }
- }
- },
- {
- "type": "Feature",
- "properties": {
- "name": "Feature 02",
- "description": "Just testing things..."
- },
- "geometry": {
- "type": "Point",
- "coordinates": [
- 101.6015625,
- 51.85546875
- ]
- },
- "crs": {
- "type": "name",
- "properties": {
- "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
- }
- }
- },
- {
- "type": "Feature",
- "properties": {
- "name": "Feature 03",
- "description": "Just testing things..."
- },
- "geometry": {
- "type": "Point",
- "coordinates": [
- 110.7421875,
- 39.55078125
- ]
- },
- "crs": {
- "type": "name",
- "properties": {
- "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/tests/data/openlayers_test.kml b/tests/data/openlayers_test.kml
deleted file mode 100644
index 60b5692ee1a0972c6b712a06f39f06549e51d151..0000000000000000000000000000000000000000
--- a/tests/data/openlayers_test.kml
+++ /dev/null
@@ -1,915 +0,0 @@
-
-
-
- KML Samples
- 1
- Unleash your creativity with the help of these examples!
-
-
-
-
-
-
-
-
-
-
-
-
-
- Placemarks
- These are just some of the different kinds of placemarks with
- which you can mark your favorite places
-
- -122.0839597145766
- 37.42222904525232
- 0
- -148.4122922628044
- 40.5575073395506
- 500.6566641072245
-
-
- Simple placemark
- Attached to the ground. Intelligently places itself at the
- height of the underlying terrain.
-
- -122.0822035425683,37.42228990140251,0
-
-
-
- Floating placemark
- 0
- Floats a defined distance above the ground.
-
- -122.0839597145766
- 37.42222904525232
- 0
- -148.4122922628044
- 40.5575073395506
- 500.6566641072245
-
- #downArrowIcon
-
- relativeToGround
- -122.084075,37.4220033612141,50
-
-
-
- Extruded placemark
- 0
- Tethered to the ground by a customizable
- "tail"
-
- -122.0845787421525
- 37.42215078737763
- 0
- -148.4126684946234
- 40.55750733918048
- 365.2646606980322
-
- #globeIcon
-
- 1
- relativeToGround
- -122.0857667006183,37.42156927867553,50
-
-
-
-
- Styles and Markup
- 0
- With KML it is easy to create rich, descriptive markup to
- annotate and enrich your placemarks
-
- -122.0845787422371
- 37.42215078726837
- 0
- -148.4126777488172
- 40.55750733930874
- 365.2646826292919
-
- #noDrivingDirections
-
- Highlighted Icon
- 0
- Place your mouse over the icon to see it display the new
- icon
-
- -122.0856552124024
- 37.4224281311035
- 0
- 0
- 0
- 265.8520424250024
-
-
-
-
-
- normal
- #normalPlacemark
-
-
- highlight
- #highlightPlacemark
-
-
-
- Roll over this icon
- 0
- #exampleStyleMap
-
- -122.0856545755255,37.42243077405461,0
-
-
-
-
- Descriptive HTML
- 0
-
-Placemark descriptions can be enriched by using many standard HTML tags.
-For example:
-
-Styles:
-Italics,
-Bold,
-Underlined,
-Strike Out,
-subscriptsubscript,
-superscriptsuperscript,
-Big,
-Small,
-Typewriter,
-Emphasized,
-Strong,
-Code
-
-Fonts:
-red by name,
-leaf green by hexadecimal RGB
-
-size 1,
-size 2,
-size 3,
-size 4,
-size 5,
-size 6,
-size 7
-
-Times,
-Verdana,
-Arial
-
-Links:
-
-Google Earth!
-
- or: Check out our website at www.google.com
-
-Alignment:
-
left
-
center
-
right
-
-Ordered Lists:
-
First
Second
Third
-
First
Second
Third
-
First
Second
Third
-
-Unordered Lists:
-
A
B
C
-
A
B
C
-
A
B
C
-
-Definitions:
-
-
Google:
The best thing since sliced bread
-
-
-Centered:
-Time present and time past
-Are both perhaps present in time future,
-And time future contained in time past.
-If all time is eternally present
-All time is unredeemable.
-
-
-Block Quote:
-
-
-We shall not cease from exploration
-And the end of all our exploring
-Will be to arrive where we started
-And know the place for the first time.
--- T.S. Eliot
-