I'm experiencing a situation where identifyGraphicsOverlay calls are never indicating they've finished to the application. I've got an application with several layers of GraphicsOverlays, and when an end-user clicks on the mapView, I need to identify what items in which layer may have been clicked.
What I'm observing is that if I get "click happy" the identifyGraphicsOverlay calls will stack (I am keeping a list of taskWatchers) and nothing happens... eventually the mapView will lock up until I move the mouse off the application; at which point all of the tasks seem to execute and the mapView "frees up" as if nothing ever happened.
I've put in a monitor function to gain information about the taskWatchers, and they are valid and remain so. Here's a little bit of that monitor's output:
Other task count: 22 -- tasks started: 60 ; tasks finished: 38
"Hung states = [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid]"
Other task count: 22 -- tasks started: 60 ; tasks finished: 38
"Hung states = [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid]"
Other task count: 22 -- tasks started: 60 ; tasks finished: 38
"Hung states = [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid]"
Other task count: 22 -- tasks started: 60 ; tasks finished: 38
"Hung states = [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid]"
Other task count: 22 -- tasks started: 60 ; tasks finished: 38
"Hung states = [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid]"
Other task count: 22 -- tasks started: 60 ; tasks finished: 38
"Hung states = [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid]"
Other task count: 22 -- tasks started: 60 ; tasks finished: 38
"Hung states = [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid]"
Other task count: 22 -- tasks started: 60 ; tasks finished: 38
"Hung states = [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid]"
Other task count: 22 -- tasks started: 60 ; tasks finished: 38
"Hung states = [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid]"
Other task count: 22 -- tasks started: 60 ; tasks finished: 38
"Hung states = [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid]"
Other task count: 22 -- tasks started: 60 ; tasks finished: 38
"Hung states = [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid]"
Other task count: 22 -- tasks started: 60 ; tasks finished: 38
"Hung states = [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid] [valid]"
Again, as soon as I move the mouse off of the application, I am seeing this:
Other task count: 0 -- tasks started: 60 ; tasks finished: 60
Other task count: 0 -- tasks started: 60 ; tasks finished: 60
Other task count: 0 -- tasks started: 60 ; tasks finished: 60
Here is the relevant code:
connect(m_mapView,
&MapGraphicsView::identifyGraphicsOverlayCompleted,
this,
&App::identify_overlay_completed);
...
void App::build_taskwatchers(const QList<our_layer_enum> layers_to_watch, const int x, const int y)
{
constexpr double tolerance = 5;
constexpr bool returnPopupsOnly = false;
constexpr int maximumResults = 10;
// Set up a bunch of identifyGraphics threads to see which (if any) overlay items
// were clicked.
for (our_layer_enum layer : layers_to_watch)
{
Esri::ArcGISRuntime::TaskWatcher tw =
m_mapView->identifyGraphicsOverlay(m_overlays[layer].data(),
x,
y,
tolerance,
returnPopupsOnly,
maximumResults);
}
}
...
void App::identify_overlay_completed(const QUuid id,
Esri::ArcGISRuntime::IdentifyGraphicsOverlayResult * raw_result)
{
... do stuff
Again, if you click like a sane human, this all works fine. But our users tend to get click happy; and when they do so "identify_overlay_completed" is never called.
I have tried to do the
identifyGraphicsOverlays / identifyGraphicsOverlaysCompleted
pairing instead, and it did the same thing; that is, it never finished tasks if someone was click happy.
I guess what I'm looking for is a way to actually have TaskWatcher::cancel work. I have tried cancelling the tasks in my little monitor function if they are aged out, and it does absolutely nothing.
The only (seemingly magical) way to get these stuck identifications unstuck is to move the mouse off of the application.
Note: I did build the "IdentifyGraphics" tutorial, and while it never freezes up, if you get click-happy with it, it will intermittently not pop up the "Tapped on Graphic" message. It never seems to lock up though.