Exemplo n.º 1
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            var          build = new GeomBuild();
            MgLineString geom1 = build.CreateLineString(5.0);
            MgLineString geom2 = build.CreateLineString(11.0);
            MgLineString geom3 = build.CreateLineString(5.0);

            MgLineStringCollection coll = new MgLineStringCollection();

            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 (MgLineString geom in coll)
            {
                width += geom.Envelope().GetWidth();
            }
            Assert.AreEqual(geom1.Envelope().GetWidth() * 3.0, width);
        }
Exemplo n.º 2
0
        public MgMultiLineString CreateMultiLineString()
        {
            MgCoordinate coord1 = factory.CreateCoordinateXYZ(0.0, 1.0, 2.0);
            MgCoordinate coord2 = factory.CreateCoordinateXYZ(3.0, 4.0, 5.0);
            MgCoordinate coord3 = factory.CreateCoordinateXYZ(6.0, 7.0, 8.0);

            MgCoordinateCollection coordColA = new MgCoordinateCollection();

            coordColA.Add(coord1);
            coordColA.Add(coord2);
            coordColA.Add(coord3);

            MgCoordinate coord4 = factory.CreateCoordinateXYZ(9.0, 10.0, 11.0);
            MgCoordinate coord5 = factory.CreateCoordinateXYZ(12.0, 13.0, 14.0);
            MgCoordinate coord6 = factory.CreateCoordinateXYZ(15.0, 16.0, 17.0);

            MgCoordinateCollection coordColB = new MgCoordinateCollection();

            coordColB.Add(coord4);
            coordColB.Add(coord5);
            coordColB.Add(coord6);

            MgLineString lineString1 = factory.CreateLineString(coordColA);
            MgLineString lineString2 = factory.CreateLineString(coordColB);

            MgLineStringCollection lineStrings = new MgLineStringCollection();

            lineStrings.Add(lineString1);
            lineStrings.Add(lineString2);

            return(factory.CreateMultiLineString(lineStrings));
        }
Exemplo n.º 3
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            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);
            MgLineString linestring = gf.CreateLineString(coordinates);

            Assert.AreEqual(pt1.ToString(), linestring.StartCoordinate.ToString());
            Assert.AreEqual(pt4.ToString(), linestring.EndCoordinate.ToString());
            Assert.AreEqual(MgGeometryType.LineString, linestring.GeometryType);
            Assert.AreEqual(1, linestring.Dimension);
        }
Exemplo n.º 4
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            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);
            MgLineString           ls = gf.CreateLineString(coordinates);
            MgLineStringCollection lineStringCollection = new MgLineStringCollection();

            lineStringCollection.Add(ls);
            MgMultiLineString mls = gf.CreateMultiLineString(lineStringCollection);

            Assert.AreEqual(1, mls.Count);
            Assert.AreEqual(MgGeometryType.MultiLineString, mls.GeometryType);
            Assert.AreEqual(1, mls.Dimension);
        }