<commit_before>(function($) {

$.widget("mapbender.ol_map", {
	options: {
		'srs': 'EPSG:4326',
		'main': null, //mapset for main map
		'overview': null //mapset for overview map
	},

	map: null,
	highlightLayer: null,
	
	_create: function() {
		var self = this;

		//TODO: Listen to changes on Mapbender.configuration.srs
		if(Mapbender.configuration.srs) {		
			this._setOption('srs', Mapbender.configuration.srs);
		}

		var opts = $.extend({}, {
			theme: null,
			maxResolution: 'auto',
			units: 'm',
			projection: this.options.srs
		});
	
		if(Mapbender.configuration.extents.max) {
			$.extend(opts, { maxExtent: OpenLayers.Bounds.fromArray(Mapbender.configuration.extents.max) });
		}

		if(this.options.scales) {
			$.extend(opts, { scales: this.options.scales });
		}

		$.extend(opts, { controls: [
			new OpenLayers.Control.Navigation(),
			new OpenLayers.Control.ArgParser(),
			new OpenLayers.Control.Attribution(),
			new OpenLayers.Control.PanZoomBar(),
			new OpenLayers.Control.Scale(),
			new OpenLayers.Control.ZoomBox(),
			new OpenLayers.Control.LayerSwitcher()
		] });
		
		this.map = new OpenLayers.Map(opts);

		if(this.options.main)
			this._loadLayers('main');

		this.map.render(this.element[0]);


		if(Mapbender.configuration.extents.start) {
			this._setOption('extent', Mapbender.configuration.extents.start);
		}

	},

	_loadLayers: function(target) {
		if(!this.map)
			return;

		var self = this;	
		$.each(Mapbender.configuration.layersets[target], function(key, def) {
			/*
			title
			configuration
				layers
				url
			*/
			// only WMS for now
			var defaults = {
				baselayer: true,
				visible: true,
				opacity: 100,
				tiled: true
			};
			def.configuration = $.extend({}, defaults, def.configuration);

			var layer = new OpenLayers.Layer.WMS(def.title, def.configuration.url, 
			{
				layers: def.configuration.layers,
                                format: def.configuration.format,
                                transparent: def.configuration.transparent
			}, { 
				isBaseLayer: def.configuration.baselayer,
				visibility: def.configuration.visible,
				opacity: def.configuration.opacity / 100.0,
				noMagic: true,
				singleTile: !def.configuration.tiled
			});
			self.map.addLayer(layer);
		});
	},

	_setOption: function(key, value) {
		switch(key) {
			// Set SRS on Map
			case 'srs':
				if(this.map) {
					//TODO
				} else {
					this.options.srs = value;
				}
				break;
			case 'extent':
				this.options.extent = OpenLayers.Bounds.fromArray(value);
				this.map.zoomToExtent(this.options.extent);
		}
	},

	destroy: function() {
		$.Widget.prototype.destroy.call(this);
	},

	highlight: function(geom) {
			if(!this.highlightLayer) {
				var hll = this.highlightLayer = new OpenLayers.Layer.Vector();
				this.map.addLayer(hll);
			} 
			geojsonFormat = new OpenLayers.Format.GeoJSON();
			
			hll.removeAllFeatures();
			hll.addFeatures(geojsonFormat.read(geom));
			var extent = hll.getDataExtent();
			this.map.zoomToExtent(extent);
	}
});

})(jQuery);<commit_msg>Changes to use overview map<commit_after>(function($) {

$.widget("mapbender.ol_map", {
	options: {
		'srs': 'EPSG:4326',
		'main': null, //mapset for main map
		'overview': null //mapset for overview map
	},

	map: null,
	highlightLayer: null,
	
	_create: function() {
		var self = this;

		//TODO: Listen to changes on Mapbender.configuration.srs
		if(Mapbender.configuration.srs) {		
			this._setOption('srs', Mapbender.configuration.srs);
		}

		var opts = $.extend({}, {
			theme: null,
			maxResolution: 'auto',
			units: 'm',
			projection: this.options.srs
		});
	
		if(Mapbender.configuration.extents.max) {
			$.extend(opts, { maxExtent: OpenLayers.Bounds.fromArray(Mapbender.configuration.extents.max) });
		}

		if(this.options.scales) {
			$.extend(opts, { scales: this.options.scales });
		}

		$.extend(opts, { controls: [
			new OpenLayers.Control.Navigation(),
			new OpenLayers.Control.ArgParser(),
			new OpenLayers.Control.Attribution(),
			new OpenLayers.Control.PanZoomBar(),
			new OpenLayers.Control.Scale(),
			new OpenLayers.Control.ZoomBox(),
			new OpenLayers.Control.LayerSwitcher()
		] });

	    if(this.options.overview) {
            var layerConf = Mapbender.configuration.layersets[this.options.overview][0];
            var layer = new OpenLayers.Layer.WMS(layerConf.title, layerConf.configuration.url, {
                layers: layerConf.configuration.layers
            });
            opts['controls'].push(new OpenLayers.Control.OverviewMap({
                layers: [layer]
            }));
        }
        console.log(opts);
		
        this.map = new OpenLayers.Map(opts);

		if(this.options.main)
			this._loadLayers('main');

		this.map.render(this.element[0]);


		if(Mapbender.configuration.extents.start) {
			this._setOption('extent', Mapbender.configuration.extents.start);
		}

	},

	_loadLayers: function(target) {
		if(!this.map)
			return;

		var self = this;	
		$.each(Mapbender.configuration.layersets[target], function(key, def) {
			/*
			title
			configuration
				layers
				url
			*/
			// only WMS for now
			var defaults = {
				baselayer: true,
				visible: true,
				opacity: 100,
				tiled: true
			};
			def.configuration = $.extend({}, defaults, def.configuration);

			var layer = new OpenLayers.Layer.WMS(def.title, def.configuration.url, 
			{
				layers: def.configuration.layers,
                                format: def.configuration.format,
                                transparent: def.configuration.transparent
			}, { 
				isBaseLayer: def.configuration.baselayer,
				visibility: def.configuration.visible,
				opacity: def.configuration.opacity / 100.0,
				noMagic: true,
				singleTile: !def.configuration.tiled
			});
			self.map.addLayer(layer);
		});
	},

	_setOption: function(key, value) {
		switch(key) {
			// Set SRS on Map
			case 'srs':
				if(this.map) {
					//TODO
				} else {
					this.options.srs = value;
				}
				break;
			case 'extent':
				this.options.extent = OpenLayers.Bounds.fromArray(value);
				this.map.zoomToExtent(this.options.extent);
		}
	},

	destroy: function() {
		$.Widget.prototype.destroy.call(this);
	},

	highlight: function(data, type) {
			if(!this.highlightLayer) {
				this.highlightLayer = new OpenLayers.Layer.Vector();
				this.map.addLayer(this.highlightLayer);
			}
            var hll = this.highlightLayer;

            var features = [];
            switch(type) {
                case 'gml':
                    var gmlFormat = new OpenLayers.Format.GML();
                    features = gmlFormat.read(data);
                    break;
                case 'xy':
                    data = data.split(" ");
                    var x = parseFloat(data[0]);
                    var y = parseFloat(data[1]);
                    if(!(x && y)) {
                        return;
                    }
                    var point = new OpenLayers.Geometry.Point(x, y);
                    features = [new OpenLayers.Feature.Vector(point)];
                    break;
                case 'json':
                    var geojsonFormat = new OpenLayers.Format.GeoJSON();
                    features = geojsonFormat.read(data);
                    break;
            }
			
			hll.removeAllFeatures();
			hll.addFeatures(features);
			var extent = hll.getDataExtent();
			this.map.zoomToExtent(extent);
	}
});

})(jQuery);
{'fraction_non_alphanumeric': 0.13969197514185355, 'fraction_numerical': 0.0036476627938395027, 'mean_word_length': 2.4788533834586466, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1893310', 'n_tokens_mistral': 2867, 'n_tokens_neox': 2367, 'n_words': 415}