Skip To Content ArcGIS for Developers Sign In Dashboard

BackgroundGrid Class

(Esri::ArcGISRuntime::BackgroundGrid)

Defines the default color and context grid for display behind a map or scene surface. More...

Header: #include <BackgroundGrid>
Since: Esri::ArcGISRuntime 100.0

Public Functions

BackgroundGrid()
BackgroundGrid(const QColor &color, const QColor &gridLineColor, float gridLineWidth, float gridSize)
BackgroundGrid(const BackgroundGrid &other)
BackgroundGrid(BackgroundGrid &&other)
~BackgroundGrid()
QColor color() const
QColor gridLineColor() const
double gridLineWidth() const
double gridSize() const
bool isVisible() const
void setColor(const QColor &color)
void setGridLineColor(const QColor &color)
void setGridLineWidth(double gridLineWidth)
void setGridSize(double gridSize)
void setVisible(bool visible)
BackgroundGrid &operator=(const BackgroundGrid &other)
BackgroundGrid &operator=(BackgroundGrid &&other)

Detailed Description

Defines the default color and context grid for display behind a map or scene surface.

BackgroundGrid is the grid that displays behind a Map in a MapView, or a Surface in a SceneView. If there is no map or surface provided, an empty view will display with only the BackgroundGrid.

The BackgroundGrid is not associated with the Grid that can be displayed over a MapView. The Map displays on top of the background grid or the optional Map::backgroundColor to determine what is displayed under transparent areas of the map.

An instance of this class can be used to set a default backdrop that a Map or Scene will display on top of.

Example: Change the MapView's background grid:

BackgroundGrid newGrid;
newGrid.setColor(Qt::white);
newGrid.setGridLineColor(Qt::black);
newGrid.setGridLineWidth(5);
newGrid.setGridSize(50);
mapView->setBackgroundGrid(newGrid);

Member Function Documentation

BackgroundGrid::BackgroundGrid()

Constructs a default BackgroundGrid.

These default values are used: l color = Qt::black, l gridLineColor = c Qt::white, l gridLineWidth = 1, l gridSize = 32.

BackgroundGrid::BackgroundGrid(const QColor &color, const QColor &gridLineColor, float gridLineWidth, float gridSize)

Creates a BackgroundGrid with the specified color, gridLineColor, gridLineWidth and gridSize.

BackgroundGrid is the grid that displays behind a Map in a MapView, or a Surface in a SceneView. If there is no map or surface provided, an empty view will display with only the BackgroundGrid.

An instance of this class can be used to set a default backdrop that a Map or Scene will display on top of.

Note that gridLineWidth and gridSize are defined in device-independent pixels.

BackgroundGrid::BackgroundGrid(const BackgroundGrid &other)

Copy constructor from other BackgroundGrid.

BackgroundGrid::BackgroundGrid(BackgroundGrid &&other)

Move constructor from other BackgroundGrid.

BackgroundGrid::~BackgroundGrid()

Destructor.

QColor BackgroundGrid::color() const

Returns the fill color of the background.

The default value is Silver ("#C0C0C0" or QColor(192, 192, 192)).

See also setColor().

QColor BackgroundGrid::gridLineColor() const

Returns the color of the background grid lines.

The default value is Black ("#FFFFFF" or QColor(255, 255, 255)).

See also setGridLineColor().

double BackgroundGrid::gridLineWidth() const

Returns the width (in DIPs) of the background grid lines.

The default value is 1.

See also setGridLineWidth().

double BackgroundGrid::gridSize() const

Returns the size (in DIPs) of the background grid.

The default value is 20.0.

See also setGridSize().

bool BackgroundGrid::isVisible() const

Returns whether the grid lines are visible in the background.

If this value is true, grid lines will display on top of the BackgroundGrid::Color. If this value is false, the BackgroundGrid::Color will display without the grid lines. The default value is true.

This function was introduced in Esri::ArcGISRuntime 100.3.

void BackgroundGrid::setColor(const QColor &color)

Sets the fill color of the background.

The default value is Silver ("#C0C0C0" or QColor(192, 192, 192)).

See also color().

void BackgroundGrid::setGridLineColor(const QColor &color)

Sets the color of the background grid lines.

The default value is Black ("#FFFFFF" or QColor(255, 255, 255)).

See also gridLineColor().

void BackgroundGrid::setGridLineWidth(double gridLineWidth)

Sets the width of the background grid lines to gridLineWidth DIPs.

The default value is 1. This value must be greater than or equal to 0. Setting the grid line width to 0 will make grid lines invisible.

See also gridLineWidth().

void BackgroundGrid::setGridSize(double gridSize)

Sets the size of the background grid to gridSize DIPs.

The default value is 20.0.

See also gridSize().

void BackgroundGrid::setVisible(bool visible)

Sets whether the grid lines are visible in the background to visible.

If this value is true, grid lines will display on top of the BackgroundGrid::Color. If this value false, the BackgroundGrid::Color will display without the grid lines. The default value is true.

This function was introduced in Esri::ArcGISRuntime 100.3.

See also isVisible().

BackgroundGrid &BackgroundGrid::operator=(const BackgroundGrid &other)

Assignment operator from other BackgroundGrid.

BackgroundGrid &BackgroundGrid::operator=(BackgroundGrid &&other)

Move operator from other BackgroundGrid.


Feedback on this topic?