Skip To Content ArcGIS for Developers Sign In Dashboard

GraphicsOverlay Class

(Esri::ArcGISRuntime::GraphicsOverlay)

A graphics overlay to display graphics on top of a GeoView. More...

Header: #include <GraphicsOverlay>
Since: Esri::ArcGISRuntime 100.0
Inherits: Object and PopupSource

Public Functions

GraphicsOverlay(QObject *parent = nullptr)
~GraphicsOverlay()
void clearSelection()
Envelope extent() const
GraphicListModel *graphics() const
bool isLabelsEnabled() const
bool isScaleSymbols() const
bool isVisible() const
LabelDefinitionListModel *labelDefinitions() const
double maxScale() const
double minScale() const
float opacity() const
QString overlayId() const
Renderer *renderer() const
GraphicsRenderingMode renderingMode() const
LayerSceneProperties sceneProperties() const
void selectGraphics(const QList<Graphic *> &graphics)
QList<Graphic *> selectedGraphics() const
void setLabelsEnabled(bool labelsEnabled)
void setMaxScale(double maxScale)
void setMinScale(double minScale)
void setOpacity(float opacity)
void setOverlayId(const QString &overlayId)
void setRenderer(Renderer *renderer)
void setRenderingMode(GraphicsRenderingMode value)
void setScaleSymbols(bool scaleSymbols)
void setSceneProperties(const LayerSceneProperties &sceneProperties)
void setVisible(bool visible)
void unselectGraphics(const QList<Graphic *> &graphics)

Reimplemented Public Functions

virtual bool isPopupEnabled() const
virtual PopupDefinition *popupDefinition() const
virtual void setPopupDefinition(PopupDefinition *popupDefinition)
virtual void setPopupEnabled(bool popupEnabled)

Additional Inherited Members

Detailed Description

A graphics overlay to display graphics on top of a GeoView.

Graphics can represent temporary data in your application, such as the results of a query or an analysis, or they can be used to highlight existing content in the map.

Each graphic contains a geometry describing the location and the shape of the graphic. A graphics overlay typically contains graphics based on a single geometry type (Point, Multipoint, Polyline, or Polygon). Each graphic can be associated with a symbol which controls how the graphic looks. Alternatively, the overlay can be associated with a renderer which manages the appearance of all graphics in the graphics overlay that do not have specific symbols associated with each of them.

Example:

Create a graphics overlay and add a graphic to the overlay:

// create graphics overlay
GraphicsOverlay* graphicsOverlay = new GraphicsOverlay(this);

// create a graphic
Point point(0, 0);
SimpleMarkerSymbol* simpleMarker = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::X, QColor(Qt::red), 15.0, this);
QVariantMap attr;
attr["name"] = "Null Island";
Graphic* graphic = new Graphic(point, attr, simpleMarker, this);

//add the graphic to the graphics overlay
graphicsOverlay->graphics()->append(graphic);

See also Graphic, GraphicsOverlayListModel, and PopupSource.

Member Function Documentation

GraphicsOverlay::GraphicsOverlay(QObject *parent = nullptr)

Constructor with an optional parent.

GraphicsOverlay::~GraphicsOverlay()

Destructor

void GraphicsOverlay::clearSelection()

Clears the current graphics selection.

Envelope GraphicsOverlay::extent() const

Gets the extent of the GraphicsOverlay.

Returns the extent of all graphics in the overlay.

GraphicListModel *GraphicsOverlay::graphics() const

Gets the list of graphics in the overlay as a GraphicsListModel.

Returns a list model of the graphics in the overlay.

bool GraphicsOverlay::isLabelsEnabled() const

Returns true if graphics will be labeled in this overlay.

This function was introduced in Esri::ArcGISRuntime 100.1.

[virtual] bool GraphicsOverlay::isPopupEnabled() const

Reimplemented from PopupSource::isPopupEnabled().

See PopupSource.

bool GraphicsOverlay::isScaleSymbols() const

Returns whether the overlay's symbols and labels honor the Map reference scale when displayed in a MapView.

If the Map has a positive reference scale, and the overlay honors it, then symbols and labels will be drawn at their specified size when the viewing scale is the same as the reference scale, and will grow or shrink as the view zooms in or out, to keep the symbol a fixed size on the map.

If the Map has no reference scale, the reference scale is zero or the GraphicOverlay's scaleSymbols property is false, then the symbols and labels will be drawn at their fixed screen size.

The default value is false.

ScaleSymbols can only be used when displaying the overlay in a MapView.

The symbols and labels will be displayed at fixed screen size in a SceneView.

This function was introduced in Esri::ArcGISRuntime 100.7.

bool GraphicsOverlay::isVisible() const

Gets whether the graphics overlay is visible.

Returns true if the graphics overlay is visible.

LabelDefinitionListModel *GraphicsOverlay::labelDefinitions() const

Returns the list model of label definitions in the GraphicsOverlay.

This function was introduced in Esri::ArcGISRuntime 100.1.

double GraphicsOverlay::maxScale() const

Gets the maximum scale at which the graphics should be displayed.

Returns the maximum scale.

See also setMaxScale().

double GraphicsOverlay::minScale() const

Gets the minimum scale at which the graphics should be displayed.

Returns the minimum scale.

See also setMinScale().

float GraphicsOverlay::opacity() const

Gets the opacity of the graphics.

Returns the opacity as a value from 0.0 (transparent) to 1.0 (opaque).

See also setOpacity().

QString GraphicsOverlay::overlayId() const

Gets the graphics overlay's ID.

This function was introduced in Esri::ArcGISRuntime 100.2.

See also setOverlayId().

[virtual] PopupDefinition *GraphicsOverlay::popupDefinition() const

Reimplemented from PopupSource::popupDefinition().

See PopupSource.

See also setPopupDefinition().

Renderer *GraphicsOverlay::renderer() const

Gets the renderer of the overlay.

See also setRenderer().

GraphicsRenderingMode GraphicsOverlay::renderingMode() const

Gets the GraphicsRenderingMode of the overlay.

Returns the renderingMode.

See also setRenderingMode().

LayerSceneProperties GraphicsOverlay::sceneProperties() const

Gets the LayerSceneProperties of the overlay.

Returns the LayerSceneProperties.

See also setSceneProperties().

void GraphicsOverlay::selectGraphics(const QList<Graphic *> &graphics)

Selects the graphics in the graphics list.

Any graphics that are not in the overlay will be ignored.

This function was introduced in Esri::ArcGISRuntime 100.2.

QList<Graphic *> GraphicsOverlay::selectedGraphics() const

Gets the list of selected graphics.

Returns a list representing the selected graphics in the overlay.

void GraphicsOverlay::setLabelsEnabled(bool labelsEnabled)

Sets whether labels are enabled on graphics in this overlay to labelsEnabled.

See also isLabelsEnabled().

void GraphicsOverlay::setMaxScale(double maxScale)

Sets the maximum scale at which the graphics should be displayed to maxScale.

See also maxScale().

void GraphicsOverlay::setMinScale(double minScale)

Sets the minimum scale at which the graphics should be displayed to minScale.

See also minScale().

void GraphicsOverlay::setOpacity(float opacity)

Sets the opacity to opacity.

The opacity can have a value from 0.0 (transparent) to 1.0 (opaque).

See also opacity().

void GraphicsOverlay::setOverlayId(const QString &overlayId)

Sets the graphics overlay's ID to overlayId.

This function was introduced in Esri::ArcGISRuntime 100.2.

See also overlayId().

[virtual] void GraphicsOverlay::setPopupDefinition(PopupDefinition *popupDefinition)

Reimplemented from PopupSource::setPopupDefinition().

Sets the popup definition to popupDefinition.

See also popupDefinition() and PopupSource.

[virtual] void GraphicsOverlay::setPopupEnabled(bool popupEnabled)

Reimplemented from PopupSource::setPopupEnabled().

Sets whether the PopupSource is enabled to popupEnabled.

See also isPopupEnabled() and PopupSource.

void GraphicsOverlay::setRenderer(Renderer *renderer)

Sets the renderer of the overlay to renderer.

See also renderer().

void GraphicsOverlay::setRenderingMode(GraphicsRenderingMode value)

Sets the GraphicsRenderingMode of the overlay to value.

See also renderingMode().

void GraphicsOverlay::setScaleSymbols(bool scaleSymbols)

Sets whether the overlay's symbols and labels honor the Map reference scale when displayed in a MapView.

  • scaleSymbols - true to scale the symbols, false to not.

This function was introduced in Esri::ArcGISRuntime 100.7.

See also isScaleSymbols.

void GraphicsOverlay::setSceneProperties(const LayerSceneProperties &sceneProperties)

Sets the LayerSceneProperties of the overlay to sceneProperties.

See also sceneProperties().

void GraphicsOverlay::setVisible(bool visible)

Sets the graphics overlay visibility to visible.

See also isVisible().

void GraphicsOverlay::unselectGraphics(const QList<Graphic *> &graphics)

Unselects the graphics in the graphics list.

Any graphics that are not in the overlay will be ignored.

This function was introduced in Esri::ArcGISRuntime 100.2.


Feedback on this topic?