Files
qt-migration-legatus/qt5-before/dlbo/Lts/Viewer/SituationMap/MapImpl/grid_impl.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

221 lines
5.0 KiB
C++

/**
* @RDE_HEADER@
* Interface-Implementation of Grid
* $Id$
* $HeadURL$
* $Author$
*/
// Own
#include "grid_impl.h"
#include "map_impl.h"
// ESRI
#include <arcgis/arcgisversion.h> // This file is created by RME, not ESRI
#include <arcgis/Map.h>
#include <arcgis/MapGraphicsView.h>
#include <arcgis/LatitudeLongitudeGrid.h>
#include <arcgis/MGRSGrid.h>
#include <arcgis/UTMGrid.h>
#include <arcgis/USNGGrid.h>
#include <arcgis/SimpleLineSymbol.h>
#include <arcgis/TextSymbol.h>
// Qt
namespace SituationMap
{
class GridImpl::Private
{
public:
Private() = default;
~Private() = default;
// ESRI data:
Esri::ArcGISRuntime::Grid *m_esriGrid = nullptr;
// Own data:
SituationMap::MapImpl *m_mapImpl = nullptr;
}; // class GridImpl::Private
//-----------------------------------------------------------------------------
GridImpl::GridImpl(SituationMap::MapImpl *mapImpl)
: m_logger(getLogger("GridImpl"))
, d(new Private)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
d->m_mapImpl = mapImpl;
if (d->m_mapImpl && d->m_mapImpl->getEsriMapGraphicsView())
d->m_esriGrid = d->m_mapImpl->getEsriMapGraphicsView()->grid();
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
GridImpl::~GridImpl()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
delete d;
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
GridType GridImpl::gridType()
{
GridType curType = GridType::NoType;
if (d->m_esriGrid)
{
Esri::ArcGISRuntime::GridType esriGridType = d->m_esriGrid->gridType();
switch (esriGridType)
{
case Esri::ArcGISRuntime::GridType::Unknown:
curType = GridType::NoType;
break;
case Esri::ArcGISRuntime::GridType::LatitudeLongitudeGrid:
curType = GridType::LatLon;
break;
case Esri::ArcGISRuntime::GridType::MGRSGrid:
curType = GridType::MGRS;
break;
case Esri::ArcGISRuntime::GridType::UTMGrid:
curType = GridType::UTM;
break;
case Esri::ArcGISRuntime::GridType::USNGGrid:
curType = GridType::USGN;
break;
} // switch
}
else
DEBUG_LOG(m_logger) << LOGFUNCTION << " no object";
return curType;
}
void GridImpl::setGridType(GridType gridType)
{
// change?
if (this->gridType() == gridType)
return;
if (d->m_esriGrid)
d->m_esriGrid->deleteLater();
if (! d->m_mapImpl->getEsriMapGraphicsView())
return;
QObject *parent = d->m_mapImpl->getEsriMapGraphicsView();
switch (gridType)
{
case GridType::NoType:
d->m_esriGrid = nullptr;
break;
case GridType::LatLon:
d->m_esriGrid = new Esri::ArcGISRuntime::LatitudeLongitudeGrid(parent);
break;
case GridType::MGRS:
d->m_esriGrid = new Esri::ArcGISRuntime::MGRSGrid(parent);
break;
case GridType::UTM:
d->m_esriGrid = new Esri::ArcGISRuntime::UTMGrid(parent);
break;
case GridType::USGN:
d->m_esriGrid = new Esri::ArcGISRuntime::USNGGrid(parent);
break;
} // switch
if (d->m_esriGrid)
{
d->m_esriGrid->setLabelPosition(Esri::ArcGISRuntime::GridLabelPosition::AllSides);
int levelCount = d->m_esriGrid->levelCount();
for (int i = 0; i < levelCount; ++i)
{
Esri::ArcGISRuntime::TextSymbol *gridLabel = static_cast<Esri::ArcGISRuntime::TextSymbol *>(d->m_esriGrid->textSymbol(i));
if (gridLabel)
{
gridLabel->setSize(10);
gridLabel->setHaloWidth(1.0);
}
const QColor col(0, 0, 0, 200);
Esri::ArcGISRuntime::SimpleLineSymbol sls(Esri::ArcGISRuntime::SimpleLineSymbolStyle::Solid,
col,
1);
d->m_esriGrid->setLineSymbol(i, &sls);
} // for
}
// call setGrid even if d->m_esriGrid is nullptr !!!
d->m_mapImpl->getEsriMapGraphicsView()->setGrid(d->m_esriGrid);
d->m_mapImpl->emitVisualComponentChanged(VisualComponent::Grid);
}
void GridImpl::setVisible(bool visible)
{
if (d->m_esriGrid)
{
if (d->m_esriGrid->isVisible() != visible)
{
d->m_esriGrid->setVisible(visible);
d->m_mapImpl->emitVisualComponentChanged(VisualComponent::Grid);
}
}
else
ERROR_LOG(m_logger) << LOGFUNCTION << " no object";
}
bool GridImpl::isVisible()
{
if (d->m_esriGrid)
return d->m_esriGrid->isVisible();
else
DEBUG_LOG(m_logger) << LOGFUNCTION << " no object";
return false;
}
int GridImpl::levelCount()
{
if (d->m_esriGrid)
return d->m_esriGrid->levelCount();
else
ERROR_LOG(m_logger) << LOGFUNCTION << " no object";
return -1;
}
bool GridImpl::isLabelVisible()
{
if (d->m_esriGrid)
return d->m_esriGrid->isLabelsVisible();
else
ERROR_LOG(m_logger) << LOGFUNCTION << " no object";
return false;
}
void GridImpl::setLabelVisible(bool visible)
{
if (d->m_esriGrid)
{
if (d->m_esriGrid->isLabelsVisible() != visible)
{
d->m_esriGrid->setLabelsVisible(visible);
d->m_mapImpl->emitVisualComponentChanged(VisualComponent::Grid);
}
}
else
ERROR_LOG(m_logger) << LOGFUNCTION << " no object";
}
} // namespace SituationMap