|
|
#include "settingflightpoint3ddialog.h"
|
|
|
#include "Geometry3D/UGGeoLine3D.h"
|
|
|
#include "qdebug.h"
|
|
|
#include "ui_settingflightpoint3ddialog.h"
|
|
|
|
|
|
#include <QStyleFactory>
|
|
|
#include <QString>
|
|
|
|
|
|
SettingFlightPoint3DDialog::SettingFlightPoint3DDialog(QWidget *parent) :
|
|
|
QDialog(parent),
|
|
|
ui(new Ui::SettingFlightPoint3DDialog)
|
|
|
{
|
|
|
ui->setupUi(this);
|
|
|
this->setWindowTitle("航线信息");
|
|
|
this->resize(800,700);
|
|
|
this->setWindowFlags(Qt::WindowCloseButtonHint); //关闭右上角帮助(?)按钮。
|
|
|
this->setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
|
|
QApplication::setStyle(QStyleFactory::create("Fusion"));
|
|
|
|
|
|
|
|
|
currentId = 0;
|
|
|
|
|
|
initTableWidget();
|
|
|
|
|
|
ui->Height->setSuffix(" m");
|
|
|
ui->Height->setValue(300);
|
|
|
|
|
|
//设置高度模式选项()
|
|
|
ui->AltitudeMode->addItem("海拔高度");
|
|
|
ui->AltitudeMode->addItem("相对高度");
|
|
|
// ui->AltitudeMode->addItem("相对前一点高度 ");
|
|
|
|
|
|
ui->AltitudeMode->setCurrentIndex(0);
|
|
|
|
|
|
heightType = ui->AltitudeMode->currentIndex();
|
|
|
height = ui->Height->value();
|
|
|
|
|
|
// //设置纬度输入范围()
|
|
|
// QRegularExpression latRe("^(\\- |\\+)?([0-8]?\\d{1}\\.\\d*|90\\.0*|[0-8]?\\d{1}|90)[s\\-,;°度]?$");
|
|
|
// ui->Latitude->setValidator(new QRegularExpressionValidator(latRe));
|
|
|
// //设置经度输入范围()
|
|
|
// QRegularExpression lonRe("^(\\- |\\+)?(((\\d|[1-9]\\d|1[0-7]\\d|0{1,3})\\.\\d*)|(\\d|[1-9]\\d|1[0-7]\\d|0{1,3})|180\\.0*|180)[s\\-,;°度]?$");
|
|
|
// ui->Longitude->setValidator(new QRegularExpressionValidator(lonRe));
|
|
|
|
|
|
}
|
|
|
|
|
|
SettingFlightPoint3DDialog::~SettingFlightPoint3DDialog()
|
|
|
{
|
|
|
delete ui;
|
|
|
}
|
|
|
|
|
|
//接收正在编辑中的三维几何对象
|
|
|
void SettingFlightPoint3DDialog::receiveTrackingGeometry(UGGeometry *pGeometry)
|
|
|
{
|
|
|
qDebug()<<"*****************receiveGeometryCount:"<<pGeometry->GetSubPntCount(0);
|
|
|
UGGeoLine3D* line3D = (UGGeoLine3D*)pGeometry;
|
|
|
const UGPoint3D* p = line3D->GetPoints();
|
|
|
for(int i = 0;i< currentId;i++)
|
|
|
{//移动指针到点击点
|
|
|
p++;
|
|
|
}
|
|
|
double v_altitude = p->z; //地形高度
|
|
|
|
|
|
double v_height = 0;
|
|
|
if(heightType == 1)
|
|
|
{//相对高度类型换算为绝对高度
|
|
|
v_height = height + v_altitude;
|
|
|
}
|
|
|
else if(heightType==0)
|
|
|
{
|
|
|
v_height = height;
|
|
|
}
|
|
|
//添加航点信息到table
|
|
|
addFlightPointToTableWidget(p->x,p->y,v_height,v_altitude);
|
|
|
//修改航高
|
|
|
UGPoint3D temp(p->x,p->y,v_height);
|
|
|
line3D->SetPoint(currentId,temp);
|
|
|
|
|
|
currentId++;
|
|
|
line3D = NULL;
|
|
|
p = NULL;
|
|
|
}
|
|
|
|
|
|
//接收编辑完成的几何对象
|
|
|
void SettingFlightPoint3DDialog::receiveTrackedGeometry(UGGeometry *pGeometry)
|
|
|
{
|
|
|
this->pTrackedGeometry = pGeometry;
|
|
|
|
|
|
UGGeoLine3D* line3D = (UGGeoLine3D*)pGeometry;
|
|
|
//显示航线总长度
|
|
|
double totalLength = line3D->GetLength();
|
|
|
ui->DistanceLabel->setText(QString::number(totalLength,'g',2)+" m");
|
|
|
/*
|
|
|
UGGeoLine3D* l = (UGGeoLine3D*)pGeometry;
|
|
|
const UGPoint3D* p = NULL;
|
|
|
p = l->GetPoints();
|
|
|
for(int i =0;i<pGeometry->GetSubPntCount(0);i++)
|
|
|
{
|
|
|
qDebug()<<"****************x:"<<p->x;
|
|
|
qDebug()<<"****************y:"<<p->y;
|
|
|
qDebug()<<"****************z:"<<p->z;
|
|
|
qDebug()<<"*********************";
|
|
|
p++;
|
|
|
}
|
|
|
*/
|
|
|
}
|
|
|
|
|
|
void SettingFlightPoint3DDialog::on_AcceptBtn_clicked()
|
|
|
{
|
|
|
this->accept();
|
|
|
emit showSaveRouteDialog(pTrackedGeometry);
|
|
|
}
|
|
|
|
|
|
|
|
|
void SettingFlightPoint3DDialog::on_ClosedBtn_clicked()
|
|
|
{
|
|
|
this->close();
|
|
|
}
|
|
|
|
|
|
void SettingFlightPoint3DDialog::initTableWidget()
|
|
|
{
|
|
|
ui->RouteInfoTb->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);//横向先自适应宽度
|
|
|
ui->RouteInfoTb->horizontalHeader()->setStretchLastSection(true); //设置充满表宽度
|
|
|
|
|
|
ui->RouteInfoTb->resizeRowsToContents();//调整行内容大小
|
|
|
ui->RouteInfoTb->setColumnCount(5);//设置列数
|
|
|
//设置header
|
|
|
setTableWidgetHeader();
|
|
|
|
|
|
ui->RouteInfoTb->verticalHeader()->setVisible(false); //设置行号列,true为显示
|
|
|
|
|
|
ui->RouteInfoTb->setEditTriggers(QAbstractItemView::NoEditTriggers);//设置所有单元格不可编辑
|
|
|
}
|
|
|
|
|
|
void SettingFlightPoint3DDialog::setTableWidgetHeader()
|
|
|
{
|
|
|
//设置标题头的文字
|
|
|
QStringList header;
|
|
|
header<< "ID" << "经度" << "纬度" << "高度(m)" << "地形高度(m)" ;
|
|
|
ui->RouteInfoTb->setHorizontalHeaderLabels(header);
|
|
|
|
|
|
//设置标题头的字体样式
|
|
|
QFont font = ui->RouteInfoTb->horizontalHeader()->font();
|
|
|
font.setBold(true);
|
|
|
ui->RouteInfoTb->horizontalHeader()->setFont(font);
|
|
|
}
|
|
|
|
|
|
void SettingFlightPoint3DDialog::addFlightPointToTableWidget(double v_lon, double v_lat, double v_height, double v_altitude)
|
|
|
{
|
|
|
int curRow = ui->RouteInfoTb->rowCount();
|
|
|
ui->RouteInfoTb->insertRow(curRow); //在表格尾部添加一行,但不会自动为单元格创建item,需要手动创建内容
|
|
|
|
|
|
ui->RouteInfoTb->setItem(curRow,h_id,new QTableWidgetItem(QString::number(curRow+1)));
|
|
|
ui->RouteInfoTb->setItem(curRow,h_longitude,new QTableWidgetItem(QString::number(v_lon,'f',6)));
|
|
|
ui->RouteInfoTb->setItem(curRow,h_latitude,new QTableWidgetItem(QString::number(v_lat,'f',6)));
|
|
|
ui->RouteInfoTb->setItem(curRow,h_height,new QTableWidgetItem(QString::number(v_height,'f',2)));
|
|
|
ui->RouteInfoTb->setItem(curRow,h_altitude,new QTableWidgetItem(QString::number(v_altitude,'f',2)));
|
|
|
|
|
|
// ui->RouteInfoTb->item(curRow,0)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
//此功能还有待完善
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
void SettingFlightPoint3DDialog::on_AltitudeMode_currentIndexChanged(int index)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
void SettingFlightPoint3DDialog::on_accecptHeightBtn_clicked()
|
|
|
{
|
|
|
height = ui->Height->value();
|
|
|
heightType = ui->AltitudeMode->currentIndex();
|
|
|
}
|
|
|
|