Get the list of Graphic items on a clicked point

788
3
Jump to solution
06-02-2021 05:56 AM
FatmaAkdemir
Occasional Contributor II

Is there a way to understand that user clicks on a specific Graphic on the map?

0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

Yep. If you want to know for a specific GraphicsOverlay, you can call GeoView.indentifyGraphicsOverlay() and pass in the graphics overlay in question. If you want to consider all the GraphicsOverlays in your MapView, you can call GeoView.indentifyGraphicsOverlays().

There are also overrides that allow you to specify a max number of results to return. See the full list here.

View solution in original post

3 Replies
Nicholas-Furness
Esri Regular Contributor

Yep. If you want to know for a specific GraphicsOverlay, you can call GeoView.indentifyGraphicsOverlay() and pass in the graphics overlay in question. If you want to consider all the GraphicsOverlays in your MapView, you can call GeoView.indentifyGraphicsOverlays().

There are also overrides that allow you to specify a max number of results to return. See the full list here.

FatmaAkdemir
Occasional Contributor II

Hi @Nicholas-Furness ,

I managed to get the clicked Graphic by using the method you suggested. However I am getting segmentation faults while dynamic casting the Graphic to the class that inherits the Graphic.

mpSelectedRulerNode->setGeometry(destinationPoint);

Even if I don't make any dynamic_cast, above code causes a SEGFAULT.

0 Kudos
by Anonymous User
Not applicable

Hi Fatma,

Are you able to post any code that recreates this issue, or a crash-dump? I suspect that either  `mpSelectedRulerNode` or `destinationPoint` are being used after deletion.

0 Kudos