<commit_before>(function () {
  'use strict';

  angular
    .module('openSenseMapApp')
    .directive('osemMap', osemMap);

  osemMap.$inject = ['$q', '$rootScope', 'osemMapData'];

  /* @ngInject */
  function osemMap ($q, $rootScope, osemMapData) {
    var rmax = 30;
    var directive = {
      templateUrl: 'components/leaflet.directive.html',
      link: link,
      restrict: 'EA',
      transclude: true,
      controller: function () {
        this._leafletMap = $q.defer();
        this.getMap = function () {
          return this._leafletMap.promise;
        };
      },
      scope: {
        markers: '=',
        center: '=',
        events: '='
      }
    };
    return directive;

    function link(scope, element, attrs, ctrl) {
      //TODO: destroy
      scope.mapId =  attrs.id;

      var map = new L.map(element[0], {
        minZoom: 2,
        maxZoom: 18,
        worldCopyJump: true,
        scrollWheelZoom: true
      }).setView([51.04139389812637, 10.2172851562], 6);
      ctrl._leafletMap.resolve(map);

      map.on('click', onMapClick);

      var mcg = L.markerClusterGroup({
            maxClusterRadius: 2*rmax,
            iconCreateFunction: defineClusterIcon,
            disableClusteringAtZoom: 17,
            spiderfyOnMaxZoom: false
          }),
          activeMarkerGroup = L.featureGroup.subGroup(mcg),
          inactiveMarkerGroup = L.featureGroup.subGroup(mcg),
          oldMarkerGroup = L.featureGroup.subGroup(mcg);

      mcg.addTo(map);

      activeMarkerGroup.on('add', function () {
        osemMapData.setLayer('activeMarkers', activeMarkerGroup);
      });

      inactiveMarkerGroup.on('add', function () {
        osemMapData.setLayer('inactiveMarkers', inactiveMarkerGroup);
      });

      oldMarkerGroup.on('add', function () {
        osemMapData.setLayer('oldMarkers', oldMarkerGroup);
      });

      L.tileLayer('@@OPENSENSEMAP_MAPTILES_URL', {
        subdomains: 'abc',
        attribution: '&copy; <a href="http://osm.org/copyright" target="_blank">OpenStreetMap</a> contributors | Tiles &copy; <a href="http://www.mapbox.com/" target="_blank">Mapbox</a>',
        detectRetina: true,
        reuseTiles: true,
        maxZoom: 18
      }).addTo(map);

      L.control.scale().addTo(map);

      activeMarkerGroup.addTo(map); // Adding to map now adds all child layers into the parent group.
      inactiveMarkerGroup.addTo(map);
      oldMarkerGroup.addTo(map);

      if (angular.isDefined(scope.events) && !angular.equals({}, scope.events)) {
        if (scope.events.autolocation) {
          map.locate({setView: true, maxZoom: 16});
          map.on('locationfound', onLocationFound);<commit_msg>show markers on clustermouseover<commit_after>(function () {
  'use strict';

  angular
    .module('openSenseMapApp')
    .directive('osemMap', osemMap);

  osemMap.$inject = ['$q', '$rootScope', 'osemMapData'];

  /* @ngInject */
  function osemMap ($q, $rootScope, osemMapData) {
    var rmax = 30;
    var directive = {
      templateUrl: 'components/leaflet.directive.html',
      link: link,
      restrict: 'EA',
      transclude: true,
      controller: function () {
        this._leafletMap = $q.defer();
        this.getMap = function () {
          return this._leafletMap.promise;
        };
      },
      scope: {
        markers: '=',
        center: '=',
        events: '='
      }
    };
    return directive;

    function link(scope, element, attrs, ctrl) {
      //TODO: destroy
      scope.mapId =  attrs.id;

      var map = new L.map(element[0], {
        minZoom: 2,
        maxZoom: 18,
        worldCopyJump: true,
        scrollWheelZoom: true
      }).setView([51.04139389812637, 10.2172851562], 6);
      ctrl._leafletMap.resolve(map);

      map.on('click', onMapClick);

      var mcg = L.markerClusterGroup({
            maxClusterRadius: 2*rmax,
            iconCreateFunction: defineClusterIcon,
            disableClusteringAtZoom: 17,
            spiderfyOnMaxZoom: false,
            showCoverageOnHover: false
          }),
          activeMarkerGroup = L.featureGroup.subGroup(mcg),
          inactiveMarkerGroup = L.featureGroup.subGroup(mcg),
          oldMarkerGroup = L.featureGroup.subGroup(mcg);

      var mouseOverGroup = L.layerGroup();

      mcg.addTo(map);

      mcg.on('clustermouseover', function (e) {
        var allChildMarkers = e.layer.getAllChildMarkers();
        for (var childMarker in allChildMarkers) {
          var marker = allChildMarkers[childMarker];
          var circle = new L.CircleMarker(marker._latlng, {
            radius: 5,
            color: marker.options.icon.options.markerColor,
            fillOpacity: .3,
            opacity: 0
          });
          mouseOverGroup.addLayer(circle);
        }
        mouseOverGroup.addTo(map);
      });

      mcg.on('clustermouseout', function (e) {
        mouseOverGroup.clearLayers();
        map.removeLayer(mouseOverGroup);
      });

      mcg.on('clusterclick', function (e) {
        map.removeLayer(mouseOverGroup);
      });

      activeMarkerGroup.on('add', function () {
        osemMapData.setLayer('activeMarkers', activeMarkerGroup);
      });

      inactiveMarkerGroup.on('add', function () {
        osemMapData.setLayer('inactiveMarkers', inactiveMarkerGroup);
      });

      oldMarkerGroup.on('add', function () {
        osemMapData.setLayer('oldMarkers', oldMarkerGroup);
      });

      L.tileLayer('@@OPENSENSEMAP_MAPTILES_URL', {
        subdomains: 'abc',
        attribution: '&copy; <a href="http://osm.org/copyright" target="_blank">OpenStreetMap</a> contributors | Tiles &copy; <a href="http://www.mapbox.com/" target="_blank">Mapbox</a>',
        detectRetina: true,
        reuseTiles: true,
        maxZoom: 18
      }).addTo(map);

      L.control.scale().addTo(map);

      activeMarkerGroup.addTo(map); // Adding to map now adds all child layers into the parent group.
      inactiveMarkerGroup.addTo(map);
      oldMarkerGroup.addTo(map);

      if (angular.isDefined(scope.events) && !angular.equals({}, scope.events)) {
        if (scope.events.autolocation) {
          map.locate({setView: true, maxZoom: 16});
          map.on('locationfound', onLocationFound);
{'fraction_non_alphanumeric': 0.13759253299002253, 'fraction_numerical': 0.014000643707756678, 'mean_word_length': 2.4451219512195124, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '1767376', 'n_tokens_mistral': 2019, 'n_tokens_neox': 1912, 'n_words': 344}