Package org.geotools.styling

Examples of org.geotools.styling.Stroke


    public Stroke build() {
        if (unset) {
            return null;
        }
        Stroke stroke = sf.createStroke(color, width, opacity, lineJoin, lineCap, dashArray,
                dashOffset, graphicFill.build(), this.graphicStroke.build());
        if (parent == null) {
            reset();
        }
        return stroke;
View Full Code Here


     * we are displaying.
     */
    private Rule createRule(Color outlineColor, Color fillColor) {
        Symbolizer symbolizer = null;
        Fill fill = null;
        Stroke stroke = sf.createStroke(ff.literal(outlineColor), ff.literal(LINE_WIDTH));

        switch (geometryType) {
            case POLYGON:
                fill = sf.createFill(ff.literal(fillColor), ff.literal(OPACITY));
                symbolizer = sf.createPolygonSymbolizer(stroke, fill, geometryAttributeName);
View Full Code Here

  }

  private LineSymbolizer linesym(StyleFactory sFac)
      throws IllegalFilterException {
    LineSymbolizer linesym = sFac.createLineSymbolizer();
    Stroke myStroke = sFac.getDefaultStroke();
    myStroke.setColor(filterFactory.literal("#0000ff"));
    myStroke
        .setWidth(filterFactory.literal(new Integer(5)));
    LOGGER.fine("got new Stroke " + myStroke);
    linesym.setStroke(myStroke);
    return linesym;
  }
View Full Code Here

    return linesym;
  }

  private PolygonSymbolizer polysym(StyleFactory sFac)
      throws IllegalFilterException {
    Stroke myStroke;
    PolygonSymbolizer polysym = sFac.createPolygonSymbolizer();
    Fill myFill = sFac.getDefaultFill();
    myFill.setColor(filterFactory.literal("#ff0000"));
    polysym.setFill(myFill);
    myStroke = sFac.getDefaultStroke();
    myStroke.setColor(filterFactory.literal("#0000ff"));
    myStroke
        .setWidth(filterFactory.literal(new Integer(2)));
    polysym.setStroke(myStroke);
    return polysym;
  }
View Full Code Here

    return polysym;
  }

  private PolygonSymbolizer polysym1(StyleFactory sFac)
      throws IllegalFilterException {
    Stroke myStroke;
    PolygonSymbolizer polysym = sFac.createPolygonSymbolizer();
    Fill myFill = sFac.getDefaultFill();
    myFill.setColor(filterFactory.literal("#00ff00"));
    polysym.setFill(myFill);
    myStroke = sFac.getDefaultStroke();
    myStroke.setColor(filterFactory.literal("#00ff00"));
    myStroke
        .setWidth(filterFactory.literal(new Integer(2)));
    polysym.setStroke(myStroke);
    return polysym;
  }
View Full Code Here

    ftsP.setFeatureTypeName("querytest");

    LineSymbolizer linesym = sFac.createLineSymbolizer();
    linesym.setGeometryPropertyName("line");

    Stroke myStroke = sFac.getDefaultStroke();
    myStroke.setColor(filterFactory.literal("#0000ff"));
    myStroke
        .setWidth(filterFactory.literal(new Integer(3)));
    LOGGER.info("got new Stroke " + myStroke);
    linesym.setStroke(myStroke);

    Rule rule2 = sFac.createRule();
View Full Code Here

     * a cyan fill
     */
    private Style createPolygonStyle() {

        // create a partially opaque outline stroke
        Stroke stroke = styleFactory.createStroke(
                filterFactory.literal(Color.BLUE),
                filterFactory.literal(1),
                filterFactory.literal(0.5));

        // create a partial opaque fill
View Full Code Here

   
    /**
     * Create a Style to draw line features as thin blue lines
     */
    private Style createLineStyle() {
        Stroke stroke = styleFactory.createStroke(
                filterFactory.literal(Color.BLUE),
                filterFactory.literal(1));

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

    /**
     * Computes and returns the stroke
     */
    public java.awt.Stroke getStroke() {
        Stroke stroke = ls.getStroke();

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

        // resolve join type into a join code
        String joinType;
        int joinCode;

        joinType = evaluateExpression(stroke.getLineJoin(), feature, "miter");

        joinCode = SLDStyleFactory.lookUpJoin(joinType);

        // resolve cap type into a cap code
        String capType;
        int capCode;

        capType = evaluateExpression(stroke.getLineCap(), feature, "square");
        capCode = SLDStyleFactory.lookUpCap(capType);

        // get the other properties needed for the stroke
        float[] dashes = stroke.getDashArray();
        float width = ((Float) stroke.getWidth().evaluate(feature, Float.class)).floatValue();
        float dashOffset = ((Float) stroke.getDashOffset().evaluate(feature, Float.class)).floatValue();

        // Simple optimization: let java2d use the fast drawing path if the line width
        // is small enough...
        if (width <= 1) {
            width = 0;
View Full Code Here

    /**
     * Computes and returns the contour style
     */
    public java.awt.Composite getContourComposite() {
        Stroke stroke = ls.getStroke();

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

        float opacity = ((Float) stroke.getOpacity().evaluate(feature,Float.class)).floatValue();
        Composite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity);

        return composite;
    }
View Full Code Here

TOP

Related Classes of org.geotools.styling.Stroke

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.