# all files / ol/source/ osmsource.js

92.86% Statements 13/14
58.33% Branches 7/12
100% Functions 1/1
92.86% Lines 13/14

    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
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    611×

    1×
    1×

    1×

    3×

    3×
    3×

    3×

    3×

    3×

    3×

    1×

    1×

     goog.provide('ol.source.OSM');

    goog.require('ol.Attribution');
    goog.require('ol.source.XYZ');

    /**
     * @classdesc
     * Layer source for the OpenStreetMap tile server.
     *
     * @constructor
     * @extends {ol.source.XYZ}
     * @param {olx.source.OSMOptions=} opt_options Open Street Map options.
     * @api stable
     */
    ol.source.OSM = function(opt_options) {

      var options = opt_options || {};

      var attributions;
      Iif (options.attributions !== undefined) {
        attributions = options.attributions;
      } else {
        attributions = [ol.source.OSM.ATTRIBUTION];
      }

      var crossOrigin = options.crossOrigin !== undefined ?
          options.crossOrigin : 'anonymous';

      var url = options.url !== undefined ?
          options.url : 'https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png';

      goog.base(this, {
        attributions: attributions,
        cacheSize: options.cacheSize,
        crossOrigin: crossOrigin,
        opaque: options.opaque !== undefined ? options.opaque : true,
        maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19,
        reprojectionErrorThreshold: options.reprojectionErrorThreshold,
        tileLoadFunction: options.tileLoadFunction,
        url: url,
        wrapX: options.wrapX
      });

    };
    goog.inherits(ol.source.OSM, ol.source.XYZ);

    /**
     * The attribution containing a link to the OpenStreetMap Copyright and License
     * page.
     * @const
     * @type {ol.Attribution}
     * @api
     */
    ol.source.OSM.ATTRIBUTION = new ol.Attribution({
      html: '&copy; ' +
          '<a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> ' +
          'contributors.'
    });