Class MarkerSymbol

java.lang.Object
com.esri.arcgisruntime.symbology.Symbol
com.esri.arcgisruntime.symbology.MarkerSymbol
All Implemented Interfaces:
JsonSerializable
Direct Known Subclasses:
PictureMarkerSymbol, SimpleMarkerSymbol, TextSymbol

public abstract class MarkerSymbol extends Symbol
A base class for marker symbols used to display graphics and features (collectively referred to as geoelements) that have points or multipoint geometry.

Symbols describe how graphics and features look on a map. Different symbols are used with different geometry types. Marker symbols are used to display graphics and features that are based on point or multipoint geometries such as cities, a route destination, or fire hydrants. Subclasses of this class represent specific types of marker symbols such as SimpleMarkerSymbol, PictureMarkerSymbol, or TextSymbol.

You can specify the following two types of offsets:

  • Offset the visible symbol from the symbol's point geometry.
  • Offset a callout's leader line from the symbol's point geometry.

For each offset, you can specify an x-offset and a y-offset in device independent pixels (DIPs) using a Cartesian coordinate system. For example, if you specify a callout x-offset of -5.0, the callout's leader line will offset to the left along the x-axis by five points.

By default, the center of a PictureMarkerSymbol.getImage() is placed at the Point location. If the image is a pushpin, for example, you may want the needle of the pushpin to end at the Point location. In this situation, you need to offset the symbol to make the needle's end coincide with that Point location.

You can control the rotation of the marker symbol using setAngle(float). However, you must also consider whether this rotation is relative to the map or screen (getAngleAlignment()).

Since:
100.0.0
See Also:
  • Method Details

    • getAngle

      public float getAngle()
      Gets the angle (in degrees) that the marker symbol is rotated by.

      The marker symbol can be rotated relative to the map or the screen, depending on the getAngleAlignment().

      A full rotation is 360 units and default value is 0.0.

      Returns:
      the angle that the Symbol is rotated by
      Since:
      100.0.0
      See Also:
    • setAngle

      public void setAngle(float angle)
      Sets the angle (in degrees) that the marker symbol is rotated by.

      The marker symbol can be rotated relative to the map or the screen, depending on the getAngleAlignment().

      A rotation is anywhere from 0 to 360 units.

      A positive number will rotate the Symbol clockwise while a negative number will cause the Symbol to rotate counter-clockwise.

      Parameters:
      angle - the angle to rotate the Symbol
      Since:
      100.0.0
      See Also:
    • getAngleAlignment

      public MarkerSymbol.AngleAlignment getAngleAlignment()
      Gets whether the marker symbol is rotated relative to the screen or map.

      If the value is MarkerSymbol.AngleAlignment.MAP, the marker symbol is rotated relative to the map and will be affected by the map's rotation. If the value is MarkerSymbol.AngleAlignment.SCREEN, the marker symbol is rotated relative to the user's screen and is unaffected by the map's rotation.

      When the GraphicsOverlay.getRenderingMode() is GraphicsOverlay.RenderingMode.STATIC, each MarkerSymbol is aligned with the MapView. If the MapView rotates, every marker symbol on the ArcGISMap will stay in the same orientation as the MapView. Even if you set getAngle() and MarkerSymbol#getAngleAlignment(), they are not respected when the GraphicsOverlay.RenderingMode is set to static.

      When the GraphicsOverlay.renderingModeProperty() is set to GraphicsOverlay.RenderingMode.DYNAMIC, each MarkerSymbol rotates independently of a MapView rotation. If you set MarkerSymbol.angleProperty() and MarkerSymbol.angleAlignmentProperty(), they are respected.

      The default value is AngleAlignment.SCREEN.

      Returns:
      the angle alignment of the symbol
      Since:
      100.0.0
      See Also:
    • setAngleAlignment

      public void setAngleAlignment(MarkerSymbol.AngleAlignment angleAlignment)
      Sets whether the marker symbol is rotated relative to the screen or map.

      If the value is MarkerSymbol.AngleAlignment.MAP, the marker symbol is rotated relative to the map and will be affected by the map's rotation. If the value is MarkerSymbol.AngleAlignment.SCREEN, the marker symbol is rotated relative to the user's screen and is unaffected by the map's rotation.

      When the GraphicsOverlay.getRenderingMode() is GraphicsOverlay.RenderingMode.STATIC, each MarkerSymbol is aligned with the MapView. If the MapView rotates, every marker symbol on the ArcGISMap will stay in the same orientation as the MapView. Even if you set getAngle() and MarkerSymbol#getAngleAlignment(), they are not respected when the GraphicsOverlay.RenderingMode is set to static.

      When the GraphicsOverlay.renderingModeProperty() is set to GraphicsOverlay.RenderingMode.DYNAMIC, each MarkerSymbol rotates independently of a MapView rotation. If you set MarkerSymbol.angleProperty() and MarkerSymbol.angleAlignmentProperty(), they are respected.

      The default value is AngleAlignment.SCREEN.

      Parameters:
      angleAlignment - the new AngleAlignment of the Symbol
      Since:
      100.0.0
      See Also:
    • getLeaderOffsetX

      public float getLeaderOffsetX()
      Gets the callout leader's X offset relative to the marker symbol.

      Default value is 0.0.

      Returns:
      the offset of the callout's leader x coordinate in dp
      Since:
      100.0.0
    • setLeaderOffsetX

      public void setLeaderOffsetX(float offsetX)
      Sets the callout leader's X offset relative to the marker symbol.

      A positive number will cause the callout's leader to increase along the x-axis while a negative number will cause the callout's leader to decrease along the x-axis.

      Parameters:
      offsetX - the new offset in dp of the callout's leader x coordinate
      Since:
      100.0.0
    • getLeaderOffsetY

      public float getLeaderOffsetY()
      Gets the callout leader's Y offset relative to the marker symbol.

      Default value is 0.0.

      Returns:
      the offset of the callout's leader y coordinate in dp
      Since:
      100.0.0
    • setLeaderOffsetY

      public void setLeaderOffsetY(float offsetY)
      Sets the callout leader's Y offset relative to the marker symbol.

      A positive number will cause the callout's leader to rise along the y-axis while a negative number will cause the callout's leader to fall along the y-axis.

      Parameters:
      offsetY - the new offset in dp of the callout's leader y coordinate
      Since:
      100.0.0
      See Also:
    • getOffsetX

      public float getOffsetX()
      Gets the offset of the Symbol's x coordinate from its starting location. This is the number of density-independent pixels (dp) away from the Symbol's initial x coordinate point.

      Default value is 0.0.

      Returns:
      the offset of the Symbol's x coordinate in dp
      Since:
      100.0.0
    • setOffsetX

      public void setOffsetX(float offsetX)
      Sets the offset of the Symbol's x coordinate from its starting location in density-independent pixels (dp).

      A positive number will cause the Symbol to increase along the x-axis while a negative number will cause the Symbol to decrease along the x-axis.

      Parameters:
      offsetX - the new offset in dp of the Symbol's x coordinate
      Since:
      100.0.0
    • getOffsetY

      public float getOffsetY()
      Gets the offset of the Symbol's y coordinate from its starting location. This is the number of density-independent pixels (dp) away from the Symbol's initial y coordinate point.

      Default value is 0.0.

      Returns:
      the offset of the Symbol's y coordinate in dp
      Since:
      100.0.0
    • setOffsetY

      public void setOffsetY(float offsetY)
      Sets the offset of the Symbol's y coordinate from its starting location in density-independent pixels (dp).

      A positive number will cause the Symbol to rise along the y-axis while a negative number will cause the Symbol to fall along the y-axis.

      Parameters:
      offsetY - the new offset in dp of the Symbol's y coordinate
      Since:
      100.0.0