2017-10-17 58 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個參數

回答