<commit_before>/* 
 * Copyright (c) 2016 <NAME>.
 * The MIT License
 * http://www.opensource.org/licenses/mit-license
 */

/*global define, WorldWind*/


define([
    'model/Config',
    'model/globe/Globe',
    'model/util/Log',
    'model/util/Settings',
    'model/markers/MarkerManager',
    'model/weather/WeatherScoutManager',
    'viewmodels/BookmarkViewModel',
    'viewmodels/GlobeViewModel',
    'viewmodels/InfoViewModel',
    'viewmodels/LayersViewModel',
    'viewmodels/LayerSettings',
    'viewmodels/MarkerEditor',
    'viewmodels/MarkersViewModel',
    'viewmodels/ProjectionsViewModel',
    'viewmodels/SearchViewModel',
    'viewmodels/SettingsViewModel',
    'viewmodels/WeatherScoutEditor',
    'viewmodels/WeatherViewModel',
    'text!views/bookmark.html',
    'text!views/globe.html',
    'text!views/info.html',
    'text!views/layers.html',
    'text!views/layer-settings.html',
    'text!views/markers.html',
    'text!views/marker-editor.html',
    'text!views/projections.html',
    'text!views/settings.html',
    'text!views/weather.html',
    'text!views/weather-scout-editor.html',
    'url-search-params',
    'knockout',
    'jquery',
    'jqueryui',
    'jquery-touch',
    'text',
    'worldwind'],
    function (
        config,
        Globe,
        log,
        settings,
        MarkerManager,
        WeatherScoutManager,
        BookmarkViewModel,
        GlobeViewModel,
        InfoViewModel,
        LayersViewModel,
        LayerSettings,
        MarkerEditor,
        MarkersViewModel,
        ProjectionsViewModel,
        SearchViewModel,
        SettingsViewModel,
        WeatherScoutEditor,
        WeatherViewModel,
        bookmarkHtml,
        globeHtml,
        infoHtml,
        layersHtml,
        layerSettingsHtml,
        markersHtml,
        markerEditorHtml,
        projectionsHtml,
        settingsHtml,
        weatherHtml,
        weatherScoutEditorHtml,
        URLSearchParams,
        ko,
        $) {
        "use strict";
        /**
         * Assembles the views and view models that defined the Explorer's 
         * look and behavior.
         * 
         * @constructor
         * @param {WorldWind.WorldWindow} wwd A WorldWindow object hosting a virtual globe
         * @returns {Explorer}
         */
        var Explorer = function (wwd) {

            var self = this;
            this.wwd = wwd;

            // Create our Globe model objectmodel explorer's primary globe that's 
            // Define the configuration for the primary globe
            var globeOptions = {
                showBackground: true,
                showReticule: true,
                showViewControls: true,
                includePanControls: config.showPanControl,
                includeRotateControls: true,
                includeTiltControls: true,
                includeZoomControls: true,
                includeExaggerationControls: config.showExaggerationControl,
                includeFieldOfViewControls: config.showFieldOfViewControl};

            this.globe = new Globe(wwd, globeOptions);

            // Load additional layers and layer options
            this.globe.layerManager.loadDefaultLayers();

            // Configure the manager of objects on the globe
            this.markerManager = new MarkerManager(this.globe);
            this.weatherManager = new WeatherScoutManager(this.globe);

            // Configure the objects used to animate the globe when performing "go to" operations
            this.goToAnimator = new WorldWind.GoToAnimator(this.wwd);
            this.isAnimating = false;

            // Internal. Intentionally not documented.
            this.updateTimeout = null;
            this.updateInterval = 200;   // throttle the spatial data updates to 5hz

            // Setup to update each time the World Window is repainted.
            this.wwd.redrawCallbacks.push(function () {
                self.handleRedraw();
            });

            // Setup an interval to update the current time
            this.autoUpdateTimeEnabled = ko.observable(true);
            this.dateTimeInterval = window.setInterval(function () {
                if (self.autoUpdateTimeEnabled()) {
                    self.globe.updateDateTime(new Date());
                }
            }, 30000);  // Update every 30 seconds

            // Setup to track the cursor position relative to the World Window's canvas. Listen to touch events in order
            // to recognize and ignore simulated mouse events in mobile browsers.
            window.addEventListener("mousemove", function (event) {
                self.handleMouseEvent(event);
            });
            window.addEventListener("touchstart", function (event) {
                self.handleTouchEvent(event);
            });


            // --------------------------------------------------------
            // Assemble the views and view models 
            // --------------------------------------------------------
            Explorer.createKnockoutBindingsForSlider();

            new GlobeViewModel(this, {
                markerManager: this.markerManager,
                weatherManager: this.weatherManager},
                globeHtml, "globe");

            new SearchViewModel(this.globe, "search");
            new BookmarkViewModel(this.globe, bookmarkHtml, "right-navbar");
            new ProjectionsViewModel(this.globe, projectionsHtml, "right-navbar");

            // Tab Panels
            new LayersViewModel(this.globe, layersHtml, "left-sidebar");
            new MarkersViewModel(this.globe, this.markerManager, markersHtml, "left-sidebar");
            new WeatherViewModel(this.globe, this.weatherManager, weatherHtml, "left-sidebar");
            new SettingsViewModel(this.globe, settingsHtml, "left-sidebar");
            new InfoViewModel(this.globe, infoHtml, "info-panel");

            // Dialogs
            new LayerSettings(this.globe, layerSettingsHtml);
            new MarkerEditor(markerEditorHtml);
            new WeatherScoutEditor(weatherScoutEditorHtml);
<commit_msg>Refactoed Explorer to append marker collections to the MarkersViewModel.<commit_after>/* 
 * Copyright (c) 2016 <NAME>.
 * The MIT License
 * http://www.opensource.org/licenses/mit-license
 */

/*global define, WorldWind*/


define([
    'model/Config',
    'model/globe/Globe',
    'model/util/Log',
    'model/util/Settings',
    'model/markers/MarkerManager',
    'model/weather/WeatherScoutManager',
    'viewmodels/BookmarkViewModel',
    'viewmodels/GlobeViewModel',
    'viewmodels/InfoViewModel',
    'viewmodels/LayersViewModel',
    'viewmodels/LayerSettings',
    'viewmodels/MarkerEditor',
    'viewmodels/MarkersViewModel',
    'viewmodels/ProjectionsViewModel',
    'viewmodels/SearchViewModel',
    'viewmodels/SettingsViewModel',
    'viewmodels/WeatherScoutEditor',
    'viewmodels/WeatherViewModel',
    'text!views/basic-markers.html',
    'text!views/bookmark.html',
    'text!views/globe.html',
    'text!views/info.html',
    'text!views/layers.html',
    'text!views/layer-settings.html',
    'text!views/markers.html',
    'text!views/marker-editor.html',
    'text!views/projections.html',
    'text!views/settings.html',
    'text!views/weather.html',
    'text!views/weather-scouts.html',
    'text!views/weather-scout-editor.html',
    'url-search-params',
    'knockout',
    'jquery',
    'jqueryui',
    'jquery-touch',
    'text',
    'worldwind'],
    function (
        config,
        Globe,
        log,
        settings,
        MarkerManager,
        WeatherScoutManager,
        BookmarkViewModel,
        GlobeViewModel,
        InfoViewModel,
        LayersViewModel,
        LayerSettings,
        MarkerEditor,
        MarkersViewModel,
        ProjectionsViewModel,
        SearchViewModel,
        SettingsViewModel,
        WeatherScoutEditor,
        basicMarkersHtml,
        bookmarkHtml,
        globeHtml,
        infoHtml,
        layersHtml,
        layerSettingsHtml,
        markersHtml,
        markerEditorHtml,
        projectionsHtml,
        settingsHtml,
        weatherScoutsHtml,
        weatherScoutEditorHtml,
        URLSearchParams,
        ko,
        $) {
        "use strict";
        /**
         * Assembles the views and view models that defined the Explorer's 
         * look and behavior.
         * 
         * @constructor
         * @param {WorldWind.WorldWindow} wwd A WorldWindow object hosting a virtual globe
         * @returns {Explorer}
         */
        var Explorer = function (wwd) {

            var self = this;
            this.wwd = wwd;

            // Create our Globe model objectmodel explorer's primary globe that's 
            // Define the configuration for the primary globe
            var globeOptions = {
                showBackground: true,
                showReticule: true,
                showViewControls: true,
                includePanControls: config.showPanControl,
                includeRotateControls: true,
                includeTiltControls: true,
                includeZoomControls: true,
                includeExaggerationControls: config.showExaggerationControl,
                includeFieldOfViewControls: config.showFieldOfViewControl};

            this.globe = new Globe(wwd, globeOptions);

            // Load additional layers and layer options
            this.globe.layerManager.loadDefaultLayers();

            // Configure the manager of objects on the globe
            this.markerManager = new MarkerManager(this.globe);
            this.weatherManager = new WeatherScoutManager(this.globe);

            // Configure the objects used to animate the globe when performing "go to" operations
            this.goToAnimator = new WorldWind.GoToAnimator(this.wwd);
            this.isAnimating = false;

            // Internal. Intentionally not documented.
            this.updateTimeout = null;
            this.updateInterval = 200;   // throttle the spatial data updates to 5hz

            // Setup to update each time the World Window is repainted.
            this.wwd.redrawCallbacks.push(function () {
                self.handleRedraw();
            });

            // Setup an interval to update the current time
            this.autoUpdateTimeEnabled = ko.observable(true);
            this.dateTimeInterval = window.setInterval(function () {
                if (self.autoUpdateTimeEnabled()) {
                    self.globe.updateDateTime(new Date());
                }
            }, 30000);  // Update every 30 seconds

            // Setup to track the cursor position relative to the World Window's canvas. Listen to touch events in order
            // to recognize and ignore simulated mouse events in mobile browsers.
            window.addEventListener("mousemove", function (event) {
                self.handleMouseEvent(event);
            });
            window.addEventListener("touchstart", function (event) {
                self.handleTouchEvent(event);
            });


            // --------------------------------------------------------
            // Assemble the views and view models 
            // --------------------------------------------------------
            Explorer.createKnockoutBindingsForSlider();

            new GlobeViewModel(this, {
                markerManager: this.markerManager,
                weatherManager: this.weatherManager},
                globeHtml, "globe");

            new SearchViewModel(this.globe, "search");
            new BookmarkViewModel(this.globe, bookmarkHtml, "right-navbar");
            new ProjectionsViewModel(this.globe, projectionsHtml, "right-navbar");

            // Tab Panels
            new LayersViewModel(this.globe, layersHtml, "left-sidebar");
            var markersViewModel = new MarkersViewModel(markersHtml, "left-sidebar");
            new SettingsViewModel(this.globe, settingsHtml, "left-sidebar");
            new InfoViewModel(this.globe, infoHtml, "info-panel");

            // Dialogs
            new LayerSettings(this.globe, layerSettingsHtml);
            new MarkerEditor(markerEditorHtml);
            new WeatherScoutEditor(weatherScoutEditorHtml);
            
            // Marker content
            markersViewModel.addMarkers(this.markerManager, basicMarkersHtml, "markers-body");
            markersViewModel.addMarkers(this.weatherManager, weatherScoutsHtml, "markers-body");


{'fraction_non_alphanumeric': 0.10944913550462404, 'fraction_numerical': 0.0024125452352231603, 'mean_word_length': 1.960952380952381, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5598179', 'n_tokens_mistral': 3322, 'n_tokens_neox': 3077, 'n_words': 691}