modify graphic on graphicsoverlay qt

520
3
01-10-2020 12:27 PM
MauricioRamirez1
New Contributor

I'm looking for an example that shows how to modify the location of a graphic.  Say I added 50 graphics, and later on I need to modify 5.  Is there a way to update just the 5 or do I have to clear the layer and add them all back in.  

0 Kudos
3 Replies
JamesBallard1
Esri Regular Contributor

Hi Mauricio Ramirez‌,

    Thanks for reaching out. You can change the geometry of a graphic at any time. So in your example, you can modify the geometries for the 5 graphics you want to change and leave the other 45 alone; you don't need to clear the entire graphicsOverlay collection and start over.

If you need assistance with identifying graphics, we do have a sample for that. I hope this helps.

arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/DisplayInformation/IdentifyGraphics at maste... 

arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_QMLSamples/DisplayInformation/IdentifyGraphics at maste... 

0 Kudos
MauricioRamirez1
New Contributor

James,

Thank you for replying.  After the graphic is identified, do we just change the geometry for the identified graphic and that's it, or do we then have to add it back to the overlay?  The workflow is muddy in my mind.

0 Kudos
JamesBallard1
Esri Regular Contributor

Mauricio Ramirez

That's right - you can change the geometry directly on the identified graphic and that's it.

If you're working with our C++ Qt API, then the pointers may actually be different for the graphics returned from an identify operation, but they will reference the same underlying Runtime graphics that exist in the graphics overlay.

0 Kudos