<commit_before>
angular.module('NodeWebBase')
    .service('shapeService', ['$rootScope', '$http','ngDialog','themeChangedMsg',function ($rootScope, $http, ngDialog,themeChangedMsg) {
        var me = this;
        me.shapes = {
            "score":[],
            "polyset":[],
            "dataset":[]
        };
        me.map = null;
        me.drawingManager = null;

        me.init = function(map, drawingManager){
            me.map = map;
            me.drawingManager = drawingManager;
            google.maps.event.addListener(me.drawingManager, 'polygoncomplete', me.handleShape);
            google.maps.event.addListener(me.drawingManager, 'rectanglecomplete', me.handleShape);

            $rootScope.$on('drawPolygonFile', function (event, data) {
                me.clearCurrentShapes(["polyset"]);
                me.drawPolygonFile(data);
            });

            $rootScope.$on('clearCurrentShapes', function (event,shapeTypes) {
                me.clearCurrentShapes(shapeTypes);
            });

            $rootScope.$on('clearAll', function () {
                me.clearAll();
            });

            $rootScope.$on('deleteShape', function (event, shape, shapeType) {
                shape.setMap(null);
                var index = me.shapes[shapeType].indexOf(shape);
                if (index > -1) {
                    me.shapes[shapeType].splice(index, 1);
                }
            });

            $rootScope.$on('renderKmlFile', function (event, file) {
                me.renderKmlFile(file);
            });

            $rootScope.$on('drawShapes', function (event, data, shapeType) {
                me.clearCurrentShapes([shapeType]);

                switch (shapeType) {
                    case "score":
                        me.drawScoreShapes(data);
                        break;
                    case "dataset":
                        me.drawDataSetShapes(data);
                        break;
                }
            });

            themeChangedMsg.listen( function () {
                if ($rootScope.theme.shapeStyles) {
                    drawingManager.setOptions({
                        polygonOptions: $rootScope.theme.shapeStyles,
                        rectangleOptions: $rootScope.theme.shapeStyles
                    });

                    var shapeTypes = ["score","polyset"];
                    angular.forEach(shapeTypes, function (shapeType) {
                        angular.forEach(me.shapes[shapeType], function (shape) {
                            shape.setOptions($rootScope.theme.shapeStyles);
                        });
                    });

                }
            });

            $rootScope.$on('selectDatasetShape', function (event, dataset) {
                angular.forEach(me.shapes['dataset'], function (shape) {
                    if(shape.name === dataset.name){
                        shape.setOptions({'strokeColor':'green'});
                        return;
                    }
                    shape.setOptions({'strokeColor':'lightblue'});
                });
            });

            $rootScope.$on('getShapesText', function (event, callbackInfo) {
                var params = [];
                params.push(me.getSitesJson());
                callbackInfo.callback.apply(callbackInfo.scope, params);
            });
        };

        me.handleShape = function (shape) {
            shape.setEditable(true);
            if ($rootScope.theme && $rootScope.theme.shapeStyles)
                shape.setOptions($rootScope.theme.shapeStyles);
            me.shapes["polyset"].push(shape);
            shape.geqeData = {
                "name": "site",
                "dates": []
            };

            me.addShapeClickListener(shape);
        };

        me.calculateBounds = function (locations) {
            var bounds = new google.maps.LatLngBounds();
            angular.forEach(locations, function (location, idx) {
                bounds.extend(location);
            });
            me.map.fitBounds(bounds);
        };<commit_msg>data set shapes turn green when selected<commit_after>
angular.module('NodeWebBase')
    .service('shapeService', ['$rootScope', '$http','ngDialog','themeChangedMsg',function ($rootScope, $http, ngDialog,themeChangedMsg) {
        var me = this;
        me.shapes = {
            "score":[],
            "polyset":[],
            "dataset":[]
        };
        me.map = null;
        me.drawingManager = null;

        me.init = function(map, drawingManager){
            me.map = map;
            me.drawingManager = drawingManager;
            google.maps.event.addListener(me.drawingManager, 'polygoncomplete', me.handleShape);
            google.maps.event.addListener(me.drawingManager, 'rectanglecomplete', me.handleShape);

            $rootScope.$on('drawPolygonFile', function (event, data) {
                me.clearCurrentShapes(["polyset"]);
                me.drawPolygonFile(data);
            });

            $rootScope.$on('clearCurrentShapes', function (event,shapeTypes) {
                me.clearCurrentShapes(shapeTypes);
            });

            $rootScope.$on('clearAll', function () {
                me.clearAll();
            });

            $rootScope.$on('deleteShape', function (event, shape, shapeType) {
                shape.setMap(null);
                var index = me.shapes[shapeType].indexOf(shape);
                if (index > -1) {
                    me.shapes[shapeType].splice(index, 1);
                }
            });

            $rootScope.$on('renderKmlFile', function (event, file) {
                me.renderKmlFile(file);
            });

            $rootScope.$on('drawShapes', function (event, data, shapeType) {
                me.clearCurrentShapes([shapeType]);

                switch (shapeType) {
                    case "score":
                        me.drawScoreShapes(data);
                        break;
                    case "dataset":
                        me.drawDataSetShapes(data);
                        break;
                }
            });

            themeChangedMsg.listen( function () {
                if ($rootScope.theme.shapeStyles) {
                    drawingManager.setOptions({
                        polygonOptions: $rootScope.theme.shapeStyles,
                        rectangleOptions: $rootScope.theme.shapeStyles
                    });

                    var shapeTypes = ["score","polyset"];
                    angular.forEach(shapeTypes, function (shapeType) {
                        angular.forEach(me.shapes[shapeType], function (shape) {
                            shape.setOptions($rootScope.theme.shapeStyles);
                        });
                    });

                }
            });

            $rootScope.$on('selectDatasetShape', function (event, dataset) {
                angular.forEach(me.shapes['dataset'], function (shape) {
                    if(shape.name === dataset.name){
                        shape.setOptions({strokeColor:'green',strokeWeight: 3});
                        return;
                    }
                    shape.setOptions({strokeColor:'lightblue',strokeWeight: 2});
                });
            });

            $rootScope.$on('getShapesText', function (event, callbackInfo) {
                var params = [];
                params.push(me.getSitesJson());
                callbackInfo.callback.apply(callbackInfo.scope, params);
            });
        };

        me.handleShape = function (shape) {
            shape.setEditable(true);
            if ($rootScope.theme && $rootScope.theme.shapeStyles)
                shape.setOptions($rootScope.theme.shapeStyles);
            me.shapes["polyset"].push(shape);
            shape.geqeData = {
                "name": "site",
                "dates": []
            };

            me.addShapeClickListener(shape);
        };

        me.calculateBounds = function (locations) {
            var bounds = new google.maps.LatLngBounds();
            angular.forEach(locations, function (location, idx) {
                bounds.extend(location);
            });
            me.map.fitBounds(bounds);
        };
{'fraction_non_alphanumeric': 0.12455905607590317, 'fraction_numerical': 0.0007298382191947452, 'mean_word_length': 1.441936441936442, 'pattern_counts': {'":': 14, '<': 3, '<?xml version=': 0, '>': 5, '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': '2561236', 'n_tokens_mistral': 2093, 'n_tokens_neox': 1982, 'n_words': 302}