You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.0 KiB
C++
76 lines
2.0 KiB
C++
#include "computeoffsetpositiondialog.h"
|
|
#include "Stream/ugdefs.h"
|
|
#include "qdebug.h"
|
|
#include "qvalidator.h"
|
|
#include <QRegExp>
|
|
#include "ui_computeoffsetpositiondialog.h"
|
|
|
|
#include <cmath>
|
|
|
|
ComputeOffsetPositionDialog::ComputeOffsetPositionDialog(QWidget *parent) :
|
|
QDialog(parent),
|
|
ui(new Ui::ComputeOffsetPositionDialog)
|
|
{
|
|
ui->setupUi(this);
|
|
this->setWindowTitle("计算下一点");
|
|
this->setWindowFlags(Qt::WindowCloseButtonHint); //关闭右上角帮助(?)按钮。
|
|
|
|
// ui->bearingText->setValidator(new QRegExpValidator(QRegExp("^([0]|-?[1-3][0-6]{0,5})(?:\.\d{1,4})?$|(^\t?$)") ));
|
|
// ui->distanceText->setValidator(new QRegExpValidator(QRegExp("^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$") ));
|
|
}
|
|
|
|
ComputeOffsetPositionDialog::~ComputeOffsetPositionDialog()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
QString ComputeOffsetPositionDialog::getBearing()
|
|
{
|
|
return ui->bearingText->text();
|
|
}
|
|
|
|
QString ComputeOffsetPositionDialog::getDistance()
|
|
{
|
|
return ui->distanceText->text();
|
|
}
|
|
|
|
QPointF ComputeOffsetPositionDialog::getOffsetPosition()
|
|
{
|
|
return offsetPoint;
|
|
}
|
|
|
|
void ComputeOffsetPositionDialog::on_cancelBtn_clicked()
|
|
{
|
|
this->close();
|
|
}
|
|
|
|
|
|
void ComputeOffsetPositionDialog::on_acceptBtn_clicked()
|
|
{
|
|
// this->accept();
|
|
qDebug()<<"*********************lon1:"<<preLon1;
|
|
qDebug()<<"*********************lon1:"<<preLon1;
|
|
qDebug()<<"*********************lon1:"<<preLat1;
|
|
qDebug()<<"*********************lon1:"<<preLat1;
|
|
double bearing = ui->bearingText->text().toDouble();
|
|
double dist = ui->distanceText->text().toDouble();
|
|
|
|
GeoComputation geoCPT;
|
|
QPointF nextPoint = geoCPT.computeOffsetGeoPosition(preLon1,preLat1,bearing,dist);
|
|
emit sendComputedPoint(nextPoint);
|
|
}
|
|
|
|
void ComputeOffsetPositionDialog::on_bearingText_editingFinished()
|
|
{
|
|
// qDebug()<<"***************************************:";
|
|
}
|
|
|
|
void ComputeOffsetPositionDialog::acceptPresiousPoint(double lon1, double lat1)
|
|
{
|
|
preLon1 = lon1;
|
|
preLat1 = lat1;
|
|
|
|
|
|
}
|
|
|