public void CanInsertVertexIntoPolyline() { IPolyline polyline = GeometryFactory.CreatePolyline(1000, 2000, 1500, 2500); ISpatialReference lv95 = CreateSpatialReference(0.0125, 0.0125); polyline.SpatialReference = lv95; IPoint newPoint = GeometryFactory.CreatePoint(1250, 2250, lv95); SegmentReplacementUtils.InsertVertex(newPoint, 0, 0, (ISegmentCollection)polyline); Assert.AreEqual(2, ((ISegmentCollection)polyline).SegmentCount); newPoint = GeometryFactory.CreatePoint(1400, 2400, lv95); SegmentReplacementUtils.InsertVertex(newPoint, 1, 0, (ISegmentCollection)polyline); Assert.AreEqual(3, ((ISegmentCollection)polyline).SegmentCount); }
public void CanInsertVertexIntoPolygon() { ISpatialReference lv95 = CreateSpatialReference(0.0125, 0.0125); IPolygon polygon = GeometryFactory.CreatePolygon(1000, 2000, 1500, 2500, lv95); GeometryUtils.Simplify(polygon, false); Assert.AreEqual(4, ((ISegmentCollection)polygon).SegmentCount); IPoint newPoint = GeometryFactory.CreatePoint(1250, 2000, lv95); SegmentReplacementUtils.InsertVertex(newPoint, 3, 0, (ISegmentCollection)polygon); Assert.AreEqual(5, ((ISegmentCollection)polygon).SegmentCount); newPoint = GeometryFactory.CreatePoint(1000, 2250, lv95); SegmentReplacementUtils.InsertVertex(newPoint, 0, 0, (ISegmentCollection)polygon); Assert.AreEqual(6, ((ISegmentCollection)polygon).SegmentCount); }