Package org.mapfish.print.map

Examples of org.mapfish.print.map.Scale


                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;
        }

        // adjust scalebar width and height to the DPI value
        final int maxWidthInPixelAdjusted = (int) (scalebarParams.getSize().width * dpiRatio);
        final int maxHeightInPixelAdjusted = (int) (scalebarParams.getSize().height * dpiRatio);
        final int maxLengthInPixelAdjusted = (scalebarParams.getOrientation().isHorizontal()) ?
                maxWidthInPixelAdjusted : maxHeightInPixelAdjusted;

        final double maxIntervalLengthInWorldUnits = DistanceUnit.PX.convertTo(maxLengthInPixelAdjusted, scaleUnit)
                * scale.getDenominator() / scalebarParams.intervals;
        final double niceIntervalLengthInWorldUnits =
                getNearestNiceValue(maxIntervalLengthInWorldUnits, scaleUnit, scalebarParams.lockUnits);

        final ScaleBarRenderSettings settings = new ScaleBarRenderSettings();
        settings.setParams(scalebarParams);
View Full Code Here


        return workingDirectories.getTaskDirectory();
    }

    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

TOP

Related Classes of org.mapfish.print.map.Scale

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.