|
@@ -0,0 +1,57 @@
|
|
|
+#include "dialogcalcs.h"
|
|
|
+#include "ui_dialogcalcs.h"
|
|
|
+
|
|
|
+
|
|
|
+#include "xodrfunc.h"
|
|
|
+#include "gnss_coordinate_convert.h"
|
|
|
+
|
|
|
+DialogCalcS::DialogCalcS(OpenDrive * pxodr,double xlon0,double xlat0, QWidget *parent) :
|
|
|
+ QDialog(parent),
|
|
|
+ ui(new Ui::DialogCalcS)
|
|
|
+{
|
|
|
+ ui->setupUi(this);
|
|
|
+
|
|
|
+ mpxodr = pxodr;
|
|
|
+ mlon0 = xlon0;
|
|
|
+ mlat0 = xlat0;
|
|
|
+
|
|
|
+ setWindowTitle("Calculate S in Road");
|
|
|
+}
|
|
|
+
|
|
|
+DialogCalcS::~DialogCalcS()
|
|
|
+{
|
|
|
+ delete ui;
|
|
|
+}
|
|
|
+
|
|
|
+void DialogCalcS::on_pushButton_Calculate_clicked()
|
|
|
+{
|
|
|
+ double flon = ui->lineEdit_Lon->text().toDouble();
|
|
|
+ double flat = ui->lineEdit_Lat->text().toDouble();
|
|
|
+
|
|
|
+ double x0,y0;
|
|
|
+ GaussProjCal(mlon0,mlat0,&x0,&y0);
|
|
|
+
|
|
|
+ double x,y;
|
|
|
+ GaussProjCal(flon,flat,&x,&y);
|
|
|
+
|
|
|
+
|
|
|
+ double rel_x,rel_y;
|
|
|
+ rel_x = x - x0;
|
|
|
+ rel_y = y - y0;
|
|
|
+
|
|
|
+ Road * pRoad = 0;
|
|
|
+ GeometryBlock * pgeob;
|
|
|
+ double fdis,nearx,neary,hdg;
|
|
|
+ double fs;
|
|
|
+ int nlane;
|
|
|
+ if(xodrfunc::GetNearPoint(rel_x,rel_y,mpxodr,&pRoad,&pgeob,fdis,nearx,neary,hdg,50,&fs,&nlane) == 0)
|
|
|
+ {
|
|
|
+ char strout[256];
|
|
|
+ snprintf(strout,256,"Road %s S:%f",pRoad->GetRoadId().data(),fs);
|
|
|
+ ui->lineEdit_Res->setText(strout);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ui->lineEdit_Res->setText("not found");
|
|
|
+ }
|
|
|
+}
|