Select to view content in your preferred language

Deleting a single entity from DynamicEntityLayer

211
5
Jump to solution
2 weeks ago
FatmaAkdemir
Frequent Contributor

Given a specific entity ID, I want to remove an entity from DynamicDataSource or DynamicEntityLayer. Is that possible?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JamesBallard1
Esri Regular Contributor

Hi @FatmaAkdemir ,

Yes indeed, you can call deleteEntityAsync and pass in the ID. It is a protected function, but if you are implementing your own data source you should have access to it.

https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-dynamicentitydatasource.html#d... 

If you are using the out-of-the-box ArcGISStreamService class, then it won't be possible.

View solution in original post

5 Replies
JamesBallard1
Esri Regular Contributor

Hi @FatmaAkdemir ,

Yes indeed, you can call deleteEntityAsync and pass in the ID. It is a protected function, but if you are implementing your own data source you should have access to it.

https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-dynamicentitydatasource.html#d... 

If you are using the out-of-the-box ArcGISStreamService class, then it won't be possible.

FatmaAkdemir
Frequent Contributor

Hi @JamesBallard1 ,

Thanks for the answer. What should I do with the return value QFuture?

0 Kudos
JamesBallard1
Esri Regular Contributor

@FatmaAkdemir we recommend you check for errors in case anything goes wrong. 

See the "Handling Errors" section here: https://developers.arcgis.com/qt/cpp/api-reference/working-with-qfuture.html

https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-errorexception.html 

All tasks can fail, so it is best to recognize when and if that happens so your code can recover (or ignore) accordingly. For example if you pass an invalid ID (doesn't exist, for example), then I assume the task will fail with an error indicating that's what happened.

FatmaAkdemir
Frequent Contributor

Thank you very much for the explanation. If there was a function in DynamicEntity like setVisible() or hide() that would be great. Do you have any plans for the next releases regarding this?

When we apply a filter associated with a DataSource on runtime, we need to show some entities and hide some other entities  but I could not find necessary functions neither in DynamicEntityDataSource nor in DynamicEntityLayer. After I apply the filter, there is no way to delete previously added observations.

0 Kudos
JamesBallard1
Esri Regular Contributor

@FatmaAkdemir unfortunately no, no plans for setVisible or hide functionality. That would be similar to a display filter, and no immediate plans for that at the moment.

0 Kudos