Class SimpleRenderer

java.lang.Object
com.esri.arcgisruntime.symbology.Renderer
com.esri.arcgisruntime.symbology.SimpleRenderer
All Implemented Interfaces:
JsonSerializable

public final class SimpleRenderer extends Renderer
A simple renderer uses a single Symbol to draw all features and graphics.

Properties of a SimpleRenderer:

  • Symbol, the Symbol that is used to draw Features/Graphics to a GeoView.
  • Description, gives detail information about what this Renderer's does.
  • Label, name that this Renderer can be referred to.

Example of creating a SimpleRender:

 // create a mapView
 ...
 // create a GraphicsOverlay and set it to the mapView
 GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
 mapView.getGraphicsOverlays().add(graphicsOverlay);

 SimpleMarkerSymbol symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.TRIANGLE, 0xffff0000, 5);
 SimpleRenderer simpleRenderer = new SimpleRenderer(symbol);
 graphicsOverlay.setRenderer(simpleRenderer);

 // the graphic's symbol should be that of the renderer that was assigned
 Point randomPoint = new Point(2000000, 2000000);
 Graphic graphic = new Graphic(randomPoint);
 graphicsOverlay.getGraphics().add(graphic);
 
Since:
100.0.0
  • Constructor Details

    • SimpleRenderer

      public SimpleRenderer()
      Creates a new simple renderer without a Symbol.
      Since:
      100.0.0
    • SimpleRenderer

      public SimpleRenderer(Symbol symbol)
      Creates a new simple renderer with the given symbol.

      Setting the Symbol to null will just apply a default red circle Symbol.

      Parameters:
      symbol - the Symbol for this Renderer, can be null
      Since:
      100.0.0
  • Method Details

    • getSymbol

      public Symbol getSymbol(Feature feature)
      Returns the symbol that is used to visualize the given feature.

      If the renderer is a DictionaryRenderer and its associated DictionarySymbolStyle references a style file hosted on ArcGIS Online or an ArcGIS Enterprise portal (also referred to as a web style), this method returns null. If the layer has rendered and the symbol is already drawn on the view, this method returns a valid MultilayerSymbol. If you want to get the symbol before the layer is rendered, use DictionarySymbolStyle.getSymbolAsync(Map).

      Specified by:
      getSymbol in class Renderer
      Parameters:
      feature - the Feature to get a Symbol from, not null
      Returns:
      the Symbol of the Feature that was passed
      Throws:
      IllegalArgumentException - if feature is null
      Since:
      100.0.0
      See Also:
    • getSymbol

      public Symbol getSymbol(Graphic graphic)
      Returns the symbol that is used to visualize the given graphic.

      If the renderer is a DictionaryRenderer and its associated DictionarySymbolStyle references a style file hosted on ArcGIS Online or an ArcGIS Enterprise portal (also referred to as a web style), this method returns null. If the layer has rendered and the symbol is already drawn on the view, this method returns a valid MultilayerSymbol. If you want to get the symbol before the layer is rendered, use DictionarySymbolStyle.getSymbolAsync(Map).

      Specified by:
      getSymbol in class Renderer
      Parameters:
      graphic - the Graphic to get a Symbol from, not null
      Returns:
      the Symbol of the Graphic that was passed
      Throws:
      IllegalArgumentException - if graphic is null
      Since:
      100.0.0
      See Also:
    • getSymbol

      public Symbol getSymbol()
      Gets the Symbol that is being used by this Renderer to draw Features/Graphics to the GeoView.

      Default value is a red circle Symbol.

      Returns:
      the Symbol being used by this Renderer
      Since:
      100.0.0
      See Also:
    • setSymbol

      public void setSymbol(Symbol symbol)
      Sets the Symbol to be used by this Renderer to draw Features/Graphics to the GeoView.

      Setting the Symbol to null will just apply a default red circle Symbol.

      Parameters:
      symbol - the new Symbol used by this Renderer, can be null
      Since:
      100.0.0
    • getDescription

      public String getDescription()
      Gets the description that describes what this Renderer's does.

      Default value an empty string.

      Returns:
      the description of this Renderer
      Since:
      100.0.0
    • setDescription

      public void setDescription(String description)
      Sets the description, which gives detail information about what this Renderer's does. An example could be describing the meaning behind the Symbol it uses.
      Parameters:
      description - the new description for this Renderer
    • getLabel

      public String getLabel()
      Gets the name of this Renderer.

      Default value is an empty string.

      Returns:
      the label of this Renderer
      Since:
      100.0.0
    • setLabel

      public void setLabel(String label)
      Sets a name that this Renderer can be referred to.
      Parameters:
      label - the new label for this Renderer
      Since:
      100.0.0