Package org.mapfish.print.attribute.map

Examples of org.mapfish.print.attribute.map.MapfishMapContext


    }

    @Test
    public void testGetRotatedBounds_CenterScaleMapBounds() {
        MapBounds bounds = new CenterScaleMapBounds(DefaultGeographicCRS.WGS84, 0, 0, new Scale(1000));
        MapfishMapContext transformer = new MapfishMapContext(bounds, null, 90, Constants.PDF_DPI, Constants.PDF_DPI, null, true);
        // nothing changes
        assertEquals(bounds, transformer.getRotatedBounds());
    }
View Full Code Here


    }

    @Test
    public void testGetRotatedMapSize() {
        // no rotation
        MapfishMapContext transformer = new MapfishMapContext(null, new Dimension(1, 1), 0, Constants.PDF_DPI, Constants.PDF_DPI, null, true);
        assertEquals(new Dimension(1, 1), transformer.getRotatedMapSize());

        // rotate 90 degree
        transformer = new MapfishMapContext(null, new Dimension(2, 1), 90, Constants.PDF_DPI, Constants.PDF_DPI, null, true);
        assertEquals(new Dimension(1, 2), transformer.getRotatedMapSize());

        // rotate 180 degree
        transformer = new MapfishMapContext(null, new Dimension(2, 1), 180, Constants.PDF_DPI, Constants.PDF_DPI, null, true);
        assertEquals(new Dimension(2, 1), transformer.getRotatedMapSize());

        // rotate 45 degree
        transformer = new MapfishMapContext(null, new Dimension(100, 100), 45, Constants.PDF_DPI, Constants.PDF_DPI, null, true);
        Dimension rotatedMapSize = transformer.getRotatedMapSize();
        assertEquals(141, rotatedMapSize.getWidth(), 1e-6);
        assertEquals(141, rotatedMapSize.getHeight(), 1e-6);
    }
View Full Code Here

    public void testGetTransform() {
        MapBounds bounds = new BBoxMapBounds(DefaultGeographicCRS.WGS84, -0.5, -0.5, 0.5, 0.5);
        Dimension mapSize = new Dimension(100, 100);
       
        // no rotation
        MapfishMapContext transformer = new MapfishMapContext(bounds, mapSize, 0, Constants.PDF_DPI, Constants.PDF_DPI, null, true);
        assertNull(transformer.getTransform());
       
        // rotate 180 degree
        transformer = new MapfishMapContext(bounds, mapSize, 180, Constants.PDF_DPI, Constants.PDF_DPI, null, true);
        AffineTransform transform = transformer.getTransform();
        assertEquals(100, transform.getTranslateX(), 1e-6);
        assertEquals(100, transform.getTranslateY(), 1e-6);
       
        double[] matrix = new double[6];
        transform.getMatrix(matrix);
        assertArrayEquals(new double[] {-1.0, 0.0, 0.0, -1.0, 100.0, 100.0}, matrix, 1e-6);
       
        // rotate 90 degree
        transformer = new MapfishMapContext(bounds, mapSize, 90, Constants.PDF_DPI, Constants.PDF_DPI, null, true);
        transform = transformer.getTransform();
        assertEquals(100, transform.getTranslateX(), 1e-6);
        assertEquals(0, transform.getTranslateY(), 1e-6);
       
        matrix = new double[6];
        transform.getMatrix(matrix);
View Full Code Here

    }

    public static MapfishMapContext createTestMapContext() {
        try {
            final CenterScaleMapBounds bounds = new CenterScaleMapBounds(CRS.decode("CRS:84"), 0, 0, new Scale(30000));
            return new MapfishMapContext(bounds, new Dimension(500,500), 0, 72, Constants.PDF_DPI, null, true);
        } catch (Throwable e) {
            throw new Error(e);
        }
    }
View Full Code Here

    @Autowired
    private TestHttpClientFactory clientHttpRequestFactory;

    @Test
    public void testAttributesFromJson() throws Exception {
        MapfishMapContext mapContext = new MapfishMapContext(new BBoxMapBounds(null, 0,0,10,10), new Dimension(20,20), 0,
                72, Constants.PDF_DPI, null, true);
        configurationFactory.setDoValidation(false);
        final File configFile = getFile(StyleAttributeTest.class, "style_attributes/config.yaml");
        final Configuration config = configurationFactory.getConfig(configFile);
        final Template template = config.getTemplate("main");
View Full Code Here

TOP

Related Classes of org.mapfish.print.attribute.map.MapfishMapContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.