Exemplo n.º 1
0
        public void TestCustom()
        {
            SpatialContext ctx = Call("geo", "false");

            Assert.True(!ctx.IsGeo);
            Assert.Equal(new CartesianDistCalc(), ctx.DistCalc);

            ctx = Call("geo", "false",
                       "distCalculator", "cartesian^2",
                       "worldBounds", "ENVELOPE(-100, 75, 200, 0)");//xMin, xMax, yMax, yMin
            Assert.Equal(new CartesianDistCalc(true), ctx.DistCalc);
            Assert.Equal(new Rectangle(-100, 75, 0, 200, ctx), ctx.WorldBounds);

            ctx = Call("geo", "true",
                       "distCalculator", "lawOfCosines");
            Assert.True(ctx.IsGeo);
            var test = new GeodesicSphereDistCalc.LawOfCosines();

            Assert.Equal(test, ctx.DistCalc);
        }
        public void TestCustom()
        {
            SpatialContext sc = Call("geo", "false");

            Assert.True(!sc.IsGeo());
            Assert.Equal(new CartesianDistCalc(), sc.GetDistCalc());

            sc = Call("geo", "false",
                      "distCalculator", "cartesian^2",
                      "worldBounds", "-100 0 75 200");//West South East North
            Assert.Equal(new CartesianDistCalc(true), sc.GetDistCalc());
            Assert.Equal(new RectangleImpl(-100, 75, 0, 200, sc), sc.GetWorldBounds());

            sc = Call("geo", "true",
                      "distCalculator", "lawOfCosines");
            Assert.True(sc.IsGeo());
            var test = new GeodesicSphereDistCalc.LawOfCosines();

            Assert.Equal(test, sc.GetDistCalc());
        }