FerrariRace

How to add TextSymbol and SimpleMarkerSymbol to the same Graphic object.

Discussion created by FerrariRace on Sep 4, 2017
Latest reply on Sep 5, 2017 by FerrariRace

Hi everyone! I have some trouble with displayng a marker with some legend. When i put a marker on the map, there is no problem to replace it during the program execution. But i want to connect this marker with a legend and update the position of my marker at the same time with the legend. I found a simple way to create a legend by using TextSymbol, but it blocked SimpleMarkerSymbol.

Sample of code:

----------------------------------------------------------------------------------------------------------------------------------------------------------

SimpleMarkerSymbol* crossSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Cross, QColor("red"), 12, this);

Point point(-110.828140, 44.460458, SpatialReference::wgs84());

Graphic* graphic = new Graphic(point, crossSymbol, this);

m_graphicsOverlay->graphics()->append(graphic);

 

And display it:

m_mapView->graphicsOverlays()->append(m_graphicsOverlay);

 

In this code there's no any problems. As if i add TextSymbol.

I know that both of this classes Inherited from the same parent, but can i put them together and then update coordinates in a way like this:

Graphic* tmp= m_graphicsOverlay->graphics()->at( 'Some index ');

tmp->setGeometry(point); (reinitialize coordinates).

 

Or should i use some other way? Can anyone tell me.

Outcomes