Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/CentralEffectSimulation/Plugins/Explosions/expand_polygon.cpp
T
torstenandCopilot d5af8b9764 Session 026: Lts/Services Qt5:: to Qt6:: migration
- Migrated all 104 CMakeLists.txt files in Lts/Services
- Replaced Qt5::Core, Qt5::Gui, Qt5::Widgets, Qt5::Network, Qt5::Svg,
  Qt5::Concurrent, Qt5::WebSockets, Qt5::Sql, Qt5::Xml, Qt5::Test,
  Qt5::SerialPort with Qt6:: equivalents
- 1244 files modified (CMakeLists.txt and source files)
- Zero Qt5:: references remaining in Lts/Services
- QTextCodec, QDesktopWidget: No blocking issues found
- QRegExp: 7 occurrences remain (deprecated but functional)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-25 19:23:30 +02:00

63 lines
1.8 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Extend a polygon by a distance of <double> meters.
* $Id$
* $HeadURL$
* $Author$
*/
#include "expand_polygon.h"
#include <CentralEffectSimulation/logger.h>
#include <arcgis/PolygonBuilder.h>
#include <arcgis/GeometryEngine.h>
namespace CesExplosions
{
namespace ExpandPolygon
{
QPolygonF bufferUtmPolygon(const QPolygonF &polygonUtmIn, const int zone, const double distance, double maxDeviation, QString *errorOut)
{
static CentralEffectSimulation::LOGGER_T logger = CentralEffectSimulation::getLogger("Plugin.Explosions.HandlerExplosions");
// return (polygonUtmIn);
Q_UNUSED(maxDeviation);
Esri::ArcGISRuntime::PolygonBuilder polygonBuilder(Esri::ArcGISRuntime::SpatialReference(32600 + zone));
DEBUG_LOG(logger) << "ExpandPolygon::bufferUtmPolygon";
for (const QPointF &pointUtm : qAsConst(polygonUtmIn))
polygonBuilder.addPoint(Esri::ArcGISRuntime::Point(pointUtm.x(), pointUtm.y(), 0));
const Esri::ArcGISRuntime::Geometry &esriGeometry = polygonBuilder.toGeometry();
const Esri::ArcGISRuntime::Polygon polyline =
Esri::ArcGISRuntime::GeometryEngine::buffer(esriGeometry, distance);
if (polyline.parts().isEmpty())
{
if (errorOut)
*errorOut = QStringLiteral("GeometryEngine::buffer failed (no parts");
return {};
}
const Esri::ArcGISRuntime::ImmutablePart &immutablePart = polyline.parts().part(0);
const int size = immutablePart.pointCount();
QPolygonF bufferedPoly;
bufferedPoly.reserve(size);
for (int i = 0; i < size; ++i)
{
const Esri::ArcGISRuntime::Point &esriP = immutablePart.point(i);
bufferedPoly.append(QPointF(esriP.x(), esriP.y()));
}
DEBUG_LOG(logger) << "ExpandPolygon return bufferedPoly size=" << bufferedPoly.size();
return bufferedPoly;
}
} // namespace ExpandPolygon
} // namespace CesExplosions