如何创建MapPoints的图形几何返回表单列表

时间:2017-10-17 14:50:04

标签: .net arcgis esri arcgis-runtime-net

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

    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()的属性进行序列化/反序列化后将此Geometry附加回Graphic。由于环是Polygon的一部分而Polygon有一个接受Map Map列表的构造函数,我猜想下面的代码可以工作,但它不能编译。

多边形课程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个参数的构造函数

1 个答案:

答案 0 :(得分:1)

使用带有一组点集合的构造函数。每个戒指的一个积分集合: https://developers.arcgis.com/net/10-2/desktop/api-reference/html/M_Esri_ArcGISRuntime_Geometry_Polygon__ctor_5.htm