Code coverage report for ol/source/imagestaticsource.js

Statements: 95.83% (23 / 24)      Branches: 50% (5 / 10)      Functions: 100% (2 / 2)      Lines: 95.83% (23 / 24)      Ignored: none     

All files » ol/source/ » imagestaticsource.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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 701   1 1 1 1 1 1                         1   1     1   1 1 1 1     1     1     1                     1   1       1           1   1 1        
goog.provide('ol.source.ImageStatic');
 
goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('ol.Image');
goog.require('ol.extent');
goog.require('ol.proj');
goog.require('ol.source.Image');
 
 
 
/**
 * @classdesc
 * A layer source for displaying a single, static image.
 *
 * @constructor
 * @extends {ol.source.Image}
 * @param {olx.source.ImageStaticOptions} options Options.
 * @api stable
 */
ol.source.ImageStatic = function(options) {
 
  var attributions = goog.isDef(options.attributions) ?
      options.attributions : null;
 
  var imageExtent = options.imageExtent;
 
  var resolution, resolutions;
  Eif (goog.isDef(options.imageSize)) {
    resolution = ol.extent.getHeight(imageExtent) / options.imageSize[1];
    resolutions = [resolution];
  }
 
  var crossOrigin = goog.isDef(options.crossOrigin) ?
      options.crossOrigin : null;
 
  var imageLoadFunction = goog.isDef(options.imageLoadFunction) ?
      options.imageLoadFunction : ol.source.Image.defaultImageLoadFunction;
 
  goog.base(this, {
    attributions: attributions,
    logo: options.logo,
    projection: ol.proj.get(options.projection),
    resolutions: resolutions
  });
 
  /**
   * @private
   * @type {ol.Image}
   */
  this.image_ = new ol.Image(imageExtent, resolution, 1, attributions,
      options.url, crossOrigin, imageLoadFunction);
  goog.events.listen(this.image_, goog.events.EventType.CHANGE,
      this.handleImageChange, false, this);
 
};
goog.inherits(ol.source.ImageStatic, ol.source.Image);
 
 
/**
 * @inheritDoc
 */
ol.source.ImageStatic.prototype.getImage =
    function(extent, resolution, pixelRatio, projection) {
  Eif (ol.extent.intersects(extent, this.image_.getExtent())) {
    return this.image_;
  }
  return null;
};