Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* @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
|
||||
Reference in new issue
Block a user