java.lang.Object
com.esri.arcgisruntime.mapping.view.Grid
- Direct Known Subclasses:
LatitudeLongitudeGrid
,MgrsGrid
,UsngGrid
,UtmGrid
Represents options to display a grid on top of a MapView.
Supported grid types are:
LatitudeLongitudeGrid
, has one grid resolution level that changes size to match MapView.MgrsGrid
, has five grid resolution levels that covers the entire globe.UsngGrid
, has five grid resolution levels that covers the North America region.UtmGrid
, has one grid resolution level that stays the same size.
This class allows customization of the grid by setting:
- show grid
setVisible(boolean)
- show labels
setLabelVisible(boolean)
- label offsets
setLabelOffset(double)
- label position
setLabelPosition(LabelPosition)
- change text symbol
setTextSymbol(int, Symbol)
- change line symbol
setLineSymbol(int, Symbol)
- Since:
- 100.0.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Represents options for positioning grid labels on the MapView. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Gets grid's label offset from the edge of the MapView in dips.Gets positioning of grid labels.int
Gets number of resolution levels supported by the grid.getLineSymbol
(int gridLevel) Gets line symbol used by the grid at given resolution level.getTextSymbol
(int gridLevel) Gets text symbol used by the grid's labels at given resolution level.boolean
Checks if labels are being displayed to the grid.boolean
Checks if the grid lines and labels are displayed on the grid.void
setLabelOffset
(double labelOffset) Sets grid's label offset from the edge of the MapView in dips.void
setLabelPosition
(Grid.LabelPosition labelPosition) Sets positioning of grid labels.void
setLabelVisible
(boolean visible) Sets labels to be displayed on the grid.void
setLineSymbol
(int gridLevel, Symbol symbol) Sets line symbol used by the grid at the given resolution level.void
setTextSymbol
(int gridLevel, Symbol symbol) Sets text symbol used by the grid's labels at given resolution level.void
setVisible
(boolean visible) Sets grid lines and labels to be displayed on the grid.
-
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
Sets positioning of grid labels.- Parameters:
labelPosition
- position of labels on grid- Throws:
IllegalArgumentException
- if labelPosition is null- Since:
- 100.0.0
-
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
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
Sets line symbol used by the grid at the given resolution level.- Parameters:
gridLevel
- grid resolution level of line symbolsymbol
- line symbol to set at given grid resolution level- Throws:
IllegalArgumentException
- if symbol is nullArcGISRuntimeException
- if gridLevel is greater than or equal to level count- Since:
- 100.0.0
- See Also:
-
getTextSymbol
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
Sets text symbol used by the grid's labels at given resolution level.- Parameters:
gridLevel
- grid level of text symbolsymbol
- text symbol to set at given grid level- Throws:
IllegalArgumentException
- if symbol is nullArcGISRuntimeException
- if gridLevel is greater than or equal to level count- Since:
- 100.0.0
- See Also:
-