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

Arnd Wippermann arnd.wippermann at web.de
Fri Oct 19 09:17:25 PDT 2012


I'm pleased, that the example helped to solve your problem.


Instead of an MultiLineString you could also use a single LineString to draw
the arrow.
LINESTRING(0 0,0 8,-0.5 8,0 10,0.5 8,0 8)

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

BTW. You couldn't blame OpenLayers for not finding this example. I have just
created it as return to your post.

Arnd
http://gis.ibbeck.de/


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

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-usin
g-rotation-style-tp5009318p5009833.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