<commit_before>goog.provide('ol.reproj.Image');

goog.require('goog.asserts');
goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('ol.ImageBase');
goog.require('ol.ImageState');
goog.require('ol.dom');
goog.require('ol.extent');
goog.require('ol.proj');
goog.require('ol.reproj');
goog.require('ol.reproj.Triangulation');



/**
 * @constructor
 * @extends {ol.ImageBase}
 * @param {ol.proj.Projection} sourceProj
 * @param {ol.proj.Projection} targetProj
 * @param {ol.Extent} targetExtent
 * @param {number} targetResolution
 * @param {number} pixelRatio
 * @param {function(ol.Extent, number, number, ol.proj.Projection) :
 *             ol.ImageBase} getImageFunction
 */
ol.reproj.Image = function(sourceProj, targetProj,
    targetExtent, targetResolution, pixelRatio, getImageFunction) {

  /**
   * @private
   * @type {ol.Extent}
   */
  this.maxSourceExtent_ = sourceProj.getExtent();
  var maxTargetExtent = targetProj.getExtent();

  var limitedTargetExtent = ol.extent.getIntersection(
      targetExtent, maxTargetExtent);


  var errorThresholdInPixels = ol.DEFAULT_RASTER_REPROJ_ERROR_THRESHOLD;

  // in source units
  var errorThreshold = targetResolution * errorThresholdInPixels *
      targetProj.getMetersPerUnit() / sourceProj.getMetersPerUnit();

  /**
   * @private
   * @type {!ol.reproj.Triangulation}
   */
  this.triangulation_ = new ol.reproj.Triangulation(
      sourceProj, targetProj, limitedTargetExtent, this.maxSourceExtent_,
      errorThreshold);

  /**
   * @private
   * @type {number}
   */
  this.targetResolution_ = targetResolution;

  /**
   * @private
   * @type {ol.Extent}
   */
  this.targetExtent_ = targetExtent;

  var srcExtent = this.triangulation_.calculateSourceExtent();

  var targetCenter = ol.extent.getCenter(targetExtent);
  var sourceResolution = ol.reproj.calculateSourceResolution(
      sourceProj, targetProj, targetCenter, targetResolution);

  /**
   * @private
   * @type {ol.ImageBase}
   */
  this.srcImage_ = getImageFunction(srcExtent, sourceResolution,
                                    pixelRatio, sourceProj);

  var width = ol.extent.getWidth(targetExtent) / targetResolution;
  var height = ol.extent.getHeight(targetExtent) / targetResolution;

  /**
   * @private
   * @type {number}<commit_msg>Minor type fix in ol.reproj.Image<commit_after>goog.provide('ol.reproj.Image');

goog.require('goog.asserts');
goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('ol.ImageBase');
goog.require('ol.ImageState');
goog.require('ol.dom');
goog.require('ol.extent');
goog.require('ol.proj');
goog.require('ol.reproj');
goog.require('ol.reproj.Triangulation');



/**
 * @constructor
 * @extends {ol.ImageBase}
 * @param {ol.proj.Projection} sourceProj
 * @param {ol.proj.Projection} targetProj
 * @param {ol.Extent} targetExtent
 * @param {number} targetResolution
 * @param {number} pixelRatio
 * @param {function(ol.Extent, number, number):ol.ImageBase} getImageFunction
 */
ol.reproj.Image = function(sourceProj, targetProj,
    targetExtent, targetResolution, pixelRatio, getImageFunction) {

  /**
   * @private
   * @type {ol.Extent}
   */
  this.maxSourceExtent_ = sourceProj.getExtent();
  var maxTargetExtent = targetProj.getExtent();

  var limitedTargetExtent = ol.extent.getIntersection(
      targetExtent, maxTargetExtent);


  var errorThresholdInPixels = ol.DEFAULT_RASTER_REPROJ_ERROR_THRESHOLD;

  // in source units
  var errorThreshold = targetResolution * errorThresholdInPixels *
      targetProj.getMetersPerUnit() / sourceProj.getMetersPerUnit();

  /**
   * @private
   * @type {!ol.reproj.Triangulation}
   */
  this.triangulation_ = new ol.reproj.Triangulation(
      sourceProj, targetProj, limitedTargetExtent, this.maxSourceExtent_,
      errorThreshold);

  /**
   * @private
   * @type {number}
   */
  this.targetResolution_ = targetResolution;

  /**
   * @private
   * @type {ol.Extent}
   */
  this.targetExtent_ = targetExtent;

  var srcExtent = this.triangulation_.calculateSourceExtent();

  var targetCenter = ol.extent.getCenter(targetExtent);
  var sourceResolution = ol.reproj.calculateSourceResolution(
      sourceProj, targetProj, targetCenter, targetResolution);

  /**
   * @private
   * @type {ol.ImageBase}
   */
  this.srcImage_ = getImageFunction(srcExtent, sourceResolution, pixelRatio);

  var width = ol.extent.getWidth(targetExtent) / targetResolution;
  var height = ol.extent.getHeight(targetExtent) / targetResolution;

  /**
   * @private
   * @type {number}
{'fraction_non_alphanumeric': 0.13601406284333115, 'fraction_numerical': 0.0, 'mean_word_length': 4.178612059158135, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '884378', 'n_tokens_mistral': 1588, 'n_tokens_neox': 1503, 'n_words': 242}