2017-10-17 56 views
1

我从以下方式检索了一个多边形中的点列表;我如何创建一个图形几何形式的MapPoints列表

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

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

如何,我可以得到环回图形属性?

  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“多边形”不包含一个构造函数1个参数

回答