java.lang.Object
com.esri.arcgisruntime.mapping.view.Grid
Direct Known Subclasses:
LatitudeLongitudeGrid, MgrsGrid, UsngGrid, UtmGrid

public abstract class Grid extends Object
Represents options to display a grid on top of a MapView.

Supported grid types are:

  1. LatitudeLongitudeGrid, has one grid resolution level that changes size to match MapView.
  2. MgrsGrid, has five grid resolution levels that covers the entire globe.
  3. UsngGrid, has five grid resolution levels that covers the North America region.
  4. UtmGrid, has one grid resolution level that stays the same size.

This class allows customization of the grid by setting:

Since:
100.0.0
See Also:
  • Method Details

    • isLabelVisible

      public boolean isLabelVisible()
      Checks if labels are being displayed to the grid.

      Default value is true.

      Returns:
      true if labels are visible, false otherwise
      Since:
      100.0.0
    • setLabelVisible

      public void setLabelVisible(boolean visible)
      Sets labels to be displayed on the grid.

      If grid visibility is set to false, labels will not be visible even if label visibility is set to true.

      Parameters:
      visible - true, to make labels visible
      Since:
      100.0.0
      See Also:
    • isVisible

      public boolean isVisible()
      Checks if the grid lines and labels are displayed on the grid.

      Default value is true.

      Returns:
      true if the grid is visible, false otherwise
      Since:
      100.0.0
    • setVisible

      public void setVisible(boolean visible)
      Sets grid lines and labels to be displayed on the grid.
      Parameters:
      visible - true, to make the grid visible
      Since:
      100.0.0
    • getLevelCount

      public int getLevelCount()
      Gets number of resolution levels supported by the grid. Line and label styles can be set for each of these resolution levels.
      Returns:
      number of resolution levels supported by the grid
      Since:
      100.0.0
    • setLabelPosition

      public void setLabelPosition(Grid.LabelPosition labelPosition)
      Sets positioning of grid labels.
      Parameters:
      labelPosition - position of labels on grid
      Throws:
      IllegalArgumentException - if labelPosition is null
      Since:
      100.0.0
    • getLabelPosition

      public Grid.LabelPosition getLabelPosition()
      Gets positioning of grid labels.

      Default label positioning is GEOGRAPHIC.

      Returns:
      the position of labels on grid
      Since:
      100.0.0
    • setLabelOffset

      public void setLabelOffset(double labelOffset)
      Sets grid's label offset from the edge of the MapView in dips.

      Applicable to screen-anchored labels only - this value will have no effect if the type of label positioning is Grid.LabelPosition.GEOGRAPHIC.

      Parameters:
      labelOffset - grid's label offset from the edge of the MapView in dips
      Since:
      100.0.0
    • getLabelOffset

      public double getLabelOffset()
      Gets grid's label offset from the edge of the MapView in dips.

      Applicable to screen-anchored labels only - this value will have no effect if the type of label positioning is Grid.LabelPosition.GEOGRAPHIC.

      Returns:
      grid's text label offset from the edge of the MapView in dips
      Since:
      100.0.0
    • getLineSymbol

      public Symbol getLineSymbol(int gridLevel)
      Gets line symbol used by the grid at given resolution level.
      Parameters:
      gridLevel - grid resolution level of line symbol
      Returns:
      line symbol at given grid resolution level
      Throws:
      ArcGISRuntimeException - if gridLevel is greater than or equal to level count
      Since:
      100.0.0
      See Also:
    • setLineSymbol

      public void setLineSymbol(int gridLevel, Symbol symbol)
      Sets line symbol used by the grid at the given resolution level.
      Parameters:
      gridLevel - grid resolution level of line symbol
      symbol - line symbol to set at given grid resolution level
      Throws:
      IllegalArgumentException - if symbol is null
      ArcGISRuntimeException - if gridLevel is greater than or equal to level count
      Since:
      100.0.0
      See Also:
    • getTextSymbol

      public Symbol getTextSymbol(int gridLevel)
      Gets text symbol used by the grid's labels at given resolution level.
      Parameters:
      gridLevel - grid resolution level of text symbol
      Returns:
      text symbol at given grid resolution level
      Throws:
      ArcGISRuntimeException - if gridLevel is greater than or equal to level count
      Since:
      100.0.0
      See Also:
    • setTextSymbol

      public void setTextSymbol(int gridLevel, Symbol symbol)
      Sets text symbol used by the grid's labels at given resolution level.
      Parameters:
      gridLevel - grid level of text symbol
      symbol - text symbol to set at given grid level
      Throws:
      IllegalArgumentException - if symbol is null
      ArcGISRuntimeException - if gridLevel is greater than or equal to level count
      Since:
      100.0.0
      See Also: