125 lines
3.2 KiB
C++
Executable File
125 lines
3.2 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* ViewshedGeoProcessing
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
// Own
|
|
#include "viewshed_base.h"
|
|
|
|
// ESRI
|
|
#include <arcgis/arcgisversion.h> // This file is created by RME, not ESRI
|
|
#include <arcgis/Map.h>
|
|
#include <arcgis/SpatialReference.h>
|
|
|
|
|
|
// Qt
|
|
#include <QObject>
|
|
#include <QColor>
|
|
#include <QPointF>
|
|
|
|
// 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();
|
|
#if ACRGIS_VERSION >= 0x640E00 // 100.14.0
|
|
void onJobStatusChangedWithJsParameter(const Esri::ArcGISRuntime::JobStatus &);
|
|
#endif // ACRGIS_VERSION
|
|
|
|
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;
|
|
|
|
LOGGER_T m_logger;
|
|
|
|
}; // class ViewshedGeoProcessing
|
|
|
|
|
|
|
|
} // namespace SituationMap
|
|
|