1

我通过以下方式从多边形中检索了点列表;

    public Graphic Graphic { get; set; }
    public List<MapPoint> MapPoint { get; set; }
    MapPoint = new List<MapPoint>();
    ESRI.ArcGIS.Client.Geometry.PointCollection points = null;
    if (Graphic.Geometry is Polygon)
    {
        points = ((Polygon)Graphic.Geometry).Rings[0];
        foreach (MapPoint mapPoint in points)
        {
            //Save the points  
            MapPoint.Add(mapPoint);
        }
    }

现在我的用例需要在对 List() 的属性进行序列化/反序列化之后将此几何图形附加回图形。由于环是多边形的一部分,并且多边形有一个接受地图点列表的构造函数,我猜下面的代码可以工作,但它不能编译。

多边形类https ://developers.arcgis.com/net/10-2/desktop/api-reference/html/M_Esri_ArcGISRuntime_Geometry_Polygon__ctor_4.htm

如何将戒指重新放入 Graphic 属性?

            List<MapPoint> mapPoint = null;
            Polygon myPolygon = null;
            foreach(Atribution at in sc. Atribution)
            {
                foreach(AtributionContour atContour in at.Contours)
                {
                    myPolygon = new Polygon(new List<MapPoint>( AtributionContour.MapPoint.ToList()));

                    //Append polygon to a Geometry


                    //Append geometry to graphic
                }

            }

错误

错误 CS1729 'Polygon' 不包含采用 1 个参数的构造函数

4

1 回答 1

1

使用接受点集合的构造函数。每个环的一个点集合: https ://developers.arcgis.com/net/10-2/desktop/api-reference/html/M_Esri_ArcGISRuntime_Geometry_Polygon__ctor_5.htm

于 2017-10-17T20:54:16.890 回答