From 1f539470bbba6b617139205ad7ae27faefe427d2 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Mon, 13 Feb 2012 09:42:09 +0100 Subject: [PATCH] add box drawing to draw-feature control example so it is easier to find for people --- examples/draw-feature.html | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/examples/draw-feature.html b/examples/draw-feature.html index d292794f63..f70e9eabf3 100644 --- a/examples/draw-feature.html +++ b/examples/draw-feature.html @@ -33,18 +33,27 @@ var pointLayer = new OpenLayers.Layer.Vector("Point Layer"); var lineLayer = new OpenLayers.Layer.Vector("Line Layer"); var polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer"); + var boxLayer = new OpenLayers.Layer.Vector("Box layer"); - map.addLayers([wmsLayer, pointLayer, lineLayer, polygonLayer]); + map.addLayers([wmsLayer, pointLayer, lineLayer, polygonLayer, boxLayer]); map.addControl(new OpenLayers.Control.LayerSwitcher()); map.addControl(new OpenLayers.Control.MousePosition()); drawControls = { point: new OpenLayers.Control.DrawFeature(pointLayer, - OpenLayers.Handler.Point), + OpenLayers.Handler.Point), line: new OpenLayers.Control.DrawFeature(lineLayer, - OpenLayers.Handler.Path), + OpenLayers.Handler.Path), polygon: new OpenLayers.Control.DrawFeature(polygonLayer, - OpenLayers.Handler.Polygon) + OpenLayers.Handler.Polygon), + box: new OpenLayers.Control.DrawFeature(boxLayer, + OpenLayers.Handler.RegularPolygon, { + handlerOptions: { + sides: 4, + irregular: true + } + } + ) }; for(var key in drawControls) { @@ -80,11 +89,11 @@

OpenLayers Draw Feature Example

- point, line, linestring, polygon, digitizing, geometry, draw, drag + point, line, linestring, polygon, box, digitizing, geometry, draw, drag

- Demonstrate on-screen digitizing tools for point, line, and polygon creation. + Demonstrate on-screen digitizing tools for point, line, polygon and box creation.

@@ -107,6 +116,10 @@

OpenLayers Draw Feature Example

+
  • + + +
  • @@ -119,6 +132,8 @@

    OpenLayers Draw Feature Example

    Double-click to finish drawing.

    With the polygon drawing control active, click on the map to add the points that make up your polygon. Double-click to finish drawing.

    +

    With the box drawing control active, click in the map and drag the mouse to get a rectangle. Release + the mouse to finish.

    With any drawing control active, paning the map can still be achieved. Drag the map as usual for that.

    Hold down the shift key while drawing to activate freehand mode. While drawing lines or polygons