<commit_before>/**
 * @author <NAME>
 * @license The MIT license (LICENSE.txt)
 * @copyright 2015 <NAME>
 * @url https://github.com/rharel/webgl-dm-voronoi
 */

function MarkerLayer() {

  this._sites = {};
  this._markers = {};
  this._origin = new THREE.Object3D();

  this._markerGeometry = new THREE.PlaneGeometry(1, 1);
  this._markerMaterial = new THREE.MeshBasicMaterial({
    color: MarkerLayer.style.color
  });

  this.visible = false;
}

MarkerLayer.style = {
  color: new THREE.Color(0, 0, 0),
  size: 5
};

MarkerLayer.prototype = {

  constructor: MarkerLayer,

  add: function(site) {

    if (!!this._markers[site.id]) { return; }

    var marker = new THREE.Mesh(
      this._markerGeometry,
      this._markerMaterial
    );

    switch (site.type) {

      case (SiteType.line): {

        marker.scale.set(
          MarkerLayer.style.size,
          site.length(),
          1
        );

        break;
      }

      default: {  // point

        marker.scale.set(
          MarkerLayer.style.size,
          MarkerLayer.style.size,
          1
        );

        break;
      }
    }

    this._sites[site.id] = site;
    this._markers[site.id] = marker;
    this._origin.add(marker);
  },

  remove: function(site) {

    if (!this._markers[site.id]) { return; }

    var marker = this._markers[site.id];
    this._origin.remove(marker);
    this._markers[site.id] = null;
    this._sites[site.id] = null;
  },

  update: function() {

    for (var id in this._sites) {

      var marker = this._markers[id];
      var site = this._sites[id];

      switch (site.type) {

        case (SiteType.line): {

          marker.rotation.setFromQuaternion(
            new THREE.Quaternion().setFromUnitVectors(
              new THREE.Vector3(0, 1, 0),
              site.direction()
            )
          );<commit_msg>Removed markers are deleted from the id -> site mapping<commit_after>/**
 * @author <NAME>
 * @license The MIT license (LICENSE.txt)
 * @copyright 2015 <NAME>
 * @url https://github.com/rharel/webgl-dm-voronoi
 */

function MarkerLayer() {

  this._sites = {};  // (id -> site) map
  this._markers = {};  // (id -> marker) map

  this._origin = new THREE.Object3D();

  this._markerGeometry = new THREE.PlaneGeometry(1, 1);
  this._markerMaterial = new THREE.MeshBasicMaterial({
    color: MarkerLayer.style.color
  });

  this.visible = false;
}

MarkerLayer.style = {
  color: new THREE.Color(0, 0, 0),
  size: 5
};

MarkerLayer.prototype = {

  constructor: MarkerLayer,

  add: function(site) {

    if (this._sites.hasOwnProperty(site.id)) { return; }

    var marker = new THREE.Mesh(
      this._markerGeometry,
      this._markerMaterial
    );

    switch (site.type) {

      case (SiteType.line): {

        marker.scale.set(
          MarkerLayer.style.size,
          site.length(),
          1
        );

        break;
      }

      default: {  // point

        marker.scale.set(
          MarkerLayer.style.size,
          MarkerLayer.style.size,
          1
        );

        break;
      }
    }

    this._sites[site.id] = site;
    this._markers[site.id] = marker;
    this._origin.add(marker);
  },

  remove: function(site) {

    if (!this._sites.hasOwnProperty(site.id)) { return; }

    var marker = this._markers[site.id];
    this._origin.remove(marker);
    delete this._markers[site.id];
    delete this._sites[site.id];
  },

  update: function() {

    for (var id in this._sites) {

      var marker = this._markers[id];
      var site = this._sites[id];

      switch (site.type) {

        case (SiteType.line): {

          marker.rotation.setFromQuaternion(
            new THREE.Quaternion().setFromUnitVectors(
              new THREE.Vector3(0, 1, 0),
              site.direction()
            )
          );
{'fraction_non_alphanumeric': 0.13965744400527008, 'fraction_numerical': 0.008959156785243741, 'mean_word_length': 2.0861788617886177, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, 'https://': 2, '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': '6683565', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1207, 'n_words': 238}