Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,141 @@
|
||||
/**
|
||||
* Plugin Building Ownership
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Gerlinde Rudolphus, SLTE, 2016-04-14
|
||||
*/
|
||||
|
||||
#include "plugin.h"
|
||||
|
||||
#include <CentralEffectSimulation/proxy_building.h>
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
namespace CesBuildings
|
||||
{
|
||||
|
||||
|
||||
std::shared_ptr<CentralEffectSimulation::Plugin::Interface> CesBuildingsPlugin::createInterface(CentralEffectSimulation::Plugin::DataProvider *pdp,
|
||||
const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
|
||||
NGL::Settings *settings,
|
||||
CentralEffectSimulation::MainHandler *mainHandler)
|
||||
{
|
||||
return std::make_shared<CesBuildingsInterfaceImpl>(pdp, dDSConnector, settings, mainHandler);
|
||||
}
|
||||
|
||||
|
||||
CesBuildingsInterfaceImpl::CesBuildingsInterfaceImpl(CentralEffectSimulation::Plugin::DataProvider *pdp,
|
||||
const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
|
||||
NGL::Settings *settings,
|
||||
CentralEffectSimulation::MainHandler *mainHandler)
|
||||
: m_pdp(pdp)
|
||||
, m_ddsConnector(dDSConnector)
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_ddsHandler(m_mainHandler->dds())
|
||||
, m_db(m_mainHandler->db())
|
||||
, m_handlerBuildingData(m_mainHandler->handlerBuildingData())
|
||||
, m_handlerParticipant(m_mainHandler->handlerParticipant())
|
||||
, m_logger(CentralEffectSimulation::getLogger("Plugin.Buildings.CesBuildingsInterfaceImpl"))
|
||||
{
|
||||
Q_UNUSED(settings)
|
||||
}
|
||||
|
||||
CesBuildingsInterfaceImpl::~CesBuildingsInterfaceImpl()
|
||||
{
|
||||
m_handlerBuildingOwnership.reset();
|
||||
m_handlerAesData.reset();
|
||||
m_handlerContaminations.reset();
|
||||
}
|
||||
|
||||
|
||||
bool CesBuildingsInterfaceImpl::init(int domainId, int exerciseId)
|
||||
{
|
||||
m_domainId = domainId;
|
||||
m_exerciseId = exerciseId;
|
||||
INFO_LOG(m_logger) << "CesBuildingsInterfaceImpl::init()"
|
||||
<< " m_domainId=" << m_domainId
|
||||
<< " m_exerciseId=" << m_exerciseId;
|
||||
|
||||
|
||||
// initialize handlerBuildingOwnership
|
||||
INFO_LOG(m_logger) << "initialize handlerBuildingOwnership ----------------------------";
|
||||
m_handlerBuildingOwnership = std::make_shared<HandlerBuildingOwnership>(m_ddsHandler,
|
||||
m_handlerParticipant,
|
||||
m_handlerBuildingData,
|
||||
m_db,
|
||||
this);
|
||||
|
||||
|
||||
if (!m_handlerBuildingOwnership->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation m_handlerBuildingOwnership failed.";
|
||||
return false;
|
||||
}
|
||||
INFO_LOG(m_logger) << "end initialize handlerBuildingOwnership ----------------------------";
|
||||
|
||||
// initialize handlerAesData
|
||||
INFO_LOG(m_logger) << "initialize handlerAesData ----------------------------";
|
||||
m_handlerAesData = std::make_shared<HandlerAesData>(m_ddsHandler,
|
||||
m_handlerBuildingData,
|
||||
this);
|
||||
if (!m_handlerAesData->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation m_handlerAesData failed.";
|
||||
return false;
|
||||
}
|
||||
INFO_LOG(m_logger) << "end initialize HandlerAesData ----------------------------";
|
||||
|
||||
// initialize handlerAesData
|
||||
INFO_LOG(m_logger) << "initialize handlerContaminations ----------------------------";
|
||||
m_handlerContaminations = std::make_shared<HandlerContamination>(m_ddsHandler,
|
||||
this);
|
||||
|
||||
if (!m_handlerContaminations->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation m_handlerContaminations failed.";
|
||||
return false;
|
||||
}
|
||||
INFO_LOG(m_logger) << "end initialize HandlerContaminations ----------------------------";
|
||||
|
||||
|
||||
// initialize handlerBuildingModel
|
||||
INFO_LOG(m_logger) << "initialize handlerBuildingModel ----------------------------";
|
||||
m_handlerBuildingModel = std::make_shared<HandlerBuildingModel>(m_ddsHandler,
|
||||
m_handlerAesData,
|
||||
this);
|
||||
if (!m_handlerBuildingModel->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation m_handlerBuildingModel failed.";
|
||||
return false;
|
||||
}
|
||||
INFO_LOG(m_logger) << "end initialize handlerBuildingModel ----------------------------";
|
||||
|
||||
|
||||
// Maybe not all MainStructureElements are processed yet.
|
||||
// So give MainEventLoop time to finish their processing:
|
||||
|
||||
// suggest Qtimer::singleShot()
|
||||
QTimer::singleShot(1000, this, [this]()
|
||||
{
|
||||
std::shared_ptr<CentralEffectSimulation::ProxyBuilding> proxyBuilding = m_mainHandler->proxyBuilding();
|
||||
if (proxyBuilding)
|
||||
{
|
||||
INFO_LOG(m_logger) << "set_handlerBuildingModel ----------------------------";
|
||||
proxyBuilding->set_handlerBuildingModel(m_handlerBuildingModel);
|
||||
}
|
||||
});
|
||||
|
||||
INFO_LOG(m_logger) << "CesBuildingsInterfaceImpl::init() return true";
|
||||
return true;
|
||||
}
|
||||
|
||||
QString CesBuildingsInterfaceImpl::echo(const QString &message)
|
||||
{
|
||||
QString ret(QStringLiteral("<<<< %1 >>>> CentralEffectSimulationBuildingOwnershipInterfaceImpl::echo").arg(message));
|
||||
INFO_LOG(m_logger) << "CentralEffectSimulationBuildingOwnershipInterfaceImpl::echo return:" << ret;
|
||||
DEBUG_LOG(m_logger) << "DEBUG: CentralEffectSimulationBuildingOwnershipInterfaceImpl::echo return:" << ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
} //namespace CesBuildings
|
||||
Reference in new issue
Block a user