I have 2 points on canvas. Lets say point-A [x=4.1549997, y=4.005] and Point-B [x=2.77, y=3.5749998]
Now, I want to draw an arc arrow from Point-A > Point-B AND Point-B > Point-A using OpenLayers 3 Library.
So far, I have been able to successfully create Straight Arrows using LineString. But, I could not find any inbuilt functionality given by OpenLayer to draw ARC between 2 points.
var me = this;
var line = new ol.geom.LineString(coordinate);
var fl = new ol.Feature({
name: "line",
geometry: line
});
fl.setProperties({
'coordinate': coordinate
});
fl.setStyle( function(feature, resolution) {
return me.getStyles(fl);
});
return fl;
getStyles: function (fObj) {
var geometry = fObj.getGeometry();
var styles = [new ol.style.Style({
stroke: new ol.style.Stroke({
width: 5,
color: 'rgb(21,150,18)',
lineDash: [.2,5]
})
})];
geometry.forEachSegment(function(start, end) {
var dx = end[0] - start[0];
var dy = end[1] - start[1];
var rotation = Math.atan2(dy, dx);
styles.push(new ol.style.Style({
geometry: new ol.geom.Point(end),
image: new ol.style.Icon({
src: '../images/arrow_test.png',
anchor: [0.75, 0.5],
rotateWithView: true,
rotation: -rotation
})
}));
})
return styles;
},
Can anyone please help me here regarding this ?
Note - Also, there is one more thing which I am concerned also. When multiple ARCs are drawn between Point-A and Point-B, then they should not overlap on each other.