Example #1
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            var     wkt   = new MgWktReaderWriter();
            MgPoint geom1 = wkt.Read("POINT XY (1.0 1.0)") as MgPoint;
            MgPoint geom2 = wkt.Read("POINT XY (2.0 2.0)") as MgPoint;
            MgPoint geom3 = wkt.Read("POINT XY (1.0 1.0)") as MgPoint;

            MgPointCollection coll = new MgPointCollection();

            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 x = 0.0;

            foreach (MgPoint geom in coll)
            {
                x += geom.GetCoordinate().GetX();
            }
            Assert.AreEqual(5.0, x);
        }
Example #2
0
        public MgMultiPoint CreateMultiPoint()
        {
            MgCoordinate coord1 = factory.CreateCoordinateXYZ(1.0, 2.0, 3.0);
            MgPoint      point1 = factory.CreatePoint(coord1);

            MgCoordinate coord2 = factory.CreateCoordinateXYZ(4.0, 5.0, 6.0);
            MgPoint      point2 = factory.CreatePoint(coord2);

            MgCoordinate coord3 = factory.CreateCoordinateXYZ(7.0, 8.0, 9.0);
            MgPoint      point3 = factory.CreatePoint(coord3);

            MgPointCollection pnts = new MgPointCollection();

            pnts.Add(point1);
            pnts.Add(point2);
            pnts.Add(point3);

            return(factory.CreateMultiPoint(pnts));
        }
Example #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);
            MgPoint           mgpt1  = gf.CreatePoint(pt1);
            MgPoint           mgpt2  = gf.CreatePoint(pt2);
            MgPoint           mgpt3  = gf.CreatePoint(pt3);
            MgPoint           mgpt4  = gf.CreatePoint(pt4);
            MgPointCollection points = new MgPointCollection();

            points.Add(mgpt1);
            points.Add(mgpt2);
            points.Add(mgpt3);
            points.Add(mgpt4);
            MgMultiPoint mp = gf.CreateMultiPoint(points);

            Assert.AreEqual(4, mp.Count);
            Assert.AreEqual(MgGeometryType.MultiPoint, mp.GeometryType);
            Assert.AreEqual(0, mp.Dimension);
        }
Example #4
0
        public void PointCollection()
        {
            MgPoint geom1 = wkt.Read("POINT XY (1.0 1.0)") as MgPoint;
            MgPoint geom2 = wkt.Read("POINT XY (2.0 2.0)") as MgPoint;
            MgPoint geom3 = wkt.Read("POINT XY (1.0 1.0)") as MgPoint;

            MgPointCollection coll = new MgPointCollection();
            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 x = 0.0;
            foreach (MgPoint geom in coll)
            {
                x += geom.GetCoordinate().GetX();
            }
            Assert.AreEqual(5.0, x);
        }
Example #5
0
        public void MultiPoint()
        {
            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);
            MgPoint mgpt1 = gf.CreatePoint(pt1);
            MgPoint mgpt2 = gf.CreatePoint(pt2);
            MgPoint mgpt3 = gf.CreatePoint(pt3);
            MgPoint mgpt4 = gf.CreatePoint(pt4);
            MgPointCollection points = new MgPointCollection();
            points.Add(mgpt1);
            points.Add(mgpt2);
            points.Add(mgpt3);
            points.Add(mgpt4);
            MgMultiPoint mp = gf.CreateMultiPoint(points);

            Assert.AreEqual(4, mp.Count);
            Assert.AreEqual(MgGeometryType.MultiPoint, mp.GeometryType);
            Assert.AreEqual(0, mp.Dimension);
        }
Example #6
0
        public MgMultiPoint CreateMultiPoint()
        {
            MgCoordinate coord1 = factory.CreateCoordinateXYZ(1.0, 2.0, 3.0);
            MgPoint point1 = factory.CreatePoint(coord1);

            MgCoordinate coord2 = factory.CreateCoordinateXYZ(4.0, 5.0, 6.0);
            MgPoint point2 = factory.CreatePoint(coord2);

            MgCoordinate coord3 = factory.CreateCoordinateXYZ(7.0, 8.0, 9.0);
            MgPoint point3 = factory.CreatePoint(coord3);

            MgPointCollection pnts = new MgPointCollection();
            pnts.Add(point1);
            pnts.Add(point2);
            pnts.Add(point3);

            return factory.CreateMultiPoint(pnts);
        }