Select to view content in your preferred language

GraphicsOverlay labels fromJson does not work after upgrading to 100.15

775
2
Jump to solution
09-06-2022 12:47 AM
Labels (3)
FatmaAkdemir
Frequent Contributor

Hi everyone,

I was using 100.8 runtime library in my project. After upgrading to 100.15 we saw that labels were not visible anymore. We were creating labels like below:

mpDistrictNamesOverlay = new GraphicsOverlay(this);
	 mpDistrictNamesOverlay->setSceneProperties(LayerSceneProperties(SurfacePlacement::Draped));
	 const QString labelDistrictNames(R"({"labelExpressionInfo":{"expression":"$feature.districtName"},"labelPlacement":"esriServerPointLabelPlacementAboveCenter","symbol":{"angle":0,"backgroundColor":[0,0,0,0],"borderLineColor":[0,0,0,0],"borderLineSize":0,"color": [255,255,255,255],"font":{"decoration":"none","size":8,"style":"normal","weight":"normal"},"haloColor":[0,0,0,0],"haloSize":0,"horizontalAlignment":"center","kerning":false,"type":"esriTS","verticalAlignment":"middle","xoffset":0,"yoffset":0}})");
	 LabelDefinition* labelDefDistrictNames = LabelDefinition::fromJson(labelDistrictNames, this);
	 mpDistrictNamesOverlay->labelDefinitions()->append(labelDefDistrictNames);
	 mpDistrictNamesOverlay->setLabelsEnabled(true);
	 m_sceneView->graphicsOverlays()->append(mpDistrictNamesOverlay);

What would be the new way to print $feature.districtName as a label, in fact a simple label, on an overlay? We have a 3D SceneView by the way.

 

0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

I'm not sure why the fromJSON call should have stopped working, but one option you could try (and it might make for more maintainable code) is to use the new Labeling API we added at 100.11.

See https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-labeldefinition.html for more properties you can now set through the API.

View solution in original post

2 Replies
Nicholas-Furness
Esri Regular Contributor

I'm not sure why the fromJSON call should have stopped working, but one option you could try (and it might make for more maintainable code) is to use the new Labeling API we added at 100.11.

See https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-labeldefinition.html for more properties you can now set through the API.

FatmaAkdemir
Frequent Contributor

Thank you @Nicholas-Furness , actually I discovered that I made a small mistake in my own code which was the reason of labels not being displayed. fromJSON is working just as before.

0 Kudos