# all files / ol/proj/ projections.js

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

    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
    391×

    1×

    1×
    49×

    1×
    5465×
    5465×

    1×
    784×
    784×

     goog.provide('ol.proj.projections');

    /**
     * @private
     * @type {Object.<string, ol.proj.Projection>}
     */
    ol.proj.projections.cache_ = {};

    /**
     * Clear the projections cache.
     */
    ol.proj.projections.clear = function() {
      ol.proj.projections.cache_ = {};
    };

    /**
     * Get a cached projection by code.
     * @param {string} code The code for the projection.
     * @return {ol.proj.Projection} The projection (if cached).
     */
    ol.proj.projections.get = function(code) {
      var projections = ol.proj.projections.cache_;
      return projections[code] || null;
    };

    /**
     * Add a projection to the cache.
     * @param {string} code The projection code.
     * @param {ol.proj.Projection} projection The projection to cache.
     */
    ol.proj.projections.add = function(code, projection) {
      var projections = ol.proj.projections.cache_;
      projections[code] = projection;
    };