Examples of Graphic


Examples of org.geotools.styling.Graphic

        }
       
//        IProgressMonitor monitor = new NullProgressMonitor();
//        getSelectedLayer().getResource(FeatureSource.class, monitor);
       
        Graphic g = sym.getGraphic();
        Expression opacity = g.getOpacity();
        Expression rotation = g.getRotation();
        Expression size = g.getSize();
        AnchorPoint anchor = g.getAnchorPoint();
        Displacement displacement = g.getDisplacement();
       
       
    }
View Full Code Here

Examples of org.geotools.styling.Graphic

    protected PointSymbolizer createPointSymbolizer( Color colour, int size ) {
        Fill fill = styleBuilder.createFill(Color.YELLOW, 0.0);
        Stroke stroke = builder.createStroke(colour, 2);
        Mark mark = styleBuilder.createMark("square", fill, stroke); //$NON-NLS-1$

        Graphic graph2 = styleBuilder.createGraphic(null, mark, null, 1, size, 0);
        PointSymbolizer symb = styleBuilder.createPointSymbolizer(graph2);

        symb.getGraphic().setMarks(new Mark[]{mark});

        return symb;
View Full Code Here

Examples of org.geotools.styling.Graphic

        Symbolizer[] symbolizers = SLDs.symbolizers(style);
        if (symbolizers.length > 0) {
            Symbolizer symbolizer = symbolizers[0];
            if (symbolizer instanceof PointSymbolizer) {
                PointSymbolizer previousSymbolizer = (PointSymbolizer) symbolizer;
                Graphic oldGraphic = SLDs.graphic(previousSymbolizer);
                Mark oldMark = SLDs.mark(previousSymbolizer);
                if (oldMark != null) {
                    // we apply the properties to all the new rules
                    List<Rule> rules = newFTS.rules();
                    for( Rule rule : rules ) {
                        String[] colors = SLDs.colors(rule);
                        Color fill = SLDs.toColor(colors[0]);

                        List<Symbolizer> newSymbolizers = rule.symbolizers();
                        for( Symbolizer newSymbolizer : newSymbolizers ) {
                            if (newSymbolizer instanceof PointSymbolizer) {
                                PointSymbolizer newPointSymbolizer = (PointSymbolizer) newSymbolizer;

                                Mark mark = sb.createMark(oldMark.getWellKnownName().evaluate(null, String.class));
                                Fill newFill = sb.createFill(fill);
                                newFill.setOpacity(ff.literal(opac));
                                mark.setFill(newFill);

                                Stroke newStroke = oldMark.getStroke();
                                if (newStroke != null) {
                                    if (borderColor!=null) {
                                        newStroke.setColor(ff.literal(borderColor));
                                        mark.setStroke(newStroke);
                                    }else{
                                        mark.setStroke(null);
                                    }
                                }

                                Graphic newGraphic = SLDs.graphic(newPointSymbolizer);
                                newGraphic.setSize(oldGraphic.getSize());
                                newGraphic.setRotation( oldGraphic.getRotation());
                                newGraphic.graphicalSymbols().clear();
                                newGraphic.graphicalSymbols().add(mark);
                                break;
                            }
                        }
                    }
                }
View Full Code Here

Examples of org.geotools.styling.Graphic

        if (this.allowNullSymbolizer && !(styleJson.has(JSON_EXTERNAL_GRAPHIC) || styleJson.has(JSON_GRAPHIC_NAME) ||
                                          styleJson.has(JSON_POINT_RADIUS))) {
            return null;
        }

        Graphic graphic = this.styleBuilder.createGraphic();
        graphic.graphicalSymbols().clear();
        if (styleJson.has(JSON_EXTERNAL_GRAPHIC)) {
            String externalGraphicUrl = validateURL(styleJson.getString(JSON_EXTERNAL_GRAPHIC));
            final String graphicFormat = getGraphicFormat(externalGraphicUrl, styleJson);
            final ExternalGraphic externalGraphic = this.styleBuilder.createExternalGraphic(externalGraphicUrl, graphicFormat);

            graphic.graphicalSymbols().add(externalGraphic);
        }

        if (styleJson.has(JSON_GRAPHIC_NAME)) {
            Expression graphicName = parseProperty(styleJson.getString(JSON_GRAPHIC_NAME), new Function<String, Object>() {
                public Object apply(final String input) {
                    return input;
                }
            });
            Fill fill = createFill(styleJson);
            Stroke stroke = createStroke(styleJson, false);

            final Mark mark = this.styleBuilder.createMark(graphicName, fill, stroke);
            graphic.graphicalSymbols().add(mark);
        }

        if (graphic.graphicalSymbols().isEmpty()) {
            Fill fill = createFill(styleJson);
            Stroke stroke = createStroke(styleJson, false);

            final Mark mark = this.styleBuilder.createMark(DEFAULT_POINT_MARK, fill, stroke);
            graphic.graphicalSymbols().add(mark);
        }

        graphic.setOpacity(parseExpression(null, styleJson, JSON_GRAPHIC_OPACITY, new Function<String, Object>() {
            @Nullable
            @Override
            public Object apply(final String opacityString) {
                return Double.parseDouble(opacityString);
            }
        }));

        if (!Strings.isNullOrEmpty(styleJson.optString(JSON_POINT_RADIUS))) {
            Expression size = parseExpression(null, styleJson, JSON_POINT_RADIUS, new Function<String, Object>() {
                @Nullable
                @Override
                public Object apply(final String input) {
                    return Double.parseDouble(input) * 2;
                }
            });
            graphic.setSize(size);
        } else if (!Strings.isNullOrEmpty(styleJson.optString(JSON_GRAPHIC_WIDTH))) {
            Expression size = parseExpression(null, styleJson, JSON_GRAPHIC_WIDTH, new Function<String, Object>() {
                @Nullable
                @Override
                public Object apply(final String input) {
                    return Double.parseDouble(input);
                }
            });
            graphic.setSize(size);
        }

        if (!Strings.isNullOrEmpty(styleJson.optString(JSON_ROTATION))) {
            final Expression rotation = parseExpression(null, styleJson, JSON_ROTATION, new Function<String, Object>() {
                @Nullable
                @Override
                public Object apply(final String rotation) {
                    return Double.parseDouble(rotation);
                }
            });
            graphic.setRotation(rotation);
        }

        return this.styleBuilder.createPointSymbolizer(graphic);
    }
View Full Code Here

Examples of org.geotools.styling.Graphic

        PointSymbolizer symbolizer = helper.createPointSymbolizer(new PJsonObject(style, null));
        assertNotNull(symbolizer);
        transformer.transform(symbolizer); // assert it can be converted to SLD

        final Graphic graphic = symbolizer.getGraphic();
        assertNotNull(graphic);

        final List<GraphicalSymbol> graphicalSymbols = graphic.graphicalSymbols();

        assertEquals(1, graphicalSymbols.size());

        ExternalGraphic externalGraphic = (ExternalGraphic) graphicalSymbols.get(0);
        assertEquals("image/png", externalGraphic.getFormat());
View Full Code Here

Examples of org.geotools.styling.Graphic

        final PointSymbolizer symbolizer = helper.createPointSymbolizer(new PJsonObject(style, null));
        assertNotNull(symbolizer);

        transformer.transform(symbolizer); // verify it can be encoded without exceptions

        final Graphic graphic = symbolizer.getGraphic();
        assertEquals(1, graphic.graphicalSymbols().size());

        Mark externalGraphic = (Mark) graphic.graphicalSymbols().get(0);

        assertEquals("circle", valueOf(externalGraphic.getWellKnownName()));

        assertFill(fillOpacity, "#EEEEEE", externalGraphic.getFill());

        assertStroke(stokeOpacity, lineCap, externalGraphic.getStroke(), "#FFFFFF", new float[]{5f, 2f}, 2.0);

        assertEquals(0.4, valueOf(graphic.getOpacity()));
        assertEquals(10.0, valueOf(graphic.getSize()));
        assertEquals(90.0, valueOf(graphic.getRotation()));
    }
View Full Code Here

Examples of org.geotools.styling.Graphic

        JSONObject json = new JSONObject();
        PJsonObject pJson = new PJsonObject(json, "symbolizers");
        final PointSymbolizer pointSymbolizer = this.helper.createPointSymbolizer(pJson);
        assertNotNull(pointSymbolizer);

        final Graphic graphic = pointSymbolizer.getGraphic();
        assertEquals(1, graphic.graphicalSymbols().size());
        Mark mark = (Mark) graphic.graphicalSymbols().get(0);

        assertEquals("circle", valueOf(mark.getWellKnownName()));
        assertNotNull(mark.getFill());
        assertNotNull(mark.getStroke());
    }
View Full Code Here

Examples of org.geotools.styling.Graphic

        PJsonObject pJson = new PJsonObject(json, "symbolizers");
        final PointSymbolizer pointSymbolizer = this.helper.createPointSymbolizer(pJson);
        assertNotNull(pointSymbolizer);

        final Graphic graphic = pointSymbolizer.getGraphic();
        Mark mark = (Mark) graphic.graphicalSymbols().get(0);
        Stroke stroke = mark.getStroke();
        assertArrayEquals(Arrays.toString(stroke.getDashArray()), new float[]{5f, 4f}, stroke.getDashArray(), FLOAT_DELTA);
    }
View Full Code Here

Examples of org.geotools.styling.Graphic

        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));

        final Graphic graphic = pointSymbolizer.getGraphic();
        assertEquals("rotation", propertyName(graphic.getRotation()));
        assertEquals("graphicOpacity", propertyName(graphic.getOpacity()));
        assertEquals("pointRadius", propertyName(graphic.getSize()));

        Mark mark = (Mark) graphic.graphicalSymbols().get(0);
        assertEquals("graphicName", propertyName(mark.getWellKnownName()));

        assertEquals("fillOpacity", propertyName(mark.getFill().getOpacity()));
        assertEquals("fillColor", propertyName(mark.getFill().getColor()));
View Full Code Here

Examples of org.gudy.azureus2.plugins.ui.Graphic

        gcImage.fillRectangle(x0,y0,newWidth,y1);
    }
    gcImage.dispose();

    Image oldImage = null;
    Graphic graphic = cell.getGraphic();
    if (graphic instanceof UISWTGraphic) {
      oldImage = ((UISWTGraphic) graphic).getImage();
    }
    if (bImageChanged || image != oldImage || !cell.isValid()) {
      if (cell instanceof TableCellSWT) {
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.