[OpenLayers-Users] How to modify regular polygon - ModifyFeature vs TransformControl

mikeluz paweluz at o2.pl
Tue Oct 30 11:07:11 PDT 2012


Hi everyone

Well I am having another problem with OL, and I really hope I can get some
knowledge or idea here how to go on. My functionality should work like that:
- user draws regular polygon (4 sides - actually rectangle, option
irregular=true in modifyFeature example page in here:
http://www.openlayers.org/dev/examples/modify-feature.html )
- user can edit rectangle that he draws. Editing should look like that:
 - drag handler in the middle of rectangle
 - rotation handler is in bottom right corner. But not exactly in there, a
bit in right and a bit down (so it does not cover edit node)
 - 8 edit/resize vertex - in each corners, and in the middle of each sides
of the rectangle. 
 - creating additional vertex is not allowed - so actually this is just
resize functionality. But I want it to be allowed from each corner, and each
middle of side of the rectangle.

I want actually combination of transformCOntrol anf ModifyFeature. 
I can not use transformControl becouse:
 - drag is allowed in any place of rectangle (you can just simply drag it)
 - rotation handler is sicked to its place (I want to be always in the
bottom-right of bounds)
 - the worst thing. If the rectangle is already rotated, and I select it to
transfrom, the transform box is like a bounds of the rectangle. so it is
always at the begining a box without any rotation.

I have decided to go on with modifyFeature. I have drag handler, rotate
handler in correct places. Now problem is with this resizing. If I choose
RESIZE option the I can resize rectangle just from one corner. If I choose
RESHAPE I got all my vertex but I am actually editing the sides, vertex....
and I want to resize them, so at the end it is always a regular rectangle (4
* 90 angles).

Thanks in advance for any help!

cheers,
Pawel




--
View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-modify-regular-polygon-ModifyFeature-vs-TransformControl-tp5012350.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list