Exemplo n.º 1
0
        private async void MouseRightButtonUp(object parameter)
        {
            Point    curPoint = Mouse.GetPosition(tagView as FrameworkElement);
            MapPoint tagPoint = tagView.ScreenToLocation(curPoint);

            _graphicsOverlay = tagView.GraphicsOverlays["drawGraphicsOverlay"];
            var ga = await _graphicsOverlay.HitTestAsync(tagView, curPoint);

            if (ga != null)
            {
                if (ga.Geometry.GeometryType == GeometryType.Point)
                {
                    drawPointGraphic = ga;
                    drawpointX       = (drawPointGraphic.Geometry as MapPoint).X;
                    drawpointY       = (drawPointGraphic.Geometry as MapPoint).Y;
                    drawpointZ       = (drawPointGraphic.Geometry as MapPoint).Z;

                    if (pointwinshowing == false)
                    {
                        pointWin        = new PointToolWin();
                        pointwinshowing = true;
                        pointWin.ShowDialog();
                    }
                }
                if (ga.Geometry.GeometryType == GeometryType.Polyline)
                {
                    drawLineGraphic = ga;
                    linegraphictext = drawLineGraphic.Attributes["Label"] as string;
                    linewidth       = (drawLineGraphic.Symbol as SimpleLineSymbol).Width;
                    Esri.ArcGISRuntime.Geometry.PointCollection tagcol = new Esri.ArcGISRuntime.Geometry.PointCollection();
                    foreach (var part in (drawLineGraphic.Geometry as Polyline).Parts)
                    {
                        for (int i = 0; i < part.Count; i++)
                        {
                            var linepart = part.ElementAt(i);
                            tagcol.Add(linepart.StartPoint);
                            if (i == (part.Count - 1))
                            {
                                tagcol.Add(linepart.EndPoint);
                            }
                            drawLineZ = linepart.StartPoint.Z;
                        }
                    }
                    Linepointcollec = tagcol;

                    if (linewinshowing == false)
                    {
                        LineWin        = new LineToolWin();
                        linewinshowing = true;
                        LineWin.ShowDialog();
                    }
                }
                if (ga.Geometry.GeometryType == GeometryType.Polygon)
                {
                    drawPolygonGraphic = ga;
                    polygongraphictext = drawPolygonGraphic.Attributes["Label"] as string;
                    Esri.ArcGISRuntime.Geometry.PointCollection tagcol = new Esri.ArcGISRuntime.Geometry.PointCollection();
                    foreach (var part in (drawPolygonGraphic.Geometry as Polygon).Parts)
                    {
                        for (int i = 0; i < part.Count; i++)
                        {
                            var Polygonpart = part.ElementAt(i);
                            tagcol.Add(Polygonpart.StartPoint);
                            if (i == (part.Count - 1))
                            {
                                tagcol.Add(Polygonpart.EndPoint);
                            }
                            drawPolygonZ = Polygonpart.StartPoint.Z;
                        }
                    }
                    Polygonpointcollec = tagcol;

                    if (Polygonwinshowing == false)
                    {
                        PolygonWin        = new PolygonToolWin();
                        Polygonwinshowing = true;
                        PolygonWin.ShowDialog();
                    }
                }
            }
        }
Exemplo n.º 2
0
        private  async void MouseRightButtonUp(object parameter)
        {
            Point curPoint = Mouse.GetPosition(tagView as FrameworkElement);
            MapPoint tagPoint = tagView.ScreenToLocation(curPoint);
            _graphicsOverlay = tagView.GraphicsOverlays["drawGraphicsOverlay"];
            var ga = await _graphicsOverlay.HitTestAsync(tagView, curPoint);
            if (ga != null)
            {
                if(ga.Geometry.GeometryType==GeometryType.Point)
                {
                    drawPointGraphic = ga;
                    drawpointX = (drawPointGraphic.Geometry as MapPoint).X;
                    drawpointY = (drawPointGraphic.Geometry as MapPoint).Y;
                    drawpointZ = (drawPointGraphic.Geometry as MapPoint).Z;

                    if(pointwinshowing==false)
                    {
                        pointWin = new PointToolWin();
                        pointwinshowing = true;
                        pointWin.ShowDialog();
                    }
                   
                }
                if (ga.Geometry.GeometryType == GeometryType.Polyline)
                {
                    drawLineGraphic = ga;
                    linegraphictext = drawLineGraphic.Attributes["Label"] as string;
                    linewidth = (drawLineGraphic.Symbol as SimpleLineSymbol).Width;
                    Esri.ArcGISRuntime.Geometry.PointCollection tagcol = new Esri.ArcGISRuntime.Geometry.PointCollection();
                    foreach (var part in (drawLineGraphic.Geometry as Polyline).Parts)
                    {
                        for(int i=0;i<part.Count;i++)
                        {
                            var linepart = part.ElementAt(i);
                            tagcol.Add(linepart.StartPoint);
                            if(i==(part.Count-1)) tagcol.Add(linepart.EndPoint);
                            drawLineZ = linepart.StartPoint.Z;
                        }
                    }
                    Linepointcollec = tagcol;

                    if(linewinshowing==false)
                    {
                        LineWin = new LineToolWin();
                        linewinshowing = true;
                        LineWin.ShowDialog();

                    }
                    
                }
                if (ga.Geometry.GeometryType == GeometryType.Polygon)
                {
                    drawPolygonGraphic = ga;
                    polygongraphictext = drawPolygonGraphic.Attributes["Label"] as string;
                    Esri.ArcGISRuntime.Geometry.PointCollection tagcol = new Esri.ArcGISRuntime.Geometry.PointCollection();
                    foreach (var part in (drawPolygonGraphic.Geometry as Polygon).Parts)
                    {
                        for (int i = 0; i < part.Count; i++)
                        {
                            var Polygonpart = part.ElementAt(i);
                            tagcol.Add(Polygonpart.StartPoint);
                            if (i == (part.Count - 1)) tagcol.Add(Polygonpart.EndPoint);
                            drawPolygonZ = Polygonpart.StartPoint.Z;
                        }
                    }
                    Polygonpointcollec = tagcol;

                    if(Polygonwinshowing==false)
                    {
                        PolygonWin = new PolygonToolWin();
                        Polygonwinshowing = true;
                        PolygonWin.ShowDialog();
                    }                   
                }
            }
        }
Exemplo n.º 3
0
        //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;
                }
            }
        }
Exemplo n.º 4
0
        //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;
                }
            }

        }