<commit_before>/**
 *
 * @author <EMAIL> (<NAME>)
 *
 * Copyright 2013 Klokan Technologies Gmbh (www.klokantech.com)
 */

goog.provide('weapi.App');

goog.require('goog.dom');

goog.require('weapi.Camera');
goog.require('weapi.NoRepeatTextureAtlas');
goog.require('weapi.maps');
goog.require('weapi.markers.MarkerManager');
goog.require('weapi.markers.PrettyMarker');


/**
 * @define {number} API version.
 */
weapi.VERSION = 2;


/**
 * @define {string} .
 */
weapi.UA = 'UA-20846306-1';



/**
 *
 * @param {string} divid .
 * @param {Object=} opt_options Application options.
 * @constructor
 */
weapi.App = function(divid, opt_options) {
  var options = opt_options || {};
  var container = goog.dom.getElement(divid);

  var webGLSupported = weapi.App.detectWebGLSupport();

  if (weapi.UA && weapi.UA.length > 0) {
    var trackerVar = '__WE_ga'; //global variable
    (function(i, s, o, g, r) {
      i['GoogleAnalyticsObject'] = r;
      i[r] = i[r] || function() {(i[r]['q'] = i[r]['q'] || []).push(arguments)};
      i[r]['l'] = 1 * new Date();
      var a = s.createElement(o), m = s.getElementsByTagName(o)[0];
      a.async = 1;
      a.src = g;
      m.parentNode.insertBefore(a, m);
    })(window, document, 'script',
       '//www.google-analytics.com/analytics.js', trackerVar);
    window[trackerVar]('create', weapi.UA, {'name': 'we0'});
    window[trackerVar]('we0.send', 'event', weapi.VERSION.toString(),
                       window.location.host, window.location.href,
                       webGLSupported ? 1 : 0);
  }

  if (!webGLSupported) {
    var ifr = goog.dom.createDom('iframe', {
      'src': 'http://www.webglearth.com/webgl-error.html'
    });
    ifr.style.width = '100%';
    ifr.style.height = '100%';
    ifr.style.border = 'none';
    container.appendChild(ifr);
    return;
  }

  goog.style.installStyles('.cesium-credit-textContainer:before{' +
                           'content:\'WebGL Earth \\2022\\20\';' +
                           'font-weight:bold;}');

  weapi.maps.initStatics(this);

  container.style.position = 'relative';
  container.style.overflow = 'hidden';
  this.canvas = /** @type {!HTMLCanvasElement} */
      (goog.dom.createElement('canvas'));
  this.canvas.style.width = '100%';
  this.canvas.style.height = '100%';
  this.canvas.oncontextmenu = function() {return false;};
  container.appendChild(this.canvas);

  /** @type {?Function} */
  this.afterFrameOnce = null;

  this.scene = new Cesium.Scene({
    'canvas': this.canvas,
    'contextOptions': {'webgl': {'alpha': options['sky'] !== true}}
  });

  /** @type {?weapi.MiniGlobe} */
  this.miniglobe = null;

  /** @type {boolean} */
  this.forcedPause = false;

  /** @type {boolean} */
  this.sceneChanged = true;

  // Debug stats for the rendering: (uncomment here and stats[_]++ below)
  //var stats = [0, 0];
  //setInterval(function() {
  //  window['console']['log']('rendered:', stats[0], 'ommited:', stats[1],
  //                           'rendered %:', stats[0] / (stats[0] + stats[1]));
  //}, 2000);

  /** @type {!Cesium.Matrix4} */
  this.lastViewMatrix = new Cesium.Matrix4();

  /** @type {?string} */
  var proxyHost = opt_options['proxyHost'] || null;

  /* type {{getURL: function(string) : string}} */
  this.mapProxyObject = {
    'getURL': function(url) {
      return goog.isDefAndNotNull(proxyHost) ?
             proxyHost + encodeURIComponent(url) : url;
    }
  };

  if (options['atmosphere'] !== false) {
    this.scene.skyAtmosphere = new Cesium.SkyAtmosphere();
  }
  if (options['sky'] === true) {
    //TODO: solve resources
    var skyBoxBaseUrl = (goog.DEBUG ? '../deploy/' : '') + 'SkyBox/';
    this.scene.skyBox = new Cesium.SkyBox({
      'sources': {
        'positiveX' : skyBoxBaseUrl + 'px.jpg',
        'negativeX' : skyBoxBaseUrl + 'mx.jpg',
        'positiveY' : skyBoxBaseUrl + 'py.jpg',
        'negativeY' : skyBoxBaseUrl + 'my.jpg',
        'positiveZ' : skyBoxBaseUrl + 'pz.jpg',
        'negativeZ' : skyBoxBaseUrl + 'mz.jpg'
      }
    });
  } else {<commit_msg>Turn atmosphere off by default<commit_after>/**
 *
 * @author <EMAIL> (<NAME>)
 *
 * Copyright 2013 Klokan Technologies Gmbh (www.klokantech.com)
 */

goog.provide('weapi.App');

goog.require('goog.dom');

goog.require('weapi.Camera');
goog.require('weapi.NoRepeatTextureAtlas');
goog.require('weapi.maps');
goog.require('weapi.markers.MarkerManager');
goog.require('weapi.markers.PrettyMarker');


/**
 * @define {number} API version.
 */
weapi.VERSION = 2;


/**
 * @define {string} .
 */
weapi.UA = 'UA-20846306-1';



/**
 *
 * @param {string} divid .
 * @param {Object=} opt_options Application options.
 * @constructor
 */
weapi.App = function(divid, opt_options) {
  var options = opt_options || {};
  var container = goog.dom.getElement(divid);

  var webGLSupported = weapi.App.detectWebGLSupport();

  if (weapi.UA && weapi.UA.length > 0) {
    var trackerVar = '__WE_ga'; //global variable
    (function(i, s, o, g, r) {
      i['GoogleAnalyticsObject'] = r;
      i[r] = i[r] || function() {(i[r]['q'] = i[r]['q'] || []).push(arguments)};
      i[r]['l'] = 1 * new Date();
      var a = s.createElement(o), m = s.getElementsByTagName(o)[0];
      a.async = 1;
      a.src = g;
      m.parentNode.insertBefore(a, m);
    })(window, document, 'script',
       '//www.google-analytics.com/analytics.js', trackerVar);
    window[trackerVar]('create', weapi.UA, {'name': 'we0'});
    window[trackerVar]('we0.send', 'event', weapi.VERSION.toString(),
                       window.location.host, window.location.href,
                       webGLSupported ? 1 : 0);
  }

  if (!webGLSupported) {
    var ifr = goog.dom.createDom('iframe', {
      'src': 'http://www.webglearth.com/webgl-error.html'
    });
    ifr.style.width = '100%';
    ifr.style.height = '100%';
    ifr.style.border = 'none';
    container.appendChild(ifr);
    return;
  }

  goog.style.installStyles('.cesium-credit-textContainer:before{' +
                           'content:\'WebGL Earth \\2022\\20\';' +
                           'font-weight:bold;}');

  weapi.maps.initStatics(this);

  container.style.position = 'relative';
  container.style.overflow = 'hidden';
  this.canvas = /** @type {!HTMLCanvasElement} */
      (goog.dom.createElement('canvas'));
  this.canvas.style.width = '100%';
  this.canvas.style.height = '100%';
  this.canvas.oncontextmenu = function() {return false;};
  container.appendChild(this.canvas);

  /** @type {?Function} */
  this.afterFrameOnce = null;

  this.scene = new Cesium.Scene({
    'canvas': this.canvas,
    'contextOptions': {'webgl': {'alpha': options['sky'] !== true}}
  });

  /** @type {?weapi.MiniGlobe} */
  this.miniglobe = null;

  /** @type {boolean} */
  this.forcedPause = false;

  /** @type {boolean} */
  this.sceneChanged = true;

  // Debug stats for the rendering: (uncomment here and stats[_]++ below)
  //var stats = [0, 0];
  //setInterval(function() {
  //  window['console']['log']('rendered:', stats[0], 'ommited:', stats[1],
  //                           'rendered %:', stats[0] / (stats[0] + stats[1]));
  //}, 2000);

  /** @type {!Cesium.Matrix4} */
  this.lastViewMatrix = new Cesium.Matrix4();

  /** @type {?string} */
  var proxyHost = opt_options['proxyHost'] || null;

  /* type {{getURL: function(string) : string}} */
  this.mapProxyObject = {
    'getURL': function(url) {
      return goog.isDefAndNotNull(proxyHost) ?
             proxyHost + encodeURIComponent(url) : url;
    }
  };

  if (options['atmosphere']) {
    this.scene.skyAtmosphere = new Cesium.SkyAtmosphere();
  }
  if (options['sky']) {
    //TODO: solve resources
    var skyBoxBaseUrl = (goog.DEBUG ? '../deploy/' : '') + 'SkyBox/';
    this.scene.skyBox = new Cesium.SkyBox({
      'sources': {
        'positiveX' : skyBoxBaseUrl + 'px.jpg',
        'negativeX' : skyBoxBaseUrl + 'mx.jpg',
        'positiveY' : skyBoxBaseUrl + 'py.jpg',
        'negativeY' : skyBoxBaseUrl + 'my.jpg',
        'positiveZ' : skyBoxBaseUrl + 'pz.jpg',
        'negativeZ' : skyBoxBaseUrl + 'mz.jpg'
      }
    });
  } else {
{'fraction_non_alphanumeric': 0.1948629291183008, 'fraction_numerical': 0.013089651765868116, 'mean_word_length': 2.8918789043728976, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '851958', 'n_tokens_mistral': 2937, 'n_tokens_neox': 2782, 'n_words': 508}