Class Grid
- 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:
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 for JavaSE and 100.2.0 for Android
- See Also:
Grid.LabelPosition
,MapView.setGrid(Grid)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Grid.LabelPosition
Represents options for positioning grid labels on the MapView.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getLabelOffset()
Gets grid's label offset from the edge of the MapView in dips.Grid.LabelPosition
getLabelPosition()
Gets positioning of grid labels.int
getLevelCount()
Gets number of resolution levels supported by the grid.Symbol
getLineSymbol(int gridLevel)
Gets line symbol used by the grid at given resolution level.Symbol
getTextSymbol(int gridLevel)
Gets text symbol used by the grid's labels at given resolution level.boolean
isLabelVisible()
Checks if labels are being displayed to the grid.boolean
isVisible()
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 Detail
-
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 for JavaSE and 100.2.0 for Android
-
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 for JavaSE and 100.2.0 for Android
- See Also:
setVisible(boolean)
-
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 for JavaSE and 100.2.0 for Android
-
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 for JavaSE and 100.2.0 for Android
-
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 for JavaSE and 100.2.0 for Android
-
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 for JavaSE and 100.2.0 for Android
-
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 for JavaSE and 100.2.0 for Android
-
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 for JavaSE and 100.2.0 for Android
-
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 for JavaSE and 100.2.0 for Android
-
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 for JavaSE and 100.2.0 for Android
- See Also:
setLineSymbol(int, Symbol)
,getLevelCount()
-
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 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 for JavaSE and 100.2.0 for Android
- See Also:
getLineSymbol(int)
,getLevelCount()
-
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 for JavaSE and 100.2.0 for Android
- See Also:
setTextSymbol(int, Symbol)
-
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 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 for JavaSE and 100.2.0 for Android
- See Also:
getTextSymbol(int)
,getLevelCount()
-
-