[OpenLayers-Users] DrawFeature: box supported?

Tim Schaub tschaub at openplans.org
Wed Oct 17 18:03:02 EDT 2007


Hey-

Bart van den Eijnden (OSGIS) wrote:
> Hi Chris,
> 
> would this require making changes to the existing Box Handler, or write a
> complete new Handler specific for the Box feature handler?
> 
> Best regards,
> Bart
> 

I've added an "irregular" property to the RegularPolygon handler.  See 
the patch for ticket #1098 [1].

If you want to draw a "box," you can do something like

var options = {
     handlerOptions: {
         sides: 4,
         irregular: true
     }
};
var draw = new OpenLayers.Control.DrawFeature(
     layer, OpenLayers.Handler.RegularPolygon, options
);

The syntax is a bit odd, but it is flexible - if you want a non-circular 
ellipse, just change 4 to 30 or so.  If there is a need for simpler 
syntax, we could make a rectangle handler.

Tim

[1] http://trac.openlayers.org/ticket/1098

> --
> Bart van den Eijnden
> OSGIS, Open Source GIS
> http://www.osgis.nl
> 
> 
> --------- Oorspronkelijk bericht --------
> Van: Christopher Schmidt <crschmidt at metacarta.com>
> Naar: Bart van den Eijnden OSGIS <bartvde at osgis.nl>
> Cc: users at openlayers.org
> Onderwerp: Re: [OpenLayers-Users] DrawFeature: box supported?
> Datum: 15/10/07 10:47
> 
>> On Mon, Oct 15, 2007 at 02:28:49PM +0200, Bart van den Eijnden (OSGIS)
> wrote:
>> &gt; Hi list,
>> &gt; 
>> &gt; can DrawFeature be used to draw a box / rectangular geometry?
>> &gt; 
>> &gt; I tried adding a button to the EditingToolbar/Control:
>> &gt; 
>> &gt; new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Box,
>> &gt; {'displayClass': 'olControlDrawFeatureBox'})
>>
>> The box handler is not a vector feature handler. Point, Path, Poly,
>> RegularPoly are the only vector feature handlers. 
>>
>> Regards,
>> -- 
>> Christopher Schmidt
>> MetaCarta
>>
>>
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> !DSPAM:4033,471367eb12971961014482!
> 




More information about the Users mailing list