Examples of TextSymbolizer


Examples of org.geotools.styling.TextSymbolizer

        assertEquals(2, item.getGeoms().size());
    }

    @Test
    public void testGroupDifferentSymbolizers() throws Exception {
        TextSymbolizer ts1 = sb.createTextSymbolizer(Color.BLACK, (Font) null, "name");
        ts1.getOptions().put(TextSymbolizer.GROUP_KEY, "true");
        TextSymbolizer ts2 = sb.createTextSymbolizer(Color.YELLOW, (Font) null, "name");
        ts2.getOptions().put(TextSymbolizer.GROUP_KEY, "true");

        SimpleFeature f1 = createFeature("label1", L1);
        SimpleFeature f2 = createFeature("label1", L2);
        cache.put(LAYER_ID, ts1, f1, new LiteShape2((Geometry) f1.getDefaultGeometry(), null, null,
                false), ALL_SCALES);
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

        assertEquals(2, labels.size());
    }
   
    @Test
    public void testMinNonGrouped() throws Exception {
        TextSymbolizer ts = sb.createTextSymbolizer(Color.BLACK, (Font) null, "name");
        TextSymbolizer tsGroup = sb.createTextSymbolizer(Color.YELLOW, (Font) null, "name");
        tsGroup.getOptions().put(TextSymbolizer.GROUP_KEY, "true");

        SimpleFeature f1 = createFeature("label1", L1);
        SimpleFeature f2 = createFeature("label1", L2);
        SimpleFeature f3 = createFeature("label1", L3);
        cache.put(LAYER_ID, tsGroup, f1, new LiteShape2((Geometry) f1.getDefaultGeometry(), null, null,
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer


    private static Style createLabelOffsetStyle() {
        StyleBuilder sb = new StyleBuilder();
        PointPlacement pp = sb.createPointPlacement(0.5, 0.5, 50, 0, 0);
        TextSymbolizer ts = sb.createTextSymbolizer();
        ts.setFont(sb.createFont("Bitstream Vera Sans", 20));
        ts.setLabel(sb.getFilterFactory().literal("name"));
        ts.setLabelPlacement(pp);
        ts.getOptions().put("partials", "true");
        return sb.createStyle(ts);
    }
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

    public void testParse() throws Exception {
        String xml = "<LabelStyle>" + "<color>ffff0000</color>" + "</LabelStyle>";

        buildDocument(xml);

        TextSymbolizer text = (TextSymbolizer) parse();
        assertEquals(Color.RED, SLD.color(text.getFill()));
    }
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

        style.accept(collector);
        assertEquals(1, collector.featureTypeStyles.size());
        assertEquals(1, collector.rules.size());
        assertEquals(2, collector.symbolizers.size());

        TextSymbolizer ps = (TextSymbolizer) collector.symbolizers.get(1);
        assertEquals(ff.property("name"), ps.getLabel());
        assertEquals(Color.BLACK, ps.getFill().getColor().evaluate(null, Color.class));

        // placement
        PointPlacement pp = (PointPlacement) ps.getLabelPlacement();
        assertEquals(0, pp.getRotation().evaluate(null, Double.class), 0.0);
        assertEquals(0., pp.getAnchorPoint().getAnchorPointX().evaluate(null, Double.class), 0);
        assertEquals(0, pp.getAnchorPoint().getAnchorPointY().evaluate(null, Double.class), 0);
    }
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

        style.accept(collector);
        assertEquals(1, collector.featureTypeStyles.size());
        assertEquals(1, collector.rules.size());
        assertEquals(2, collector.symbolizers.size());

        TextSymbolizer ts = (TextSymbolizer) collector.symbolizers.get(1);
        assertEquals(ff.property("name"), ts.getLabel());
        assertEquals(Color.BLACK, ts.getFill().getColor().evaluate(null, Color.class));
        assertEquals(4, ts.getOptions().size());

        // placement
        assertTrue(ts.getLabelPlacement() instanceof LinePlacement);
    }
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

        }
        Font[] array = new Font[fonts.size()];
        for (int i = 0; i < array.length; i++) {
            array[i] = fonts.get(i).build();
        }
        TextSymbolizer ts = sf.createTextSymbolizer(fill.build(), array, halo.build(), label,
                placement.build(), geometry);
        if (uom != null) {
            ts.setUnitOfMeasure(uom);
        }
        if (ts instanceof TextSymbolizer2 && options != null) {
            TextSymbolizer2 ts2 = (TextSymbolizer2) ts;
            ts2.getOptions().putAll(options);
        }
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

        // round up the basic elements and check its simple
        StyleCollector collector = new StyleCollector();
        style.accept(collector);
        basicPointWithLabelAssertions(collector);

        TextSymbolizer ps = (TextSymbolizer) collector.symbolizers.get(1);
        assertEquals(ff.property("name"), ps.getLabel());
        assertEquals(Color.BLACK, ps.getFill().getColor().evaluate(null, Color.class));
    }
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

        // round up the basic elements and check its simple
        StyleCollector collector = new StyleCollector();
        style.accept(collector);
        basicPointWithLabelAssertions(collector);

        TextSymbolizer ps = (TextSymbolizer) collector.symbolizers.get(1);
        assertEquals(ff.property("name"), ps.getLabel());
        assertEquals(Color.BLACK, ps.getFill().getColor().evaluate(null, Color.class));

        // font
        Font font = ps.getFont();
        assertEquals("Arial", font.getFamily().get(0).evaluate(null, String.class));
        assertEquals(12, (int) font.getSize().evaluate(null, Integer.class));
        assertEquals(Font.Style.NORMAL, font.getStyle().evaluate(null, String.class));
        assertEquals(Font.Weight.BOLD, font.getWeight().evaluate(null, String.class));

        // placement
        PointPlacement pp = (PointPlacement) ps.getLabelPlacement();
        assertEquals(0.5, pp.getAnchorPoint().getAnchorPointX().evaluate(null, Double.class), 0);
        assertEquals(0, pp.getAnchorPoint().getAnchorPointY().evaluate(null, Double.class), 0);
        assertEquals(0, (int) pp.getDisplacement().getDisplacementX().evaluate(null, Integer.class));
        assertEquals(5, (int) pp.getDisplacement().getDisplacementY().evaluate(null, Integer.class));
    }
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

        // round up the basic elements and check its simple
        StyleCollector collector = new StyleCollector();
        style.accept(collector);
        basicPointWithLabelAssertions(collector);

        TextSymbolizer ps = (TextSymbolizer) collector.symbolizers.get(1);
        assertEquals(ff.property("name"), ps.getLabel());
        assertEquals(Color.BLACK, ps.getFill().getColor().evaluate(null, Color.class));

        // font
        Font font = ps.getFont();
        assertEquals("Arial", font.getFamily().get(0).evaluate(null, String.class));
        assertEquals(12, (int) font.getSize().evaluate(null, Integer.class));
        assertEquals(Font.Style.NORMAL, font.getStyle().evaluate(null, String.class));
        assertEquals(Font.Weight.BOLD, font.getWeight().evaluate(null, String.class));

        // placement
        PointPlacement pp = (PointPlacement) ps.getLabelPlacement();
        assertEquals(-45, pp.getRotation().evaluate(null, Double.class), 0.0);
        assertEquals(0.5, pp.getAnchorPoint().getAnchorPointX().evaluate(null, Double.class), 0);
        assertEquals(0, pp.getAnchorPoint().getAnchorPointY().evaluate(null, Double.class), 0);
        assertEquals(0, (int) pp.getDisplacement().getDisplacementX().evaluate(null, Integer.class));
        assertEquals(5, (int) pp.getDisplacement().getDisplacementY().evaluate(null, Integer.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.