Class SimpleFillSymbol

  • All Implemented Interfaces:
    JsonSerializable

    public final class SimpleFillSymbol
    extends FillSymbol
    Defines a SimpleFillSymbol which is a FillSymbol based on simple pre-defined patterns.

    SimpleFillSymbols symbolize Graphics and Features having Polygon geometries, which defines how to fill it's interior using a color and a fill pattern. A LineSymbol can be used in combination with a SimpleFillSymbol to add an outline. The outline property is optional and null can be passed if no LineSymbol is given, which will add no border to this Symbol.

    Example of creating a SimpleFillSymbol with no outline:

     PointCollection points = new PointCollection(SpatialReferences.getWebMercator());
     points.add(-1.1579397849033352E7, 5618494.623878779);
     points.add(-1.158486021463032E7, 5020365.591010623);
     points.add(-1.236324731219847E7, 5009440.859816683);
     points.add(-1.2360516129399985E7, 5621225.806677263);
     Polygon square = new Polygon(points);
    
     // creates a solid red simple fill symbol
     SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, 0x88FF0000, null);
    
     // add square with symbol to graphics overlay and add overlay to map view
     GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
     mapView.getGraphicsOverlays().add(graphicsOverlay);
     graphicsOverlay.getGraphics().add(new Graphic(square, fillSymbol));
     
    A SimpleFillSymbol can be displayed using a Graphic and setting it to a GraphicsOverlay or setting the Symbol as a Renderer.
    GraphicsOverlay.getGraphics().add(new Graphic(Geometry, SimpleFillSymbol));
    OR
    GraphicsOverlay.setRender(new SimpleRenderer(SimpleFillSymbol));
    Since:
    100.0.0
    See Also:
    Graphic, GraphicsOverlay, SimpleRenderer, SimpleLineSymbol
    • Constructor Detail

      • SimpleFillSymbol

        public SimpleFillSymbol()
        Creates a new SimpleFillSymbol with default properties set. Useful if the properties of this Symbol are only known after the application is running.

        Each property can be set on its own but setting the style property by itself will have no effect on making the Symbol visible.

        Default properties:

        Since:
        100.0.0
      • SimpleFillSymbol

        public SimpleFillSymbol​(SimpleFillSymbol.Style style,
                                int color,
                                LineSymbol outline)
        Creates a new SimpleFillSymbol with the given properties:
        • Color, interior color of the Symbol.
        • Style, pattern that makes up the interior of this Symbol.
        • Outline, the LineSymbol that makes up the border of this SimpleFillSymbol.

        The outline can be left null which will apply no outline to this symbol.

        Parameters:
        style - the fill style, not null
        color - an integer representing the fill color as 0xAARRGGBB
        outline - the Symbol's outline, if any
        Throws:
        java.lang.IllegalArgumentException - if style is null
        Since:
        100.0.0
    • Method Detail

      • getStyle

        public SimpleFillSymbol.Style getStyle()
        Gets the fill style that describes how the Symbol's pattern is being displayed.

        Default value is SOLID.

        Returns:
        the current fill style for this Symbol
        Since:
        100.0.0
        See Also:
        SimpleFillSymbol.Style
      • setStyle

        public void setStyle​(SimpleFillSymbol.Style style)
        Sets the fill style that describes how this Symbol's pattern will be displayed.
        Parameters:
        style - the new fill style for this symbol, not null
        Throws:
        java.lang.IllegalArgumentException - if style is null
        Since:
        100.0.0
        See Also:
        SimpleFillSymbol.Style