Class SimpleMarkerSymbol

  • All Implemented Interfaces:
    JsonSerializable

    public final class SimpleMarkerSymbol
    extends MarkerSymbol
    Defines a SimpleMarkerSymbol which is a MarkerSymbol based on simple shapes.

    SimpleMarkerSymbols symbolize Graphics and Features that have a Point or Multipoint geometry using simple predefined markers such as a circle. A LineSymbol can be used in combination with a SimpleMarkerSymbol to add an outline. The outline of the SimpleMarkerSymbol can be set once it has been created, but this property is optional.

    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:
    Graphic, GraphicsOverlay, SimpleRenderer, SimpleLineSymbol
    • Constructor Detail

      • SimpleMarkerSymbol

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

        Default properties:

        • Color, gray, 0xFFD3D3D3
        • Size, 8.0
        • Style, Circle

        Since:
        100.0.0
      • SimpleMarkerSymbol

        public SimpleMarkerSymbol​(SimpleMarkerSymbol.Style style,
                                  int color,
                                  float size)
        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:
        java.lang.IllegalArgumentException - if style is null
        java.lang.IllegalArgumentException - if size is less than 0
        Since:
        100.0.0
    • Method Detail

      • toMultilayerSymbol

        public MultilayerPointSymbol toMultilayerSymbol()
        Gets a multilayer point symbol generated from this simple marker symbol. The multilayer symbol will consist of a VectorMarkerSymbolLayer which will contain VectorMarkerSymbolElements that represent the converted marker symbol.
        Returns:
        a converted multilayer point symbol
        Since:
        100.5.0
      • getStyle

        public SimpleMarkerSymbol.Style getStyle()
        Gets the marker style that describes what shape this Symbol is displayed as.

        Default value is CIRCLE.

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

        public void setStyle​(SimpleMarkerSymbol.Style style)
        Sets the marker style that describes what shape this Symbol is going to be displayed as.
        Parameters:
        style - the new marker style for this Symbol, not null
        Throws:
        java.lang.IllegalArgumentException - if style is null
        Since:
        100.0.0
        See Also:
        SimpleMarkerSymbol.Style
      • 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:
        SimpleLineSymbol
      • 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:
        java.lang.IllegalArgumentException - if outline is null
        Since:
        100.0.0
        See Also:
        SimpleLineSymbol
      • getSize

        public float getSize()
        Gets the height and width in density-independent pixels (dp) of the symbol.

        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 height and width in density-independent pixels (dp) of the symbol.
        Parameters:
        size - the new size in dp of the symbol
        Since:
        100.0.0
      • getColor

        public int getColor()
        Gets the interior color of this Symbol as a ARGB(alpha, red, green, blue) value.

        Default value is gray, 0xFFD3D3D3.

        Returns:
        an integer representing the interior color as 0xAARRGGBB
        Since:
        100.0.0
      • setColor

        public void setColor​(int 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