Browse Source

change map_lanetoxodr, add add parkingspacefrompoint, not complete.

yuchuli 5 months ago
parent
commit
abfc88d146

+ 3 - 0
src/tool/map_lanetoxodr/map_lanetoxodr.pro

@@ -43,6 +43,7 @@ SOURCES += \
     ui/dialoglanefromrtk.cpp \
     ui/dialoglaneoffset.cpp \
     ui/dialogobject_lanevalidity.cpp \
+    ui/dialogparkingfrompoint.cpp \
     ui/dialogparkingspaceedit.cpp \
     ui/dialogparkingspacefromrtk.cpp \
     ui/dialogroadborrow.cpp \
@@ -116,6 +117,7 @@ HEADERS += \
     ui/dialoglanefromrtk.h \
     ui/dialoglaneoffset.h \
     ui/dialogobject_lanevalidity.h \
+    ui/dialogparkingfrompoint.h \
     ui/dialogparkingspaceedit.h \
     ui/dialogparkingspacefromrtk.h \
     ui/dialogroadborrow.h \
@@ -184,6 +186,7 @@ FORMS += \
         ui/dialoglanefromrtk.ui \
         ui/dialoglaneoffset.ui \
         ui/dialogobject_lanevalidity.ui \
+    ui/dialogparkingfrompoint.ui \
         ui/dialogparkingspaceedit.ui \
         ui/dialogparkingspacefromrtk.ui \
         ui/dialogroadborrow.ui \

+ 53 - 0
src/tool/map_lanetoxodr/ui/dialogparkingfrompoint.cpp

@@ -0,0 +1,53 @@
+#include "dialogparkingfrompoint.h"
+#include "ui_dialogparkingfrompoint.h"
+
+#include "gnss_coordinate_convert.h"
+
+DialogParkingFromPoint::DialogParkingFromPoint(Road * pRoad,QWidget *parent)
+    : QDialog(parent)
+    , ui(new Ui::DialogParkingFromPoint)
+{
+    ui->setupUi(this);
+    (void)pRoad;
+
+    mpRoad = pRoad;
+
+    ui->lineEdit_Lon->setText("117.0");
+    ui->lineEdit_Lat->setText("39.0");
+    ui->lineEdit_Heading->setText("90.0");
+    ui->lineEdit_Length->setText("5.3");
+    ui->lineEdit_Width->setText("2.3");
+    ui->lineEdit_DisOfPointAndFront->setText("2.65");
+    ui->lineEdit_DistanceOfPointAndLeft->setText("1.15");
+}
+
+DialogParkingFromPoint::~DialogParkingFromPoint()
+{
+    delete ui;
+}
+
+void DialogParkingFromPoint::on_pushButton_addparkingspace_clicked()
+{
+    Road * pRoad = mpRoad;
+
+    double fLon = ui->lineEdit_Lon->text().toDouble();
+    double fLat = ui->lineEdit_Lat->text().toDouble();
+    double fhdg = ui->lineEdit_Heading->text().toDouble();
+    double fwidth = ui->lineEdit_Width->text().toDouble();
+    double flen = ui->lineEdit_Length->text().toDouble();
+    double fdistofront = ui->lineEdit_DisOfPointAndFront->text().toDouble();
+    double fdistoleft = ui->lineEdit_DistanceOfPointAndLeft->text().toDouble();
+
+    double fx,fy;
+    GaussProjCal(fLon,fLat,&fx,&fy);
+    fhdg = (90 - fhdg)*M_PI/180.0;
+
+    double fCenter_x,fCenter_y;
+    double fmovex,fmovey;
+    fmovex = fdistofront - flen/2.0;
+    fmovey = fdistoleft - fwidth/2.0;
+    fCenter_x = fx + fmovex * cos(fhdg) + fmovey * cos(fhdg + M_PI/2.0);
+    fCenter_y = fy + fmovex * sin(fhdg) + fmovey * sin(fhdg + M_PI/2.0);
+
+}
+

+ 29 - 0
src/tool/map_lanetoxodr/ui/dialogparkingfrompoint.h

@@ -0,0 +1,29 @@
+#ifndef DIALOGPARKINGFROMPOINT_H
+#define DIALOGPARKINGFROMPOINT_H
+
+#include <QDialog>
+
+#include <OpenDrive/OpenDrive.h>
+
+namespace Ui {
+class DialogParkingFromPoint;
+}
+
+class DialogParkingFromPoint : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit DialogParkingFromPoint(Road * pRoad,QWidget *parent = nullptr);
+    ~DialogParkingFromPoint();
+
+private slots:
+    void on_pushButton_addparkingspace_clicked();
+
+private:
+    Ui::DialogParkingFromPoint *ui;
+
+    Road * mpRoad = NULL;
+};
+
+#endif // DIALOGPARKINGFROMPOINT_H

+ 193 - 0
src/tool/map_lanetoxodr/ui/dialogparkingfrompoint.ui

@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogParkingFromPoint</class>
+ <widget class="QDialog" name="DialogParkingFromPoint">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>682</width>
+    <height>447</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <widget class="QLineEdit" name="lineEdit_Lon">
+   <property name="geometry">
+    <rect>
+     <x>147</x>
+     <y>50</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>50</y>
+     <width>101</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Longitude:</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_Lat">
+   <property name="geometry">
+    <rect>
+     <x>477</x>
+     <y>50</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>350</x>
+     <y>50</y>
+     <width>101</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Latitude:</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_Heading">
+   <property name="geometry">
+    <rect>
+     <x>147</x>
+     <y>120</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_3">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>120</y>
+     <width>101</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Heading:</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_Length">
+   <property name="geometry">
+    <rect>
+     <x>147</x>
+     <y>190</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_4">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>190</y>
+     <width>101</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Length:</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_Width">
+   <property name="geometry">
+    <rect>
+     <x>477</x>
+     <y>190</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_5">
+   <property name="geometry">
+    <rect>
+     <x>350</x>
+     <y>190</y>
+     <width>101</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Width:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_6">
+   <property name="geometry">
+    <rect>
+     <x>23</x>
+     <y>260</y>
+     <width>241</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Distance of Point and Front:</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_DisOfPointAndFront">
+   <property name="geometry">
+    <rect>
+     <x>288</x>
+     <y>260</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_7">
+   <property name="geometry">
+    <rect>
+     <x>23</x>
+     <y>330</y>
+     <width>211</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Distance of Point and Left:</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_DistanceOfPointAndLeft">
+   <property name="geometry">
+    <rect>
+     <x>290</x>
+     <y>323</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_addparkingspace">
+   <property name="geometry">
+    <rect>
+     <x>240</x>
+     <y>390</y>
+     <width>171</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Add  ParkingSpace</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 13 - 0
src/tool/map_lanetoxodr/ui/roadeditdialog.cpp

@@ -706,3 +706,16 @@ void RoadEditDialog::on_pushButton_TurnDirection_clicked()
     dlgtd.exec();
 }
 
+
+void RoadEditDialog::on_pushButton_ParkingSpaceFromPoint_clicked()
+{
+    if(mpCurRoad == 0)
+    {
+        QMessageBox::warning(this,"Warning","Not Select Road");
+        return;
+    }
+
+    DialogParkingFromPoint dlgparkpoint(mpCurRoad,this);
+    dlgparkpoint.exec();
+}
+

+ 3 - 0
src/tool/map_lanetoxodr/ui/roadeditdialog.h

@@ -25,6 +25,7 @@
 #include "dialogroadtype.h"
 #include "dialogparkingspacefromrtk.h"
 #include "dialogturndirection.h"
+#include "dialogparkingfrompoint.h"
 
 #include "roaddigit.h"
 #include "xodrscenfunc.h"
@@ -81,6 +82,8 @@ private slots:
 
     void on_pushButton_TurnDirection_clicked();
 
+    void on_pushButton_ParkingSpaceFromPoint_clicked();
+
 private:
     bool IsDrawMark(double s);
 

+ 13 - 0
src/tool/map_lanetoxodr/ui/roadeditdialog.ui

@@ -402,6 +402,19 @@
     <string>Edit Turn Direction</string>
    </property>
   </widget>
+  <widget class="QPushButton" name="pushButton_ParkingSpaceFromPoint">
+   <property name="geometry">
+    <rect>
+     <x>500</x>
+     <y>260</y>
+     <width>181</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>ParkingSpace From Point</string>
+   </property>
+  </widget>
  </widget>
  <resources/>
  <connections/>