public void ExtremeCoordCalc_ExtremePoly_SimpleDiamond()
        {
            // Create a simple diamond poly around the axis
            Polygon p = new Polygon();
            p.AddCoord(0,1); // North
            p.AddCoord(2,0); // East
            p.AddCoord(0,-3); // South
            p.AddCoord(-4,0); // West

            ExtremeCoordCalc calc = new ExtremeCoordCalc(p);
            Polygon extreme = calc.GetExtremeBounds();

            // Grab coords off extreme poly
            Coord a = (Coord)extreme.coords[0];
            Coord b = (Coord)extreme.coords[1];
            Coord c = (Coord)extreme.coords[2];
            Coord d = (Coord)extreme.coords[3];

            // Assert
            Assert.AreEqual(-54, a.X);
            Assert.AreEqual(51, a.Y);
            Assert.AreEqual(52, b.X);
            Assert.AreEqual(51, b.Y);
            Assert.AreEqual(52, c.X);
            Assert.AreEqual(-53, c.Y);
            Assert.AreEqual(-54, d.X);
            Assert.AreEqual(-53, d.Y);
        }
Пример #2
0
        public void ExtremeCoordCalc_ExtremePoly_SimpleDiamond()
        {
            // Create a simple diamond poly around the axis
            Polygon p = new Polygon();

            p.AddCoord(0, 1);            // North
            p.AddCoord(2, 0);            // East
            p.AddCoord(0, -3);           // South
            p.AddCoord(-4, 0);           // West

            ExtremeCoordCalc calc    = new ExtremeCoordCalc(p);
            Polygon          extreme = calc.GetExtremeBounds();

            // Grab coords off extreme poly
            Coord a = (Coord)extreme.coords[0];
            Coord b = (Coord)extreme.coords[1];
            Coord c = (Coord)extreme.coords[2];
            Coord d = (Coord)extreme.coords[3];

            // Assert
            Assert.AreEqual(-54, a.X);
            Assert.AreEqual(51, a.Y);
            Assert.AreEqual(52, b.X);
            Assert.AreEqual(51, b.Y);
            Assert.AreEqual(52, c.X);
            Assert.AreEqual(-53, c.Y);
            Assert.AreEqual(-54, d.X);
            Assert.AreEqual(-53, d.Y);
        }
Пример #3
0
        //[ExpectedException(typeof(System.Exception), ExpectedMessage = "Polygon has no points." )]
        public void ExtremeCoordCalc_NoPointPoly()
        {
            // Create a poly and add no points
            Polygon poly = new Polygon();

            ExtremeCoordCalc calc = new ExtremeCoordCalc(poly);

            try {
                calc.GetExtremeBounds();
                Assert.Fail("Exception expected");
            } catch (Exception e) {
            }
        }
        public void ExtremeCoordCalc_NoPointPoly()
        {
            // Create a poly and add no points
            Polygon poly = new Polygon();

            ExtremeCoordCalc calc = new ExtremeCoordCalc(poly);

            try {
                calc.GetExtremeBounds();
                Assert.Fail("Exception expected");
            } catch (Exception e) {

            }
        }