Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Viewer/SituationMap/MapImpl/viewshed_geo_processing.h
T
torstenandCopilot e581d1e91c Fix viewshed_geo_processing for ArcGIS SDK v300
- Changed QList<Field>() to {} for Field type compatibility
- Updated signal connection from jobStatusChanged to statusChanged
- Changed addFeature() to addFeatureAsync() with QFutureWatcher pattern
- Removed ACRGIS_VERSION guards (Qt6/SDK v300 only)
- Added QFutureWatcher<void> m_addFeatureWatcher member to header

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-13 14:36:47 +02:00

125 lines
3.1 KiB
C++
Executable File

/**
* @RDE_HEADER@
* ViewshedGeoProcessing
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "viewshed_base.h"
// ESRI
#include <Map.h>
#include <SpatialReference.h>
// Qt
#include <QObject>
#include <QColor>
#include <QPointF>
#include <QFutureWatcher>
// forward:
namespace Esri
{
namespace ArcGISRuntime
{
class Map;
class Graphic;
class GraphicsOverlay;
class GeoprocessingTask;
class GeoprocessingJob;
class GeoprocessingResult;
class GeoprocessingFeatures;
class GeoprocessingRaster;
}
}
//----------------------------------------------------------------------------
namespace SituationMap
{
class MapImpl;
class ViewshedGeoProcessing : public ViewshedBase
{
Q_OBJECT
public:
explicit ViewshedGeoProcessing(const QString &url,
Esri::ArcGISRuntime::GraphicsOverlay *graphicsLayer,
const Esri::ArcGISRuntime::SpatialReference &spatialReference,
QObject *parent = nullptr);
virtual ~ViewshedGeoProcessing();
bool init(SituationMap::MapImpl *mapImpl = nullptr); // mapImpl is required only if processRasterResults is used
bool initialized() const { return m_initialized; }
bool execute(const QPointF &viewshedPoint_map, double outerRadius, double observerOffset) override;
bool isRunning() const { return m_viewshedInProgress; }
bool processResults(Esri::ArcGISRuntime::GeoprocessingResult *results);
void clearGraphics();
void createInputGraphic(const Esri::ArcGISRuntime::Point &origin);
void clearInputGraphics();
void createExtentGraphic(const Esri::ArcGISRuntime::Point &origin, double radius);
void clearExtentGraphics();
void clearResultGraphics();
protected slots:
void onJobStatusChanged();
void onJobStatusChangedWithJsParameter(const Esri::ArcGISRuntime::JobStatus &);
void onErrorOccuredGeoprocessingTask(const Esri::ArcGISRuntime::Error &error);
void onErrorOccuredGeoprocessingJob(const Esri::ArcGISRuntime::Error &error);
protected:
bool processFeatureResults(Esri::ArcGISRuntime::GeoprocessingFeatures *viewshedResultFeatures);
bool processRasterResults(Esri::ArcGISRuntime::GeoprocessingRaster *viewshedResultRaster);
private:
QString m_url;
Esri::ArcGISRuntime::GraphicsOverlay *m_resultsOverlay;
SituationMap::MapImpl *m_mapImpl = nullptr;
Esri::ArcGISRuntime::SpatialReference m_srMap;
Esri::ArcGISRuntime::GeoprocessingTask *m_viewshedTask = nullptr;
QString m_jobStatus;
Esri::ArcGISRuntime::GeoprocessingJob *m_viewshedJob = nullptr;
bool m_initialized = false;
bool m_viewshedInProgress = false;
QList<Esri::ArcGISRuntime::Graphic *> m_resultGraphics;
Esri::ArcGISRuntime::Graphic *m_originGraphic = nullptr;
Esri::ArcGISRuntime::Graphic *m_extentGraphic = nullptr;
QFutureWatcher<void> m_addFeatureWatcher;
LOGGER_T m_logger;
}; // class ViewshedGeoProcessing
} // namespace SituationMap