<commit_before>// Allow testing of specific renderers via "?renderer=Canvas", etc
var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
OpenLayers.Layer.Vector.prototype.renderers = renderer ?
                                    [renderer] :
                                    OpenLayers.Layer.Vector.prototype.renderers;

// Create Objects
// --------------

// Create the vectorial layer
var topLayer = new OpenLayers.Layer.Vector('Green top', {
    styleMap: new OpenLayers.StyleMap({'default':{fillColor: 'green'},'select':{strokeColor: 'yellow'}})
});
var middleLayer = new OpenLayers.Layer.Vector('Red middle', {
    styleMap: new OpenLayers.StyleMap({'default':{fillColor: 'red'},'select':{strokeColor: 'yellow'}})
});
var bottomLayer = new OpenLayers.Layer.Vector('Blue bottom', {
    styleMap: new OpenLayers.StyleMap({'default':{fillColor: 'blue'},'select':{strokeColor: 'yellow'}})
});
// Create and show the map
var map = new OpenLayers.Map({
    div: 'map',
    layers: [
        new OpenLayers.Layer.WMS('osgeo WMS',
                  'http://vmap0.tiles.osgeo.org/wms/vmap0?', {layers: 'basic'}),
        bottomLayer, middleLayer, topLayer
    ]
});
map.setCenter(new OpenLayers.LonLat(0, 0), 3);
map.addControl(new OpenLayers.Control.LayerSwitcher());

// Create the control collection to draw vectorial features.
var controls = {
    bottom: new OpenLayers.Control.DrawFeature(bottomLayer,
                OpenLayers.Handler.Polygon),
    middle: new OpenLayers.Control.DrawFeature(middleLayer,
                OpenLayers.Handler.Polygon),
    top:    new OpenLayers.Control.DrawFeature(topLayer,
                OpenLayers.Handler.Polygon),
    modify: new OpenLayers.Control.ModifyFeature(null, {
        selectOnUp: true // To use same event as SelectFeature to select.
    })
};
// add this controls to the map
for (var key in controls) {
    map.addControl(controls[key]);
}

// Create a selectFeture control.
var selLayers = [bottomLayer, middleLayer, topLayer];
var selFeature = new OpenLayers.Control.SelectFeature(selLayers);
map.addControl(selFeature);
selFeature.activate();
selListener = {
    // It is not necessary listen 'featureselected' event.
    'featureselected': function(evt) {
        controls.modify.selectFeature(evt.feature);
    }
};
for (var i = 0, len = selLayers.length; i < len; i++) {
    selLayers[i].events.on(selListener);
}

// Functions called from the form fields to choose the desired control to test.
// ----------------------------------------------------------------------------

// Function to toggle the active control
function toggleControl(element) {
    for (key in controls) {
        var control = controls[key];
        if (element.value === key && element.checked) {
            control.activate();<commit_msg>Fix undeclared var.<commit_after>// Allow testing of specific renderers via "?renderer=Canvas", etc
var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
OpenLayers.Layer.Vector.prototype.renderers = renderer ?
                                    [renderer] :
                                    OpenLayers.Layer.Vector.prototype.renderers;

// Create Objects
// --------------

// Create the vectorial layer
var topLayer = new OpenLayers.Layer.Vector('Green top', {
    styleMap: new OpenLayers.StyleMap({'default':{fillColor: 'green'},'select':{strokeColor: 'yellow'}})
});
var middleLayer = new OpenLayers.Layer.Vector('Red middle', {
    styleMap: new OpenLayers.StyleMap({'default':{fillColor: 'red'},'select':{strokeColor: 'yellow'}})
});
var bottomLayer = new OpenLayers.Layer.Vector('Blue bottom', {
    styleMap: new OpenLayers.StyleMap({'default':{fillColor: 'blue'},'select':{strokeColor: 'yellow'}})
});
// Create and show the map
var map = new OpenLayers.Map({
    div: 'map',
    layers: [
        new OpenLayers.Layer.WMS('osgeo WMS',
                  'http://vmap0.tiles.osgeo.org/wms/vmap0?', {layers: 'basic'}),
        bottomLayer, middleLayer, topLayer
    ]
});
map.setCenter(new OpenLayers.LonLat(0, 0), 3);
map.addControl(new OpenLayers.Control.LayerSwitcher());

// Create the control collection to draw vectorial features.
var controls = {
    bottom: new OpenLayers.Control.DrawFeature(bottomLayer,
                OpenLayers.Handler.Polygon),
    middle: new OpenLayers.Control.DrawFeature(middleLayer,
                OpenLayers.Handler.Polygon),
    top:    new OpenLayers.Control.DrawFeature(topLayer,
                OpenLayers.Handler.Polygon),
    modify: new OpenLayers.Control.ModifyFeature(null, {
        selectOnUp: true // To use same event as SelectFeature to select.
    })
};
// add this controls to the map
for (var key in controls) {
    map.addControl(controls[key]);
}

// Create a selectFeture control.
var selLayers = [bottomLayer, middleLayer, topLayer];
var selFeature = new OpenLayers.Control.SelectFeature(selLayers);
map.addControl(selFeature);
selFeature.activate();
var selListener = {
    // It is not necessary listen 'featureselected' event.
    'featureselected': function(evt) {
        controls.modify.selectFeature(evt.feature);
    }
};
for (var i = 0, len = selLayers.length; i < len; i++) {
    selLayers[i].events.on(selListener);
}

// Functions called from the form fields to choose the desired control to test.
// ----------------------------------------------------------------------------

// Function to toggle the active control
function toggleControl(element) {
    for (key in controls) {
        var control = controls[key];
        if (element.value === key && element.checked) {
            control.activate();
{'fraction_non_alphanumeric': 0.15871036693979337, 'fraction_numerical': 0.0021375133594584966, 'mean_word_length': 2.9348283111422564, 'pattern_counts': {'":': 0, '<': 5, '<?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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3940424', 'n_tokens_mistral': 1675, 'n_tokens_neox': 1611, 'n_words': 392}