Class SimpleMarkerSymbol

All Implemented Interfaces:
JsonSerializable

public final class SimpleMarkerSymbol extends MarkerSymbol
Uses a color and marker shape to symbolize graphics and features that have point or multipoint geometry.

Simple marker symbols display graphics and features (collectively referred to as geoelements) using predefined markers such as circle and cross. These symbols can have an optional outline, which is defined as a SimpleLineSymbol.

Example of creating a SimpleMarkerSymbol:

 // create points for the line
 Point point = new Point(-1.1579397849033352E7, 5618494.623878779);

 // creates a red circle simple marker symbol
 SimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xffff0000, 10);

 // add the point with a symbol to graphics overlay and add overlay to map view
 GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
 mapView.getGraphicsOverlays().add(graphicsOverlay);
 graphicsOverlay.getGraphics().add(new Graphic(point, markerSymbol));
 
A SimpleMarkerSymbol 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, SimpleMarkerSymbol));
 
OR
 GraphicsOverlay.setRenderer(new SimpleRenderer(SimpleMarkerSymbol));
 
Since:
100.0.0
See Also:
  • Property Details

  • Constructor Details

    • SimpleMarkerSymbol

      public SimpleMarkerSymbol()
      Creates a simple marker symbol object.

      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
    • SimpleMarkerSymbol

      @Deprecated(since="200.0.0", forRemoval=true) public SimpleMarkerSymbol(SimpleMarkerSymbol.Style style, int color, float size)
      Deprecated, for removal: This API element is subject to removal in a future version.
      as of 200.0.0, replaced by SimpleMarkerSymbol(Style, Color, float)
      Creates a new SimpleMarkerSymbol with the given properties:
      • Color, interior color of the Symbol.
      • Size, height and width of the area to place the Symbol in.
      • Style, the shape that makes up the the Symbol.

      Parameters:
      style - the marker style for this Symbol, not null
      color - an integer representing the interior color as 0xAARRGGBB
      size - the size of this Symbol, must be 0 or greater
      Throws:
      IllegalArgumentException - if style is null
      IllegalArgumentException - if size is less than 0
      Since:
      100.0.0
    • SimpleMarkerSymbol

      public SimpleMarkerSymbol(SimpleMarkerSymbol.Style style, Color color, float size)
      Creates a simple marker symbol with the given properties.
      Parameters:
      style - the marker style for this Symbol, not null
      color - the interior color
      size - the size of the simple marker symbol in device independent pixels (DIPs)
      Throws:
      IllegalArgumentException - if style is null
      IllegalArgumentException - if color is null
      IllegalArgumentException - if size is less than 0
      Since:
      200.0.0
  • Method Details

    • toMultilayerSymbol

      public MultilayerPointSymbol toMultilayerSymbol()
      Converts a SimpleMarkerSymbol to a MultilayerPointSymbol.

      This method allows you to create complex and custom symbols with multiple layers of different type of symbology. Simple marker symbol provides a factory of shapes such as square, diamond, and cross. This method generates a MultilayerPointSymbol that contains a VectorMarkerSymbolLayer that has a VectorMarkerSymbolElement with a polygon representation of the simple marker symbol geometry.

      Returns:
      a converted multilayer point symbol
      Since:
      100.5.0
    • getStyle

      public SimpleMarkerSymbol.Style getStyle()
      Gets the style of the simple marker symbol, such as circle, cross, or diamond.

      Default value is CIRCLE.

      Returns:
      the marker style for this Symbol
      Since:
      100.0.0
      See Also:
    • setStyle

      public void setStyle(SimpleMarkerSymbol.Style style)
      Sets the style of the simple marker symbol, such as circle, cross, or diamond.
      Parameters:
      style - the new marker style for this Symbol, not null
      Throws:
      IllegalArgumentException - if style is null
      Since:
      100.0.0
      See Also:
    • getOutline

      public SimpleLineSymbol getOutline()
      Gets the SimpleLineSymbol used to create the border of this Symbol, if any border is present.

      Default value is null.

      Returns:
      the outline if there is one or null otherwise
      Since:
      100.0.0
      See Also:
    • setOutline

      public void setOutline(SimpleLineSymbol outline)
      Sets the SimpleLineSymbol used to create the border of the Symbol.
      Parameters:
      outline - the new outline, not null
      Throws:
      IllegalArgumentException - if outline is null
      Since:
      100.0.0
      See Also:
    • getSize

      public float getSize()
      Gets the size of the simple marker symbol in device independent pixels (DIPs).

      Default value is 8.0.

      Returns:
      the size in dp of this symbol
      Since:
      100.0.0
    • setSize

      public void setSize(float size)
      Sets the size of the simple marker symbol in device independent pixels (DIPs).
      Parameters:
      size - the new size in dp of the symbol
      Since:
      100.0.0
    • colorProperty

      public ObjectProperty<Color> colorProperty()
      The interior color of this Symbol.

      Default value is Color.LIGHTGRAY.

      Attempting to set the color to null will throw a NullPointerException exception.

      Returns:
      the color property
      Since:
      200.0.0
      See Also:
    • getColor

      public Color getColor()
      Gets the value of the color property.
      Property description:
      The interior color of this Symbol.

      Default value is Color.LIGHTGRAY.

      Attempting to set the color to null will throw a NullPointerException exception.

      Returns:
      the value of the color property
      Since:
      200.0.0
      See Also:
    • setColor

      public void setColor(Color color)
      Sets the value of the color property.
      Property description:
      The interior color of this Symbol.

      Default value is Color.LIGHTGRAY.

      Attempting to set the color to null will throw a NullPointerException exception.

      Parameters:
      color - the value for the color property
      Since:
      200.0.0
      See Also:
    • setColor

      @Deprecated(since="200.0.0", forRemoval=true) public void setColor(int color)
      Deprecated, for removal: This API element is subject to removal in a future version.
      as of 200.0.0, replaced by setColor(Color)
      Sets the interior color of this Symbol to a ARGB(alpha, red, green, blue) value.
      Parameters:
      color - an integer representing the interior color as 0xAARRGGBB
      Since:
      100.0.0