//private async void MouseMove(object parameter) //{ // Point curPoint = Mouse.GetPosition(tagView as FrameworkElement); // _graphicsOverlay = tagView.GraphicsOverlays["drawGraphicsOverlay"]; // if (b_onpointmoving && b_onpoint) // { // var tempgraphic = drawPointGraphic; // _graphicsOverlay.Graphics.Remove(drawPointGraphic); // MapPoint point = tagView.ScreenToLocation(curPoint); // drawPointGraphic = new Graphic(new MapPoint(point.X, point.Y, (tempgraphic.Geometry as MapPoint).Z), tempgraphic.Attributes, tempgraphic.Symbol); // _graphicsOverlay.Graphics.Add(drawPointGraphic); // return; // } // var ga = await _graphicsOverlay.HitTestAsync(tagView, curPoint); // if (ga != null) // { // b_onpoint = true; // Mouse.SetCursor(Cursors.Hand); // } // else // { // b_onpoint = false; // Mouse.SetCursor(Cursors.Arrow); // } //} private void MouseLeftButtonDown(object parameter) { if (readytodrawPoint) { Point curPoint = Mouse.GetPosition(tagView as FrameworkElement); MapPoint tagPoint = tagView.ScreenToLocation(curPoint); drawpointX = tagPoint.X; drawpointY = tagPoint.Y; drawPointGraphic = new Graphic(tagPoint, App.Current.Resources["drawtoolpoint"] as Symbol); Pointgraphictext = "InputLabel"; drawPointGraphic.Attributes["Label"] = pointgraphictext; pointColor = new SolidColorBrush((drawPointGraphic.Symbol as SphereMarkerSymbol).Color); _graphicsOverlay = tagView.GraphicsOverlays["drawGraphicsOverlay"]; _graphicsOverlay.Graphics.Add(drawPointGraphic); if (!pointwinshowing) { pointWin = new PointToolWin(); //pointWin.Owner = tagView.Parent as Window; pointwinshowing = true; pointWin.Show(); readytodrawPoint = false; } } else if (readytodrawLine) { Point curPoint = Mouse.GetPosition(tagView as FrameworkElement); MapPoint tagPoint = tagView.ScreenToLocation(curPoint); _graphicsOverlay = tagView.GraphicsOverlays["drawGraphicsOverlay"]; if (linewinshowing) { _graphicsOverlay.Graphics.Remove(drawLineGraphic); } linegraphictext = "Inputlabel"; Linepointcollec.Add(new MapPoint(tagPoint.X, tagPoint.Y, drawLineZ)); var linesym = new SimpleLineSymbol(); lineColor = new SolidColorBrush((App.Current.Resources["drawtoolpoint"] as SphereMarkerSymbol).Color); linesym.Color = LineColor.Color; linesym.Width = linewidth; drawLineGraphic = new Graphic(new Polyline(Linepointcollec), linesym); _graphicsOverlay.Graphics.Add(drawLineGraphic); if (!linewinshowing) { LineWin = new LineToolWin(); LineWin.Show(); linewinshowing = true; } } else if (readytodrawPolygon) { Point curPoint = Mouse.GetPosition(tagView as FrameworkElement); MapPoint tagPoint = tagView.ScreenToLocation(curPoint); _graphicsOverlay = tagView.GraphicsOverlays["drawGraphicsOverlay"]; if (Polygonwinshowing) { _graphicsOverlay.Graphics.Remove(drawPolygonGraphic); } polygongraphictext = "Inputlabel"; Polygonpointcollec.Add(new MapPoint(tagPoint.X, tagPoint.Y, drawPolygonZ)); var Polygonsym = new SimpleFillSymbol(); PolygonColor = new SolidColorBrush((App.Current.Resources["drawtoolpoint"] as SphereMarkerSymbol).Color); Polygonsym.Color = PolygonColor.Color; drawPolygonGraphic = new Graphic(new Polygon(Polygonpointcollec), Polygonsym); _graphicsOverlay.Graphics.Add(drawPolygonGraphic); if (!Polygonwinshowing) { PolygonWin = new PolygonToolWin(); PolygonWin.Show(); Polygonwinshowing = true; } } }
//private async void MouseMove(object parameter) //{ // Point curPoint = Mouse.GetPosition(tagView as FrameworkElement); // _graphicsOverlay = tagView.GraphicsOverlays["drawGraphicsOverlay"]; // if (b_onpointmoving && b_onpoint) // { // var tempgraphic = drawPointGraphic; // _graphicsOverlay.Graphics.Remove(drawPointGraphic); // MapPoint point = tagView.ScreenToLocation(curPoint); // drawPointGraphic = new Graphic(new MapPoint(point.X, point.Y, (tempgraphic.Geometry as MapPoint).Z), tempgraphic.Attributes, tempgraphic.Symbol); // _graphicsOverlay.Graphics.Add(drawPointGraphic); // return; // } // var ga = await _graphicsOverlay.HitTestAsync(tagView, curPoint); // if (ga != null) // { // b_onpoint = true; // Mouse.SetCursor(Cursors.Hand); // } // else // { // b_onpoint = false; // Mouse.SetCursor(Cursors.Arrow); // } //} private void MouseLeftButtonDown(object parameter) { if(readytodrawPoint) { Point curPoint = Mouse.GetPosition(tagView as FrameworkElement); MapPoint tagPoint = tagView.ScreenToLocation(curPoint); drawpointX = tagPoint.X;drawpointY = tagPoint.Y; drawPointGraphic = new Graphic(tagPoint, App.Current.Resources["drawtoolpoint"] as Symbol); Pointgraphictext = "InputLabel"; drawPointGraphic.Attributes["Label"] = pointgraphictext; pointColor = new SolidColorBrush((drawPointGraphic.Symbol as SphereMarkerSymbol).Color); _graphicsOverlay = tagView.GraphicsOverlays["drawGraphicsOverlay"]; _graphicsOverlay.Graphics.Add(drawPointGraphic); if(!pointwinshowing) { pointWin = new PointToolWin(); //pointWin.Owner = tagView.Parent as Window; pointwinshowing = true; pointWin.Show(); readytodrawPoint = false; } } else if(readytodrawLine) { Point curPoint = Mouse.GetPosition(tagView as FrameworkElement); MapPoint tagPoint = tagView.ScreenToLocation(curPoint); _graphicsOverlay = tagView.GraphicsOverlays["drawGraphicsOverlay"]; if(linewinshowing) { _graphicsOverlay.Graphics.Remove(drawLineGraphic); } linegraphictext = "Inputlabel"; Linepointcollec.Add(new MapPoint(tagPoint.X,tagPoint.Y,drawLineZ)); var linesym = new SimpleLineSymbol(); lineColor = new SolidColorBrush((App.Current.Resources["drawtoolpoint"] as SphereMarkerSymbol).Color); linesym.Color = LineColor.Color; linesym.Width = linewidth; drawLineGraphic = new Graphic(new Polyline(Linepointcollec), linesym); _graphicsOverlay.Graphics.Add(drawLineGraphic); if (!linewinshowing) { LineWin = new LineToolWin(); LineWin.Show(); linewinshowing = true; } } else if (readytodrawPolygon) { Point curPoint = Mouse.GetPosition(tagView as FrameworkElement); MapPoint tagPoint = tagView.ScreenToLocation(curPoint); _graphicsOverlay = tagView.GraphicsOverlays["drawGraphicsOverlay"]; if (Polygonwinshowing) { _graphicsOverlay.Graphics.Remove(drawPolygonGraphic); } polygongraphictext = "Inputlabel"; Polygonpointcollec.Add(new MapPoint(tagPoint.X, tagPoint.Y, drawPolygonZ)); var Polygonsym = new SimpleFillSymbol(); PolygonColor = new SolidColorBrush((App.Current.Resources["drawtoolpoint"] as SphereMarkerSymbol).Color); Polygonsym.Color = PolygonColor.Color; drawPolygonGraphic = new Graphic(new Polygon(Polygonpointcollec), Polygonsym); _graphicsOverlay.Graphics.Add(drawPolygonGraphic); if (!Polygonwinshowing) { PolygonWin = new PolygonToolWin(); PolygonWin.Show(); Polygonwinshowing = true; } } }