OpenLayers OpenLayers

Ticket #828 (closed feature: fixed)

Opened 3 years ago

Last modified 3 years ago

regular polygon control

Reported by: tschaub Assigned to: elemoine
Priority: major Milestone: 2.5 Release
Component: Handler Version: 2.4
Keywords: Cc:
State:

Description

This was brought up on the mailing list some time ago (http://openlayers.org/pipermail/users/2007-May/001577.html). I needed one with some different functionality - and didn't see the attachment on that email until just now (oops). Anyway, the following patch creates a RegularPolygon handler that can be used by the DrawFeature control. Also included is an example demonstrating the options (rotating, angle snapping, fixed radius, etc).

Attachments

regular-poly.patch (29.8 kB) - added by tschaub on 09/07/07 19:01:04.
updated patch

Change History

07/10/07 16:01:38 changed by tschaub

  • keywords set to review.

please review

07/11/07 11:11:12 changed by tschaub

note that this requires the patch for #827

07/12/07 14:58:09 changed by tschaub

second patch, same as the first, minus one line of nd comment

07/12/07 18:03:10 changed by tschaub

  • keywords deleted.

pulling this one from the review queue - awaiting any discussion on #827

In the meantime, you can play with regular polygons here: http://dev.openlayers.org/sandbox/tschaub/feature/examples/regular-polygons.html

08/03/07 09:59:23 changed by crschmidt

  • owner changed from tschaub to elemoine.
  • priority changed from minor to major.

It sounds like elemoine has an interest in taking this on and testing it. If he does, then it can go into 2.5. #827 discussion still needs to happen first.

08/23/07 20:18:29 changed by crschmidt

Tim --

Can you explain why angles are in radians instead of degrees? I think people are more used to thinking in degrees, and I don't see why we can't do the math for them unless there is some strong reason to make people think about the units.

08/28/07 22:14:48 changed by crschmidt

Current state of RegularPolygon code in feature sandbox attached. However, I'd still like a n explanation of the use of radians over degrees in snapping angle -- if it's not important, I'd like to go ahead and change it before we review/commit this.

08/31/07 22:50:23 changed by crschmidt

  • keywords set to review.

regular_polygon_trunk.2.patch (29.4 kB) - added by crschmidt on 08/31/07 23:47:52.

Barring complaints from Tim, I'm happy with this code going to trunk. Marking for review.

09/07/07 16:11:36 changed by tschaub

  • keywords deleted.

a bit of trouble here - some angle mis-calcs and tests not passing IE - will submit new patch shortly

09/07/07 19:01:04 changed by tschaub

  • attachment regular-poly.patch added.

updated patch

09/10/07 12:39:49 changed by tschaub

  • keywords set to review.

Ok, sorry if deleting all patches was overkill - just got tired of applying the wrong one.

So, the regular-poly.patch adds in a necessary point.clearBounds after each point modification (there is potential for more efficiency here - but I'm leaving it as is for now). Tests changed to catch this (see r4200).

Also, this.angle needed setting in createGeometry (see r4196).

All tests pass in IE and FF. Please review.

09/10/07 15:17:39 changed by crschmidt

  • keywords changed from review to commit.

Looks good. Sorry my tests before didn't cover those couple cases, but I'm ready for this to go in. Thanks for the hard work, Tim.

09/10/07 15:24:30 changed by tschaub

  • keywords deleted.
  • status changed from new to closed.
  • resolution set to fixed.

(In [4205]) Adding a RegularPolygon handler for drawing squares, triangles, circles, etc. Demo in the regular-polygon.html example. Also adding a createRegularPolygon class method to the Polygon geometry class. Thanks to crschmidt for all the tests and help getting this in (closes #828).