You are here

class openlayers_layer_type_virtualearth in Openlayers 6.2

OpenLayers VirtualEarth Layer Type class

Hierarchy

Expanded class hierarchy of openlayers_layer_type_virtualearth

4 string references to 'openlayers_layer_type_virtualearth'
openlayers_layer_type_virtualearth::options_form in includes/layer_types/virtualearth.inc
Options form which generates layers
_openlayers_openlayers_layers in includes/openlayers.layers.inc
@file
_openlayers_openlayers_layer_types in includes/openlayers.layer_types.inc
Layer Type Implementation
_openlayers_upgrade_1xto2x_convert_layers in ./openlayers.install
Converting layer arrays for the upgrade from 1.x to 2.x

File

includes/layer_types/virtualearth.inc, line 12
OpenLayers VirtualEarth layer type

View source
class openlayers_layer_type_virtualearth extends openlayers_layer_type {
  function __construct($layer = array(), $map = array()) {
    parent::__construct($layer, $map);
    if (isset($this->data)) {
      $this->data += $this
        ->options_init();
    }
    else {
      $this->data = $this
        ->options_init();
    }
  }

  /**
   * Provide initial values for options.
   */
  function options_init() {
    return array(
      'layer_type' => 'virtualearth',
      'layer_handler' => 'virtualearth',
    );
  }

  /**
   * Options form which generates layers
   */
  function options_form() {
    return array(
      'layer_type' => array(
        '#type' => 'hidden',
        '#value' => 'openlayers_layer_type_virtualearth',
      ),
    );
  }

  /**
   * Layer-type-wide settings form
   */
  function settings_form() {
    return array(
      'openlayers_layers_virtualearth_api' => array(
        '#type' => 'textfield',
        '#title' => t('VirtualEarth API Key'),
        '#default_value' => variable_get('openlayers_layers_virtualearth_api', ''),
        '#description' => t('<a href="@microsoft">Get a Virtual Earth API Key</a>', array(
          '@microsoft' => 'http://www.microsoft.com/maps/developers/',
        )),
      ),
    );
  }

  /**
   * Render.
   */
  function render(&$map) {
    static $virtualearth_maps_included;
    if (!isset($virtualearth_maps_included)) {
      drupal_add_js(drupal_get_path('module', 'openlayers') . '/includes/layer_types/js/virtualearth.js');
      drupal_set_html_head('<script src="' . check_url("http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1") . '" type="text/javascript"></script>');
      $virtualearth_maps_included = TRUE;
    }
    return $this->options;
  }

}

Members