public void OnPolygonWinOK(object parameter)
        {
            readytodrawPolygon = false;
            _graphicsOverlay   = tagView.GraphicsOverlays["drawGraphicsOverlay"];
            var tempgraphic = drawPolygonGraphic;

            _graphicsOverlay.Graphics.Remove(drawPolygonGraphic);

            SphereMarkerSymbol tagsymbol = App.Current.Resources["drawtoolPolygon"] as SphereMarkerSymbol;

            PolygonColor = parameter as SolidColorBrush;
            var Polygonsym = new SimpleFillSymbol();

            Polygonsym.Color = PolygonColor.Color;

            var sPointcollect = new Esri.ArcGISRuntime.Geometry.PointCollection();

            foreach (MapPoint tPoint in Polygonpointcollec)
            {
                MapPoint sPoint = new MapPoint(tPoint.X, tPoint.Y, drawPolygonZ);
                sPointcollect.Add(sPoint);
            }

            drawPolygonGraphic = new Graphic(new Polygon(sPointcollect), Polygonsym);
            drawPolygonGraphic.Attributes["Label"] = Polygongraphictext;
            _graphicsOverlay.Graphics.Add(drawPolygonGraphic);

            drawPolygonZ = 0;
            Polygonpointcollec.Clear();
            Polygonwinshowing = false;
            PolygonWin.Close();

            return;
        }
Beispiel #2
0
 private void DrawPolylineMenuItem_Click(object sender, RoutedEventArgs e)
 {
     operation = OperateType.DrawPolyline;
     if (pointCollection != null)
     {
         pointCollection.Clear();
     }
     else
     {
         pointCollection = new Esri.ArcGISRuntime.Geometry.PointCollection(myMapView.Map.SpatialReference);
     }
 }
        private void DrawLine(object parameter)
        {
            readytodrawPoint   = false;
            readytodrawLine    = !readytodrawLine;
            readytodrawPolygon = false;
            Linepointcollec.Clear();

            if (pointWin != null)
            {
                if (pointWin.IsVisible)
                {
                    pointwinshowing = false;
                    pointWin.Close();
                }
            }
            if (PolygonWin != null)
            {
                if (PolygonWin.IsVisible)
                {
                    PolygonWin.Close();
                    Polygonwinshowing = false;
                }
            }
        }
Beispiel #4
0
        public static void Reverse(Esri.ArcGISRuntime.Geometry.PointCollection pts)
        {
            IEnumerable <MapPoint> reversedPts = pts.Reverse();

            Esri.ArcGISRuntime.Geometry.PointCollection newPts =
                new Esri.ArcGISRuntime.Geometry.PointCollection();
            foreach (MapPoint pt in reversedPts)
            {
                newPts.Add(pt);
            }

            pts.Clear();
            foreach (MapPoint pt in newPts)
            {
                pts.Add(pt);
            }
        }
Beispiel #5
0
        private void init()
        {
            operation          = OperateType.None;
            pointSymbol        = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Color.FromArgb(0, 0, 0), 8.0);
            lineSymbol         = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.Black, 2.0);
            fillSymbol         = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, Color.FromArgb(125, 255, 0, 0), new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.FromArgb(0, 0, 0), 2.0));
            vertexSymbol       = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Square, Color.FromArgb(0, 0, 255), 8.0);
            curSelGraphic      = null;
            orgPoint           = null;
            selGracphicIndex   = -1;
            selPointIndex      = -1;
            listOfClipGraphics = new List <Graphic>();

            // 画点
            drawPoint.Checked += (sender, e) =>
            {
                operation = OperateType.DrawPoint;
            };

            // 画线
            drawLine.Checked += (sender, e) =>
            {
                operation = OperateType.DrawPolyline;
                if (pointCollection != null)
                {
                    pointCollection.Clear();
                }
                else
                {
                    pointCollection = new Esri.ArcGISRuntime.Geometry.PointCollection(myMapView.Map.SpatialReference);
                }
            };

            // 画面
            drawPoly.Checked += (sender, e) =>
            {
                operation = OperateType.DrawPolygon;
                if (pointCollection != null)
                {
                    pointCollection.Clear();
                }
                else
                {
                    pointCollection = new Esri.ArcGISRuntime.Geometry.PointCollection(myMapView.Map.SpatialReference);
                }
            };
        }
Beispiel #6
0
        public void check()
        {
            XDocument doc = XDocument.Load(@"D:\EwLinear\Input\AVCS_Cateloge_wk45_new_modif.xml");
            int       ScalarVariableCount = doc.Root.Descendants("Products")
                                            .Elements("ENC").Count();

            Console.WriteLine("count{0}", ScalarVariableCount);
            var polygonPoints1 = new Esri.ArcGISRuntime.Geometry.PointCollection(SpatialReferences.Wgs84);

            // var polygonPoints_list = new List<string, string>();
            var labelPointBass = new Esri.ArcGISRuntime.Geometry.PointCollection(SpatialReferences.Wgs84);
            // IDictionary<string, Esri.ArcGISRuntime.Geometry.PointCollection(SpatialReferences.Wgs84) > dict = new Dictionary<string, string>();
            var query = from Polygon in doc.Root.Descendants("ENC")
                        group Polygon by Polygon.Element("ShortName").Value into gr
                        select gr;

            var shortname = doc.Root.Descendants("shortname");
            var srt       = shortname.ToString();
            var reasons   = doc.Descendants("Polygon").ToList();


            //for (int i = 0; i < elemList.Count; i++)
            //{
            //    Console.WriteLine(elemList[i].InnerXml);
            //}
            // var textname = new List<string>();
            var latitude     = new List <string>();
            var longitude    = new List <string>();
            var scale        = new List <string>();
            var usage        = new List <string>();
            var DatasetTitle = new List <string>();

            Func <XElement, string, string, string> getAttributeValue = (xElement, name, text) => xElement.Element(name).Value;


            // Task<IEnumerable<IGrouping<string, XElement>>> query;
            // query = ConfigurationManager.AppSettings.Get();

            // query = objMgr.GetAVCS();
            foreach (var value in query)
            {
                List <XElement> str = new List <XElement>();
                // textname.Add(value.Key);
                //  textname.Add(value.Key);
                var q2 = value.Descendants("Polygon").SelectMany(array => array.Value.ToList());

                value.Descendants("Polygon").ToList().ForEach(item =>
                {
                    str.Add(item);
                });
                if (str.Count > 1)
                {
                    foreach (var set1 in str)
                    {
                        set1.Descendants("Position").ToList().ForEach(item =>
                        {
                            latitude.Add(item.Attribute("latitude").Value);
                            longitude.Add(item.Attribute("longitude").Value);
                            polygonPoints1.Add(new MapPoint(Convert.ToDouble(item.Attribute("longitude").Value), Convert.ToDouble(item.Attribute("latitude").Value)));
                        });

                        var q5 = value.Descendants("Metadata").Select(s => new
                        {
                            ONE   = s.Element("Scale").Value,
                            TWO   = s.Element("Usage").Value,
                            THREE = s.Element("DatasetTitle").Value
                        }).ToList();
                        string four = q5[0].THREE;
                        string two  = q5[0].TWO;
                        usage.Add(four);
                        CreateGraphic_Label(polygonPoints1, value.Key, two);
                        polygonPoints1.Clear();
                    }
                }
                else
                {
                    value.Descendants("Position").ToList().ForEach(item =>
                    {
                        latitude.Add(item.Attribute("latitude").Value);
                        longitude.Add(item.Attribute("longitude").Value);
                        polygonPoints1.Add(new MapPoint(Convert.ToDouble(item.Attribute("longitude").Value), Convert.ToDouble(item.Attribute("latitude").Value)));
                    });
                    var q1 = value.Descendants("Metadata").Select(s => new
                    {
                        ONE   = s.Element("Scale").Value,
                        TWO   = s.Element("Usage").Value,
                        THREE = s.Element("DatasetTitle").Value
                    }).ToList();
                    string three = q1[0].THREE;
                    string two   = q1[0].TWO;
                    string one   = q1[0].ONE;
                    usage.Add(three);
                    CreateGraphic_Label(polygonPoints1, value.Key, two);
                }



                polygonPoints1.Clear();
                //}
            }
        }