I am using dictionarySymbolStyle and dictionary renderer in ArcGIS qt 100.5 to read and display symbols from a style file. The code for the function is as follows. m_mapView is my MapGraphicsView object. The application is successfully built. The map is displayed in the output window however the points aren't displayed. The points are displayed using a simplemarkersymbol but not using the dictionary symbology. Can somebody guide me why this problem is occurring??
void offlinemap2d::addPointsFromStyleFile()
{
//create a new graphicsoverlay
GraphicsOverlay* graphicsOverlay = new GraphicsOverlay(this);
// create a list of points
const QList<Point> pointsList
{
Point(72.852642647560347, 19.092812566811544, SpatialReference::wgs84()),
Point(72.8708416959572303, 19.08444173689877, SpatialReference::wgs84()),
Point(32.6697273884990937, 56.064250073402874, SpatialReference::wgs84()),
Point(32.6395150461199726, 56.06127916736989, SpatialReference::wgs84())
};
// create the symbology for the points
dictionarySymbolStyle = new DictionarySymbolStyle("mil2525d",":/Res/mil2525d.stylx", this);
DictionaryRenderer* renderer = new DictionaryRenderer(dictionarySymbolStyle, this);
graphicsOverlay->setRenderer(renderer);
foreach (const Point &buoyPoint, pointsList)
{
graphic = new Graphic(buoyPoint, this);
graphicsOverlay->graphics()->append(graphic);
}
//add overlay to the map
m_mapView->graphicsOverlays()->append(graphicsOverlay);
}
Hi James,
The load status of the DictionarySymbolStyle is displayed as FailedToLoad. Can you suggest what is causing the load to fail?? I have upgraded my code to arcgis 100.6. I have added the stylx and xml files as resouces to the project. Is this the correct way?
This is good progress. The stylx file must be a file on disk, not in the resources of the application. I would recommend the xml file also be on disk since that is the pattern of the sample.
Please give that a try and see if you're able to load the DictionarySymbolStyle now.
Hi James ,
I have kept the xml file on disk and now the example is working. However I am facing issues with some symbols. The civilian symbols are not displayed in the color code (purple) as intended.
Intended symbol as per mil2525d:
Symbol set - Air (code:01)
Identity - Pending (code:00)
SymbolEntity : Civilian - Fixed Wing (120100)
The details of xml file are as follows:
<message>
<_action>update</_action>
<_wkid>4326</_wkid>
<name>Coordinating Point</name>
<identity>0</identity>
<symbolset>1</symbolset>
<symbolentity>120100</symbolentity>
<_control_points>72.8562,19.0923</_control_points>
</message>
However in my application the symbol is displayed with yellow color code which is default for other symbols. Is there any other information required for civilian symbols??
In order to build the symbol you want with the civilian attributes, you will need to use the fetchSymbol method. Please take a look at the documentation for that method, which gives some good explanation of what to do.