Sha256: c357a402af109bc08176ff5c6c36607b1a689a1c5e69548eb139d9c9f2975f01

Contents?: true

Size: 1.22 KB

Versions: 7

Compression:

Stored size: 1.22 KB

Contents

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

var map = new OpenLayers.Map({
    div: "map",
    layers: [
        new OpenLayers.Layer.OSM(),
        new OpenLayers.Layer.Vector("Vector Layer", {
            renderers: renderer
        })
    ],
    center: new OpenLayers.LonLat(0, 0),
    zoom: 1
});

var draw = new OpenLayers.Control.DrawFeature(
    map.layers[1],
    OpenLayers.Handler.Polygon,
    {handlerOptions: {holeModifier: "altKey"}}
);
map.addControl(draw);

// optionally listen for sketch events on the layer
var output = document.getElementById("output");
function updateOutput(event) {
    window.setTimeout(function() {
        output.innerHTML = event.type + " " + event.feature.id;
    }, 100);
}
map.layers[1].events.on({
    sketchmodified: updateOutput,
    sketchcomplete: updateOutput
});

// add behavior to UI elements
function toggleControl(element) {
    if (element.value === "polygon" && element.checked) {
        draw.activate();
    } else {
        draw.deactivate();
    }
}
document.getElementById("noneToggle").checked = true;

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
postrunner-0.0.10 misc/openlayers/examples/donut.js
postrunner-0.0.9 misc/openlayers/examples/donut.js
postrunner-0.0.8 misc/openlayers/examples/donut.js
postrunner-0.0.7 misc/openlayers/examples/donut.js
postrunner-0.0.6 misc/openlayers/examples/donut.js
postrunner-0.0.5 misc/openlayers/examples/donut.js
postrunner-0.0.4 misc/openlayers/examples/donut.js