"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "modules/library/render/src/test/java/org/geotools/map/MapViewportTest.java" between
geotools-21.1-project.zip and geotools-21.2-project.zip

About: GeoTools (The Open Source Java GIS Toolkit) is a Java code library which provides standards compliant methods for the manipulation of geospatial data.

MapViewportTest.java  (geotools-21.1-project):MapViewportTest.java  (geotools-21.2-project)
skipping to change at line 52 skipping to change at line 52
private static final ReferencedEnvelope BIG_WORLD_1_1 = private static final ReferencedEnvelope BIG_WORLD_1_1 =
new ReferencedEnvelope(140, 160, -30, -50, DefaultGeographicCRS.WGS8 4); new ReferencedEnvelope(140, 160, -30, -50, DefaultGeographicCRS.WGS8 4);
// Screen area with aspect ratio 1:1 // Screen area with aspect ratio 1:1
private static final Rectangle SCREEN_1_1 = new Rectangle(100, 100); private static final Rectangle SCREEN_1_1 = new Rectangle(100, 100);
// Screen area with aspect ratio 2:1 // Screen area with aspect ratio 2:1
private static final Rectangle SCREEN_2_1 = new Rectangle(200, 100); private static final Rectangle SCREEN_2_1 = new Rectangle(200, 100);
// Screen area with aspect ratio 1:2 // Screen area with aspect ratio 1:2
private static final Rectangle SCREEN_1_2 = new Rectangle(100, 200); private static final Rectangle SCREEN_1_2 = new Rectangle(100, 200);
// Screen area with aspect ration 2:2 (or 1:1)
private static final Rectangle SCREEN_2_2 = new Rectangle(200, 200);
private static final double TOL = 1.0e-6d; private static final double TOL = 1.0e-6d;
@Test @Test
public void defaultCtor() { public void defaultCtor() {
MapViewport vp = new MapViewport(); MapViewport vp = new MapViewport();
assertFalse(vp.isMatchingAspectRatio()); assertFalse(vp.isMatchingAspectRatio());
assertTrue(vp.isEmpty()); assertTrue(vp.isEmpty());
assertTrue(vp.getBounds().isEmpty()); assertTrue(vp.getBounds().isEmpty());
assertTrue(vp.getScreenArea().isEmpty()); assertTrue(vp.getScreenArea().isEmpty());
skipping to change at line 203 skipping to change at line 204
ReferencedEnvelope expectedBounds = ReferencedEnvelope expectedBounds =
new ReferencedEnvelope( new ReferencedEnvelope(
WORLD_1_1.getMinX(), WORLD_1_1.getMinX(),
WORLD_1_1.getMaxX() + WORLD_1_1.getWidth(), WORLD_1_1.getMaxX() + WORLD_1_1.getWidth(),
WORLD_1_1.getMinY(), WORLD_1_1.getMinY(),
WORLD_1_1.getMaxY(), WORLD_1_1.getMaxY(),
WORLD_1_1.getCoordinateReferenceSystem()); WORLD_1_1.getCoordinateReferenceSystem());
assertTrue(expectedBounds.boundsEquals2D(vp.getBounds(), TOL)); assertTrue(expectedBounds.boundsEquals2D(vp.getBounds(), TOL));
// Now check with Fixed bounds set - bounding box will change but will i
nclude the old bbox
vp.setFixedBoundsOnResize(true);
vp.setScreenArea(SCREEN_1_1);
vp.setBounds(WORLD_1_1);
vp.setScreenArea(SCREEN_2_1);
expectedBounds =
new ReferencedEnvelope(
WORLD_1_1.getMinX() - WORLD_1_1.getWidth() / 2,
WORLD_1_1.getMaxX() + WORLD_1_1.getWidth() / 2,
WORLD_1_1.getMinY(),
WORLD_1_1.getMaxY(),
WORLD_1_1.getCoordinateReferenceSystem());
assertTrue(expectedBounds.boundsEquals2D(vp.getBounds(), TOL));
// double size of screen - no change in BBOX
vp.setScreenArea(SCREEN_1_1);
vp.setBounds(WORLD_1_1);
vp.setScreenArea(SCREEN_2_2);
assertTrue(WORLD_1_1.boundsEquals2D(vp.getBounds(), TOL));
// and back to small
vp.setScreenArea(SCREEN_1_1);
assertTrue(WORLD_1_1.boundsEquals2D(vp.getBounds(), TOL));
} }
@Test @Test
public void newBoundsAreHonoured_NoAspectMatching() { public void newBoundsAreHonoured_NoAspectMatching() {
MapViewport vp = new MapViewport(false); MapViewport vp = new MapViewport(false);
vp.setScreenArea(SCREEN_1_1); vp.setScreenArea(SCREEN_1_1);
vp.setBounds(WORLD_1_1); vp.setBounds(WORLD_1_1);
vp.setBounds(BIG_WORLD_1_1); vp.setBounds(BIG_WORLD_1_1);
assertTrue(BIG_WORLD_1_1.boundsEquals2D(vp.getBounds(), TOL)); assertTrue(BIG_WORLD_1_1.boundsEquals2D(vp.getBounds(), TOL));
 End of changes. 2 change blocks. 
1 lines changed or deleted 26 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)