我通过以下方式从多边形中检索了一个点列表;
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列表的构造函数,我猜想下面的代码可以工作,但它不能编译。
如何将铃声重新置于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个参数的构造函数
答案 0 :(得分:1)