# all files / ol/ index.js

100% Statements 32/32
100% Branches 2/2
100% Functions 3/3
100% Lines 32/32

    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
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    2491×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×
    235×
    235×

    1×

    1×
    30622×

    1×
     goog.provide('ol');

    /**
     * Constants defined with the define tag cannot be changed in application
     * code, but can be set at compile time.
     * Some reduce the size of the build in advanced compile mode.
     */

    /**
     * @define {boolean} Assume touch.  Default is `false`.
     */
    ol.ASSUME_TOUCH = false;

    /**
     * TODO: rename this to something having to do with tile grids
     * see https://github.com/openlayers/openlayers/issues/2076
     * @define {number} Default maximum zoom for default tile grids.
     */
    ol.DEFAULT_MAX_ZOOM = 42;

    /**
     * @define {number} Default min zoom level for the map view.  Default is `0`.
     */
    ol.DEFAULT_MIN_ZOOM = 0;

    /**
     * @define {number} Default maximum allowed threshold  (in pixels) for
     *     reprojection triangulation. Default is `0.5`.
     */
    ol.DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD = 0.5;

    /**
     * @define {number} Default tile size.
     */
    ol.DEFAULT_TILE_SIZE = 256;

    /**
     * @define {string} Default WMS version.
     */
    ol.DEFAULT_WMS_VERSION = '1.3.0';

    /**
     * @define {boolean} Enable the Canvas renderer.  Default is `true`. Setting
     *     this to false at compile time in advanced mode removes all code
     *     supporting the Canvas renderer from the build.
     */
    ol.ENABLE_CANVAS = true;

    /**
     * @define {boolean} Enable integration with the Proj4js library.  Default is
     *     `true`.
     */
    ol.ENABLE_PROJ4JS = true;

    /**
     * @define {boolean} Enable automatic reprojection of raster sources. Default is
     *     `true`.
     */
    ol.ENABLE_RASTER_REPROJECTION = true;

    /**
     * @define {boolean} Enable the WebGL renderer.  Default is `true`. Setting
     *     this to false at compile time in advanced mode removes all code
     *     supporting the WebGL renderer from the build.
     */
    ol.ENABLE_WEBGL = true;

    /**
     * @define {boolean} Include debuggable shader sources.  Default is `true`.
     *     This should be set to `false` for production builds (if `ol.ENABLE_WEBGL`
     *     is `true`).
     */
    ol.DEBUG_WEBGL = true;

    /**
     * @define {number} The size in pixels of the first atlas image. Default is
     * `256`.
     */
    ol.INITIAL_ATLAS_SIZE = 256;

    /**
     * @define {number} The maximum size in pixels of atlas images. Default is
     * `-1`, meaning it is not used (and `ol.WEBGL_MAX_TEXTURE_SIZE` is
     * used instead).
     */
    ol.MAX_ATLAS_SIZE = -1;

    /**
     * @define {number} Maximum mouse wheel delta.
     */
    ol.MOUSEWHEELZOOM_MAXDELTA = 1;

    /**
     * @define {number} Maximum width and/or height extent ratio that determines
     * when the overview map should be zoomed out.
     */
    ol.OVERVIEWMAP_MAX_RATIO = 0.75;

    /**
     * @define {number} Minimum width and/or height extent ratio that determines
     * when the overview map should be zoomed in.
     */
    ol.OVERVIEWMAP_MIN_RATIO = 0.1;

    /**
     * @define {number} Maximum number of source tiles for raster reprojection of
     *     a single tile.
     *     If too many source tiles are determined to be loaded to create a single
     *     reprojected tile the browser can become unresponsive or even crash.
     *     This can happen if the developer defines projections improperly and/or
     *     with unlimited extents.
     *     If too many tiles are required, no tiles are loaded and
     *     `ol.TileState.ERROR` state is set. Default is `100`.
     */
    ol.RASTER_REPROJECTION_MAX_SOURCE_TILES = 100;

    /**
     * @define {number} Maximum number of subdivision steps during raster
     *     reprojection triangulation. Prevents high memory usage and large
     *     number of proj4 calls (for certain transformations and areas).
     *     At most `2*(2^this)` triangles are created for each triangulated
     *     extent (tile/image). Default is `10`.
     */
    ol.RASTER_REPROJECTION_MAX_SUBDIVISION = 10;

    /**
     * @define {number} Maximum allowed size of triangle relative to world width.
     *     When transforming corners of world extent between certain projections,
     *     the resulting triangulation seems to have zero error and no subdivision
     *     is performed.
     *     If the triangle width is more than this (relative to world width; 0-1),
     *     subdivison is forced (up to `ol.RASTER_REPROJECTION_MAX_SUBDIVISION`).
     *     Default is `0.25`.
     */
    ol.RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH = 0.25;

    /**
     * @define {number} Tolerance for geometry simplification in device pixels.
     */
    ol.SIMPLIFY_TOLERANCE = 0.5;

    /**
     * @define {number} Texture cache high water mark.
     */
    ol.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK = 1024;

    /**
     * @define {string} OpenLayers version.
     */
    ol.VERSION = '';

    /**
     * The maximum supported WebGL texture size in pixels. If WebGL is not
     * supported, the value is set to `undefined`.
     * @const
     * @type {number|undefined}
     */
    ol.WEBGL_MAX_TEXTURE_SIZE; // value is set in `ol.has`

    /**
     * List of supported WebGL extensions.
     * @const
     * @type {Array.<string>}
     */
    ol.WEBGL_EXTENSIONS; // value is set in `ol.has`

    /**
     * Inherit the prototype methods from one constructor into another.
     *
     * Usage:
     *
     *     function ParentClass(a, b) { }
     *     ParentClass.prototype.foo = function(a) { }
     *
     *     function ChildClass(a, b, c) {
     *       // Call parent constructor
     *       ParentClass.call(this, a, b);
     *     }
     *     ol.inherits(ChildClass, ParentClass);
     *
     *     var child = new ChildClass('a', 'b', 'see');
     *     child.foo(); // This works.
     *
     * @param {!Function} childCtor Child constructor.
     * @param {!Function} parentCtor Parent constructor.
     * @function
     * @api
     */
    ol.inherits = function(childCtor, parentCtor) {
      childCtor.prototype = Object.create(parentCtor.prototype);
      childCtor.prototype.constructor = childCtor;
    };

    /**
     * A reusable function, used e.g. as a default for callbacks.
     *
     * @return {undefined} Nothing.
     */
    ol.nullFunction = function() {};

    /**
     * Gets a unique ID for an object. This mutates the object so that further calls
     * with the same object as a parameter returns the same value. Unique IDs are generated
     * as a strictly increasing sequence. Adapted from goog.getUid.
     *
     * @param {Object} obj The object to get the unique ID for.
     * @return {number} The unique ID for the object.
     */
    ol.getUid = function(obj) {
      return obj.ol_uid ||
          (obj.ol_uid = ++ol.uidCounter_);
    };

    /**
     * Counter for getUid.
     * @type {number}
     * @private
     */
    ol.uidCounter_ = 0;