Assert.assertEquals(10, transformed.getY(), DELTA);
}
@Test
public void testTransformBbox() {
Bbox bbox = factory.createBbox(-10, -10, 20, 20);
Bbox transformed = viewPort.transform(bbox, RenderSpace.WORLD, RenderSpace.SCREEN);
Assert.assertEquals((MAP_WIDTH / 2) - (viewPort.getScale() * 10), transformed.getX(), DELTA);
Assert.assertEquals((MAP_HEIGHT / 2) - (viewPort.getScale() * 10), transformed.getY(), DELTA);
Assert.assertEquals((MAP_WIDTH / 2) + (viewPort.getScale() * 10), transformed.getMaxX(), DELTA);
Assert.assertEquals((MAP_HEIGHT / 2) + (viewPort.getScale() * 10), transformed.getMaxY(), DELTA);
transformed = viewPort.transform(transformed, RenderSpace.SCREEN, RenderSpace.WORLD);
Assert.assertEquals(-10.0, transformed.getX(), DELTA);
Assert.assertEquals(-10.0, transformed.getY(), DELTA);
Assert.assertEquals(10.0, transformed.getMaxX(), DELTA);
Assert.assertEquals(10.0, transformed.getMaxY(), DELTA);
// Test identity transformations:
transformed = viewPort.transform(bbox, RenderSpace.WORLD, RenderSpace.WORLD);
Assert.assertEquals(-10.0, transformed.getX(), DELTA);
Assert.assertEquals(-10.0, transformed.getY(), DELTA);
Assert.assertEquals(10.0, transformed.getMaxX(), DELTA);
Assert.assertEquals(10.0, transformed.getMaxY(), DELTA);
transformed = viewPort.transform(bbox, RenderSpace.SCREEN, RenderSpace.SCREEN);
Assert.assertEquals(-10.0, transformed.getX(), DELTA);
Assert.assertEquals(-10.0, transformed.getY(), DELTA);
Assert.assertEquals(10.0, transformed.getMaxX(), DELTA);
Assert.assertEquals(10.0, transformed.getMaxY(), DELTA);
}