/// <summary> /// 回调函数 /// </summary> /// <param name="logPntArr"></param> void freeline(List <Point> logPntArr) { line = new IMSPredefinedLineStyle(); this.graphicsLayer.AddGraphicsAt(line, 1000000); line.Stroke = new SolidColorBrush(Colors.Red); line.Draw(logPntArr); }
void iMSMap1_MapReady(ZDIMS.Event.IMSMapEvent e) { if (!DesignerProperties.IsInDesignTool) { //添加线样式对象 IMSPredefinedLineStyle lines; lines = new IMSPredefinedLineStyle(); this.graphicsLayer.AddGraphics(lines); //添加对象选择监听事件 lines.ChossedMarkerOverCallBack += new IMSPredefinedLineStyle.ChossedMarkerHander(chossedCallBack); //设置坐标 lines.Points.Add(new Point(45.99919517012924, 30.671057152220655)); lines.Points.Add(new Point(20.99919517012924, 10.671057152220655)); lines.LineSymbol = LineType.DashDotDot; lines.Draw(); lines = new IMSPredefinedLineStyle(); lines.StrokeThickness = 5; lines.LineSymbol = LineType.Solid; this.graphicsLayer.AddGraphics(lines); lines.ChossedMarkerOverCallBack += new IMSPredefinedLineStyle.ChossedMarkerHander(chossedCallBack); lines.Points.Add(new Point(4.99919517012924, 29.671057152220655)); lines.Points.Add(new Point(-10.99919517012924, 3.671057152220655)); lines.Points.Add(new Point(-40.99919517012924, 35.671057152220655)); lines.LineSymbol = LineType.DashDotDot; lines.Draw(); } }
/// <summary> /// 添加线 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddLine_Click(object sender, RoutedEventArgs e) { //初始化线样式对象 IMSPredefinedLineStyle lines; lines = new IMSPredefinedLineStyle(); lines.IsShowMenum = true; //允许显示右键菜单 lines.IsCursor = true; //鼠标形状为手形 //监听对象选择事件 lines.ChossedMarkerOverCallBack += new IMSPredefinedLineStyle.ChossedMarkerHander(chossedCallBack); this.graphicesLaye.AddGraphics(lines);//图形添加到绘图层对象 //设置线的坐标 lines.Points.Add(new Point(6.99919517012924, 30.671057152220655)); lines.Points.Add(new Point(20.99919517012924, 10.671057152220655)); lines.LineSymbol = LineType.DashDotDot; //设置线的显示样式为:_ .._ .. lines.Draw(); //绘制对象 }