# all files / ol/proj/ projections.js

90% Statements 9/10
50% Branches 1/2
66.67% Functions 2/3
90% Lines 9/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×

    1×
    15×
    15×

    1×
    15×
    15×

     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;
    };