[OpenLayers-Users] Rotate the line geometry with arrow - usingrotation style?

Arnd Wippermann arnd.wippermann at web.de
Wed Oct 17 14:26:58 PDT 2012


Instead of a pointfeature extended to a line with an arrow 
you can perhaps use a simple multifeature

Example:
http://gis.ibbeck.de/ginfo/apps/OLExamples/OL212/Direction_Vectors/rotation_
of_simple_direction_vectors.asp

This way the ModifyFeatureControl can be used to manipulate the feature.

The other way with a pointfeature extended to a line with an arrow may not
be possible.

Arnd

-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von mikeluz
Gesendet: Mittwoch, 17. Oktober 2012 16:24
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] Rotate the line geometry with arrow -
usingrotation style?

Hi

It has been a while since I post some problem in OL forum. Unfortunately for
me I got another one...

The main goal is to have vector layer with collection of:
- line geometry (only two points),
- point geometry - that is in fact an arrowhead I was checking this example:


http://gis.ibbeck.de/ginfo/apps/OLExamples/OL212/Direction_Vectors/direction
_arrow_for_point_features.asp

Arrows in there are done pretty nice. If the goal was just to show the
arrows it is not a problem . My goal it to allow the user to drag and rotate
this arrow (line with the arrowhead). There isn't any problem with
dragging... the problem is with rotation. I am using ModifyControl class in
two mode at the same time: DRAG and ROTATE. Problem is when I rotate the
line rotates - that is good, but arrowhead stays all the time this same. In
fact that is point that has some graphicName in styles. How to make it work?
So e.g. if you want a user to say in what direction the wind blows :) User
can use this arrow and set it...

You can use the example that I put the link above (download it, adjust the
proper path to OL library). Just add this code at the end of init method:

/        var controls = {
            modify: new OpenLayers.Control.ModifyFeature(targetLyr,
{clickout: false})
        };
            map.addControl(controls["modify"]);

        controls.modify.mode = OpenLayers.Control.ModifyFeature.ROTATE |
OpenLayers.Control.ModifyFeature.DRAG;
        controls["modify"].activate();/

There is something mentioned about rotation in styles definition.... but I
do not understand it that much... maybe someone has a bigger knowledge how
to make graphic rotate ??

I would really appreciated any help... Maybe someone has a better way to add
arrows ii line geometry??

Regards,
Pawel



--
View this message in context:
http://osgeo-org.1560.n6.nabble.com/Rotate-the-line-geometry-with-arrow-usin
g-rotation-style-tp5009318.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list