Package org.geotools.styling

Examples of org.geotools.styling.Mark


    SymbolInfo info = featureStyle.getSymbol();
    if (info.getImage() != null) {
      return styleBuilder.createExternalGraphic(getURL(info.getImage().getHref()),
          getFormat(info.getImage().getHref()));
    } else {
      Mark mark = null;
      if (info.getRect() != null) {
        // TODO: do rectangles by adding custom factory ?
        mark = styleBuilder.createMark("square");
        mark.setSize(styleBuilder.literalExpression((int) info.getRect().getW()));
      } else if (info.getCircle() != null) {
        mark = styleBuilder.createMark("circle");
        mark.setSize(styleBuilder.literalExpression(2 * (int) info.getCircle().getR()));
      }
      mark.setFill(createFill(featureStyle));
      mark.setStroke(createStroke(featureStyle));
      return mark;
    }
  }
View Full Code Here


            return null;
        }

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

            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 build
     * @return Graphic defined by this model
     */
    public Graphic getGraphic(Fill filll, Stroke stroke, StyleBuilder build ) {
        if(!this.enabled) {
            Mark mark = null;
            if(this.type == null) {
                build.createMark("square", null, null); //$NON-NLS-1$
            } else {
                mark = build.createMark(this.type, (Fill)null, (Stroke)null);
            }
            return build.createGraphic(null, mark, null);
        }
        Mark mark = build.createMark(this.type, filll, stroke);
        Graphic graphic = build.createGraphic(null, mark, null);
        graphic.setSize(build.literalExpression(this.width));
        return graphic;
    }
View Full Code Here

        if (graphic != null && graphic.graphicalSymbols() != null
                && !graphic.graphicalSymbols().isEmpty()) {
       
            for( GraphicalSymbol symbol : graphic.graphicalSymbols() ) {
                if (symbol instanceof Mark) {
                    Mark mark = (Mark) symbol;
                    setMark(mark, mode);
                    marked = true;
                    break;
                }
            }
View Full Code Here

     *
     * @return the default rule.
     */
    public static Rule createDefaultPointRule() {
        Graphic graphic = sf.createDefaultGraphic();
        Mark circleMark = sf.getCircleMark();
        circleMark.setFill(sf.createFill(ff.literal(Color.red)));
        circleMark.setStroke(sf.createStroke(ff.literal(Color.BLACK), ff.literal(DEFAULT_WIDTH)));
        graphic.graphicalSymbols().clear();
        graphic.graphicalSymbols().add(circleMark);
        graphic.setSize(ff.literal(DEFAULT_SIZE));

        PointSymbolizer pointSymbolizer = sf.createPointSymbolizer();
View Full Code Here

     * @param rule the rule of which the mark has to be changed.
     * @param wellKnownMarkName the name of the new mark.
     */
    public static void substituteMark( Rule rule, String wellKnownMarkName ) {
        PointSymbolizer pointSymbolizer = Utilities.pointSymbolizerFromRule(rule);
        Mark oldMark = SLDs.mark(pointSymbolizer);

        Graphic graphic = SLDs.graphic(pointSymbolizer);
        graphic.graphicalSymbols().clear();
       
        Mark mark = Utilities.sf.createMark();
        mark.setWellKnownName(Utilities.ff.literal(wellKnownMarkName));
        if (oldMark != null) {
            mark.setFill(oldMark.getFill());
            mark.setStroke(oldMark.getStroke());
        }
        graphic.graphicalSymbols().add(mark);
    }
View Full Code Here

        if (Point.class.isAssignableFrom(type) || MultiPoint.class.isAssignableFrom(type)) {
            PointSymbolizer point = builder.createPointSymbolizer(builder.createGraphic());
            FilterFactory ff = builder.getFilterFactory();
            // point.getGraphic().getMarks()[0].setSize((Expression) ff.literal(10));
            point.getGraphic().setSize(ff.literal(10));
            Mark mark = (Mark) point.getGraphic().graphicalSymbols().get(0);
            mark.setFill(builder.createFill(baseColor));
            syms[0] = point;
        }
        if (Polygon.class.isAssignableFrom(type) || MultiPolygon.class.isAssignableFrom(type)) {
            syms[0] = builder.createPolygonSymbolizer(builder.createStroke(baseColor, 2),
                    builder.createFill(baseColor, useTransparency ? .6 : 1.0));
View Full Code Here

        if (Point.class.isAssignableFrom(type) || MultiPoint.class.isAssignableFrom(type)) {
            PointSymbolizer point = builder.createPointSymbolizer(builder.createGraphic());
            FilterFactory ff = builder.getFilterFactory();

            point.getGraphic().setSize(ff.literal(10));
            Mark mark = (Mark) point.getGraphic().graphicalSymbols().get(0);
            mark.setFill(builder.createFill(baseColor));
            syms[0] = point;
        }
        if (Polygon.class.isAssignableFrom(type) || MultiPolygon.class.isAssignableFrom(type)) {
            syms[0] = builder.createPolygonSymbolizer(builder.createStroke(baseColor, 2),
                    builder.createFill(baseColor, useTransparency ? .6 : 1.0));
View Full Code Here

          PointSymbolizer point = builder.createPointSymbolizer(builder.createGraphic());
          FilterFactory filterFactory = builder.getFilterFactory();
          point.getGraphic().setSize( filterFactory.literal(10));
            for( GraphicalSymbol symbol : point.getGraphic().graphicalSymbols() ){
                if( symbol instanceof Mark){
                    Mark mark = (Mark) symbol;
                    mark.setFill( builder.createFill( baseColor ));
                }
            }
          syms[0]=point;
        }
        if( Polygon.class.isAssignableFrom(type) ||
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.