Interface Stroke

  • All Known Implementing Classes:
    Stroke.ConstantStroke, StrokeImpl

    public interface Stroke
    Contains all the information needed to draw styled lines. Stroke objects are contained by LineSymbolizers and PolygonSymbolizers. There are three basic types of strokes: solid-color, GraphicFill (stipple), and repeated linear GraphicStroke. A repeated linear graphic is plotted linearly and has its graphic symbol bent around the curves of the line string, and a graphic fill has the pixels of the line rendered with a repeating area-fill pattern. If neither a GraphicFill nor GraphicStroke element is given, then the line symbolizer will render a solid color.
    Since:
    GeoAPI 2.2
    Author:
    Open Geospatial Consortium, Johann Sorel (Geomatys), Chris Dillard (SYS Technologies)
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  Stroke.ConstantStroke  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void accept​(StyleVisitor visitor)  
      Object accept​(TraversingStyleVisitor visitor, Object extraData)
      calls the visit method of a StyleVisitor
      List<Expression> dashArray()
      This parameter encodes the dash pattern as a seqeuence of floats.
      The first number gives the length in pixels of the dash to draw, the second gives the amount of space to leave, and this pattern repeats.
      If an odd number of values is given, then the pattern is expanded by repeating it twice to give an even number of values.
      Expression getColor()
      Indicates the color of the line if it is to be solid-color filled.
      float[] getDashArray()
      If present, indicates the dash pattern as a space-separated sequence of floating point numbers.
      Expression getDashOffset()
      A dash array need not start from the beginning.
      Graphic getGraphicFill()
      This parameter indicates that a stipple-fill repeated graphic will be used and specifies the fill graphic to use.
      Graphic getGraphicStroke()
      This parameter indicates that a repeated-linear-graphic graphic stroke type will be used and specifies the graphic to use.
      Expression getLineCap()
      This parameter controls how line strings should be capped.
      Expression getLineJoin()
      This parameter controls how line strings should be joined together.
      Expression getOpacity()
      Indicates the level of translucency as a floating point number whose value is between 0.0 and 1.0 (inclusive).
      Expression getWidth()
      Gives the absolute width in uoms of the line stroke as a floating point number.
      void setColor​(Expression color)
      This parameter gives the solid color that will be used for a stroke.
      The color value is RGB-encoded using two hexidecimal digits per primary-color component in the order Red, Green, Blue, prefixed wih the hash (#) sign.
      void setDashArray​(float[] dashArray)
      Shortcut to define dash array using literal numbers.
      void setDashArray​(List<Expression> dashArray)
      This parameter encodes the dash pattern as a list of expressions.
      The first expression gives the length in pixels of the dash to draw, the second gives the amount of space to leave, and this pattern repeats.
      If an odd number of values is given, then the pattern is expanded by repeating it twice to give an even number of values.
      void setDashOffset​(Expression dashOffset)
      A dash array need not start from the beginning.
      void setGraphicFill​(Graphic graphicFill)
      This parameter indicates that a stipple-fill repeated graphic will be used and specifies the fill graphic to use.
      void setGraphicStroke​(Graphic graphicStroke)
      This parameter indicates that a repeated-linear-graphic graphic stroke type will be used and specifies the graphic to use.
      void setLineCap​(Expression lineCap)
      This parameter controls how line strings should be capped.
      void setLineJoin​(Expression lineJoin)
      This parameter controls how line strings should be joined together.
      void setOpacity​(Expression opacity)
      This specifies the level of translucency to use when rendering the stroke.
      The value is encoded as a floating-point value between 0.0 and 1.0 with 0.0 representing totally transparent and 1.0 representing totally opaque.
      void setWidth​(Expression width)
      This parameter gives the absolute width (thickness) of a stroke in pixels encoded as a float.
    • Method Detail

      • setDashOffset

        void setDashOffset​(Expression dashOffset)
        A dash array need not start from the beginning. This method allows for an offset into the dash array before starting it.
      • getGraphicFill

        Graphic getGraphicFill()
        This parameter indicates that a stipple-fill repeated graphic will be used and specifies the fill graphic to use.
        Returns:
        The graphic to use as a stipple fill. If null, then no Stipple fill should be used.
      • setGraphicFill

        void setGraphicFill​(Graphic graphicFill)
        This parameter indicates that a stipple-fill repeated graphic will be used and specifies the fill graphic to use.
      • getGraphicStroke

        Graphic getGraphicStroke()
        This parameter indicates that a repeated-linear-graphic graphic stroke type will be used and specifies the graphic to use.

        Proper stroking with a linear graphic requires two "hot-spot" points within the space of the graphic to indicate where the rendering line starts and stops. In the case of raster images with no special mark-up, this line will be assumed to be the middle pixel row of the image, starting from the first pixel column and ending at the last pixel column.

        Returns:
        The graphic to use as a linear graphic. If null, then no graphic stroke should be used.
      • getColor

        Expression getColor()
        Indicates the color of the line if it is to be solid-color filled. The format of color values is "#rrggbb" where rr, gg, and bb, are red, green, and blue intensity values, respectively, represented as two digit hexadecimal integers. The hexadecimal digits between A and F may be in either uppercase or lowercase. If null, the default color is "#000000", black.
        Returns:
        Expression
      • getOpacity

        Expression getOpacity()
        Indicates the level of translucency as a floating point number whose value is between 0.0 and 1.0 (inclusive). A value of zero means completely transparent. A value of 1.0 means completely opaque. If null, the default value is 1.0, totally opaque.
        Returns:
        expression
      • getWidth

        Expression getWidth()
        Gives the absolute width in uoms of the line stroke as a floating point number. Fractional numbers are allowed (with system-dependent interpretation), but negative numbers are not. If null, the default value is 1.0.
        Returns:
        expression
      • setColor

        void setColor​(Expression color)
        This parameter gives the solid color that will be used for a stroke.
        The color value is RGB-encoded using two hexidecimal digits per primary-color component in the order Red, Green, Blue, prefixed wih the hash (#) sign. The hexidecimal digits between A and F may be in either upper or lower case. For example, full red is encoded as "#ff0000" (with no quotation marks).

        Note: in CSS this parameter is just called Stroke and not Color.

      • setWidth

        void setWidth​(Expression width)
        This parameter gives the absolute width (thickness) of a stroke in pixels encoded as a float. Fractional numbers are allowed but negative numbers are not.
      • setOpacity

        void setOpacity​(Expression opacity)
        This specifies the level of translucency to use when rendering the stroke.
        The value is encoded as a floating-point value between 0.0 and 1.0 with 0.0 representing totally transparent and 1.0 representing totally opaque. A linear scale of translucency is used for intermediate values.
        For example, "0.65" would represent 65% opacity.
      • getLineJoin

        Expression getLineJoin()
        This parameter controls how line strings should be joined together.
      • setLineJoin

        void setLineJoin​(Expression lineJoin)
        This parameter controls how line strings should be joined together.
      • getLineCap

        Expression getLineCap()
        This parameter controls how line strings should be capped.
      • getDashArray

        float[] getDashArray()
        If present, indicates the dash pattern as a space-separated sequence of floating point numbers. The first number represents the length of the first dash to draw. The second number represents the length of space to leave. This continues to the end of the list then repeats. If the list contains an odd number of values, then before rendering the list is enlarged by repeating the last value. If this parameter is omitted, lines will be drawn as solid and unbroken.
        Returns:
        expression
      • setLineCap

        void setLineCap​(Expression lineCap)
        This parameter controls how line strings should be capped.
      • setDashArray

        void setDashArray​(float[] dashArray)
        Shortcut to define dash array using literal numbers.
      • dashArray

        List<Expression> dashArray()
        This parameter encodes the dash pattern as a seqeuence of floats.
        The first number gives the length in pixels of the dash to draw, the second gives the amount of space to leave, and this pattern repeats.
        If an odd number of values is given, then the pattern is expanded by repeating it twice to give an even number of values.

        For example, "2 1 3 2" would produce:
        -- ---  -- ---  -- ---   -- ---  -- ---  --

      • setDashArray

        void setDashArray​(List<Expression> dashArray)
        This parameter encodes the dash pattern as a list of expressions.
        The first expression gives the length in pixels of the dash to draw, the second gives the amount of space to leave, and this pattern repeats.
        If an odd number of values is given, then the pattern is expanded by repeating it twice to give an even number of values.

        For example, "2 1 3 2" would produce:
        -- ---  -- ---  -- ---   -- ---  -- ---  --

      • getDashOffset

        Expression getDashOffset()
        A dash array need not start from the beginning. This method allows for an offset into the dash array before starting it.
      • setGraphicStroke

        void setGraphicStroke​(Graphic graphicStroke)
        This parameter indicates that a repeated-linear-graphic graphic stroke type will be used and specifies the graphic to use.

        Proper stroking with a linear graphic requires two "hot-spot" points within the space of the graphic to indicate where the rendering line starts and stops. In the case of raster images with no special mark-up, this line will be assumed to be the middle pixel row of the image, starting from the first pixel column and ending at the last pixel column.