I retrieved a list of Points from a Polygon the following way;
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);
}
}
Now my use case requires appending this Geometry back to the Graphic after a serialization/deserialization of the attribute of List(). Since rings are part of a Polygon and Polygon has a constructor that accepts a list of Map Points I would guess the following code works, but it doesn't compile.
Polygon class : https://developers.arcgis.com/net/10-2/desktop/api-reference/html/M_Esri_ArcGISRuntime_Geometry_Polygon__ctor_4.htm
How can I get the rings back into the Graphic attribute?
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
}
}
Error
Error CS1729 'Polygon' does not contain a constructor that takes 1 arguments