Package org.geotools.styling

Examples of org.geotools.styling.Graphic


      if (isModel.getTextContent().equalsIgnoreCase("true")) {
        return parseModel(root);
      }
    }

    Graphic graphic = factory.getDefaultGraphic();

    NodeList children = root.getChildNodes();
    final int length = children.getLength();
    boolean firstGraphic = true;
    for (int i = 0; i < length; i++) {
      Node child = children.item(i);

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

      if (childName.equalsIgnoreCase("ExternalGraphic")) {
        if (LOGGER.isLoggable(Level.FINEST))
          LOGGER.finest("parsing extgraphic " + child);
        if (firstGraphic) {
          graphic.graphicalSymbols().clear();
          firstGraphic = false;
        }
        graphic.graphicalSymbols().add(parseExternalGraphic(child));
      } else if (childName.equalsIgnoreCase("Mark")) {
        if (firstGraphic) {
          graphic.graphicalSymbols().clear();
          firstGraphic = false;
        }
        graphic.graphicalSymbols().add(parseMark(child));
      } else if (childName.equalsIgnoreCase(opacityString)) {
        graphic.setOpacity(parseCssParameter(child));
      } else if (childName.equalsIgnoreCase("size")) {
        graphic.setSize(parseCssParameter(child));
      } else if (childName.equalsIgnoreCase("displacement")) {
        graphic.setDisplacement(parseDisplacement(child));
      } else if (childName.equalsIgnoreCase("rotation")) {
        graphic.setRotation(parseCssParameter(child));
      }
    }

    return graphic;
  }
View Full Code Here


        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 stroke graphicfill with " + g);
          stroke.setGraphicFill(g);
        }
      }
    }

    list = findElements(((Element) root), "GraphicStroke");
    length = list.getLength();
    if (length > 0) {
      if (LOGGER.isLoggable(Level.FINEST))
        LOGGER.finest("stroke: found a graphic stroke " + 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 stroke graphicStroke with " + g);
          stroke.setGraphicStroke(g);
        }
      }
View Full Code Here

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

        final Expression opacity;
        final Expression lineJoin;
        final Expression lineCap;
        final float[] dashArray;
        final Expression dashOffset;
        final Graphic graphicFill;
        final Graphic graphicStroke;
       
        if (stroke.getColor() == null || isStatic(stroke.getColor())) {
            color = stroke.getColor();
        } else {
            color = getLiteral(key + ".color");
View Full Code Here

    private Fill injectFill(String key, Fill fill) {
        final Expression color;
        final Expression backgroundColor = null;
        final Expression opacity;
        final Graphic graphicFill;

        if (fill.getColor() == null || isStatic(fill.getColor())) {
            color = fill.getColor();
        } else {
            color = getLiteral(key + ".color");
View Full Code Here

            if (ftStyle.rules().isEmpty()) throw new IllegalArgumentException("Rule list was empty");
            for (Rule rule : ftStyle.rules()) {
                if (rule.symbolizers().isEmpty()) throw new IllegalArgumentException("Symbolizer list was empty");
                for (Symbolizer symbolizer : rule.symbolizers()) {
                    if (symbolizer instanceof PointSymbolizer) {
                        Graphic g = ((PointSymbolizer) symbolizer).getGraphic();
                        if (g != null) {
                            Double rotation = g.getRotation() != null ? g.getRotation().evaluate(null, Double.class) : null;
                            size = Math.max(size, getGraphicSize(g, rotation));
                        }
                    } else {
                        throw new IllegalArgumentException("IconRenderer only supports PointSymbolizer");
                    }
View Full Code Here

   
    @Test
    public void testMixDynamicGraphicStroke() {
        Style style = sb.createStyle();
        FeatureTypeStyle fts1 = sb.createFeatureTypeStyle("Feature", staticPolygonRule);
        Graphic graphic = sb.createGraphic(null, sb.createMark("square"), null);
        graphic.setSize(sb.getFilterFactory().property("myAttribute"));
        LineSymbolizer ls = sb.createLineSymbolizer();
        ls.getStroke().setGraphicStroke(graphic);
        FeatureTypeStyle fts2 = sb.createFeatureTypeStyle(ls);
        style.featureTypeStyles().add(fts1);
        style.featureTypeStyles().add(fts2);
View Full Code Here

    }
   
    @Test
    public void testDynamicSymbolizerStrokeLineSymbolizer() {
        ExternalGraphic dynamicSymbolizer = sb.createExternalGraphic("file://./${myAttribute}.jpeg", "image/jpeg");
        Graphic graphic = sb.createGraphic(dynamicSymbolizer, null, null);
        LineSymbolizer ls = sb.createLineSymbolizer();
        ls.getStroke().setGraphicStroke(graphic);

        Style style = sb.createStyle(ls);
       
View Full Code Here

    }
   
    @Test
    public void testStaticGraphicLineSymbolizer() {
        ExternalGraphic dynamicSymbolizer = sb.createExternalGraphic("file://./hello.jpeg", "image/jpeg");
        Graphic graphic = sb.createGraphic(dynamicSymbolizer, null, null);
        LineSymbolizer ls = sb.createLineSymbolizer();
        ls.getStroke().setGraphicStroke(graphic);

        Style style = sb.createStyle(ls);
       
View Full Code Here

    public void testDynamicStrokeInGraphicMark() {
        Stroke markStroke = sb.createStroke();
        markStroke.setWidth(sb.getFilterFactory().property("myAttribute"));
        Mark mark = sb.createMark("square");
        mark.setStroke(markStroke);
        Graphic graphic = sb.createGraphic(null, mark, null);
        LineSymbolizer ls = sb.createLineSymbolizer();
        ls.getStroke().setGraphicStroke(graphic);

        Style style = sb.createStyle(ls);
       
View Full Code Here

TOP

Related Classes of org.geotools.styling.Graphic

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.