I am working on sample Advanced Symbology->Symbol Dictionary given in Arc GIS Qt Samples. As given in the sample we are able to draw symbols, move the symbol(using the call EsriRuntimeQt::MessageHelper::createUpdateMessage) but I am not able to select the symbol which I drawn on map.
In the documentation I found out that in order to select symbol I can use function
static Message EsriRuntimeQt::MessageHelper::createSelectMessage ( const SymbolDictionaryType & type,
const QString & messageId,
const QString & messageType,
const bool & highlight
)
How to use this function in order to achieve selection of symbol?
Solved! Go to Solution.
Bhargav-
There seems to be a bug in our select method, which is setting the "_action" property incorrectly. Luckily, there is a workaround.
Can you try something like:
Message selectMsg = MessageHelper::createSelectMessage(SymbolDictionaryType::Mil2525C, “message_id”, “position_report", true); selectMsg.setProperty(“_action”, “select”); // set _action property to “select” or “un-select” m_groupLayer->messageProcessor()->processMessage( selectMsg ); // process select message
Bhargav-
There seems to be a bug in our select method, which is setting the "_action" property incorrectly. Luckily, there is a workaround.
Can you try something like:
Message selectMsg = MessageHelper::createSelectMessage(SymbolDictionaryType::Mil2525C, “message_id”, “position_report", true); selectMsg.setProperty(“_action”, “select”); // set _action property to “select” or “un-select” m_groupLayer->messageProcessor()->processMessage( selectMsg ); // process select message
Thanks Lucas Danzinger. It is working as you told.
How to select these graphics on mouse click?
I got these in one way,
EsriRuntimeQt::GraphicsLayer* m_graphicsLayer = (EsriRuntimeQt::GraphicsLayer *)m_messageGroupLayer->get(0);
connect(m_graphicsLayer, SIGNAL(graphicIdsComplete(const QList<qint64>&)), this, SLOT(onGraphicIdsComplete(const QList<qint64>&)));
m_graphicsLayer->graphicIds(event.x(),event.y(), 10);
void Symbology::onGraphicIdsComplete(const QList<qint64>& hitGraphicIDs)
{
qDebug()<<"in graphic ids complete";
EsriRuntimeQt::GraphicsLayer *m_graphicsLayer = (EsriRuntimeQt::GraphicsLayer *)m_messageGroupLayer->get(0);
for (int i = 0; i < hitGraphicIDs.length(); i++)
{
if (!m_graphicsLayer->isGraphicSelected(hitGraphicIDs.at(i)))
m_graphicsLayer->select(hitGraphicIDs.at(i));
else
m_graphicsLayer->unselect(hitGraphicIDs.at(i));
}
}
I am able to select mil2525c symbol created by using above procedure. Is there any other way to select graphic(mil2525c graphic) on mouse click?