64 lines
1.6 KiB
C++
Executable File
64 lines
1.6 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* The BuildingModel provices building data for SimulationDialog
|
|
* $Id: ism_asset_list_dialog_model.h 58852 2023-02-01 11:28:56Z fritsche_h $
|
|
* $HeadURL: svn://192.168.133.21/TDS/branches/product/features/3dws_devel/Lts/Plugins/InfrastructureManagement/Gui/ResourceManagement/AssetList/ism_asset_list_dialog_model.h $
|
|
* $Author: fritsche_h $
|
|
* Created by Hannes Fritsche, ESZS, 2024-09-20
|
|
*/
|
|
|
|
#include "cds_building_model.h"
|
|
|
|
#include <InfrastructureManagement/ism_dtc.h>
|
|
|
|
namespace CollateralDamageSimulation
|
|
{
|
|
|
|
BuildingModel::BuildingModel(QObject *parent)
|
|
: LtsWidgets::LtsAbstractTableModel<QString>(
|
|
{
|
|
tr("Name")
|
|
},
|
|
parent)
|
|
{
|
|
|
|
}
|
|
|
|
QVariant BuildingModel::data(const QModelIndex &index, int role) const
|
|
{
|
|
if (role != Qt::DisplayRole || !indexIsValid(index))
|
|
return QVariant();
|
|
|
|
if (role == Qt::DisplayRole)
|
|
{
|
|
switch (index.column())
|
|
{
|
|
case NAME:
|
|
return m_vecData.at(index.row());
|
|
default:
|
|
return QVariant();
|
|
}
|
|
}
|
|
|
|
return QVariant();
|
|
}
|
|
|
|
bool BuildingModel::initModel(const std::shared_ptr<InfrastructureManagement::Interface::Dtc> &ismDtc, const QVector<int> &buildingIds)
|
|
{
|
|
m_vecData.clear();
|
|
m_vecData.reserve(buildingIds.size());
|
|
|
|
if (!ismDtc->isMainStructureElementEnabled())
|
|
{
|
|
ismDtc->enableMainStructureElement();
|
|
ismDtc->waitForHistoricalDataMainStructureElement(3000);
|
|
}
|
|
|
|
for (int currentBuildingId : buildingIds)
|
|
m_vecData.append(QString::fromStdString(ismDtc->mainStructureElement(currentBuildingId).name()));
|
|
|
|
return true;
|
|
}
|
|
|
|
} // namespace CollateralDamageSimulation
|