[OpenLayers-Users] DrawFeature: box supported?

Tim Schaub tschaub at openplans.org
Tue Oct 16 17:12:31 EDT 2007


Hey-

Yeah, if you want to use the DrawFeature control then you should use one 
of the handlers that Chris mentions (point, path, poly, regular poly).

See the regular polygon example for an indication of how to draw regular 
polygons:
http://openlayers.org/dev/examples/regular-polygons.html

Well, you may say "I want non square rectangles."  The RegularPolygon 
handler is about regular polygons (equilateral and equiangular). 
Because of this, I use the mouse down as the center of the feature and 
let the user rotate the feature with mouse moves.

However, we could give the regular poly handler an "irregular" property. 
  If true, this would allow for irregular polygons (rectangles, 
non-equilateral triangles, ovals, whatever).  The behavior for 
rectanlges would be similar to the box handler - first click is one 
corner, mouse moves drag out the opposite corner.

While it's a bit weird to have an irregular flag on the regular polygon 
handler, I think this would result in the least amount of code duplication.

I'll take a look at this later if nobody else gets to it first.

Tim

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
> 
> --
> 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