Files
qt-migration-legatus/qt5-before/dlbo/Lts/Viewer/SituationMap/EvalApps/Viewshed3D/main.cpp
T
torstenandCopilot 7173785915 Qt6 Migration: Complete migration with DDS/RTI support and build validation
Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list

Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF

Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
  - Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
  - Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)

Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified

Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-15 18:20:26 +00:00

246 lines
7.5 KiB
C++

/*
**
** @RDE_HEADER@
** Showing artefacts when drawing 3D map.
** $Id$
** $HeadURL$
** $Author$
**
** -----------------------------------------------------------------------------------------------
**
** Hardware-Environment: Intel-PC
** Software-Environment: Windows 7, Linux, Qt 5.9. ArcGISRuntimeQt 100.1
**
** Language ........: C++ 11
**
** -----------------------------------------------------------------------------------------------
**
** Author ...........: Jörg Turla, SPD G, Tel. 3132
**
** -----------------------------------------------------------------------------------------------
**
** Notes .........:
**
** 08.11.2017, JT : Initial
**
** -----------------------------------------------------------------------------------------------
*/
#include <QTimer>
#include <QtCore/QDir>
#include <QtCore/QUrl>
#include <QtCore/QDebug>
#include <QtGui/QSurface>
#include <QtNetwork/QNetworkProxy>
#include <QtWidgets/QApplication>
#include <QtWidgets/QDesktopWidget>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QMessageBox>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QGraphicsScene>
#include <QtWidgets/QGraphicsProxyWidget>
#include <QtWidgets/QMainWindow>
#include <Map.h>
#include <Scene.h>
#include <SceneGraphicsView.h>
#include <GraphicsOverlay.h>
#include <GeoView.h>
#include <Basemap.h>
#include <ArcGISTiledLayer.h>
#include <Layer.h>
#include <GraphicsOverlay.h>
#include "ViewshedLocation.h"
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
class MapWindow : public QWidget
{
Esri::ArcGISRuntime::Basemap * m_basemap;
Esri::ArcGISRuntime::Scene * m_scene;
Esri::ArcGISRuntime::SceneGraphicsView * m_sceneGraphicsView;
Esri::ArcGISRuntime::GeoView * m_mapView;
Esri::ArcGISRuntime::GraphicsOverlay * m_graphicsOverlay;
Qt::MouseButton m_pressedMouseButton;
QPoint m_mouseMoveRefPos;
Esri::ArcGISRuntime::TaskWatcher m_pickingTask;
bool m_pendingRequest;
public:
MapWindow() : QWidget(), m_graphicsOverlay(nullptr), m_pickingTask(), m_pendingRequest(false)
{
m_pressedMouseButton = Qt::MouseButton::NoButton;
m_mouseMoveRefPos = QPoint();
m_basemap = new Esri::ArcGISRuntime::Basemap(this);
m_scene = new Esri::ArcGISRuntime::Scene(m_basemap,this);
connect( m_basemap, &Esri::ArcGISRuntime::Map::errorOccurred , this, &MapWindow::onErrorBasemap );
connect( m_scene , &Esri::ArcGISRuntime::Scene::errorOccurred, this, &MapWindow::onErrorScene );
connect( m_scene , &Esri::ArcGISRuntime::Scene::doneLoading , this, &MapWindow::onDoneLoading );
m_sceneGraphicsView = nullptr;
try
{
m_sceneGraphicsView = new Esri::ArcGISRuntime::SceneGraphicsView(); // no parent,
m_sceneGraphicsView->setObjectName(QLatin1String("EsriSceneView"));
m_sceneGraphicsView->setFrameShape(QFrame::NoFrame); // frameless
}
catch (std::exception &stdEx)
{
const char *what = stdEx.what();
if (what)
qCritical()<< "MapWindow init SceneGraphicsView: std Exception " << " what: '" << what << "'";
else
qCritical() << "MapWindow init SceneGraphicsView: std Exception";
throw; // re-throw
}
catch (...)
{
qCritical() << "MapWindow init SceneGraphicsView: unknown Exception";
throw; // re-throw
}
if (!m_sceneGraphicsView)
return;
m_sceneGraphicsView->setArcGISScene(m_scene);
QHBoxLayout *layout = new QHBoxLayout(this);
layout->addWidget(m_sceneGraphicsView);
initMapLayer(QLatin1String("http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"));
initMapLayer(QLatin1String("http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"));
Esri::ArcGISRuntime::Camera camera(28.4, 83.9, 10010.0, 10.0, 80.0, 300.0);
m_sceneGraphicsView->setViewpointCameraAndWait(camera);// set the viewpoint
/*
QPushButton * aButton = new QPushButton(tr("Click me")); // toplevel widget
QGraphicsProxyWidget *proxy = m_sceneGraphicsView->QGraphicsView::scene()->addWidget(aButton);
proxy->setOpacity(0.99);
connect( aButton, &QPushButton::clicked, this, []() {qCritical() << "A Button has been clicked!";} );
*/
QTimer *timer = new QTimer(this);
timer->setSingleShot(true);
timer->setInterval(5000);
connect(timer, &QTimer::timeout, this, [this]() {
qCritical() << "Create viewshed ...";
ViewshedLocation * vLoc = new ViewshedLocation(this);
vLoc->init(m_sceneGraphicsView);
});
timer->start();
} // MapWindow()
~MapWindow() = default;
void initMapLayer( const QString &mapServiceUrl )
{
Esri::ArcGISRuntime::ArcGISTiledLayer *tiledLayer = new Esri::ArcGISRuntime::ArcGISTiledLayer(QUrl(mapServiceUrl), this);
tiledLayer->setName(mapServiceUrl);
tiledLayer->setObjectName(tiledLayer->name());
m_basemap->baseLayers()->append(tiledLayer);
} // void initMapLayer()
private:
void onDoneLoading(const Esri::ArcGISRuntime::Error &loadError)
{
} // void onDoneLoading(const Esri::ArcGISRuntime::Error &loadError)
void onErrorBasemap(const Esri::ArcGISRuntime::Error &error)
{
qCritical() << " ---EsriError,Basemap --- occured: "
<< " code=" << error.code()
<< " domain=" << (int)error.domain()
<< " extendedErrorType=" << (int)error.extendedErrorType()
<< ", message='" << error.message() << "'";
} // void onErrorBasemap(const Esri::ArcGISRuntime::Error &error)
void onErrorScene(const Esri::ArcGISRuntime::Error &error)
{
qCritical() << " ---EsriError, Scene --- occured: "
<< " code=" << error.code()
<< " domain=" << (int)error.domain()
<< " extendedErrorType=" << (int)error.extendedErrorType()
<< ", message='" << error.message() << "'";
} // void onErrorScene(const Esri::ArcGISRuntime::Error &error)
}; // MapWindow
int main(int argc, char* argv[])
{
QApplication app(argc,argv);
// ESRI :
#ifdef Q_OS_WIN
// Force usage of OpenGL ES through ANGLE on Windows
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
#endif
// : ESRI
#define PROXY
#ifdef PROXY
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::HttpProxy);
proxy.setHostName(QStringLiteral("proxy-rde"));
proxy.setPort(8080);
proxy.setUser(QStringLiteral("norbert.thoden@rheinmetall.com"));
proxy.setPassword(QStringLiteral("RDEWWW11"));
QNetworkProxy::setApplicationProxy(proxy);
#endif
MapWindow * mapWin = new MapWindow();
QDesktopWidget wid;
int width = mapWin->frameGeometry().width();
int height = mapWin->frameGeometry().height();
int screenWidth = wid.screen()->width();
int screenHeight = wid.screen()->height();
mapWin->setGeometry((screenWidth / 2) - (width / 2), (screenHeight / 2) - (height / 2), width, height);
mapWin->show();
app.setQuitOnLastWindowClosed(true);
int retval = app.exec();
delete mapWin;
return retval;
} // main