Package org.mapfish.print.attribute.map

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


                json.key("rotation").value(true);

                Template template = configuration.getTemplates().get(name);

                // find the map attribute
                MapAttribute map = null;
                for (Attribute attribute : template.getAttributes().values()) {
                    if (attribute instanceof MapAttribute) {
                        if (map != null) {
                            throw new UnsupportedOperationException("Template '" + name + "' contains "
                                                                    + "more than one map configuration. The legacy API "
                                                                    + "supports only one map per template.");
                        } else {
                            map = (MapAttribute) attribute;
                        }
                    }
                }
                if (map == null) {
                    throw new UnsupportedOperationException("Template '" + name + "' contains "
                                                            + "no map configuration.");
                }
               
                MapAttributeValues mapValues = map.createValue(template);
                json.key("map");
                json.object();
                {
                    json.key("width").value(mapValues.getMapSize().width);
                    json.key("height").value(mapValues.getMapSize().height);
                }
                json.endObject();
               
                // get the zoom levels and dpi values from the first template
                if (maxDpi == null) {
                    maxDpi = map.getMaxDpi();
                    dpiSuggestions = map.getDpiSuggestions();
                }
                if (zoomLevels == null) {
                    zoomLevels = mapValues.getZoomLevels();
                }
            }
View Full Code Here


                ScalebarGraphic.getSize(params, settings, new Dimension(30, 12)));
    }

    @Test
    public void testRender() throws Exception {
        MapAttribute mapAttribute = new MapAttribute();
        mapAttribute.setWidth(780);
        mapAttribute.setHeight(330);
        mapAttribute.setMaxDpi(600.0);
        MapAttributeValues mapParams = mapAttribute.createValue(null);
        mapParams.dpi = 72;
        mapParams.center = new double[]{-8235878.4938425, 4979784.7605681};
        mapParams.scale = 26000.0;
        mapParams.layers = new PJsonArray(null, new JSONArray(), "");
        mapParams.postConstruct();
View Full Code Here

        new ImageSimilarity(new File(file), 4).assertSimilarity(getFile("expected-scalebar-graphic.tiff"), 15);
    }

    @Test
    public void testRenderDoubleDpi() throws Exception {
        MapAttribute mapAttribute = new MapAttribute();
        mapAttribute.setWidth(780);
        mapAttribute.setHeight(330);
        mapAttribute.setMaxDpi(600.0);
        MapAttributeValues mapParams = mapAttribute.createValue(null);
        // use a dpi of 144, this will create a scale bar graphic of 600x80 px
        mapParams.dpi = 144;
        mapParams.center = new double[]{-8235878.4938425, 4979784.7605681};
        mapParams.scale = 26000.0;
        mapParams.layers = new PJsonArray(null, new JSONArray(), "");
View Full Code Here

        new ImageSimilarity(new File(file), 4).assertSimilarity(getFile("expected-scalebar-graphic-dpi.tiff"), 15);
    }

    @Test
    public void testRenderSvg() throws Exception {
        MapAttribute mapAttribute = new MapAttribute();
        mapAttribute.setWidth(780);
        mapAttribute.setHeight(330);
        mapAttribute.setMaxDpi(600.0);
        MapAttributeValues mapParams = mapAttribute.createValue(null);
        mapParams.dpi = 72;
        mapParams.center = new double[]{-8235878.4938425, 4979784.7605681};
        mapParams.scale = 26000.0;
        mapParams.layers = new PJsonArray(null, new JSONArray(), "");
        mapParams.postConstruct();
View Full Code Here

TOP

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

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.