Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Plugins/SituationMapPlugin/Gui/SituationMap/viewshed_dialog.h
T
torstenandCopilot 7a6be7474e Qt6 migration: Fix BUILD_RTI=OFF build errors in TrainingAreaBase
- training_area_telegrams.cpp: Fixed QJsonObject initializer syntax (Qt6 requires {{}} not ({}))
- training_area_telegrams.cpp: Fixed fromJson() methods to access m_* members directly
- training_area_telegrams.cpp: Fixed brace mismatches in multiple toJson() methods
- training_area_telegrams.h: Changed Header struct to public members for consistency
- tx_mixin.cpp: Fixed getEquipmentNumber() template for direct member access
- lts_coordinate.cpp: Added missing #include <iomanip>
- MIGRATION_STATUS.md: Added migration progress tracking document

C++17 constraint enforced due to RTI Connext DDS 7.7.0 incompatibility with C++20+

Build status: BUILD_RTI=OFF successful (0 errors, warnings only)

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

139 lines
5.1 KiB
C++
Executable File

#pragma once
#include <LtsWidgets/lts_dialog.h>
#include <QtWidgets/QFormLayout>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QLineEdit>
#include <QtGui/QDoubleValidator>
#include <QtWidgets/QSlider>
class ViewshedDialog : public LtsWidgets::LtsDialog
{
Q_OBJECT
public:
explicit ViewshedDialog( QWidget *parent )
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly, true)
{
setUnchangeable();
QVBoxLayout *layout = new QVBoxLayout(this);
QHBoxLayout *layoutH = new QHBoxLayout(this);
QVBoxLayout *layoutCtrl = new QVBoxLayout(this);
QFormLayout *layoutParam = new QFormLayout();
m_slAlpha = new QSlider(Qt::Orientation::Horizontal, this);
m_leInnerRadius = new QLineEdit(this);
m_leObserverHeight = new QLineEdit(this);
m_leTargetHeight = new QLineEdit(this);
m_leBeamAngle = new QLineEdit(this);
m_slAlpha->setRange(0, 255);
m_leInnerRadius->setValidator(new QDoubleValidator(0.0, 10000.0, 3, m_leInnerRadius));
m_leObserverHeight->setValidator(new QDoubleValidator(0.0, 100.0, 3, m_leObserverHeight));
m_leTargetHeight->setValidator(new QDoubleValidator(0.0, 100.0, 3, m_leTargetHeight));
m_leBeamAngle->setValidator(new QDoubleValidator(0.5, 10.0, 3, m_leBeamAngle));
layout->addSpacing(10);
layout->addLayout(layoutH);
layout->addStretch(2);
layout->addSpacing(10);
layoutH->addSpacing(10);
layoutH->addLayout(layoutParam);
layoutH->addSpacing(10);
layoutH->addLayout(layoutCtrl);
layoutH->addSpacing(10);
layoutH->addStretch(2);
layoutParam->addRow(tr("Transparency"), m_slAlpha);
layoutParam->addRow(tr("Inner Radius [m]"), m_leInnerRadius);
layoutParam->addRow(tr("Observer Height [m]"), m_leObserverHeight);
layoutParam->addRow(tr("Target Height [m]"), m_leTargetHeight);
layoutParam->addRow(tr("Angle of Beam [Degree]"), m_leBeamAngle);
QPushButton *pbCreateViewshed = new QPushButton(QIcon(QStringLiteral("icon:configure_line_of_sight.svg")) , tr("Create Viewshed"), this);
QPushButton *pbRemoveViewshed = new QPushButton(QIcon(QStringLiteral("icon:configure_line_of_sight_remove.svg")), tr("Remove Viewshed"), this);
layoutCtrl->addStretch(2);
layoutCtrl->addSpacing(10);
layoutCtrl->addWidget(pbCreateViewshed);
layoutCtrl->addSpacing(10);
layoutCtrl->addWidget(pbRemoveViewshed);
layoutCtrl->addSpacing(10);
layoutCtrl->addStretch(2);
connect( pbCreateViewshed , &QPushButton::clicked, this, &ViewshedDialog::createViewshed );
connect( pbRemoveViewshed , &QPushButton::clicked, this, &ViewshedDialog::removeViewshed );
connect( m_slAlpha , &QSlider::valueChanged, this, &ViewshedDialog::parameterChanged );
connect( m_leInnerRadius , &QLineEdit::textEdited, this, &ViewshedDialog::parameterChanged );
connect( m_leObserverHeight, &QLineEdit::textEdited, this, &ViewshedDialog::parameterChanged );
connect( m_leTargetHeight , &QLineEdit::textEdited, this, &ViewshedDialog::parameterChanged );
connect( m_leBeamAngle , &QLineEdit::textEdited, this, &ViewshedDialog::parameterChanged );
setOnlineHelpFilename(QStringLiteral("Situation-Start_Viewshed"));
}
virtual ~ViewshedDialog() = default;
void retranslate() override
{
const QString txt(tr("Viewshed Dialog"));
translate(txt);
}
void initValues( double alpha
, double viewshedInnerRadius
, double viewshedObserverHeight
, double viewshedTargetHeight
, double viewshedBeamAngle)
{
if (alpha < 0.0) alpha = 0.0;
if (alpha > 1.0) alpha = 1.0;
m_slAlpha->setValue(int(alpha * 255));
m_leInnerRadius->setText(QLocale().toString(viewshedInnerRadius));
m_leObserverHeight->setText(QLocale().toString(viewshedObserverHeight));
m_leTargetHeight->setText(QLocale().toString(viewshedTargetHeight));
m_leBeamAngle->setText(QLocale().toString(viewshedBeamAngle));
m_leInnerRadius->setToolTip(tr("Inner Radius [m]"));
m_leObserverHeight->setToolTip(tr("Observer Height [m]"));
m_leTargetHeight->setToolTip(tr("Target Height [m]"));
m_leBeamAngle->setToolTip(tr("Angle of Beam [Degree]"));
}
double alpha() const { return double(m_slAlpha->value()) / 255.0; }
double innerRadius() const { return QLocale().toDouble( m_leInnerRadius->text() ); }
double observerHeight() const { return QLocale().toDouble( m_leObserverHeight->text() ); }
double targetHeight() const { return QLocale().toDouble( m_leTargetHeight->text() ); }
double beamAngle() const { return QLocale().toDouble( m_leBeamAngle->text() ); }
signals:
void createViewshed();
void removeViewshed();
void parameterChanged();
private:
QSlider * m_slAlpha;
QLineEdit * m_leInnerRadius;
QLineEdit * m_leObserverHeight;
QLineEdit * m_leTargetHeight;
QLineEdit * m_leBeamAngle;
};