Examples of PJsonObject


Examples of org.mapfish.print.wrapper.json.PJsonObject

        helper.setVersion(Versions.TWO);
        JSONObject json = new JSONObject();
        json.put(JsonStyleParserHelper.JSON_LABEL, label);
        json.put(JsonStyleParserHelper.JSON_FONT_COLOR, "red");

        PJsonObject pJson = new PJsonObject(json, "symbolizers");
        final TextSymbolizer textSymbolizer = this.helper.createTextSymbolizer(pJson);
        assertNotNull(textSymbolizer);

        assertNotNull(textSymbolizer.getFill());
        assertEquals("#FF0000", valueOf(textSymbolizer.getFill().getColor()));
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

    @Test
    public void testGetGraphicFormatDetect() throws Exception {
        // geotools only accepts formats that are supported by ImageIO. so we can have a problem if the format is image/jpg but
        // ImageIO supports image/jpeg.  The two don't match so the image won't be loaded (even if it could).
        final List<String> strings = Arrays.asList(ImageIO.getReaderMIMETypes());
        PJsonObject styleJson = new PJsonObject(new JSONObject(), "style");
        for (String supportedMimetype : strings) {
            Set<String> compatibleMimetypes = findCompatibleMimeTypes(supportedMimetype);
            for (String mimeType : compatibleMimetypes) {
                if (Strings.isNullOrEmpty(mimeType)) {
                    continue;
                }
                styleJson.getInternalObj().put(JsonStyleParserHelper.JSON_GRAPHIC_FORMAT, mimeType);
                final String graphicFormat = helper.getGraphicFormat("http://somefile.com/file.jpg", styleJson);
                assertTrue(graphicFormat + " is not supported", strings.contains(graphicFormat));
            }
        }
    }
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject


    @Test
    public void testLabelAttributes() throws Exception {
        JSONObject json = new JSONObject();
        PJsonObject pJson = new PJsonObject(json, "symbolizers");

        json.put(JsonStyleParserHelper.JSON_LABEL, "att");
        TextSymbolizer textSymbolizer = this.helper.createTextSymbolizer(pJson);
        assertTrue(textSymbolizer.getLabel() instanceof Literal);
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

        this.servlet.getCapabilities(true, "", servletResponse);
        assertEquals(HttpStatus.OK.value(), servletResponse.getStatus());

        final String contentAsString = servletResponse.getContentAsString();
        assertTrue(contentAsString.contains("\n"));
        final PJsonObject getInfoJson = parseJSONObjectFromString(contentAsString);

        assertTrue(getInfoJson.has("layouts"));
        final PJsonArray layouts = getInfoJson.getJSONArray("layouts");
        assertEquals(2, layouts.size());
        final PObject mainLayout = layouts.getObject(0);
        assertEquals("A4 Landscape", mainLayout.getString("name"));
        assertTrue(mainLayout.has("attributes"));
        assertEquals(2, mainLayout.getArray("attributes").size());
        assertEquals("imageMap", mainLayout.getArray("attributes").getObject(1).getString("name"));
        assertTrue(getInfoJson.has("formats"));
        final PJsonArray formats = getInfoJson.getJSONArray("formats");
        assertCapabilitiesFormats(formats);
    }
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

    }

    @Test
    public void testExpressionProperties() throws Exception {
        String jsonString = Files.toString(getFile("v2-style-all-properies-as-expressions.json"), Constants.DEFAULT_CHARSET);
        PJsonObject json = MapPrinter.parseSpec(jsonString).getJSONObject("*");

        final PJsonArray symb = json.getJSONArray(MapfishJsonStyleVersion2.JSON_SYMB);
        final PointSymbolizer pointSymbolizer = this.helper.createPointSymbolizer(symb.getJSONObject(0));
        final LineSymbolizer lineSymbolizer = this.helper.createLineSymbolizer(symb.getJSONObject(1));
        final PolygonSymbolizer polygonSymbolizer = this.helper.createPolygonSymbolizer(symb.getJSONObject(2));
        final TextSymbolizer textSymbolizer = this.helper.createTextSymbolizer(symb.getJSONObject(3));

View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

                    }
                }
        );
        final Configuration config = configurationFactory.getConfig(getFile(BASE_DIR + "config.yaml"));
        final Template template = config.getTemplate("main");
        PJsonObject requestData = loadJsonRequestData();
        Values values = new Values(requestData, template, this.parser, getTaskDirectory(), this.requestFactory, new File("."));
        template.getProcessorGraph().createTask(values).invoke();

        @SuppressWarnings("unchecked")
        List<URI> layerGraphics = (List<URI>) values.getObject("layerGraphics", List.class);
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

    private void assertDashStyle(String dashStyle, float[] expectedDashArray) throws JSONException {
        JSONObject strokeJson = new JSONObject();
        strokeJson.put(JsonStyleParserHelper.JSON_STROKE_DASHSTYLE, dashStyle);

        PJsonObject pStyle = new PJsonObject(strokeJson, "style");
        final Stroke stroke = helper.createStroke(pStyle, false);
        assertNotNull(stroke);
        assertArrayEquals(Arrays.toString(stroke.getDashArray()), expectedDashArray, stroke.getDashArray(), FLOAT_DELTA);
    }
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

    @Test
    public void testAttributesFromJson() throws Exception {
        final File configFile = getFile(OverviewMapAttributeTest.class, "overviewmap_attributes/config-json.yaml");
        final Configuration config = configurationFactory.getConfig(configFile);
        final Template template = config.getTemplate("main");
        final PJsonObject pJsonObject = parseJSONObjectFromFile(OverviewMapAttributeTest.class, "overviewmap_attributes/requestData-json.json");
       
        final Values values = new Values(pJsonObject, template, new MapfishParser(), getTaskDirectory(), this.httpRequestFactory,
                new File("."));
        final MapAttribute.MapAttributeValues mapValue = values.getObject("mapDef", MapAttribute.MapAttributeValues.class);
        final OverviewMapAttribute.OverviewMapAttributeValues overviewMapValue =
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

    @Test
    public void testAttributesFromYaml() throws Exception {
        final File configFile = getFile(OverviewMapAttributeTest.class, "overviewmap_attributes/config-yaml.yaml");
        final Configuration config = configurationFactory.getConfig(configFile);
        final Template template = config.getTemplate("main");
        final PJsonObject pJsonObject = parseJSONObjectFromFile(OverviewMapAttributeTest.class, "overviewmap_attributes/requestData-yaml.json");
       
        final Values values = new Values(pJsonObject, template, new MapfishParser(), getTaskDirectory(), this.httpRequestFactory, new File("."));
        final MapAttribute.MapAttributeValues mapValue = values.getObject("mapDef", MapAttribute.MapAttributeValues.class);
        final OverviewMapAttribute.OverviewMapAttributeValues overviewMapValue =
                values.getObject("overviewMapDef", OverviewMapAttribute.OverviewMapAttributeValues.class);
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

    @Test
    public void testAttributesFromBoth() throws Exception {
        final File configFile = getFile(OverviewMapAttributeTest.class, "overviewmap_attributes/config-yaml.yaml");
        final Configuration config = configurationFactory.getConfig(configFile);
        final Template template = config.getTemplate("main");
        final PJsonObject pJsonObject = parseJSONObjectFromFile(OverviewMapAttributeTest.class, "overviewmap_attributes/requestData-json.json");
       
        final Values values = new Values(pJsonObject, template, new MapfishParser(), getTaskDirectory(), this.httpRequestFactory, new File("."));
        final MapAttribute.MapAttributeValues mapValue = values.getObject("mapDef", MapAttribute.MapAttributeValues.class);
        final OverviewMapAttribute.OverviewMapAttributeValues overviewMapValue =
                values.getObject("overviewMapDef", OverviewMapAttribute.OverviewMapAttributeValues.class);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.