[OpenLayers-Users] Re: drawing rectangles

Martin Ouellet geomartino at gmail.com
Tue Nov 22 16:08:48 EST 2011


This is not my code (but it's working for me).

drawControls = new OpenLayers.Control();
      OpenLayers.Util.extend(drawControls, {
          draw: function() {
              this.box = new OpenLayers.Handler.RegularPolygon(drawControls,
              {"done": this.notice}, {sides:4, irregular:true,
persist:true});
            },
           notice: function(geom) {
            // whatever you want it to do after the box has been drawn
           }
        });

      // then add the boxControl to the map
      map.addControl(drawControls);

MartinO

On Fri, Nov 18, 2011 at 6:11 AM, Steve <thesteveborland at gmail.com> wrote:

> Puneet Kishor <punk.kish at ...> writes:
>
> >
> > I am trying to implement a control to draw non-rotatable rectangles on
> the
> map. The following code draws
> > squares only, and with "snapAngle" at 0, it can be rotated freely, while
> with
> "snapAngle" at 360 the square
> > is rotated by 45 deg, for some reason.
> >
> >       var feature_ctl = new OpenLayers.Control.DrawFeature(
> >               vectorLayer,
> >               OpenLayers.Handler.RegularPolygon, {handlerOptions:
> {sides: 4, snapAngle: 0}}
> >         );
> >
> > Would appreciate guidance on how I can make the control draw only
> non-rotatable rectangles.
> >
> > --
> > Puneet Kishor
>
>
> I am having the same problem.
> Any help would be appreciated.
>
> Many thanks,
> Steve
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111122/822b7ece/attachment.html


More information about the Users mailing list