Beispiel #1
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);
            MgLinearSegment          linearSegment = gf.CreateLinearSegment(coordinates);
            MgCurveSegmentCollection curveSegments = new MgCurveSegmentCollection();
            MgCurveRing              curveRing     = gf.CreateCurveRing(curveSegments);
            MgCurvePolygon           cp            = gf.CreateCurvePolygon(curveRing, null);
            MgCurvePolygonCollection cpc           = new MgCurvePolygonCollection();

            cpc.Add(cp);
            MgMultiCurvePolygon mcp = gf.CreateMultiCurvePolygon(cpc);

            Assert.AreEqual(1, mcp.Count);
            Assert.AreEqual(MgGeometryType.MultiCurvePolygon, mcp.GeometryType);
            Assert.AreEqual(2, mcp.Dimension);
        }
Beispiel #2
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            var            build = new GeomBuild();
            MgCurvePolygon geom1 = build.CreateCurvePolygon(2.0, 5);
            MgCurvePolygon geom2 = build.CreateCurvePolygon(12.0, 5);
            MgCurvePolygon geom3 = build.CreateCurvePolygon(2.0, 5);

            MgCurvePolygonCollection coll = new MgCurvePolygonCollection();

            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 (MgCurvePolygon geom in coll)
            {
                width += geom.Envelope().GetWidth();
            }
            Assert.AreEqual(geom1.Envelope().GetWidth() * 3.0, width);
        }
Beispiel #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);
            MgLinearSegment          linearSegment = gf.CreateLinearSegment(coordinates);
            MgCurveSegmentCollection curveSegments = new MgCurveSegmentCollection();

            curveSegments.Add(linearSegment);
            MgCurveRing    outerRing = gf.CreateCurveRing(curveSegments);
            MgCurvePolygon cp        = gf.CreateCurvePolygon(outerRing, null);

            Assert.AreEqual(outerRing.ToString(), cp.ExteriorRing.ToString());
            Assert.AreEqual(0, cp.InteriorRingCount);
            Assert.AreEqual(MgGeometryType.CurvePolygon, cp.GeometryType);
            Assert.AreEqual(2, cp.Dimension);
        }
Beispiel #4
0
        public MgMultiCurvePolygon CreateMultiCurvePolygon(int numCurvePolys, double offset)
        {
            MgCurvePolygonCollection curvePolys = new MgCurvePolygonCollection();

            for (int i = 0; i < numCurvePolys; i++)
            {
                MgCurvePolygon curvePoly = CreateCurvePolygon(i + offset, 1);
                curvePolys.Add(curvePoly);
            }

            return(factory.CreateMultiCurvePolygon(curvePolys));
        }