You are here

function openlayers_layer_type_wms::__construct in Openlayers 6.2

Overrides openlayers_layer_type::__construct

File

includes/layer_types/wms.inc, line 12
WMS Layer Type

Class

openlayers_layer_type_wms
OpenLayers WMS Layer Type class

Code

function __construct($layer = array(), $map = array()) {
  parent::__construct($layer, $map);
  if (isset($this->data)) {
    if (isset($this->data['options']['srs'])) {
      $pts = explode(':', $this->data['options']['srs']);
      $this->data['projection'] = array(
        $pts[1],
      );
      $this->data['params']['resolutions'] = openlayers_get_resolutions($pts[1]);
      $this->data['params']['projection'] = $this->data['options']['srs'];
      $this->data['params']['maxextent'] = openlayers_get_extent($pts[1]);
    }
    $this->data['params']['isBaseLayer'] = (bool) $this->data['params']['isBaseLayer'];
    $this->data['baselayer'] = $this->data['params']['isBaseLayer'];
    $this->data += $this
      ->options_init();
  }
  else {
    $this->data = $this
      ->options_init();
  }
}