[OpenLayers-Users] I want curved and arrowheaded lines as vectors
on OSM layer
Michael
mdm at yachtpc.com
Fri Aug 26 01:27:15 EDT 2011
I have drawn line ends by creating a vector feature and placing on top
of the end of the line. Any shape you want. It's a little more
time-consuming, but you can rotate the arrowhead after calculating the
slope of the last segment of the line.
Here is a snippet of code used to add a graphic to the end of the line,
in this case a predefined circle
var myGraf;
myGraf = new OpenLayers.Feature.Vector(new
OpenLayers.Geometry.Point (coursePath.geometry.getVertices
(true)[1].x,coursePath.geometry.getVertices(true)[1].y),{
graphicName: "circle"
});
posLayer.addFeatures([myGraf]);
I use getVertices to find the endpoint of the line. If you have better
access to that datum, it would save a few cycles.
Michael
More information about the Users
mailing list