Package org.mapfish.print.attribute.map

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


        assertRoundedScale(1234229, 1200000);
        assertRoundedScale(12342290, 12000000);
    }

    private void assertRoundedScale(double actualScale, double roundedScale) {
        MapBounds bounds = new CenterScaleMapBounds(DefaultGeographicCRS.WGS84, 0, 0, new Scale(actualScale));
        Dimension paint = new Dimension(200, 200);
        MapfishMapContext transformer = new MapfishMapContext(bounds, paint, 90, Constants.PDF_DPI, Constants.PDF_DPI, null, true);
        assertEquals(roundedScale, transformer.getRoundedScale(), 0.00001);
    }
View Full Code Here


        assertEquals("converted to radians", Math.toRadians(90.0), transformer.getRotation(), 1e-9);
    }

    @Test
    public void testGetRotatedBounds_BBoxMapBounds() {
        MapBounds bounds = new BBoxMapBounds(DefaultGeographicCRS.WGS84, 5, 45, 25, 55);
       
        // rotate 90 degree
        MapfishMapContext transformer = new MapfishMapContext(bounds, null, 90, Constants.PDF_DPI, Constants.PDF_DPI, null, true);
        MapBounds rotatedBounds = new BBoxMapBounds(DefaultGeographicCRS.WGS84, 10, 40, 20, 60);
        assertEquals(rotatedBounds, transformer.getRotatedBounds());

        // rotate 180 degree
        transformer = new MapfishMapContext(bounds, null, 180, Constants.PDF_DPI, Constants.PDF_DPI, null, true);
        rotatedBounds = new BBoxMapBounds(DefaultGeographicCRS.WGS84, 5, 45, 25, 55);
View Full Code Here

        assertEquals(0.707106, rotatedEnvelope.getMaxY(), 1e-6);
    }

    @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

        assertEquals(141, rotatedMapSize.getHeight(), 1e-6);
    }

    @Test
    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());
View Full Code Here

        final double dpi = mapParams.getDpi();
        final double dpiRatio = dpi / mapParams.getRequestorDPI();

        // get the map bounds
        final Rectangle paintArea = new Rectangle(mapParams.getMapSize());
        MapBounds bounds = mapParams.getMapBounds();
        bounds = CreateMapProcessor.adjustBoundsToScaleAndMapSize(
                mapParams, mapParams.getRequestorDPI(), paintArea, bounds);
        paintArea.setBounds(0, 0, (int) (paintArea.width * dpiRatio), (int) (paintArea.height * dpiRatio));

        final DistanceUnit mapUnit = getUnit(bounds);
        // to calculate the scale the requestor DPI is used , because the paint area is already adjusted
        final Scale scale = bounds.getScaleDenominator(paintArea, mapParams.getRequestorDPI());

        DistanceUnit scaleUnit = scalebarParams.getUnit();
        if (scaleUnit == null) {
            scaleUnit = mapUnit;
        }
View Full Code Here

TOP

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

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.