Package org.geotools.styling

Examples of org.geotools.styling.AnchorPoint


                        this.place.select(1); //middle   
                        this.place2.select(1); //center
                    }
                    this.place3.select(0); //0 degrees rotation
                } else {
                    AnchorPoint anchor = ((PointPlacement) labelPlacement).getAnchorPoint();
                    String anchorX = anchor.getAnchorPointX().toString();
                    String anchorY = anchor.getAnchorPointY().toString();
                    //use labels if 0, 0.5, or 1, otherwise use value for align
                    if (anchorX.equals(Double.toString(SLDs.ALIGN_LEFT))) {
                        this.place2.select(0);
                    } else if (anchorX.equals(Double.toString(SLDs.ALIGN_CENTER))) {
                        this.place2.select(1);
View Full Code Here


        return null;
    }

    @Nullable
    private PointPlacement createPointPlacement(final PJsonObject styleJson) {
        AnchorPoint anchorPoint = createAnchorPoint(styleJson);

        Displacement displacement = null;
        if (styleJson.has(JSON_LABEL_X_OFFSET) || styleJson.has(JSON_LABEL_Y_OFFSET)) {

            Expression xOffset = parseExpression(0.0, styleJson, JSON_LABEL_X_OFFSET, new Function<String, Double>() {
View Full Code Here

    @Test
    public void anchorPoint() {
        AnchorPointBuilder b = new AnchorPointBuilder();

        AnchorPoint anchor = b.build();
        assertEquals(0.0, anchor.getAnchorPointX().evaluate(null, Double.class), 0.0);
        assertEquals(0.0, anchor.getAnchorPointY().evaluate(null, Double.class), 0.0);

        anchor = b.x(0.5).y(0.9).build();
        assertEquals(0.5, anchor.getAnchorPointX().evaluate(null, Double.class), 0.0);
        assertEquals(0.9, anchor.getAnchorPointY().evaluate(null, Double.class), 0.0);

    }
View Full Code Here

    public AnchorPoint build() {
        if (unset) {
            return null;
        }
        AnchorPoint anchorPoint = sf.anchorPoint(x, y);
        if (parent == null) {
            reset();
        }
        return anchorPoint;
    }
View Full Code Here

                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) {
                        delta += anchorDelta;
                    } else {
                        delta = anchorDelta;
View Full Code Here

    symbols.add(sf.mark(ff.literal("circle"), fill, stroke)); // simple circle backup plan
   
    Expression opacity = null; // use default
    Expression size = ff.literal(10);
    Expression rotation = null; // use default
    AnchorPoint anchor = null; // use default
    Displacement displacement = null; // use default
   
    // define a point symbolizer of a small circle
    Graphic city = sf.graphic(symbols, opacity, size, rotation, anchor, displacement);
    PointSymbolizer pointSymbolizer = sf.pointSymbolizer("point", ff.property("the_geom"), null,
View Full Code Here

    // "labelPoint" feature type style
    StyleBuilder sb = new StyleBuilder();
    FilterFactory2 ff = sb.getFilterFactory();
   
    // creation of the TextSymbolizer
    AnchorPoint anchorPoint = sb.createAnchorPoint(sb.attributeExpression("X"),
            sb.attributeExpression("Y"));
    PointPlacement pointPlacement = sb.createPointPlacement(anchorPoint, null,
            sb.literalExpression(0));
    TextSymbolizer textSymbolizer = sb.createTextSymbolizer(sb.createFill(Color.BLACK), new Font[] {
            sb.createFont("Lucida Sans", 10), sb.createFont("Arial", 10) }, sb.createHalo(),
View Full Code Here

            sb.attributeExpression("size"), sb.attributeExpression("rotation"));
    style.featureTypeStyles().add(
            sb.createFeatureTypeStyle("testPoint", sb.createPointSymbolizer(graph)));
   
    // "labelPoint" feature type style
    AnchorPoint anchorPoint = sb.createAnchorPoint(sb.attributeExpression("X"),
            sb.attributeExpression("Y"));
    PointPlacement pointPlacement = sb.createPointPlacement(anchorPoint, null,
            sb.literalExpression(0));
    TextSymbolizer textSymbolizer = sb.createTextSymbolizer(sb.createFill(Color.BLACK), new Font[] {
            sb.createFont("Lucida Sans", 10), sb.createFont("Arial", 10) }, sb.createHalo(),
View Full Code Here

        ExternalGraphic[] externalGraphicsCopy = copy( gr.getExternalGraphics() );
        Mark[] marksCopy = copy( gr.getMarks() );
        Expression opacityCopy = copy( gr.getOpacity() );
        Expression rotationCopy = copy( gr.getRotation() );
        Expression sizeCopy = copy( gr.getSize() );
        AnchorPoint anchorCopy = copy( gr.getAnchorPoint() );
       
        // Looks like Symbols are a "view" of marks and external graphics?
        // Symbol[] symbolCopys = copy( gr.getSymbols() );

        copy = sf.createDefaultGraphic();
View Full Code Here

    }

    public void visit(AnchorPoint ap) {       
        Expression x = copy( ap.getAnchorPointX() );
        Expression y = copy( ap.getAnchorPointY() );
        AnchorPoint copy = sf.createAnchorPoint(x, y);
       
        if( STRICT && !copy.equals( ap)){
            throw new IllegalStateException("Was unable to duplicate provided AnchorPoint:"+ap);
        }       
        pages.push(copy);
    }
View Full Code Here

TOP

Related Classes of org.geotools.styling.AnchorPoint

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.