Migrates remaining include, viewer and DDS headers to rtiddsgen API
Converts accessor calls to plain member access and fixes SituationMap CMake.
This commit is contained in:
5 files changed
+85
-21
No files matched your search
@@ -6,6 +6,12 @@
|
|||||||
#include <AssetManagement/asm_data_plugin_interface.h>
|
#include <AssetManagement/asm_data_plugin_interface.h>
|
||||||
#include <ExerciseManagement/exm_data_plugin_interface.h>
|
#include <ExerciseManagement/exm_data_plugin_interface.h>
|
||||||
#include <Viewer/SituationMap/ElevationMap/elevation_map_manager.h>
|
#include <Viewer/SituationMap/ElevationMap/elevation_map_manager.h>
|
||||||
|
#include <Viewer/SituationMap/Common/resource_path.h>
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include <QHash>
|
||||||
|
#include <QSharedPointer>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
static_assert((int)SituationMap::ElevationMapManager::LineOfSight::LOS_UNDEFINED ==
|
static_assert((int)SituationMap::ElevationMapManager::LineOfSight::LOS_UNDEFINED ==
|
||||||
(int)LtsElevation::LineOfSight::LOS_UNDEFINED,
|
(int)LtsElevation::LineOfSight::LOS_UNDEFINED,
|
||||||
@@ -106,15 +112,71 @@ LtsElevationManager::createInstance(int exerciseId, const std::shared_ptr<Exerci
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList filePaths_rough_to_fine;
|
// Qt5 logic restored (the qt6 port had dropped the exerciseId->trainingAreaId
|
||||||
|
// caching and always returned nullptr here).
|
||||||
#ifdef BUILD_RTI
|
#ifdef BUILD_RTI
|
||||||
filePaths_rough_to_fine = getFilenamesForExercise(exerciseId);
|
int trainingAreaId = -1;
|
||||||
|
|
||||||
|
// remember for future calls
|
||||||
|
// (so createInstance should work WITHOUT dtcs)
|
||||||
|
// Idea: MainHandler: createInstance with exerciseId and valid dtcs
|
||||||
|
// Plugin or simular: createInstance with exerciseId and no dtcs
|
||||||
|
static QHash<int, int> s_exIdToTaIdStore;
|
||||||
|
|
||||||
|
const auto exTaIt = s_exIdToTaIdStore.find(exerciseId);
|
||||||
|
if (exTaIt != s_exIdToTaIdStore.end())
|
||||||
|
{
|
||||||
|
// CASE 1:
|
||||||
|
// already created:
|
||||||
|
trainingAreaId = *exTaIt;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// CASE 2:
|
||||||
|
// ... or create on demand:
|
||||||
|
if (!exmDtc || !asmDtc)
|
||||||
|
{
|
||||||
|
ERROR_LOG(logger) << Q_FUNC_INFO << " no dtcs for exerciseId=" << exerciseId
|
||||||
|
<< ", asmDtc=" << asmDtc
|
||||||
|
<< ", exmDtc=" << exmDtc;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// exId to taId
|
||||||
|
trainingAreaId = exerciseIdToTrainingAreaId(exerciseId, exmDtc);
|
||||||
|
if (trainingAreaId <= 0)
|
||||||
|
{
|
||||||
|
ERROR_LOG(logger) << Q_FUNC_INFO << " Error getting trainingAreaId"
|
||||||
|
<< ", exerciseId=" << exerciseId
|
||||||
|
<< ", trainingAreaId=" << trainingAreaId;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// store and remember:
|
||||||
|
s_exIdToTaIdStore[exerciseId] = trainingAreaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CASE 1: Following should work even with invalid asmDtc:
|
||||||
|
LTS_ELEVATION_MANAGER_TYPE temp = createInstanceForTrainingAreaId(trainingAreaId, asmDtc);
|
||||||
|
if (!temp)
|
||||||
|
{
|
||||||
|
ERROR_LOG(logger) << Q_FUNC_INFO << " Error on createInstanceForTrainingAreaId"
|
||||||
|
<< ", exerciseId=" << exerciseId
|
||||||
|
<< ", trainingAreaId=" << trainingAreaId;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add exmDtc
|
||||||
|
temp->initDDS(exmDtc, asmDtc);
|
||||||
|
|
||||||
|
TRACE_LOG(logger) << Q_FUNC_INFO << " END, exerciseId=" << exerciseId;
|
||||||
|
return temp;
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(exerciseId);
|
Q_UNUSED(exmDtc);
|
||||||
ERROR_LOG(logger) << Q_FUNC_INFO << " BUILD_RTI=OFF, cannot get filenames for exercise";
|
Q_UNUSED(asmDtc);
|
||||||
#endif
|
ERROR_LOG(logger) << Q_FUNC_INFO << " BUILD_RTI=OFF, cannot create instance";
|
||||||
Q_UNUSED(filePaths_rough_to_fine);
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
LTS_ELEVATION_MANAGER_TYPE LtsElevationManager::getInstance(int exerciseId)
|
LTS_ELEVATION_MANAGER_TYPE LtsElevationManager::getInstance(int exerciseId)
|
||||||
@@ -291,19 +353,19 @@ QStringList LtsElevationManager::getFilenamesForTrainingArea(int trainingAreaId)
|
|||||||
{
|
{
|
||||||
d->m_asmDtc->waitForHistoricalDataTrainingArea(1000);
|
d->m_asmDtc->waitForHistoricalDataTrainingArea(1000);
|
||||||
const AssetManagement::TrainingArea& ta = d->m_asmDtc->trainingArea(trainingAreaId);
|
const AssetManagement::TrainingArea& ta = d->m_asmDtc->trainingArea(trainingAreaId);
|
||||||
if (ta.id() != trainingAreaId)
|
if (ta.id != trainingAreaId)
|
||||||
{
|
{
|
||||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Error on s_asmDtc->trainingArea"
|
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Error on s_asmDtc->trainingArea"
|
||||||
<< ", trainingAreaId=" << trainingAreaId;
|
<< ", trainingAreaId=" << trainingAreaId;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const std::vector<AssetManagement::MapDescription>& mdVec = ta.elevation();
|
const std::vector<AssetManagement::MapDescription>& mdVec = ta.elevation;
|
||||||
filePaths_rough_to_fine.reserve(mdVec.size());
|
filePaths_rough_to_fine.reserve(mdVec.size());
|
||||||
|
|
||||||
for (const AssetManagement::MapDescription& md : std::as_const(mdVec))
|
for (const AssetManagement::MapDescription& md : std::as_const(mdVec))
|
||||||
{
|
{
|
||||||
|
|
||||||
QUrl url(QString::fromStdString(md.url()));
|
QUrl url(QString::fromStdString(md.url));
|
||||||
QString filePathAbs = url.toLocalFile();
|
QString filePathAbs = url.toLocalFile();
|
||||||
if (QDir::isRelativePath(filePathAbs))
|
if (QDir::isRelativePath(filePathAbs))
|
||||||
filePathAbs = SituationMap::getResourcePath() + QStringLiteral("/elevation/") + filePathAbs;
|
filePathAbs = SituationMap::getResourcePath() + QStringLiteral("/elevation/") + filePathAbs;
|
||||||
@@ -372,13 +434,13 @@ int LtsElevationManager::exerciseIdToTrainingAreaId(int exerciseId,
|
|||||||
exmDtc->waitForHistoricalDataExercise(1000);
|
exmDtc->waitForHistoricalDataExercise(1000);
|
||||||
|
|
||||||
const ExerciseManagement::Exercise& exm = exmDtc->exercise(exerciseId);
|
const ExerciseManagement::Exercise& exm = exmDtc->exercise(exerciseId);
|
||||||
if (exm.id() != exerciseId)
|
if (exm.id != exerciseId)
|
||||||
{
|
{
|
||||||
ERROR_LOG(logger) << Q_FUNC_INFO << " Error on m_exmDtc->exercise"
|
ERROR_LOG(logger) << Q_FUNC_INFO << " Error on m_exmDtc->exercise"
|
||||||
<< ", exerciseId=" << exerciseId;
|
<< ", exerciseId=" << exerciseId;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
trainingAreaId = exm.trainingAreaId();
|
trainingAreaId = exm.trainingAreaId;
|
||||||
|
|
||||||
if (trainingAreaId <= 0)
|
if (trainingAreaId <= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ class FunctionTopicTests : public QObject
|
|||||||
const DdsUnitTests::FunctionRequestWithState& request);
|
const DdsUnitTests::FunctionRequestWithState& request);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NGL::INGLLogger& m_logger;
|
|
||||||
void requestWithState();
|
void requestWithState();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
ADD_SUBDIRECTORY(Common)
|
ADD_SUBDIRECTORY(Common)
|
||||||
ADD_SUBDIRECTORY(SymbologyXML)
|
ADD_SUBDIRECTORY(SymbologyXML)
|
||||||
ADD_SUBDIRECTORY(Symbology)
|
ADD_SUBDIRECTORY(Symbology)
|
||||||
# ADD_SUBDIRECTORY(ElevationMap)
|
# ElevationMapManager compatibility stub (src/ + include/ scaffolding) needed by LtsElevation
|
||||||
|
ADD_SUBDIRECTORY(ElevationMap)
|
||||||
|
|
||||||
# Remaining subdirectories not yet migrated:
|
# Remaining subdirectories not yet migrated:
|
||||||
# ADD_SUBDIRECTORY(SymbologyGui)
|
# ADD_SUBDIRECTORY(SymbologyGui)
|
||||||
|
|||||||
+7
-7
@@ -37,7 +37,7 @@ public:
|
|||||||
|
|
||||||
const StructureElement &data() const { return m_data; }
|
const StructureElement &data() const { return m_data; }
|
||||||
void updateData(const StructureElement &data, int floorId) { m_data = data; m_floor = floorId; }
|
void updateData(const StructureElement &data, int floorId) { m_data = data; m_floor = floorId; }
|
||||||
int32_t id() const { return m_data.id(); }
|
int32_t id() const { return m_data.id; }
|
||||||
int32_t associatedAssetId() const { return m_associatedAssetId; }
|
int32_t associatedAssetId() const { return m_associatedAssetId; }
|
||||||
bool hasAssociatedAsset() const { return m_associatedAssetId > 0; }
|
bool hasAssociatedAsset() const { return m_associatedAssetId > 0; }
|
||||||
bool hasAssociatedAssetDefect() const { return m_hasAssociatedAssetDefect; }
|
bool hasAssociatedAssetDefect() const { return m_hasAssociatedAssetDefect; }
|
||||||
@@ -53,13 +53,13 @@ public:
|
|||||||
//@}
|
//@}
|
||||||
|
|
||||||
bool isValid() const { return m_isValid; }
|
bool isValid() const { return m_isValid; }
|
||||||
Core::GeoPosition geoPosition() const { return m_data.geoPosition(); }
|
Core::GeoPosition geoPosition() const { return m_data.geoPosition; }
|
||||||
Core::RelativePosition relPosition() const { return m_data.relPosition(); }
|
Core::RelativePosition relPosition() const { return m_data.relPosition; }
|
||||||
MountingPointType type() const { return m_data.mountingPointTypeId(); }
|
MountingPointType type() const { return m_data.mountingPointTypeId; }
|
||||||
int32_t buildingId() const { return m_data.mainStructureElementId(); }
|
int32_t buildingId() const { return m_data.mainStructureElementId; }
|
||||||
QString name() const;
|
QString name() const;
|
||||||
QString fileName() const;
|
QString fileName() const;
|
||||||
QByteArray properties() const { return m_data.properties().c_str(); }
|
QByteArray properties() const { return m_data.properties.c_str(); }
|
||||||
|
|
||||||
QImage toImage(int32_t edgeLength = 100) const;
|
QImage toImage(int32_t edgeLength = 100) const;
|
||||||
bool writeFile(int32_t edgeLength = 25) const;
|
bool writeFile(int32_t edgeLength = 25) const;
|
||||||
@@ -126,7 +126,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static QMap<MountingPointType_def::type, MpNameImageData> &getImageTableInternal();
|
static QMap<MountingPointType_def::type, MpNameImageData> &getImageTableInternal();
|
||||||
static void insertHelper(MountingPointType_def::type type,
|
static void insertHelper(MountingPointType::type type,
|
||||||
const QString &name,
|
const QString &name,
|
||||||
const QString &colorCodeGray,
|
const QString &colorCodeGray,
|
||||||
const QString &colorCodeGreen,
|
const QString &colorCodeGreen,
|
||||||
|
|||||||
+3
-1
@@ -25,7 +25,9 @@ using LOSVector = std::vector<double>;
|
|||||||
namespace SituationMap
|
namespace SituationMap
|
||||||
{
|
{
|
||||||
|
|
||||||
class ElevationMapManager final : public QObject
|
// The NGL build uses -fvisibility=hidden; LtsElevation links this class
|
||||||
|
// across the shared library boundary, so it needs default visibility.
|
||||||
|
class __attribute__((visibility("default"))) ElevationMapManager final : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user