# all files / ol/ control.js

100% Statements 18/18
50% Branches 7/14
100% Functions 1/1
100% Lines 18/18

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    461×

    1×
    1×
    1×
    1×

    1×

    305×

    305×

    305×
    305×
    305×

    305×
    305×
    305×

    305×

    305×
    305×

    305×

     goog.provide('ol.control');

    goog.require('ol.Collection');
    goog.require('ol.control.Attribution');
    goog.require('ol.control.Rotate');
    goog.require('ol.control.Zoom');

    /**
     * Set of controls included in maps by default. Unless configured otherwise,
     * this returns a collection containing an instance of each of the following
     * controls:
     * * {@link ol.control.Zoom}
     * * {@link ol.control.Rotate}
     * * {@link ol.control.Attribution}
     *
     * @param {olx.control.DefaultsOptions=} opt_options Defaults options.
     * @return {ol.Collection.<ol.control.Control>} Controls.
     * @api
     */
    ol.control.defaults = function(opt_options) {

      var options = opt_options ? opt_options : {};

      var controls = new ol.Collection();

      var zoomControl = options.zoom !== undefined ? options.zoom : true;
      Eif (zoomControl) {
        controls.push(new ol.control.Zoom(options.zoomOptions));
      }

      var rotateControl = options.rotate !== undefined ? options.rotate : true;
      Eif (rotateControl) {
        controls.push(new ol.control.Rotate(options.rotateOptions));
      }

      var attributionControl = options.attribution !== undefined ?
        options.attribution : true;
      Eif (attributionControl) {
        controls.push(new ol.control.Attribution(options.attributionOptions));
      }

      return controls;

    };