You are here

function openlayers_ui_maps_form_center_map in Openlayers 7.2

Create Centering Map

Create map for interactive default centering

Parameters

$defaults: Array of defults to use for the map of centering and zooming

Return value

Themed map array

1 call to openlayers_ui_maps_form_center_map()
openlayers_maps_ui::edit_form in modules/openlayers_ui/plugins/export_ui/openlayers_maps_ui.class.php
Provide the actual editing form.

File

modules/openlayers_ui/includes/openlayers_ui.maps.inc, line 243
This file holds the functions handling maps in the Openlayers UI.

Code

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);
}