Ejemplo n.º 1
0
        public void testArea()
        {
            //simple bbox
            Rectangle r      = RandomRectangle(20);
            var       ctxJts = (NtsSpatialContext)ctx;
            var       rPoly  = new NtsGeometry(ctxJts.GetGeometryFrom(r), ctxJts, false);

            CustomAssert.EqualWithDelta(r.GetArea(null), rPoly.GetArea(null), 0.0);
            CustomAssert.EqualWithDelta(r.GetArea(ctx), rPoly.GetArea(ctx), 0.000001);             //same since fills 100%

            CustomAssert.EqualWithDelta(1300, POLY_SHAPE.GetArea(null), 0.0);

            //fills 27%
            CustomAssert.EqualWithDelta(0.27, POLY_SHAPE.GetArea(ctx) / POLY_SHAPE.GetBoundingBox().GetArea(ctx), 0.009);
            Assert.True(POLY_SHAPE.GetBoundingBox().GetArea(ctx) > POLY_SHAPE.GetArea(ctx));
        }
Ejemplo n.º 2
0
        public virtual void TestArea()
        {
            //simple bbox
            IRectangle        r      = RandomRectangle(20);
            NtsSpatialContext ctxNts = (NtsSpatialContext)ctx;
            NtsGeometry       rPoly  = ctxNts.MakeShape(ctxNts.GetGeometryFrom(r), false, false);

            CustomAssert.EqualWithDelta(r.GetArea(null), rPoly.GetArea(null), 0.0);
            CustomAssert.EqualWithDelta(r.GetArea(ctx), rPoly.GetArea(ctx), 0.000001);//same since fills 100%

            CustomAssert.EqualWithDelta(1300, POLY_SHAPE.GetArea(null), 0.0);

            //fills 27%
            CustomAssert.EqualWithDelta(0.27, POLY_SHAPE.GetArea(ctx) / POLY_SHAPE.BoundingBox.GetArea(ctx), 0.009);
            Assert.True(POLY_SHAPE.BoundingBox.GetArea(ctx) > POLY_SHAPE.GetArea(ctx));
        }