Hi,
we add a EsriRuntimeQt::Graphic to a EsriRuntimeQt::GraphicsLayer with GraphicsLayer::addGraphic(m_graphicPtr). Now we want to change the graphic (e.g. the line color). What's the recommended way to do this? The documentation does not say anything about this:
Thx,
Christian
Solved! Go to Solution.
Christian-
If you are wanting to update the symbol of a particular graphic, can you just use updateGraphic that takes in the graphic's ID and the new symbol? ArcGIS Runtime SDK for Qt C++ API: EsriRuntimeQt::GraphicsLayer Class Reference
Otherwise, you can create a new Graphic, and update the existing one with updateGraphic ArcGIS Runtime SDK for Qt C++ API: EsriRuntimeQt::GraphicsLayer Class Reference
That would be the recommended approach. I would need to see your code to get a hint at why it might be crashing.
-Luke
Ok, it looks like my assumption about ownership is wrong. I moved the code into a small testcase and calling updateGraphic() in a loop (via timer every 10ms) it's crashing now and then but everytime with a similar backtrace. If you're interested in this backtrace or the testcase, please let me know.
Christian-
If you are wanting to update the symbol of a particular graphic, can you just use updateGraphic that takes in the graphic's ID and the new symbol? ArcGIS Runtime SDK for Qt C++ API: EsriRuntimeQt::GraphicsLayer Class Reference
Otherwise, you can create a new Graphic, and update the existing one with updateGraphic ArcGIS Runtime SDK for Qt C++ API: EsriRuntimeQt::GraphicsLayer Class Reference
That would be the recommended approach. I would need to see your code to get a hint at why it might be crashing.
-Luke
What we're doing is more or less something like
qid = GraphicsLayer::addGraphic(m_graphicPtr);
...
modify m_graphicPtr (change geometry or smth. else)
...
GraphicsLayer::updateGraphic(gid, m_graphicPtr);
...
do more modifications
...
GraphicsLayer::updateGraphic(gid, m_graphicPtr);
...
This does lead to race conditions because the render thread is accessing attributes of m_grpahicPtr while we're modifying those attributes.
Our solution is exactly what you're proposed - using addGraphic(), working on a new (cloned) graphic for hte changes and then call updateGraphic() with new graphic.
Thx,
Christian