Exemple #1
0
        public void ZoomToViewBoundsWhenNoWorldBoundsSetThrowsException()
        {
            MockRepository mocks = new MockRepository();

            TestPresenter2D mapPresenter = createPresenter(mocks, 1000, 1000);

            Assert.Throws <InvalidOperationException>(delegate
            {
                mapPresenter.ZoomToViewBounds(new Rectangle2D(300,
                                                              300,
                                                              900,
                                                              900));
            });
        }
Exemple #2
0
        public void ZoomToViewBounds_NoAspectCorrection()
        {
            MockRepository mocks = new MockRepository();

            TestPresenter2D mapPresenter = createPresenter(mocks, 1000, 1000);

            mapPresenter.ZoomToExtents();

            mapPresenter.ZoomToViewBounds(new Rectangle2D(300, 300, 900, 900));
            BufferedCoordinate expectedCoord = (BufferedCoordinate)_factories.GeoFactory.CoordinateFactory.Create(72, 38);

            Assert.Equal(expectedCoord, mapPresenter.GeoCenter);
            Assert.Equal(72, mapPresenter.WorldWidth);
            Assert.Equal(72, mapPresenter.WorldHeight);
        }
Exemple #3
0
        public void ZoomToViewBounds_WithAspectCorrection()
        {
            MockRepository mocks = new MockRepository();

            TestPresenter2D mapPresenter = createPresenter(mocks, 400, 200);

            // Set the aspect ratio, which is the number of height units per width unit
            // to 2 height units to 1 width unit
            mapPresenter.WorldAspectRatio = 2;
            // Zooming to extents should
            mapPresenter.ZoomToExtents();
            Assert.Equal(120, mapPresenter.WorldWidth);
            Assert.Equal(120, mapPresenter.WorldHeight);
            // Zoom to a 200x100 rectangle in view coordinates
            mapPresenter.ZoomToViewBounds(new Rectangle2D(100, 50, 300, 150));
            Assert.Equal(_factories.GeoFactory.CoordinateFactory.Create(60, 50), mapPresenter.GeoCenter);
            Assert.Equal(60, mapPresenter.WorldWidth);
            Assert.Equal(60, mapPresenter.WorldHeight);
        }