Select to view content in your preferred language

Updating rendered graphic attributes

3682
14
Jump to solution
09-07-2021 01:29 AM
PeterBell2
Emerging Contributor

Hello,

We are currently trying to optimise some of our code (which uses version 100.10 of the SDK), and the Graphics in particular. We are currently setting the symbol of each Graphic to a PictureMarkerSymbol, which seems to be quite inefficient as suggested by this forum post: https://community.esri.com/t5/arcgis-runtime-sdk-for-net-questions/adding-a-large-number-of-graphics... We have lots of different symbols in our program, but many Graphics are using the same symbol. Each type of Graphic is added to a different graphics overlay. 

I have been experimenting with using renderers as suggested by the linked post, but feels like I have hit a dead end. Our Graphics represent things like ships currently sailing, and we need to update the position and rotation of each graphic roughly once per second. I have got a DictionaryRenderer working with attribute dictionaries for the Graphics to start with the correct rotation, but my issue is that I don't see a way of then updating the rotation after the Graphics have been added to the overlay. 

Is there a way to get this working? Or is there another approach that would be better for dynamic data visualisation like this?

0 Kudos
14 Replies
PeterBell2
Emerging Contributor

Hi, thanks for the clarification. I mentioned this a bit in my reply to dotMorten_esri just now, but I was pursuing DictionaryRenderer in the hopes of using it for the rest of our program as well, which has some more complex cases. 

This approach would seem to require manually uploading all of our symbols to Pro though, which we are keen to avoid if possible. Are there any other options?

0 Kudos
dotMorten_esri
Esri Notable Contributor

A few questions, just to clarify your scenario, so I can better suggest the most efficient approach:
- Does all the ship symbols look the same (except for the direction they are rotated to)
- If the symbols doesn't look the same, do every individual ship use a unique looking symbol, or are there limited set of symbols? (like rowboat, sailboat, ferry, freighter etc, and again ignoring the heading of each one).

If they are all the same symbol, you should use a SimpleRenderer with a rotation expression set. If there is a limited group of symbols, use a UniqueValueRenderer with a rotation expression.
If every single ship uses a completely unique picture marker symbol, I would suggest you reconsider your approach, or at least keep the number of ships displayed at the same time to a minimum. If that's the case, perhaps you can go into more detail how each ship changes (ie color, size, shape changing, or unique photo of each vessel, etc and also what sort of info you use to decide how they look different)

0 Kudos
PeterBell2
Emerging Contributor

In this specific case, all the ship symbols do look the same, so SimpleRenderer could work. That said, ideally we'd use the same system for the rest of our program, which is more complex. For instance, some symbols are colour-coded, which makes SimpleRenderer less appealling (unless we use a different overlay for each symbol, but I assume that's bad form). We also have a few cases where we overlay different symbols (e.g. when the user hovers the mouse over the symbol) at runtime. It looked like DictionaryRenderer was the way to go in order to achieve that level of configurability. 

As far as I can tell though, a using a DictionaryRenderer would mean we would have to manually upload each symbol into a stylx file. We have a finite but large amount of symbols, so we are keen to avoid this if we can. 

0 Kudos
dotMorten_esri
Esri Notable Contributor

If you just have a limited set of colors, I'd just use a UniqueValueRenderer instead of DictionaryRenderer.

0 Kudos
PeterBell2
Emerging Contributor

That sounds reasonable. I think the approach we will likely go for is to use UniqueValueRenderer where possible, and use the previous inefficient system for the more complex cases when we are sure there will be a small amount of graphics. Thank you very much for your help!

0 Kudos