做arcgis silverlight画线的时候,需要画线并且添加箭头。在网上查找了资料,可以添加自定义控件,画线并且标注上箭头。
但是做gis开发,需要将箭头添加在相应的图层上,同事大神查找了silverlight的api,找到了底层添加箭头的方法,代码如下:
//添加箭头角度
double angleOfLine1 = Math.Atan2((ePoint.X - bPoint.X), (ePoint.Y - bPoint.Y)) * 180 / Math.PI;
graphic = new Graphic();
SimpleMarkerSymbol simple = new SimpleMarkerSymbol();
simple.Style = SimpleMarkerSymbol.SimpleMarkerStyle.Triangle;
simple.Color = new SolidColorBrush(c);
simple.Size = 10;
simple.Angle = angleOfLine1;
graphic.Symbol = simple;
MapPoint mapPoint = ePoint;
graphic.Geometry = mapPoint;
graphicsLayer.Graphics.Add(graphic);
这样在画完线的时候,将起点或终点设置为 箭头的中心点,就可以显示出箭头了。