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

mikeluz paweluz at o2.pl
Fri Oct 19 02:39:16 PDT 2012


Hi there

First of all thank you very much for the interest and for giving me some
idea how to do that. Maybe someone will have this same problem, so I will
write what I came up with. I think that there were 2 possible solutions for
this problem:
1. The one that was mentioned by *Jørgen S. Nicolaysen*
Actually the style definition was ok, and everything was ready to use. The
only problem was that during rotation the "angle" attribute was not changed.
I think it could be done with this code (not 100% working code, just an
idea):
/                var orginalFunction = myContorls.modify.dragControl.onDrag;
		myContorls.modify.dragControl.onComplete = function (feature, pixel){
			orginalFunction.apply(this,arguments);
                        feature.attributes.angle = 180 // (feature is the
arrow!!!!)
                        feature.layer.drawFeature(features)

                }/
I really think that this should work. I have not tested it, I just had the
idea for it... For my problem I choose second approach

2. This was *Arnd Wippermann* idea. I have not seen this example before, and
I was really surprised how nice this idea was. Create line and polygon in
shape of an Arrowhead :) I mean how simple is that :)  I used it and it
works really great. Any code I guess is not needed. Everything is in that
example that Arnd shown me. 

BTW. I find it really annoying that there was a solution online, but I was
not able to find it :( OL should put some links to their example page to
some other example that are available online. That would help a lot... 

Thank you one more time!

Regards,
Pawel






--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Rotate-the-line-geometry-with-arrow-using-rotation-style-tp5009318p5009833.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list