<commit_before>var BrowseImageView = Backbone.View.extend({
       tagName: "div",
       layers: [],
       baseLayer : null,
       map : null,
       initOptions : null,
       /**
        * BrowseImageView constructor
        * Accept options used for initialization
        * @param options
        */
       initialize: function (options) {
          this.initOptions = options.initOptions;
       },
       /**
        * Render the html into the DOM element associated to the view
        * @param tpl
        */
       doLayout: function (tpl) {
          var tpl = _.template(tpl, this.model.toJSON());
          $(this.el).append(tpl);
          var tabs = $(this.el).children('.tabs');
          this.el.tabs("add", "#tabs-" + this.model.get('id'), this.model.get('filename'));
          this.el.css("display", "block");
          this.initToolbar();
          this.initMap();
          this.initOntology();
          return this;
       },
       /**
        * Grab the layout and call ask for render
        */
       render : function() {
          var self = this;
          require([
             "text!application/templates/explorer/BrowseImage.tpl.html"
          ], function(tpl) {
             self.doLayout(tpl);
          });
       },
       /**
        * Check init options and call appropriate methods
        */
       show : function() {
          var self = this;
          if (this.initOptions.goToAnnotation != undefined) {
             _.each(this.layers, function(layer) {
                self.goToAnnotation(layer,  self.initOptions.goToAnnotation.value);
             });
          }

       },
       /**
        * Move the OpenLayers view to the Annotation, at the
        * optimal zoom
        * @param layer The vector layer containing annotations
        * @param idAnnotation the annotation
        */
       goToAnnotation : function(layer, idAnnotation) {
          var feature = layer.getFeature(idAnnotation);
          if (feature != undefined) {
             var bounds = feature.geometry.bounds;
             //Compute the ideal zoom to view the feature
             var featureWidth = bounds.right  - bounds.left;
             var featureHeight = bounds.top - bounds.bottom;
             var windowWidth = $(window).width();
             var windowHeight = $(window).height();
             var zoom = this.map.getNumZoomLevels()-1;
             var tmpWidth = featureWidth;
             var tmpHeight = featureHeight;
             while ((tmpWidth > windowWidth) || (tmpHeight > windowHeight)) {
                tmpWidth /= 2;
                tmpHeight /= 2;
                zoom--;
             }
             this.map.moveTo(new OpenLayers.LonLat(feature.geometry.getCentroid().x, feature.geometry.getCentroid().y), Math.max(0, zoom));
          }
       },
       /**
        * Callback used by AnnotationLayer at the end of theirs initializations<commit_msg>Select a annotation when goToAnnotation<commit_after>var BrowseImageView = Backbone.View.extend({
       tagName: "div",
       layers: [],
       baseLayer : null,
       map : null,
       initOptions : null,
       /**
        * BrowseImageView constructor
        * Accept options used for initialization
        * @param options
        */
       initialize: function (options) {
          this.initOptions = options.initOptions;
       },
       /**
        * Render the html into the DOM element associated to the view
        * @param tpl
        */
       doLayout: function (tpl) {
          var tpl = _.template(tpl, this.model.toJSON());
          $(this.el).append(tpl);
          var tabs = $(this.el).children('.tabs');
          this.el.tabs("add", "#tabs-" + this.model.get('id'), this.model.get('filename'));
          this.el.css("display", "block");
          this.initToolbar();
          this.initMap();
          this.initOntology();
          return this;
       },
       /**
        * Grab the layout and call ask for render
        */
       render : function() {
          var self = this;
          require([
             "text!application/templates/explorer/BrowseImage.tpl.html"
          ], function(tpl) {
             self.doLayout(tpl);
          });
       },
       /**
        * Check init options and call appropriate methods
        */
       show : function() {
          var self = this;
          if (this.initOptions.goToAnnotation != undefined) {
             _.each(this.layers, function(layer) {
                self.goToAnnotation(layer,  self.initOptions.goToAnnotation.value);
             });
          }

       },
       /**
        * Move the OpenLayers view to the Annotation, at the
        * optimal zoom
        * @param layer The vector layer containing annotations
        * @param idAnnotation the annotation
        */
       goToAnnotation : function(layer, idAnnotation) {
          var feature = layer.getFeature(idAnnotation);
          if (feature != undefined) {
             var bounds = feature.geometry.bounds;
             //Compute the ideal zoom to view the feature
             var featureWidth = bounds.right  - bounds.left;
             var featureHeight = bounds.top - bounds.bottom;
             var windowWidth = $(window).width();
             var windowHeight = $(window).height();
             var zoom = this.map.getNumZoomLevels()-1;
             var tmpWidth = featureWidth;
             var tmpHeight = featureHeight;
             while ((tmpWidth > windowWidth) || (tmpHeight > windowHeight)) {
                tmpWidth /= 2;
                tmpHeight /= 2;
                zoom--;
             }
             layer.controls.select.unselectAll();
             layer.controls.select.select(feature);

             this.map.moveTo(new OpenLayers.LonLat(feature.geometry.getCentroid().x, feature.geometry.getCentroid().y), Math.max(0, zoom));
          }
       },
       /**
        * Callback used by AnnotationLayer at the end of theirs initializations
{'fraction_non_alphanumeric': 0.1135943538901025, 'fraction_numerical': 0.0013443118803562427, 'mean_word_length': 1.6595174262734584, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4149161', 'n_tokens_mistral': 1535, 'n_tokens_neox': 1516, 'n_words': 379}