Code coverage report for ol/control/controldefaults.js

Statements: 100% (18 / 18)      Branches: 50% (7 / 14)      Functions: 100% (1 / 1)      Lines: 100% (18 / 18)      Ignored: none     

All files » ol/control/ » controldefaults.js
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 46 47 481   1 1 1 1                             1   76   76   76   76 76     76   76 76     76   76 76     76      
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 stable
 */
ol.control.defaults = function(opt_options) {
 
  var options = goog.isDef(opt_options) ? opt_options : {};
 
  var controls = new ol.Collection();
 
  var zoomControl = goog.isDef(options.zoom) ?
      options.zoom : true;
  Eif (zoomControl) {
    controls.push(new ol.control.Zoom(options.zoomOptions));
  }
 
  var rotateControl = goog.isDef(options.rotate) ?
      options.rotate : true;
  Eif (rotateControl) {
    controls.push(new ol.control.Rotate(options.rotateOptions));
  }
 
  var attributionControl = goog.isDef(options.attribution) ?
      options.attribution : true;
  Eif (attributionControl) {
    controls.push(new ol.control.Attribution(options.attributionOptions));
  }
 
  return controls;
 
};