public void MultiCurveString() { MgGeometryFactory gf = new MgGeometryFactory(); MgCoordinate pt1 = gf.CreateCoordinateXY(0, 0); MgCoordinate pt2 = gf.CreateCoordinateXY(0, 10); MgCoordinate pt3 = gf.CreateCoordinateXY(10, 10); MgCoordinate pt4 = gf.CreateCoordinateXY(10, 0); MgCoordinateCollection coordinates = new MgCoordinateCollection(); coordinates.Add(pt1); coordinates.Add(pt2); coordinates.Add(pt3); coordinates.Add(pt4); MgLinearSegment linearSegment = gf.CreateLinearSegment(coordinates); MgCurveSegmentCollection curveSegments = new MgCurveSegmentCollection(); curveSegments.Add(linearSegment); MgCurveString curveString = gf.CreateCurveString(curveSegments); MgCurveStringCollection csc = new MgCurveStringCollection(); csc.Add(curveString); MgMultiCurveString mcs = gf.CreateMultiCurveString(csc); Assert.AreEqual(1, mcs.Count); Assert.AreEqual(MgGeometryType.MultiCurveString, mcs.GeometryType); Assert.AreEqual(1, mcs.Dimension); }
public void CurveStringCollection() { MgCurveString geom1 = build.CreateCurveString(2.0); MgCurveString geom2 = build.CreateCurveString(12.0); MgCurveString geom3 = build.CreateCurveString(2.0); MgCurveStringCollection coll = new MgCurveStringCollection(); coll.Add(geom1); coll.Add(geom2); coll.Add(geom3); Assert.AreEqual(3, coll.Count); Assert.IsTrue(geom1.Equals(coll[0])); Assert.IsTrue(coll[0].Equals(coll[2])); Assert.IsFalse(coll[0].Equals(coll[1])); coll[0] = coll[1]; Assert.IsTrue(coll[0].Equals(coll[1])); double width = 0.0; foreach (MgCurveString geom in coll) { width += geom.Envelope().GetWidth(); } Assert.AreEqual(geom1.Envelope().GetWidth() * 3.0, width); }
MgMultiCurveString CreateMultiCurveString() { MgCurveString curveString1 = CreateCurveString(100); MgCurveString curveString2 = CreateCurveString(200); MgCurveString curveString3 = CreateCurveString(300); MgCurveStringCollection curveStrings = new MgCurveStringCollection(); curveStrings.Add(curveString1); curveStrings.Add(curveString2); curveStrings.Add(curveString3); return factory.CreateMultiCurveString(curveStrings); }