Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Viewer/SituationMap/ElevationMap/elevation_map.cpp
T

166 lines
3.5 KiB
C++
Executable File

// Stub implementation without GDAL dependency for Qt6 migration
#include "elevation_map.h"
#include "elevation_map_helper.h"
#include <QFileInfo>
#include <QFutureWatcher>
#include <QtConcurrent>
#include <QRectF>
#include <QPolygonF>
#include <Common/situation_map_logging.h>
using namespace SituationMap;
class ElevationMap::Internal
{
public:
Internal() = default;
~Internal() = default;
};
ElevationMap::ElevationMap(const QFileInfo &fileInfo)
: m_internal(new Internal())
, m_aproximation(true)
, m_valid(false)
, m_logger(getLogger("ElevationMap"))
{
m_fileName = fileInfo.absoluteFilePath();
INFO_LOG(m_logger) << " ctor ElevationMap: map of file '" << m_fileName << "'"
<< ", this=" << this;
if (!fileInfo.exists())
{
ERROR_LOG(m_logger) << LOGFUNCTION << " elevation data file \'" << m_fileName << "\' doesn't exists.";
return;
}
if (!fileInfo.isReadable())
{
ERROR_LOG(m_logger) << LOGFUNCTION << " elevation data file \'" << m_fileName << "\' isn't readable.";
return;
}
auto cb = [this]()
{
return readFromFile();
};
auto cbFinished = [this]()
{
NOTICE_LOG(m_logger) << " Finished reading elevation map of file '" << m_fileName << "'"
<< ", this=" << this;
};
QObject::connect(&m_gdalReadWatcher, &QFutureWatcher<bool>::finished,
&m_gdalReadWatcher, cbFinished);
m_gdalReadWatcher.setFuture(QtConcurrent::run(cb));
}
ElevationMap::~ElevationMap()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
m_gdalReadWatcher.cancel();
m_gdalReadWatcher.waitForFinished();
delete m_internal;
m_internal = nullptr;
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
bool ElevationMap::waitForInitialization()
{
m_gdalReadWatcher.waitForFinished();
return m_valid;
}
bool ElevationMap::isValid() const
{
return m_valid;
}
QString ElevationMap::filename() const
{
return m_fileName;
}
QRectF ElevationMap::extent() const
{
return QRectF();
}
QPair<double, double> ElevationMap::elexelSize() const
{
return qMakePair(0.0, 0.0);
}
double ElevationMap::elevation(double lon, double lat) const
{
return 0.0;
}
double ElevationMap::distance(const QPointF &start, const QPointF &end) const
{
return 0.0;
}
double ElevationMap::profileDistance(const QPointF &start, const QPointF &end) const
{
return 0.0;
}
unsigned int ElevationMap::elevationProfile(const QPointF &start, const QPointF &end, Vec3dVector &elevProfile) const
{
elevProfile.clear();
return 0;
}
bool ElevationMap::contains(const QPointF &point) const
{
return false;
}
bool ElevationMap::intersects(const QPolygonF &polygon) const
{
return false;
}
void ElevationMap::LOSProfile(const QPointF &start, const QPointF &end, LOSVector &losProfile)
{
losProfile.clear();
}
int ElevationMap::getElevation(int column, int row) const
{
return 0;
}
double ElevationMap::getElevation(double lon, double lat) const
{
return 0.0;
}
double ElevationMap::getOrSubstituteElevation(int column, int row, double substitute) const
{
return substitute;
}
void ElevationMap::getSamplePoints(const QPointF &start, const QPointF &end, Vec3dVector &sPnts) const
{
sPnts.clear();
}
int ElevationMap::clipp2Map(const QPointF &start, const QPointF &end, QPointF &cStart, QPointF &cEnd) const
{
cStart = start;
cEnd = end;
return 0;
}
bool ElevationMap::readFromFile()
{
// Stub implementation - GDAL removed for Qt6 migration
ERROR_LOG(m_logger) << LOGFUNCTION << " GDAL support not available in Qt6 build";
m_valid = false;
return false;
}