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>
75 lines
2.5 KiB
C++
75 lines
2.5 KiB
C++
/*
|
|
* @RDE_HEADER@
|
|
* Generates a postion for a player
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Hanna E. Rathje, SLTE, 2022-03-29
|
|
*/
|
|
|
|
#include "position_helper.h"
|
|
|
|
#include <LtsCoordTrans/lts_coord_trans.h>
|
|
#include <NGLLogger/NGLLoggerBootstrap.h>
|
|
#include <QLineF>
|
|
|
|
static QRectF s_area;
|
|
static double s_heightMin;
|
|
static double s_heightMax;
|
|
|
|
namespace WlsRandomPositions
|
|
{
|
|
|
|
PositionHelper::PositionHelper(const QPointF &topLeft, const QPointF &bottomRight, double heightMin, double heightMax)
|
|
: m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("PositionHelper"))
|
|
{
|
|
s_area = QRectF(topLeft, bottomRight).normalized();
|
|
s_heightMin = heightMin;
|
|
s_heightMax = heightMax;
|
|
INFO_LOG(m_logger) << "Area initialized: " << LtsCoordTrans::UtmCoordinate::fromGeographic(s_area.topLeft()).mgrs() << "//"
|
|
<< LtsCoordTrans::UtmCoordinate::fromGeographic(s_area.bottomRight()).mgrs();
|
|
}
|
|
|
|
void PositionHelper::set(const QPointF &topLeft, const QPointF &bottomRight, double heightMin, double heightMax)
|
|
{
|
|
s_area = QRectF(topLeft, bottomRight).normalized();
|
|
s_heightMin = heightMin;
|
|
s_heightMax = heightMax;
|
|
|
|
INFO_LOG(m_logger) << "New Area initialized: " << LtsCoordTrans::UtmCoordinate::fromGeographic(s_area.topLeft()).mgrs() << "//"
|
|
<< LtsCoordTrans::UtmCoordinate::fromGeographic(s_area.bottomRight()).mgrs();
|
|
}
|
|
|
|
QPair<QPointF,double> PositionHelper::randPos()
|
|
{
|
|
LtsCoordTrans::UtmCoordinate bl = LtsCoordTrans::UtmCoordinate::fromGeographic(s_area.bottomLeft());
|
|
LtsCoordTrans::UtmCoordinate tr = LtsCoordTrans::UtmCoordinate::fromGeographic(s_area.topRight());
|
|
|
|
QPointF distance = bl.relativeTo(tr);
|
|
|
|
// Multiplying with -1 works for all Degree Squares (northern/southern hemisphere, west/east of Greenwich)
|
|
distance.setX((rand() % 100) / 100.0 * distance.x() * -1.0);
|
|
distance.setY((rand() % 100) / 100.0 * distance.y() * -1.0);
|
|
double z = (rand() % 100) / 100.0 * (s_heightMax - s_heightMin) + s_heightMin;
|
|
return {bl.geographic(distance),z};
|
|
}
|
|
|
|
QPair<QPointF,double> PositionHelper::randPos(const QPointF &oldPos, double maxDistance)
|
|
{
|
|
double z = (rand() % 100) / 100.0 * (s_heightMax - s_heightMin) + s_heightMin;
|
|
|
|
LtsCoordTrans::UtmCoordinate utm = LtsCoordTrans::UtmCoordinate::fromGeographic(oldPos);
|
|
QLineF line;
|
|
line.setP1({0,0});
|
|
line.setP2({1,0});
|
|
do
|
|
{
|
|
line.setAngle((rand() % 36000) / 100.0);
|
|
line.setLength(((rand() % 100) / 100.0) * maxDistance);
|
|
} while (!s_area.contains(utm.geographic(line.p2())));
|
|
|
|
return {utm.geographic(line.p2()),z};
|
|
}
|
|
|
|
} // Namespace WlsRandomPositions
|