Examples of PointPlacement


Examples of org.geotools.styling.PointPlacement

        Expression xDisplacement = builder.attributeExpression(Constants.Style.Grid.ATT_X_DISPLACEMENT);
        Expression yDisplacement = builder.attributeExpression(Constants.Style.Grid.ATT_Y_DISPLACEMENT);
        Displacement displacement = builder.createDisplacement(xDisplacement, yDisplacement);
        Expression rotation = builder.attributeExpression(Constants.Style.Grid.ATT_ROTATION);

        PointPlacement text1Placement = builder.createPointPlacement(builder.createAnchorPoint(0, 0), displacement, rotation);
        final TextSymbolizer text1 = builder.createTextSymbolizer();
        text1.setFill(builder.createFill(color));
        text1.setLabelPlacement(text1Placement);
        final double opacity = 0.8;
        text1.setHalo(builder.createHalo(Color.white, opacity, 2));
View Full Code Here

Examples of org.geotools.styling.PointPlacement

        assertEquals(fontFamily, valueOf(family.get(0)));
        assertEquals(12, valueOf(font.getSize()));
        assertEquals(fontStyle, valueOf(font.getStyle()));
        assertEquals(fontWeight, valueOf(font.getWeight()));

        PointPlacement placement = (PointPlacement) symbolizer.getLabelPlacement();
        assertEquals(45.0, valueOf(placement.getRotation()));
        assertEquals(0.5, valueOf(placement.getAnchorPoint().getAnchorPointX()));
        assertEquals(0.5, valueOf(placement.getAnchorPoint().getAnchorPointY()));
        assertEquals(labelXOffset, valueOf(placement.getDisplacement().getDisplacementX()).toString());
        assertEquals(labelYOffset, valueOf(placement.getDisplacement().getDisplacementY()).toString());

        Halo halo = symbolizer.getHalo();
        assertFill(0.7, haloColor, halo.getFill());
        assertEquals(haloRadius, valueOf(halo.getRadius()).toString());
View Full Code Here

Examples of org.geotools.styling.PointPlacement

            }

            @Override
            public void visit(TextSymbolizer text) {
                foundTextSymb.incrementAndGet();
                final PointPlacement labelPlacement = (PointPlacement) text.getLabelPlacement();
                assertNotNull(labelPlacement.getDisplacement());
                super.visit(text);
            }
        };

        styleValidator.visit(gridStyle);
View Full Code Here

Examples of org.geotools.styling.PointPlacement

    }


    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");
View Full Code Here

Examples of org.geotools.styling.PointPlacement

        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.PointPlacement

        assertEquals(11, (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) ts.getLabelPlacement();
        assertEquals(0.5, pp.getAnchorPoint().getAnchorPointX().evaluate(null, Double.class), 0);
        assertEquals(0.5, pp.getAnchorPoint().getAnchorPointY().evaluate(null, Double.class), 0);

        // halo
        assertEquals(3, (int) ts.getHalo().getRadius().evaluate(null, Integer.class));
        assertEquals(Color.WHITE, ts.getHalo().getFill().getColor().evaluate(null, Color.class));
View Full Code Here

Examples of org.geotools.styling.PointPlacement

    public PointPlacement build() {
        if (unset) {
            return null;
        }
        PointPlacement placement = sf
                .pointPlacement(anchor.build(), displacement.build(), rotation);
        if (parent == null) {
            reset();
        }
        return placement;
View Full Code Here

Examples of org.geotools.styling.PointPlacement

        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.PointPlacement

        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

Examples of org.geotools.styling.PointPlacement

        if(text.getFont() != null) {

            int textSize = getPositiveValue(text.getFont().getSize());
            int delta = -1;
            if (text.getLabelPlacement() instanceof PointPlacement) {
                PointPlacement pp = (PointPlacement) text.getLabelPlacement();
                Displacement pd = pp.getDisplacement();
                if (pd != null) {
                    int dx = getPositiveValue(pd.getDisplacementX());
                    int dy = getPositiveValue(pd.getDisplacementY());
                    delta = Math.max(dx, dy);
                }
                AnchorPoint ap = pp.getAnchorPoint();
                if (ap != null) {
                    double ax = Math.abs(getDouble(ap.getAnchorPointX()) - 0.5);
                    double ay = Math.abs(getDouble(ap.getAnchorPointY()) - 0.5);
                    int anchorDelta = (int) Math.ceil(Math.max(ax, ay) * textSize);
                    if (delta > 0) {
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.