[OpenLayers-Dev] ModifyFeature for Geometry.Rectangle and others

Eric Lemoine eric.c2c at gmail.com
Thu Nov 15 17:55:48 EST 2007

On Nov 15, 2007 5:51 PM, Tim Schaub <tschaub at openplans.org> wrote:
> Hey-
> I'm a bit behind here, but I'll throw in my opinion.
> I don't want to support Geometry.Rectangle.  I think it was an accident
> to let it in the trunk, and I hope it goes away.
> I'm very much in favor of adding properties to a polygon like "regular"
> (boolean) and "sides" (integer).
> This way, controls could (optionally) respect these properties of a
> polygon - allowing for editing that would maintain the geometry "class."
> A rectangle is a four sided irregular polygon.  A circle is a many
> (maybe 30, who knows) sided regular polygon.  Turning a circle into an
> ellipse is as easy as modifying while respecting the number of sides and
> ignoring the "regular" property.  As mentioned before, no need to create
> new classes when we can modify behavior with a few properties on an
> existing class.

Thanks for your response Tim.

I think we agree on the way to proceed. I really like the addition of
"regular" and "sides" to cover every case.

I've started working on an implementation of all this, starting from
your irregular regular polygons work
(<http://trac.openlayers.org/ticket/1098>) and pvalsecc's
ModifyFeature patch. The idea is to be able to modify regular polygons
and polygons with fixed number of sides without removing these

My code doesn't work for polygons with fixed number of sides yet.

See <http://dev.openlayers.org/sandbox/elemoine/regular-polygon/examples/modify-feature.html>.

Note that I added an APIProperty to ModifyFeature to make it respect
constrains (if any). So the old behavior can still be achieved.


More information about the Dev mailing list