Extract heights in separate thread

84
3
03-03-2020 02:48 AM
Highlighted
New Contributor

We need to extract height at a point in 3d and this information shall be further used in calculations; since there is a large number of points and further operations are also very lengthy, we need to run these operations in a thread. Please tell if we can extract the heights in a thread. If possible please share a sample code

Tags (2)
Reply
0 Kudos
3 Replies
Highlighted
Esri Contributor

Hi Geet Bhatia‌,

   Yes, there is a way to do this. Assuming you are in 3D with a SceneView, you can use the Surface object to do this. Better yet, this method is already asynchronous so it will not lock up your main thread for the calculations.

Surface Class | ArcGIS for Developers 

Here is a sample that demonstrates how to do this.

arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/Scenes/GetElevationAtPoint at master · Esri/... 

Let me know if you're using our Qml Api since that would be a different recommendation.

Reply
0 Kudos
Highlighted
New Contributor

Hi James

Thanks for the reply.

We are currently using QML for making GUI. But this requirement of extracting heights is not related to GUI. The heights are needed for further calculations. This requirement is pertaining to backend processing. The application shall receive a series of coordinates and GUI has to respond with their corresponding heights. Further GUI shall also tell if these coordinates are present in a particular area (which is present on a vector layer).

That's why I asked if we can access the height information and layer information in a thread.

If there is any sample that extracts the height and accesses the map layer without any intervention of GUI in a thread, please share and please tell the way to do it.

Reply
0 Kudos
Highlighted
Esri Contributor

Geet Bhatia‌,

   I apologize for the delay in response. Yes, this can be done using Qt's threading capabilities.

QThread Class | Qt Core 5.14.1 

QtConcurrent Namespace | Qt Concurrent 5.14.1 

The easiest way may be to fire off all your processing via QtConcurrent::run which will run it in another thread. You could, for instance run all of this logic in a separate thread: arcgis-runtime-samples-qt/GetElevationAtPoint.cpp at master · Esri/arcgis-runtime-samples-qt · GitHu... 

You could also have a dedicated QThread running that kick off and process all results in that thread. Unfortunately we do not have any samples that demonstrate how to do this type of task in a multithreaded way beyond the async method that the API provides.

Reply
0 Kudos