Added support for camera

This commit is contained in:
GPayne
2020-09-11 12:29:31 -06:00
parent 7e72d9fa8f
commit ca6260718b
5 changed files with 1260 additions and 2 deletions
+5 -2
View File
@@ -25,11 +25,13 @@ set(HEADER_FILES
include/assets.h
include/assettreeitem.h
include/assettreemodel.h
include/camera.h
include/filesystemaccess.h
include/launcherwindow.h
include/profileedit.h
include/ui/addedscripts.h
include/ui/assets.h
include/ui_addedscripts.h
include/ui_assets.h
include/ui_camera.h
include/ui_editorwindow.h
include/ui_launcherwindow.h
)
@@ -39,6 +41,7 @@ set(SOURCE_FILES
src/assets.cpp
src/assettreeitem.cpp
src/assettreemodel.cpp
src/camera.cpp
src/filesystemaccess.cpp
src/launcherwindow.cpp
src/profileedit.cpp
@@ -0,0 +1,75 @@
#ifndef CAMERA_H
#define CAMERA_H
#include <QDialog>
#include <QWidget>
#include <QLineEdit>
#include <QLabel>
#include <optional>
QT_BEGIN_NAMESPACE
namespace Ui {
class camera;
}
QT_END_NAMESPACE
struct CameraNavState {
static constexpr const char* Type = "setNavigationState";
std::string anchor;
std::string aim;
std::string referenceFrame;
std::string position[3];
std::string up[3];
std::string yaw;
std::string pitch;
};
struct CameraGoToGeo {
static constexpr const char* Type = "goToGeo";
std::string anchor;
std::string latitude;
std::string longitude;
std::string altitude;
};
struct Camera {
enum class Type {
Nav,
Geo
};
Type type;
CameraNavState nav;
CameraGoToGeo geo;
};
class camera: public QDialog
{
Q_OBJECT
public slots:
void cancel();
void approved();
public:
explicit camera(Camera& imported, QWidget *parent = nullptr);
~camera();
private:
bool isNumericalValue(QLineEdit* le);
bool inNumericalRange(QLineEdit* le, float min, float max);
bool areRequiredFormsFilledAndValid();
void setErrorTextFormat(QLabel* label, const QString& labelTxt, bool setErrorFormat);
void checkFormFilled(QLabel* label, QLineEdit* value, const QString& labelTxt,
bool& allFormsValid, bool isNumber, bool isRequiredValue);
void checkFormRange(QLabel* label, QLineEdit* value, const QString& labelTxt,
float min, float max, bool& allFormsValid, bool isRequiredValue);
Ui::camera *ui;
QWidget* _parent;
Camera& _imported;
Camera _data;
};
#endif // CAMERA_H
@@ -0,0 +1,304 @@
/********************************************************************************
** Form generated from reading UI file 'camera.ui'
**
** Created by: Qt User Interface Compiler version 5.15.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_CAMERA_H
#define UI_CAMERA_H
#include <QtCore/QVariant>
#include <QtWidgets/QApplication>
#include <QtWidgets/QDialog>
#include <QtWidgets/QDialogButtonBox>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QTabWidget>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class Ui_camera
{
public:
QDialogButtonBox *buttonBox;
QTabWidget *tabWidget;
QWidget *tab;
QLabel *label_anchorNav;
QLineEdit *line_anchorNav;
QLabel *label_aim;
QLineEdit *line_aim;
QLabel *label_referenceFrame;
QLineEdit *line_referenceFrame;
QLabel *label_pos;
QLabel *label_posX;
QLineEdit *line_posX;
QLabel *label_posY;
QLineEdit *line_posY;
QLabel *label_posZ;
QLineEdit *line_posZ;
QLabel *label_up;
QLabel *label_upX;
QLineEdit *line_upX;
QLabel *label_upY;
QLineEdit *line_upY;
QLabel *label_upZ;
QLineEdit *line_upZ;
QLabel *label_yaw;
QLineEdit *line_yaw;
QLabel *label_pitch;
QLineEdit *line_pitch;
QWidget *tab_2;
QLabel *label_anchorGeo;
QLineEdit *line_anchorGeo;
QLabel *label_lat;
QLineEdit *line_lat;
QLabel *label_long;
QLineEdit *line_long;
QLabel *label_altitude;
QLineEdit *line_altitude;
void setupUi(QDialog *camera)
{
if (camera->objectName().isEmpty())
camera->setObjectName(QString::fromUtf8("camera"));
camera->resize(571, 389);
buttonBox = new QDialogButtonBox(camera);
buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
buttonBox->setGeometry(QRect(210, 340, 341, 32));
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
tabWidget = new QTabWidget(camera);
tabWidget->setObjectName(QString::fromUtf8("tabWidget"));
tabWidget->setGeometry(QRect(20, 20, 531, 301));
tab = new QWidget();
tab->setObjectName(QString::fromUtf8("tab"));
label_anchorNav = new QLabel(tab);
label_anchorNav->setObjectName(QString::fromUtf8("label_anchorNav"));
label_anchorNav->setGeometry(QRect(20, 20, 71, 17));
QFont font;
font.setFamily(QString::fromUtf8("Arial"));
font.setPointSize(12);
label_anchorNav->setFont(font);
line_anchorNav = new QLineEdit(tab);
line_anchorNav->setObjectName(QString::fromUtf8("line_anchorNav"));
line_anchorNav->setGeometry(QRect(80, 18, 180, 25));
line_anchorNav->setFont(font);
label_aim = new QLabel(tab);
label_aim->setObjectName(QString::fromUtf8("label_aim"));
label_aim->setGeometry(QRect(280, 20, 71, 17));
label_aim->setFont(font);
line_aim = new QLineEdit(tab);
line_aim->setObjectName(QString::fromUtf8("line_aim"));
line_aim->setGeometry(QRect(320, 18, 180, 25));
line_aim->setFont(font);
label_referenceFrame = new QLabel(tab);
label_referenceFrame->setObjectName(QString::fromUtf8("label_referenceFrame"));
label_referenceFrame->setGeometry(QRect(20, 60, 141, 17));
label_referenceFrame->setFont(font);
line_referenceFrame = new QLineEdit(tab);
line_referenceFrame->setObjectName(QString::fromUtf8("line_referenceFrame"));
line_referenceFrame->setGeometry(QRect(160, 58, 240, 25));
line_referenceFrame->setFont(font);
label_pos = new QLabel(tab);
label_pos->setObjectName(QString::fromUtf8("label_pos"));
label_pos->setGeometry(QRect(20, 100, 71, 17));
label_pos->setFont(font);
label_posX = new QLabel(tab);
label_posX->setObjectName(QString::fromUtf8("label_posX"));
label_posX->setGeometry(QRect(100, 100, 16, 17));
label_posX->setFont(font);
line_posX = new QLineEdit(tab);
line_posX->setObjectName(QString::fromUtf8("line_posX"));
line_posX->setGeometry(QRect(120, 98, 100, 25));
line_posX->setFont(font);
label_posY = new QLabel(tab);
label_posY->setObjectName(QString::fromUtf8("label_posY"));
label_posY->setGeometry(QRect(240, 100, 16, 17));
label_posY->setFont(font);
line_posY = new QLineEdit(tab);
line_posY->setObjectName(QString::fromUtf8("line_posY"));
line_posY->setGeometry(QRect(260, 98, 100, 25));
line_posY->setFont(font);
label_posZ = new QLabel(tab);
label_posZ->setObjectName(QString::fromUtf8("label_posZ"));
label_posZ->setGeometry(QRect(380, 100, 16, 17));
label_posZ->setFont(font);
line_posZ = new QLineEdit(tab);
line_posZ->setObjectName(QString::fromUtf8("line_posZ"));
line_posZ->setGeometry(QRect(400, 98, 100, 25));
line_posZ->setFont(font);
label_up = new QLabel(tab);
label_up->setObjectName(QString::fromUtf8("label_up"));
label_up->setGeometry(QRect(20, 140, 71, 17));
label_up->setFont(font);
label_upX = new QLabel(tab);
label_upX->setObjectName(QString::fromUtf8("label_upX"));
label_upX->setGeometry(QRect(100, 140, 16, 17));
label_upX->setFont(font);
line_upX = new QLineEdit(tab);
line_upX->setObjectName(QString::fromUtf8("line_upX"));
line_upX->setGeometry(QRect(120, 138, 100, 25));
line_upX->setFont(font);
label_upY = new QLabel(tab);
label_upY->setObjectName(QString::fromUtf8("label_upY"));
label_upY->setGeometry(QRect(240, 140, 16, 17));
label_upY->setFont(font);
line_upY = new QLineEdit(tab);
line_upY->setObjectName(QString::fromUtf8("line_upY"));
line_upY->setGeometry(QRect(260, 138, 100, 25));
line_upY->setFont(font);
label_upZ = new QLabel(tab);
label_upZ->setObjectName(QString::fromUtf8("label_upZ"));
label_upZ->setGeometry(QRect(380, 140, 16, 17));
label_upZ->setFont(font);
line_upZ = new QLineEdit(tab);
line_upZ->setObjectName(QString::fromUtf8("line_upZ"));
line_upZ->setGeometry(QRect(400, 138, 100, 25));
line_upZ->setFont(font);
label_yaw = new QLabel(tab);
label_yaw->setObjectName(QString::fromUtf8("label_yaw"));
label_yaw->setGeometry(QRect(20, 180, 91, 17));
label_yaw->setFont(font);
line_yaw = new QLineEdit(tab);
line_yaw->setObjectName(QString::fromUtf8("line_yaw"));
line_yaw->setGeometry(QRect(120, 178, 100, 25));
line_yaw->setFont(font);
label_pitch = new QLabel(tab);
label_pitch->setObjectName(QString::fromUtf8("label_pitch"));
label_pitch->setGeometry(QRect(20, 220, 91, 17));
label_pitch->setFont(font);
line_pitch = new QLineEdit(tab);
line_pitch->setObjectName(QString::fromUtf8("line_pitch"));
line_pitch->setGeometry(QRect(120, 218, 100, 25));
line_pitch->setFont(font);
tabWidget->addTab(tab, QString());
tab_2 = new QWidget();
tab_2->setObjectName(QString::fromUtf8("tab_2"));
label_anchorGeo = new QLabel(tab_2);
label_anchorGeo->setObjectName(QString::fromUtf8("label_anchorGeo"));
label_anchorGeo->setGeometry(QRect(20, 20, 71, 17));
label_anchorGeo->setFont(font);
line_anchorGeo = new QLineEdit(tab_2);
line_anchorGeo->setObjectName(QString::fromUtf8("line_anchorGeo"));
line_anchorGeo->setGeometry(QRect(110, 18, 240, 25));
line_anchorGeo->setFont(font);
label_lat = new QLabel(tab_2);
label_lat->setObjectName(QString::fromUtf8("label_lat"));
label_lat->setGeometry(QRect(20, 60, 81, 17));
label_lat->setFont(font);
line_lat = new QLineEdit(tab_2);
line_lat->setObjectName(QString::fromUtf8("line_lat"));
line_lat->setGeometry(QRect(110, 58, 240, 25));
line_lat->setFont(font);
label_long = new QLabel(tab_2);
label_long->setObjectName(QString::fromUtf8("label_long"));
label_long->setGeometry(QRect(20, 100, 81, 17));
label_long->setFont(font);
line_long = new QLineEdit(tab_2);
line_long->setObjectName(QString::fromUtf8("line_long"));
line_long->setGeometry(QRect(110, 98, 240, 25));
line_long->setFont(font);
label_altitude = new QLabel(tab_2);
label_altitude->setObjectName(QString::fromUtf8("label_altitude"));
label_altitude->setGeometry(QRect(20, 140, 81, 17));
label_altitude->setFont(font);
line_altitude = new QLineEdit(tab_2);
line_altitude->setObjectName(QString::fromUtf8("line_altitude"));
line_altitude->setGeometry(QRect(110, 138, 240, 25));
line_altitude->setFont(font);
tabWidget->addTab(tab_2, QString());
retranslateUi(camera);
//QObject::connect(buttonBox, SIGNAL(accepted()), camera, SLOT(accept()));
QObject::connect(buttonBox, SIGNAL(rejected()), camera, SLOT(reject()));
tabWidget->setCurrentIndex(1);
QMetaObject::connectSlotsByName(camera);
} // setupUi
void retranslateUi(QDialog *camera)
{
camera->setWindowTitle(QCoreApplication::translate("camera", "Set Camera Position", nullptr));
label_anchorNav->setText(QCoreApplication::translate("camera", "Anchor:", nullptr));
#if QT_CONFIG(tooltip)
line_anchorNav->setToolTip(QCoreApplication::translate("camera", "<html><head/><body><p>Anchor camera to this node</p></body></html>", nullptr));
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(whatsthis)
line_anchorNav->setWhatsThis(QString());
#endif // QT_CONFIG(whatsthis)
label_aim->setText(QCoreApplication::translate("camera", "Aim:", nullptr));
#if QT_CONFIG(tooltip)
line_aim->setToolTip(QCoreApplication::translate("camera", "<html><head/><body><p>[OPTIONAL] If specified, camera will be aimed at this node while keeping the anchor node in the same view location</p></body></html>", nullptr));
#endif // QT_CONFIG(tooltip)
label_referenceFrame->setText(QCoreApplication::translate("camera", "Reference Frame:", nullptr));
#if QT_CONFIG(tooltip)
line_referenceFrame->setToolTip(QCoreApplication::translate("camera", "<html><head/><body><p>[OPTIONAL] Camera location in reference to this frame</p></body></html>", nullptr));
#endif // QT_CONFIG(tooltip)
label_pos->setText(QCoreApplication::translate("camera", "Position:", nullptr));
label_posX->setText(QCoreApplication::translate("camera", "X", nullptr));
#if QT_CONFIG(tooltip)
line_posX->setToolTip(QCoreApplication::translate("camera", "<html><head/><body><p>Camera position vector (x)</p></body></html>", nullptr));
#endif // QT_CONFIG(tooltip)
label_posY->setText(QCoreApplication::translate("camera", "Y", nullptr));
#if QT_CONFIG(tooltip)
line_posY->setToolTip(QCoreApplication::translate("camera", "<html><head/><body><p>Camera position vector (y)</p></body></html>", nullptr));
#endif // QT_CONFIG(tooltip)
label_posZ->setText(QCoreApplication::translate("camera", "Z", nullptr));
#if QT_CONFIG(tooltip)
line_posZ->setToolTip(QCoreApplication::translate("camera", "<html><head/><body><p>Camera position vector (z)</p></body></html>", nullptr));
#endif // QT_CONFIG(tooltip)
label_up->setText(QCoreApplication::translate("camera", "Up:", nullptr));
label_upX->setText(QCoreApplication::translate("camera", "X", nullptr));
#if QT_CONFIG(tooltip)
line_upX->setToolTip(QCoreApplication::translate("camera", "<html><head/><body><p>[OPTIONAL] Camera up vector (x)</p></body></html>", nullptr));
#endif // QT_CONFIG(tooltip)
label_upY->setText(QCoreApplication::translate("camera", "Y", nullptr));
#if QT_CONFIG(tooltip)
line_upY->setToolTip(QCoreApplication::translate("camera", "<html><head/><body><p>[OPTIONAL] Camera up vector (y)</p></body></html>", nullptr));
#endif // QT_CONFIG(tooltip)
label_upZ->setText(QCoreApplication::translate("camera", "Z", nullptr));
#if QT_CONFIG(tooltip)
line_upZ->setToolTip(QCoreApplication::translate("camera", "<html><head/><body><p>[OPTIONAL] Camera up vector (z)</p></body></html>", nullptr));
#endif // QT_CONFIG(tooltip)
label_yaw->setText(QCoreApplication::translate("camera", "Yaw angle:", nullptr));
#if QT_CONFIG(tooltip)
line_yaw->setToolTip(QCoreApplication::translate("camera", "<html><head/><body><p>[OPTIONAL] yaw angle +/- 360 degrees</p></body></html>", nullptr));
#endif // QT_CONFIG(tooltip)
label_pitch->setText(QCoreApplication::translate("camera", "Pitch angle:", nullptr));
#if QT_CONFIG(tooltip)
line_pitch->setToolTip(QCoreApplication::translate("camera", "<html><head/><body><p>[OPTIONAL] pitch angle +/- 360 degrees</p></body></html>", nullptr));
#endif // QT_CONFIG(tooltip)
tabWidget->setTabText(tabWidget->indexOf(tab), QCoreApplication::translate("camera", "setNavigationState", nullptr));
label_anchorGeo->setText(QCoreApplication::translate("camera", "Anchor:", nullptr));
#if QT_CONFIG(tooltip)
line_anchorGeo->setToolTip(QCoreApplication::translate("camera", "<html><head/><body><p>Anchor camera to this globe (planet/moon)</p></body></html>", nullptr));
#endif // QT_CONFIG(tooltip)
label_lat->setText(QCoreApplication::translate("camera", "Latitude:", nullptr));
#if QT_CONFIG(tooltip)
line_lat->setToolTip(QCoreApplication::translate("camera", "<html><head/><body><p>Latitude of camera focus point (+/- 90 degrees)</p></body></html>", nullptr));
#endif // QT_CONFIG(tooltip)
label_long->setText(QCoreApplication::translate("camera", "Longitude:", nullptr));
#if QT_CONFIG(tooltip)
line_long->setToolTip(QCoreApplication::translate("camera", "<html><head/><body><p>Longitude of camera focus point (+/- 180 degrees)</p></body></html>", nullptr));
#endif // QT_CONFIG(tooltip)
label_altitude->setText(QCoreApplication::translate("camera", "Altitude:", nullptr));
#if QT_CONFIG(tooltip)
line_altitude->setToolTip(QCoreApplication::translate("camera", "<html><head/><body><p>[OPTIONAL] Altitude of camera (meters)</p></body></html>", nullptr));
#endif // QT_CONFIG(tooltip)
tabWidget->setTabText(tabWidget->indexOf(tab_2), QCoreApplication::translate("camera", "goToGeo", nullptr));
} // retranslateUi
};
namespace Ui {
class camera: public Ui_camera {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_CAMERA_H
+174
View File
@@ -0,0 +1,174 @@
#include "camera.h"
#include "./ui_camera.h"
camera::camera(Camera& imported, QWidget *parent)
: QDialog(parent)
, ui(new Ui::camera)
, _imported(imported)
, _data(imported)
{
ui->setupUi(this);
ui->tabWidget->setCurrentIndex(static_cast<int>(_data.type));
if (_data.type == Camera::Type::Nav) {
ui->line_anchorNav->setText(QString(_data.nav.anchor.c_str()));
ui->line_aim->setText(QString(_data.nav.aim.c_str()));
ui->line_referenceFrame->setText(QString(_data.nav.referenceFrame.c_str()));
ui->line_posX->setText(QString(_data.nav.position[0].c_str()));
ui->line_posY->setText(QString(_data.nav.position[1].c_str()));
ui->line_posZ->setText(QString(_data.nav.position[2].c_str()));
ui->line_upX->setText(QString(_data.nav.up[0].c_str()));
ui->line_upY->setText(QString(_data.nav.up[1].c_str()));
ui->line_upZ->setText(QString(_data.nav.up[2].c_str()));
ui->line_yaw->setText(QString(_data.nav.yaw.c_str()));
ui->line_pitch->setText(QString(_data.nav.pitch.c_str()));
}
if (_data.type == Camera::Type::Geo) {
ui->line_anchorGeo->setText(QString(_data.geo.anchor.c_str()));
ui->line_lat->setText(QString(_data.geo.latitude.c_str()));
ui->line_long->setText(QString(_data.geo.longitude.c_str()));
ui->line_altitude->setText(QString(_data.geo.altitude.c_str()));
}
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(approved()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(cancel()));
}
bool camera::isNumericalValue(QLineEdit* le) {
QString s = le->text();
bool validConversion = false;
s.toFloat(&validConversion);
return validConversion;
}
bool camera::inNumericalRange(QLineEdit* le, float min, float max) {
QString s = le->text();
bool validConversion = false;
float value = s.toFloat(&validConversion);
if (!validConversion) {
return false;
}
if (value < min || value > max) {
return false;
}
return true;
}
camera::~camera() {
delete ui;
}
void camera::cancel() {
}
bool camera::areRequiredFormsFilledAndValid() {
bool allFormsOk = true;
if (ui->tabWidget->currentIndex() == 0) {
checkFormFilled(ui->label_anchorNav, ui->line_anchorNav, "Anchor:", allFormsOk,
false, true);
checkFormFilled(ui->label_posX, ui->line_posX, "X", allFormsOk, true, true);
checkFormFilled(ui->label_posY, ui->line_posY, "Y", allFormsOk, true, true);
checkFormFilled(ui->label_posZ, ui->line_posZ, "Z", allFormsOk, true, true);
checkFormFilled(ui->label_upX, ui->line_upX, "X", allFormsOk, true, false);
checkFormFilled(ui->label_upY, ui->line_upY, "Y", allFormsOk, true, false);
checkFormFilled(ui->label_upZ, ui->line_upZ, "Z", allFormsOk, true, false);
checkFormFilled(ui->label_yaw, ui->line_yaw, "Yaw angle:", allFormsOk,
true, false);
checkFormFilled(ui->label_pitch, ui->line_pitch, "Pitch angle:", allFormsOk,
true, false);
checkFormRange(ui->label_yaw, ui->line_yaw, "Yaw angle:", -360.0, 360.0,
allFormsOk, false);
checkFormRange(ui->label_pitch, ui->line_pitch, "Pitch angle:", -360.0, 360.0,
allFormsOk, false);
}
if (ui->tabWidget->currentIndex() == 1) {
checkFormFilled(ui->label_anchorGeo, ui->line_anchorGeo, "Anchor:", allFormsOk,
false, true);
checkFormFilled(ui->label_lat, ui->line_lat, "Latitude:", allFormsOk,
true, true);
checkFormFilled(ui->label_long, ui->line_long, "Longitude:", allFormsOk,
true, true);
checkFormFilled(ui->label_altitude, ui->line_altitude, "Altitude:", allFormsOk,
true, false);
checkFormRange(ui->label_lat, ui->line_lat, "Latitude:", -90.0, 90.0,
allFormsOk, true);
checkFormRange(ui->label_long, ui->line_long, "Longitude:", -180.0, 180.0,
allFormsOk, true);
}
return allFormsOk;
}
void camera::checkFormFilled(QLabel* label, QLineEdit* value, const QString& labelTxt,
bool& allFormsOk, bool isNumber, bool isRequiredValue)
{
bool isThisFormValid = true;
if (value->text().length() == 0 && isRequiredValue) {
isThisFormValid = false;
}
if (value->text().length() > 0 && isNumber && !isNumericalValue(value)) {
isThisFormValid = false;
}
setErrorTextFormat(label, labelTxt, !isThisFormValid);
if (!isThisFormValid) {
allFormsOk = false;
}
}
void camera::checkFormRange(QLabel* label, QLineEdit* value, const QString& labelTxt,
float min, float max, bool& allFormsOk, bool isRequiredValue)
{
if (value->text().length() == 0 && !isRequiredValue) {
setErrorTextFormat(label, labelTxt, false);
return;
}
bool isThisFormValid = true;
checkFormFilled(label, value, labelTxt, isThisFormValid, true, isRequiredValue);
if (isThisFormValid) {
if (!inNumericalRange(value, min, max)) {
isThisFormValid = false;
}
}
setErrorTextFormat(label, labelTxt, !isThisFormValid);
if (!isThisFormValid && (isRequiredValue || value->text().length() > 0)) {
allFormsOk = false;
}
}
void camera::setErrorTextFormat(QLabel* label, const QString& labelTxt,
bool setErrorFormat)
{
QString formatText = "<font color='";
formatText += (setErrorFormat) ? "red" : "black";
formatText += "'>";
formatText += labelTxt;
formatText += "</font>";
label->setText(formatText);
}
void camera::approved() {
if (areRequiredFormsFilledAndValid()) {
_data.type = static_cast<Camera::Type>(ui->tabWidget->currentIndex());
if (_data.type == Camera::Type::Nav) {
_data.nav.anchor = ui->line_anchorNav->text().toUtf8().constData();
_data.nav.aim = ui->line_aim->text().toUtf8().constData();
_data.nav.referenceFrame = ui->line_referenceFrame->text().toUtf8().constData();
_data.nav.position[0] = ui->line_posX->text().toUtf8().constData();
_data.nav.position[1] = ui->line_posY->text().toUtf8().constData();
_data.nav.position[2] = ui->line_posZ->text().toUtf8().constData();
_data.nav.up[0] = ui->line_upX->text().toUtf8().constData();
_data.nav.up[1] = ui->line_upY->text().toUtf8().constData();
_data.nav.up[2] = ui->line_upZ->text().toUtf8().constData();
_data.nav.yaw = ui->line_yaw->text().toUtf8().constData();
_data.nav.pitch = ui->line_pitch->text().toUtf8().constData();
}
if (_data.type == Camera::Type::Geo) {
_data.geo.anchor = ui->line_anchorGeo->text().toUtf8().constData();
_data.geo.latitude = ui->line_lat->text().toUtf8().constData();
_data.geo.longitude = ui->line_long->text().toUtf8().constData();
_data.geo.altitude = ui->line_altitude->text().toUtf8().constData();
}
_imported = _data;
accept();
}
}
+702
View File
@@ -0,0 +1,702 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>camera</class>
<widget class="QDialog" name="camera">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>571</width>
<height>389</height>
</rect>
</property>
<property name="windowTitle">
<string>Set Camera Position</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>210</x>
<y>340</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>531</width>
<height>301</height>
</rect>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>setNavigationState</string>
</attribute>
<widget class="QLabel" name="label_anchorNav">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>71</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Anchor:</string>
</property>
</widget>
<widget class="QLineEdit" name="line_anchorNav">
<property name="geometry">
<rect>
<x>80</x>
<y>18</y>
<width>180</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Anchor camera to this node&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="whatsThis">
<string extracomment="Anchor camera to this node"/>
</property>
</widget>
<widget class="QLabel" name="label_aim">
<property name="geometry">
<rect>
<x>280</x>
<y>20</y>
<width>71</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Aim:</string>
</property>
</widget>
<widget class="QLineEdit" name="line_aim">
<property name="geometry">
<rect>
<x>320</x>
<y>18</y>
<width>180</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;[OPTIONAL] If specified, camera will be aimed at this node while keeping the anchor node in the same view location&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_referenceFrame">
<property name="geometry">
<rect>
<x>20</x>
<y>60</y>
<width>141</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Reference Frame:</string>
</property>
</widget>
<widget class="QLineEdit" name="line_referenceFrame">
<property name="geometry">
<rect>
<x>160</x>
<y>58</y>
<width>240</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;[OPTIONAL] Camera location in reference to this frame&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_pos">
<property name="geometry">
<rect>
<x>20</x>
<y>100</y>
<width>71</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Position:</string>
</property>
</widget>
<widget class="QLabel" name="label_posX">
<property name="geometry">
<rect>
<x>100</x>
<y>100</y>
<width>16</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>X</string>
</property>
</widget>
<widget class="QLineEdit" name="line_posX">
<property name="geometry">
<rect>
<x>120</x>
<y>98</y>
<width>100</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Camera position vector (x)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_posY">
<property name="geometry">
<rect>
<x>240</x>
<y>100</y>
<width>16</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Y</string>
</property>
</widget>
<widget class="QLineEdit" name="line_posY">
<property name="geometry">
<rect>
<x>260</x>
<y>98</y>
<width>100</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Camera position vector (y)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_posZ">
<property name="geometry">
<rect>
<x>380</x>
<y>100</y>
<width>16</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Z</string>
</property>
</widget>
<widget class="QLineEdit" name="line_posZ">
<property name="geometry">
<rect>
<x>400</x>
<y>98</y>
<width>100</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Camera position vector (z)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_up">
<property name="geometry">
<rect>
<x>20</x>
<y>140</y>
<width>71</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Up:</string>
</property>
</widget>
<widget class="QLabel" name="label_upX">
<property name="geometry">
<rect>
<x>100</x>
<y>140</y>
<width>16</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>X</string>
</property>
</widget>
<widget class="QLineEdit" name="line_upX">
<property name="geometry">
<rect>
<x>120</x>
<y>138</y>
<width>100</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;[OPTIONAL] Camera up vector (x)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_upY">
<property name="geometry">
<rect>
<x>240</x>
<y>140</y>
<width>16</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Y</string>
</property>
</widget>
<widget class="QLineEdit" name="line_upY">
<property name="geometry">
<rect>
<x>260</x>
<y>138</y>
<width>100</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;[OPTIONAL] Camera up vector (y)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_upZ">
<property name="geometry">
<rect>
<x>380</x>
<y>140</y>
<width>16</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Z</string>
</property>
</widget>
<widget class="QLineEdit" name="line_upZ">
<property name="geometry">
<rect>
<x>400</x>
<y>138</y>
<width>100</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;[OPTIONAL] Camera up vector (z)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_yaw">
<property name="geometry">
<rect>
<x>20</x>
<y>180</y>
<width>91</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Yaw angle:</string>
</property>
</widget>
<widget class="QLineEdit" name="line_yaw">
<property name="geometry">
<rect>
<x>120</x>
<y>178</y>
<width>100</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;[OPTIONAL] yaw angle +/- 360 degrees&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_pitch">
<property name="geometry">
<rect>
<x>20</x>
<y>220</y>
<width>91</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Pitch angle:</string>
</property>
</widget>
<widget class="QLineEdit" name="line_pitch">
<property name="geometry">
<rect>
<x>120</x>
<y>218</y>
<width>100</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;[OPTIONAL] pitch angle +/- 360 degrees&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>goToGeo</string>
</attribute>
<widget class="QLabel" name="label_anchorGeo">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>71</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Anchor:</string>
</property>
</widget>
<widget class="QLineEdit" name="line_anchorGeo">
<property name="geometry">
<rect>
<x>110</x>
<y>18</y>
<width>240</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Anchor camera to this globe (planet/moon)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_lat">
<property name="geometry">
<rect>
<x>20</x>
<y>60</y>
<width>81</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Latitude:</string>
</property>
</widget>
<widget class="QLineEdit" name="line_lat">
<property name="geometry">
<rect>
<x>110</x>
<y>58</y>
<width>240</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Latitude of camera focus point (+/- 90 degrees)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_long">
<property name="geometry">
<rect>
<x>20</x>
<y>100</y>
<width>81</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Longitude:</string>
</property>
</widget>
<widget class="QLineEdit" name="line_long">
<property name="geometry">
<rect>
<x>110</x>
<y>98</y>
<width>240</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Longitude of camera focus point (+/- 180 degrees)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_altitude">
<property name="geometry">
<rect>
<x>20</x>
<y>140</y>
<width>81</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Altitude:</string>
</property>
</widget>
<widget class="QLineEdit" name="line_altitude">
<property name="geometry">
<rect>
<x>110</x>
<y>138</y>
<width>240</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;[OPTIONAL] Altitude of camera (meters)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</widget>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>camera</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>camera</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>