Class SimpleFillSymbol

All Implemented Interfaces:
JsonSerializable

public final class SimpleFillSymbol extends FillSymbol
Uses predefined patterns and colors to symbolize graphics and features that have polygon geometry.

Simple fill symbols can fill the interior of polygons using predefined fill patterns such as SimpleFillSymbol.Style.BACKWARD_DIAGONAL, SimpleFillSymbol.Style.VERTICAL, SimpleFillSymbol.Style.HORIZONTAL and SimpleFillSymbol.Style.CROSS, as well as SimpleFillSymbol.Style.SOLID colors. These symbols can have an optional outline, which is defined by SimpleLineSymbol.

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:
  • Constructor Details

    • SimpleFillSymbol

      public SimpleFillSymbol()
      Creates a simple fill symbol object with default values.

      The default values are:

      This is useful if the properties of the symbol are only known after the application is running.

      Since:
      100.0.0
    • SimpleFillSymbol

      @Deprecated(since="200.0.0", forRemoval=true) public SimpleFillSymbol(SimpleFillSymbol.Style style, int color, LineSymbol outline)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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:
      IllegalArgumentException - if style is null
      Since:
      100.0.0
    • SimpleFillSymbol

      public SimpleFillSymbol(SimpleFillSymbol.Style style, Color color, LineSymbol outline)
      Creates a simple fill symbol object with a color, style and outline.
      Parameters:
      style - the type of simple fill symbol to create, not null
      color - the color of the simple fill symbol
      outline - the outline of the simple fill symbol, may be null
      Throws:
      IllegalArgumentException - if style is null
      IllegalArgumentException - if color is null
      Since:
      200.0.0
  • Method Details

    • toMultilayerSymbol

      public MultilayerPolygonSymbol toMultilayerSymbol()
      Gets a MultilayerPolygonSymbol from a SimpleFillSymbol.

      This method allows you to create complex and custom symbols with multiple layers of different types of symbology. Simple fill symbol provides a factory of predefined fill styles such as cross and backward_diagonal. This method generates a MultilayerPolygonSymbol with a HatchFillSymbolLayer for any of the styles containing lines, or a SolidFillSymbolLayer if the fill style is SimpleFillSymbol.Style.SOLID.

      Returns:
      a converted multilayer polygon symbol
      Since:
      100.5.0
    • 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:
    • 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:
      IllegalArgumentException - if style is null
      Since:
      100.0.0
      See Also: