Files
qt5-legatus-legacy/Lts/Plugins/CollateralDamageSimulation/Gui/CreateSimulation/cds_calculations.h
T
2026-08-13 18:33:10 +02:00

74 lines
3.3 KiB
C++
Executable File

/**
* Namespace for calculations, needed by CollateralDamageSimulation
* @RDE_HEADER@
* $Id: ppm_msdl_edit.h 52239 2020-10-05 11:33:12Z thoden $
* $HeadURL: svn://192.168.133.21/TDS/branches/product/features/3dws_devel/Lts/Plugins/ParticipantManagement/Gui/MSDL/ppm_msdl_edit.h $
* $Author: thoden $
* Created by Hannes Fritsche, ESZS, 2024-09-03
*/
#pragma once
#include <QVector>
#include <QRectF>
#include <memory>
namespace InfrastructureManagement
{
class MainStructureElement;
namespace Interface
{
class Dtc;
}
}
namespace ParticipantManagement
{
namespace Interface
{
class Dtc;
}
}
class QLineF;
class QPointF;
class QPolygonF;
namespace CollateralDamageSimulation
{
namespace Calculations
{
struct ParticipantProtectionInfo
{
QVector<int> withProtection;
QVector<int> withoutProtection;
QVector<int> participantsInUnderground;
};
QHash<int, QPolygonF> getBuildingFootprints(const QVector<int> &buildingIds, const std::shared_ptr<InfrastructureManagement::Interface::Dtc> &ismDtc, const QPointF &impactPosition);
QVector<int> getDirectlyHitBuildings(const QHash<int, QPolygonF> &footprints, const QPointF &impactPosition);
int getNearestBlockedBuildingId(const QLineF &ray, const QHash<int, QPolygonF> &buildings);
QPolygonF getBuildingFootprint(int buildingId, const std::shared_ptr<InfrastructureManagement::Interface::Dtc> &ismDtc);
QVector<QPolygonF> getProtectionAreas(const QHash<int, QPolygonF> &buildingFootprints, double radius, const QPointF &impactPosition);
bool isPointVisible(const QPointF &center, const QPointF &point, const QPolygonF &polygon);
bool doLinesIntersect(const QPointF &a1, const QPointF &a2, const QPointF &b1, const QPointF &b2);
void addOuterBounds(QPolygonF &polygon, const QPointF &center, double radius);
QPointF getStartPosForOuterBounds(const QPolygonF &polygon, const QPolygonF &circle);
QPointF getEndPosForOuterBounds(const QPolygonF &polygon, const QPolygonF &circle);
QPointF firstIntersection(const QLineF &line, const QPolygonF &circle);
ParticipantProtectionInfo getParticipantProtectionInfo(const QVector<int> &participantIds,
const QVector<QPolygonF> &protectionAreas,
const QVector<int> &undergroundBuildingIds,
const QVector<int> &directlyHitBuildingIds,
const QHash<int, QPolygonF> &buildingFootprints,
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
const std::shared_ptr<InfrastructureManagement::Interface::Dtc> &ismDtc);
bool isPointInAnyPolygon(const QHash<int, QPolygonF> &polygons, const QPointF &point);
QVector<QPolygonF> mergePolygons(const QVector<QPolygonF> &geoPolygons);
QVector<QPolygonF> getScaledPolygons(const QVector<QPolygonF> &polygons, double factor);
QVector<int> getUndergroundBuildingIds(const QVector<int> &buildingIds, const std::shared_ptr<InfrastructureManagement::Interface::Dtc> &ismDtc);
QList<QPointF> getGeoRect(const QPointF &center, double edgeLength);
} // namespace Calculations
} // namespace CollateralDamageSimulation