Package org.geotools.styling

Examples of org.geotools.styling.Fill


    public static Color polyFill( PolygonSymbolizer symbolizer ) {
        if (symbolizer == null) {
            return null;
        }

        Fill fill = symbolizer.getFill();

        if (fill == null) {
            return null;
        }

        Expression color = fill.getColor();
        return color(color);
    }
View Full Code Here


        }

        for( GraphicalSymbol gs : graphic.graphicalSymbols() ) {
            if ((gs != null) && (gs instanceof Mark)) {
                Mark mark = (Mark) gs;
                Fill fill = mark.getFill();
                if (fill != null) {
                    Color colour = color(fill.getColor());
                    if (colour == null) {
                        return null;
                    }
                    Expression opacity = fill.getOpacity();
                    if (opacity == null)
                        opacity = ff.literal(1.0);
                    float alpha = (float) Filters.asDouble(opacity);
                    colour = new Color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue() / 255f, alpha);
                    if (colour != null) {
View Full Code Here

    public void setFill( Fill fill2, Mode mode, Color defaultColor ) {
        listen(false);
        try {

            boolean enabled = true;
            Fill fill = fill2;
            if (fill == null) {
                StyleBuilder builder = new StyleBuilder();
                fill = builder.createFill(defaultColor, 0.5);
                enabled = false;
            }
View Full Code Here

                filterFactory.literal(strokeColor),
                filterFactory.literal(1),
                filterFactory.literal(0.5));

        // create a partial opaque fill
        Fill fill = styleFactory.createFill(
                filterFactory.literal(fillColor),
                filterFactory.literal(0.5));

        /*
         * Setting the geometryPropertyName arg to null signals that we want to
View Full Code Here

      if (childName.equalsIgnoreCase(geomString)) {
        symbol.setGeometry(parseGeometry(child));
      } else if (childName.equalsIgnoreCase(strokeString)) {
        symbol.setStroke(parseStroke(child));
      } else if (childName.equalsIgnoreCase(fillSt)) {
        Fill fill = parseFill(child);
        symbol.setFill(parseFill(child));
      } else if (childName.equalsIgnoreCase(VendorOptionString)) {
        parseVendorOption(symbol, child);
      }
    }
View Full Code Here

  protected Fill parseFill(Node root) {
    if (LOGGER.isLoggable(Level.FINEST)) {
      LOGGER.finest("parsing fill ");
    }

    Fill fill = new FillImpl3D();
    NodeList list = findElements(((Element) root), "GraphicFill");
    int length = list.getLength();
    if (length > 0) {
      if (LOGGER.isLoggable(Level.FINEST))
        LOGGER.finest("fill found a graphic fill " + list.item(0));

      NodeList kids = list.item(0).getChildNodes();

      for (int i = 0; i < kids.getLength(); i++) {
        Node child = kids.item(i);

        if ((child == null)
            || (child.getNodeType() != Node.ELEMENT_NODE)) {
          continue;
        }
        String childName = child.getLocalName();
        if (childName == null) {
          childName = child.getNodeName();
        }
        if (childName.equalsIgnoreCase(graphicSt)) {
          Graphic g = parseGraphic(child);
          if (LOGGER.isLoggable(Level.FINEST))
            LOGGER.finest("setting fill graphic with " + g);
          fill.setGraphicFill(g);
        }
      }
    }

    list = findElements(((Element) root), "CssParameter");
    length = list.getLength();
    for (int i = 0; i < length; i++) {
      Node child = list.item(i);

      if ((child == null) || (child.getNodeType() != Node.ELEMENT_NODE)) {
        continue;
      }

      Element param = (Element) child;
      org.w3c.dom.NamedNodeMap map = param.getAttributes();
      final int mapLength = map.getLength();
      if (LOGGER.isLoggable(Level.FINEST)) {
        LOGGER.finest("now I am processing " + child);
      }

      if (LOGGER.isLoggable(Level.FINEST)) {
        LOGGER.finest("attributes " + map.toString());
      }

      for (int k = 0; k < mapLength; k++) {
        String res = map.item(k).getNodeValue();

        if (LOGGER.isLoggable(Level.FINEST)) {
          LOGGER.finest("processing attribute " + res);
        }

        if (res.equalsIgnoreCase(fillSt)) {
          fill.setColor(parseCssParameter(child));
        } else if (res.equalsIgnoreCase(opacityString)
            || res.equalsIgnoreCase("fill-opacity")) {
          fill.setOpacity(parseCssParameter(child));
        }
      }
    }

    /*************************/
 
View Full Code Here

    }

    private Mark injectMark(String key, Mark mark) {
        final Expression wellKnownName;
        final Stroke stroke;
        final Fill fill;
        final Expression size = null; // size and fill are handled only at the PointSymbolizer level - bug?
        final Expression rotation = null;
       
        if (mark.getWellKnownName() == null || isStatic(mark.getWellKnownName())) {
            wellKnownName = mark.getWellKnownName();
View Full Code Here

                double size = font.getSize().evaluate(feature, Double.class);
                scale = Math.round(size / Font.DEFAULT_FONTSIZE * 100) / 100.0;
            }
            ls.setScale(scale);

            Fill fill = symbolizer.getFill();
            if (fill != null) {
                Double opacity = fill.getOpacity().evaluate(feature, Double.class);
                if (opacity == null || Double.isNaN(opacity)) {
                    opacity = 1.0;
                }
                Color color = fill.getColor().evaluate(feature, Color.class);
                ls.setColor(colorToHex(color, opacity));
            } else {
                ls.setColor("ffffffff");
            }
        }
View Full Code Here

                setLineStyle(style, feature, symbolizer.getStroke());
            }

            // fill
            PolyStyle ps = style.createAndSetPolyStyle();
            Fill fill = symbolizer.getFill();
            if (fill != null) {
                // get opacity
                Double opacity = fill.getOpacity().evaluate(feature, Double.class);
                if (opacity == null || Double.isNaN(opacity)) {
                    opacity = 1.0;
                }

                Color color = (Color) fill.getColor().evaluate(feature, Color.class);
                ps.setColor(colorToHex(color, opacity));
            } else {
                // make it transparent
                ps.setColor("00aaaaaa");
            }
View Full Code Here

    }

    @Override
    public void visit(Fill fill) {
        super.visit(fill);
        Fill copy = (Fill) pages.peek();
        if (copy.getGraphicFill() != null) {
            copy.setGraphicFill(null);
            copy.setColor(sb.colorExpression(Color.BLACK));
            copy.setOpacity(ff.literal(1));
        }
    }
View Full Code Here

TOP

Related Classes of org.geotools.styling.Fill

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.