List<Coordinate2D> polygon1Coords = new List<Coordinate2D>()
{
new Coordinate2D(0, -11000),
new Coordinate2D(1000, -11000),
new Coordinate2D(1000, -12000),
new Coordinate2D(0, -12000),
new Coordinate2D(0, -11000)
};
// reshaper coordinates intersect the polygon
List<Coordinate2D> reshaperCoords = new List<Coordinate2D>()
{
new Coordinate2D(1500, -11800),
new Coordinate2D(-2600, -11800)
};
SpatialReference sr = SpatialReferenceBuilder.CreateSpatialReference(102010);
Polygon polygon1 = PolygonBuilderEx.CreatePolygon(polygon1Coords, sr);
Polyline reshaper = PolylineBuilderEx.CreatePolyline(reshaperCoords, sr);
Polygon outPolygon = GeometryEngine.Instance.Reshape(polygon1, reshaper) as Polygon;
// outPolygon.PartCount = 1
ReadOnlySegmentCollection segments = outPolygon.Parts[0];
// segments.Count = 4
// outPolygon.PointCount = 5
string json = GeometryEngine.Instance.ExportToJson(JsonExportFlags.JsonExportSkipCRS, outPolygon);
// json = "{\"rings\":[[[0,-11800],[0,-11000],[1000,-11000],[1000,-11800],[0,-11800]]]}";
// example where the Reshaper polyline doesn't intersect the input
reshaperCoords.Clear();
reshaperCoords.Add(new Coordinate2D(1000, 1000));
reshaperCoords.Add(new Coordinate2D(2000, 1000));
reshaper = PolylineBuilderEx.CreatePolyline(reshaperCoords, sr);
outPolygon = GeometryEngine.Instance.Reshape(polygon1, reshaper) as Polygon;
// outPolygon = null