/** * 添加测量标记点 */ private void addMeasurePoint(GraphicsLayer gLayer, IGraphics graphics, List <Point> logPntArr) { if (IsDrawOver) { clearMeasurePnts(null, null, null); } IMSCircle pnt = new IMSCircle(CoordinateType.Logic); pnt.RadiusEx = 4; pnt.CenX = logPntArr[logPntArr.Count - 1].X; pnt.CenY = logPntArr[logPntArr.Count - 1].Y; m_graphicsLayer.AddGraphics(pnt); pnt.Draw(); this.measurePnts.Add(pnt); this.measurePntsTmp.Add(new Point(logPntArr[logPntArr.Count - 1].X, logPntArr[logPntArr.Count - 1].Y)); if (this.m_graphicsLayer.DrawingType == DrawingType.Polyline) { Label currmeasureLabel = new Label(); currmeasureLabel.Content = ""; currmeasureLabel.FontSize = 12; IMSMark currmeasureMark = new IMSMark(currmeasureLabel, CoordinateType.Logic); currmeasureMark.EnableDrag = false; currmeasureMark.EnableAnimation = false; mymarklayer.AddMark(currmeasureMark); measureMarks.Add(currmeasureMark); // (currmeasureMark.MarkControl as Label).Content = getLength(new Point(-1, -1)); ; string tollength = getCurrentLength(-1, -1, new Point(-1, -1)); measureleng += Convert.ToDouble(tollength.Split(':')[1]); currmeasureMark.X = logPntArr[logPntArr.Count - 1].X + 0.0055; currmeasureMark.Y = logPntArr[logPntArr.Count - 1].Y - 0.0055; Label centermeasureLabel = new Label(); centermeasureLabel.Content = ""; centermeasureLabel.FontSize = 12; IMSMark centermeasureMark = new IMSMark(centermeasureLabel, CoordinateType.Logic); centermeasureMark.EnableDrag = false; centermeasureMark.EnableAnimation = false; mymarklayer.AddMark(centermeasureMark); measureCenterMarks.Add(centermeasureMark); (centermeasureMark.MarkControl as Label).RenderTransform = new RotateTransform(); if ((bool)checkBox1.IsChecked) { if (centermeasureMark != null) { // centermeasureMark.Visibility = System.Windows.Visibility.Visible; } } else { if (centermeasureMark != null) { centermeasureMark.Visibility = System.Windows.Visibility.Collapsed; } } } this.m_mapContainer.MouseMove -= new MouseEventHandler(m_graphicsLayer_MouseMove); this.m_mapContainer.MouseMove += new MouseEventHandler(m_graphicsLayer_MouseMove); IsDrawOver = false; }
/// <summary> /// 绘制圆 /// </summary> /// <param name="gLayer"></param> /// <param name="graphics"></param> /// <param name="logPntArr"></param> void circle(GraphicsLayer gLayer, IGraphics graphics, List <Point> logPntArr) { //定义圆对象,添加到绘图层 IMSCircle cir = new IMSCircle(CoordinateType.Logic); this.graphicsLayer.AddGraphics(cir); cir.Draw(logPntArr); }
//将圆形区域添加到地图上 private void AddCircle() { cirObj = new Circle(); cirObj.Center = new Dot_2D(); cirObj.Center.x = 114.3041267836914; cirObj.Center.y = 30.651509197753906; cirObj.Radius = 0.004484101072174819; //在地图上显示圆形区域 Clipcir = new IMSCircle(CoordinateType.Logic); // cir.Stroke = new SolidColorBrush(Colors.Orange); Clipcir.StrokeThickness = 2; //设置圆心 Clipcir.CenX = cirObj.Center.x; Clipcir.CenY = cirObj.Center.y; //设置半径 Clipcir.Radius = cirObj.Radius; //绘制圆形 Clipcir.Draw(); m_gpLayer.AddGraphics(Clipcir); }