- Merged 292 changed files from dlbo snapshot - Fixed IDL enum collisions (PortType, PdmEventType) - Fixed Grantlee template for C++11 scoped enums - Fixed CMake VERSION_GREATER syntax - Added missing directories (THP, LtsRestClient, etc.) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
61 lines
1.6 KiB
C++
61 lines
1.6 KiB
C++
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
|
|
#include <PluginInterfaces/gui_plugin_interface.h>
|
|
#include <LtsSession/lts_session.h>
|
|
|
|
#include "gui_element_plugin.h"
|
|
#include "custom_widget.h"
|
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
GuiElementPlugin::GuiElementPlugin()
|
|
{
|
|
|
|
}
|
|
|
|
QWidget *GuiElementPlugin::createGuiElement(QWidget *parent)
|
|
{
|
|
m_customWidget = new CustomWidget(parent);
|
|
if (!m_ppmDtc)
|
|
{
|
|
qCritical()<<" ppmDtc not yet init!!!";
|
|
return nullptr;
|
|
}
|
|
|
|
connect(m_customWidget, &CustomWidget::finOnMapClicked, this, &GuiElementPlugin::onFindOnMap);
|
|
connect(m_ppmDtc.get(), &ParticipantManagement::Interface::Dtc::participantPositionChanged,
|
|
m_customWidget, [=](const ParticipantManagement::ParticipantPosition &ppPos){
|
|
m_customWidget->onPositionChanged(ppPos.pos(), m_participantId);
|
|
}, Qt::UniqueConnection);
|
|
m_customWidget->onPositionChanged(m_ppmDtc->participantPosition(m_participantId).pos(), m_participantId);
|
|
return m_customWidget;
|
|
}
|
|
|
|
|
|
bool GuiElementPlugin::init(LtsSession::LtsSession *session, int participantId)
|
|
{
|
|
m_session = session;
|
|
|
|
if (!m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
|
|
{
|
|
qCritical()<<"couln't init ppmDtc for gui element ";
|
|
return false;
|
|
}
|
|
|
|
if (!session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(m_sitMapGuiIfc))
|
|
{
|
|
qCritical()<<"couln't init sitMapGuiIfc for gui element ";
|
|
return false;
|
|
}
|
|
|
|
m_participantId = participantId;
|
|
return true;
|
|
}
|
|
|
|
void GuiElementPlugin::onFindOnMap()
|
|
{
|
|
if (m_sitMapGuiIfc)
|
|
m_sitMapGuiIfc->centerMapToParticipant(m_participantId);
|
|
}
|