I finally got my runtime qt app converted over from 100.4 to 100.11. I remember from one of the devsummit briefs that 2525 dictionary symbols were able to be resized in a later release. Is there a sample or code snippet displaying how to resize those dictionary symbols?
Solved! Go to Solution.
There is no sample at the moment. Here is the doc - https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-dictionaryrenderer.html#setSca...
Here is an example we have in our tests:
// Simple case... double the size
ArcadeExpression* arcadeExpression = new ArcadeExpression("2", this);
dictionaryRenderer->setScaleExpression(arcadeExpression);
// More advanced case... double the size if the identity_code attribute is 4
ArcadeExpression* arcadeExpression = new ArcadeExpression("iif($feature.Identity_code == 4, 2,1)", this);
dictionaryRenderer->setScaleExpression(arcadeExpression);
Here is an Arcade reference you can use to write your expressions - https://developers.arcgis.com/arcade/
There is no sample at the moment. Here is the doc - https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-dictionaryrenderer.html#setSca...
Here is an example we have in our tests:
// Simple case... double the size
ArcadeExpression* arcadeExpression = new ArcadeExpression("2", this);
dictionaryRenderer->setScaleExpression(arcadeExpression);
// More advanced case... double the size if the identity_code attribute is 4
ArcadeExpression* arcadeExpression = new ArcadeExpression("iif($feature.Identity_code == 4, 2,1)", this);
dictionaryRenderer->setScaleExpression(arcadeExpression);
Here is an Arcade reference you can use to write your expressions - https://developers.arcgis.com/arcade/
That just cleaned up about 130 lines of janky workaround to resize the symbols
Hi Troy. Yes, as Lucas mentioned, there is a new `scaleExpression` method on the Dictionary Renderer that can accept either a constant or an Arcade expression. So it doesn't set your symbol to a specific size, but you can scale all symbols based on a specific value, or use the expression to scale based on an attribute, map scale, etc.
I'm using ArcGis 100.15(Qt) but I'm not able to use 'scaleExpression",
to be clearer:
But if I try to use:
ArcadeExpression* arcadeExpression = new ArcadeExpression("2", this);
renderer->setScaleExpression(arcadeExpression);
nothing happens on the screen, the symbol is always drawn with default dimension.
I tryed to setScaleExpression during initialization and during runtime, but also the same result!
Do you have some advice?
It' funny,
I found the solution just after my question.
The issue was that I used fetchSymbol to create the symbol inside the Graphics.
Instead, the correct way is to fill attribute() of the Graphics with proper properties.
Hi- If you don't need to set the scale based on an attribute value, you can also just use a constant value for setScaleExpression, like this:
renderer->setScaleExpression(2);
Otherwise, yes, you can set the attribute of the graphic and use that in an arcade expression to set the scale.
Kerry