Skip To Content ArcGIS for Developers Sign In Dashboard

GraphicsOverlay Class

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: Esri::ArcGISRuntime::Object and Esri::ArcGISRuntime::PopupSource

This class was introduced in Esri::ArcGISRuntime 100.0.

Public Functions

GraphicsOverlay(QObject *parent = nullptr)
virtual ~GraphicsOverlay() override
void clearSelection()
Esri::ArcGISRuntime::Envelope extent() const
Esri::ArcGISRuntime::GraphicListModel *graphics() const
bool isLabelsEnabled() const
bool isScaleSymbols() const
bool isVisible() const
Esri::ArcGISRuntime::LabelDefinitionListModel *labelDefinitions() const
double maxScale() const
double minScale() const
float opacity() const
QString overlayId() const
Esri::ArcGISRuntime::Renderer *renderer() const
Esri::ArcGISRuntime::GraphicsRenderingMode renderingMode() const
Esri::ArcGISRuntime::LayerSceneProperties sceneProperties() const
void selectGraphics(const QList<Esri::ArcGISRuntime::Graphic *> &graphics)
QList<Esri::ArcGISRuntime::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(Esri::ArcGISRuntime::Renderer *renderer)
void setRenderingMode(Esri::ArcGISRuntime::GraphicsRenderingMode value)
void setScaleSymbols(bool scaleSymbols)
void setSceneProperties(const Esri::ArcGISRuntime::LayerSceneProperties &sceneProperties)
void setVisible(bool visible)
void unselectGraphics(const QList<Esri::ArcGISRuntime::Graphic *> &graphics)

Reimplemented Public Functions

virtual bool isPopupEnabled() const override
virtual Esri::ArcGISRuntime::PopupDefinition *popupDefinition() const override
virtual void setPopupDefinition(Esri::ArcGISRuntime::PopupDefinition *popupDefinition) override
virtual void setPopupEnabled(bool popupEnabled) override

Detailed Description

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.

[override virtual] GraphicsOverlay::~GraphicsOverlay()

Destructor

void GraphicsOverlay::clearSelection()

Clears the current graphics selection.

Esri::ArcGISRuntime::Envelope GraphicsOverlay::extent() const

Gets the extent of the GraphicsOverlay.

Returns the extent of all graphics in the overlay.

Esri::ArcGISRuntime::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.

[override virtual] bool GraphicsOverlay::isPopupEnabled() const

Reimplements: PopupSource::isPopupEnabled() const.

Returns whether the Popup is enabled on the 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.

Esri::ArcGISRuntime::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().

[override virtual] Esri::ArcGISRuntime::PopupDefinition *GraphicsOverlay::popupDefinition() const

Reimplements: PopupSource::popupDefinition() const.

See PopupSource.

See also setPopupDefinition().

Esri::ArcGISRuntime::Renderer *GraphicsOverlay::renderer() const

Gets the renderer of the overlay.

See also setRenderer().

Esri::ArcGISRuntime::GraphicsRenderingMode GraphicsOverlay::renderingMode() const

Gets the GraphicsRenderingMode of the overlay.

Returns the renderingMode.

See also setRenderingMode().

Esri::ArcGISRuntime::LayerSceneProperties GraphicsOverlay::sceneProperties() const

Gets the LayerSceneProperties of the overlay.

Returns the LayerSceneProperties.

See also setSceneProperties().

void GraphicsOverlay::selectGraphics(const QList<Esri::ArcGISRuntime::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<Esri::ArcGISRuntime::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().

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

Reimplements: PopupSource::setPopupDefinition(Esri::ArcGISRuntime::PopupDefinition *popupDefinition).

Sets the popup definition to popupDefinition.

See also popupDefinition() and PopupSource.

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

Reimplements: PopupSource::setPopupEnabled(bool popupEnabled).

Sets whether the PopupSource is enabled to popupEnabled.

See also isPopupEnabled() and PopupSource.

void GraphicsOverlay::setRenderer(Esri::ArcGISRuntime::Renderer *renderer)

Sets the renderer of the overlay to renderer.

See also renderer().

void GraphicsOverlay::setRenderingMode(Esri::ArcGISRuntime::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 Esri::ArcGISRuntime::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<Esri::ArcGISRuntime::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?