[OpenLayers-Users] Rotate the line geometry with arrow - using rotation style?
mikeluz
paweluz at o2.pl
Wed Oct 17 07:23:49 PDT 2012
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-using-rotation-style-tp5009318.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list