Package org.geotools.styling

Examples of org.geotools.styling.Mark


            return null;
        }

        for( GraphicalSymbol gs : graphic.graphicalSymbols() ) {
            if ((gs != null) && (gs instanceof Mark)) {
                Mark mark = (Mark) gs;
                Stroke stroke = mark.getStroke();
                if (stroke != null) {
                    Color colour = color(stroke);
                    if (colour == null) {
                        return null;
                    }
View Full Code Here


         * @param attrs1
         * @param hints
         * @throws OperationNotSupportedException
         */
        public Object getValue( Element element, ElementValue[] value, Attributes attrs1, Map hints ){
            Mark symbol = StyleFactoryFinder.createStyleFactory().getDefaultMark();
   
            for (int i = 0; i < value.length; i++) {
                if ((value[i] == null) || value[i].getElement() == null) {
                    continue;
                }
   
                Element e = value[i].getElement();
                if(elems[WELLKNOWNNAME].getName().equals(e.getName()))
                    symbol.setWellKnownName((Expression)value[i].getValue());
   
                if(elems[FILL].getName().equals(e.getName()))
                    symbol.setFill((Fill)value[i].getValue());
   
                if(elems[STROKE].getName().equals(e.getName()))
                    symbol.setStroke((Stroke)value[i].getValue());
            }
           
            return symbol;
        }
View Full Code Here

         */
             
        protected void processSymbolizer(SimpleFeature ft, Rule rule,Symbolizer symbolizer) throws IOException{
          super.processSymbolizer(ft, rule,symbolizer);
          if(symbolizer instanceof PointSymbolizer) {
            Mark mark=SLD.mark((PointSymbolizer)symbolizer);
            Graphic graphic=SLD.graphic((PointSymbolizer)symbolizer);
            if(graphic!=null && mark!=null) {
              Object oSize=graphic.getSize().evaluate(null);
              if(oSize!=null)
                size=Double.parseDouble(oSize.toString());
View Full Code Here

    /**
     * Create a Style to draw point features as circles with blue outlines
     * and cyan fill
     */
    private static Style createPointStyle(Color strokeColor, Color fillColor) {
        Mark mark = styleFactory.getCircleMark();
        mark.setStroke(styleFactory.createStroke(filterFactory.literal(strokeColor), filterFactory.literal(2)));
        mark.setFill(styleFactory.createFill(filterFactory.literal(fillColor)));

        Graphic gr = styleFactory.createDefaultGraphic();
        gr.graphicalSymbols().clear();
        gr.graphicalSymbols().add(mark);
        gr.setSize(filterFactory.literal(5));
View Full Code Here

            if (g.getSize() != null && !isStatic(g.getSize())) {
                props.put(prefix + SIZE, g.getSize().evaluate(feature, String.class));
            }
            if (!g.graphicalSymbols().isEmpty()) {
                if (g.graphicalSymbols().get(0) instanceof Mark) {
                    Mark mark = (Mark) g.graphicalSymbols().get(0);
                    addMarkProperties(prefix, mark, props);
                } else if (g.graphicalSymbols().get(0) instanceof ExternalGraphic) {
                    ExternalGraphic exGraphic = (ExternalGraphic) g.graphicalSymbols().get(0);
                    addExternalGraphicProperties(prefix, exGraphic, props);
                }
View Full Code Here

  protected Mark parseMark(Node root) {
    if (LOGGER.isLoggable(Level.FINEST)) {
      LOGGER.finest("parsing mark");
    }

    Mark mark = factory.createMark();
    mark.setFill(null);
    mark.setStroke(null);

    NodeList children = root.getChildNodes();
    final int length = children.getLength();
    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(strokeString)) {
        mark.setStroke(parseStroke(child));
      } else if (childName.equalsIgnoreCase(fillSt)) {
        mark.setFill(parseFill(child));
      } else if (childName.equalsIgnoreCase("WellKnownName")) {
        if (LOGGER.isLoggable(Level.FINEST))
          LOGGER.finest("setting mark to "
              + getFirstChildValue(child));
        mark.setWellKnownName(parseCssParameter(child));
      }
    }

    return mark;
  }
View Full Code Here

   
    @Test
    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

   
    @Test // this one should fail now??
    public void testDynamicStrokeInGraphicFill() {
        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);
        PolygonSymbolizer ps = sb.createPolygonSymbolizer();
        ps.getFill().setGraphicFill(graphic);

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

        }
        {
            FeatureTypeStyle fts = assumeSingleElement(result.featureTypeStyles());
            Rule rule = assertSingleElement(fts.rules());
            PointSymbolizer symb = assertSingleElement(rule.symbolizers(), PointSymbolizer.class);
            Mark mark = assertSingleElement(symb.getGraphic().graphicalSymbols(), Mark.class);
            assertThat(mark.getFill().getColor().evaluate(null, Color.class), is(Color.RED));
        }
    }
View Full Code Here

        }
        {
            FeatureTypeStyle fts = assumeSingleElement(result.featureTypeStyles());
            Rule rule = assertSingleElement(fts.rules());
            PointSymbolizer symb = assertSingleElement(rule.symbolizers(), PointSymbolizer.class);
            Mark mark = assertSingleElement(symb.getGraphic().graphicalSymbols(), Mark.class);
            assertThat(mark.getFill().getColor().evaluate(null, Color.class), is(Color.BLUE));
        }
    }
View Full Code Here

TOP

Related Classes of org.geotools.styling.Mark

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.