Browse Source

change tool/map_lanetoxodr. add some Draw Road Code,not complete.

yuchuli 3 years ago
parent
commit
16002cc02f

+ 108 - 0
src/tool/map_lanetoxodr/dialogdrawroad.cpp

@@ -0,0 +1,108 @@
+#include "dialogdrawroad.h"
+#include "ui_dialogdrawroad.h"
+
+#include "mainwindow.h"
+
+extern MainWindow * gw;
+
+DialogDrawRoad::DialogDrawRoad(QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::DialogDrawRoad)
+{
+    ui->setupUi(this);
+
+    ui->comboBox_Type->addItem("两点创建Line");
+    ui->comboBox_Type->addItem("航向和长度创建Line");
+    ui->comboBox_Type->addItem("两点和半径创建Arc");
+    ui->comboBox_Type->addItem("点和半径创建Arc");
+
+    ui->comboBox_Type->setCurrentIndex(0);
+
+    connect(gw,SIGNAL(CurrentPosition(double,double)),this,SLOT(onCurrentPos(double,double)));
+
+    setWindowTitle("Draw Road");
+}
+
+DialogDrawRoad::~DialogDrawRoad()
+{
+    delete ui;
+}
+
+void DialogDrawRoad::on_comboBox_Type_currentIndexChanged(int index)
+{
+    switch (index) {
+    case 0:
+        {
+            ui->label_Point1->setText("Point1(X Y)");
+            ui->label_Point2->setText("Point2(X Y)");
+            ui->checkBox_point2->setVisible(true);
+            ui->label_Point2->setVisible(true);
+            ui->lineEdit_point2x->setVisible(true);
+            ui->lineEdit_point2y->setVisible(true);
+            ui->label_Radius->setVisible(false);
+            ui->lineEdit_Radius->setVisible(false);
+            ui->lineEdit_hdgrange->setVisible(false);
+        }
+        break;
+    case 1:
+        {
+            ui->label_Point1->setText("Point(X Y)");
+            ui->label_Point2->setText("hdg&Len(hdg len)");
+            ui->checkBox_point2->setVisible(false);
+            ui->label_Point2->setVisible(true);
+            ui->lineEdit_point2x->setVisible(true);
+            ui->lineEdit_point2y->setVisible(true);
+            ui->label_Radius->setVisible(false);
+            ui->lineEdit_Radius->setVisible(false);
+            ui->lineEdit_hdgrange->setVisible(false);
+        }
+        break;
+    case 2:
+        {
+            ui->label_Point1->setText("Point1(X Y)");
+            ui->label_Point2->setText("Point2(X Y)");
+            ui->label_Radius->setText("Radius");
+            ui->checkBox_point2->setVisible(true);
+            ui->label_Point2->setVisible(true);
+            ui->lineEdit_point2x->setVisible(true);
+            ui->lineEdit_point2y->setVisible(true);
+            ui->label_Radius->setVisible(true);
+            ui->lineEdit_Radius->setVisible(true);
+            ui->lineEdit_hdgrange->setVisible(false);
+        }
+        break;
+    case 3:
+        {
+            ui->label_Point1->setText("Point(X Y");
+            ui->label_Radius->setText("Radius&Range");
+            ui->checkBox_point2->setVisible(false);
+            ui->label_Point2->setVisible(false);
+            ui->lineEdit_point2x->setVisible(false);
+            ui->lineEdit_point2y->setVisible(false);
+            ui->label_Radius->setVisible(true);
+            ui->lineEdit_Radius->setVisible(true);
+            ui->lineEdit_hdgrange->setVisible(true);
+        }
+        break;
+    default:
+        break;
+    }
+}
+
+void DialogDrawRoad::onCurrentPos(double x, double y)
+{
+    if(ui->checkBox_point1->isChecked())
+    {
+        ui->lineEdit_point1x->setText(QString::number(x));
+        ui->lineEdit_point1y->setText(QString::number(y));
+        ui->checkBox_point1->setChecked(false);
+    }
+    if(ui->checkBox_point2->isChecked())
+    {
+        ui->lineEdit_point2x->setText(QString::number(x));
+        ui->lineEdit_point2y->setText(QString::number(y));
+        ui->checkBox_point2->setChecked(false);
+    }
+    ui->lineEdit_newpointx->setText(QString::number(x));
+    ui->lineEdit_newpointy->setText(QString::number(y));
+}

+ 30 - 0
src/tool/map_lanetoxodr/dialogdrawroad.h

@@ -0,0 +1,30 @@
+#ifndef DIALOGDRAWROAD_H
+#define DIALOGDRAWROAD_H
+
+#include <QDialog>
+
+
+namespace Ui {
+class DialogDrawRoad;
+}
+
+class DialogDrawRoad : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit DialogDrawRoad(QWidget *parent = nullptr);
+    ~DialogDrawRoad();
+
+
+
+private slots:
+    void on_comboBox_Type_currentIndexChanged(int index);
+
+    void onCurrentPos(double x,double y);
+
+private:
+    Ui::DialogDrawRoad *ui;
+};
+
+#endif // DIALOGDRAWROAD_H

+ 266 - 0
src/tool/map_lanetoxodr/dialogdrawroad.ui

@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogDrawRoad</class>
+ <widget class="QDialog" name="DialogDrawRoad">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>891</width>
+    <height>648</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <widget class="QPushButton" name="pushButton_Draw">
+   <property name="geometry">
+    <rect>
+     <x>710</x>
+     <y>566</y>
+     <width>141</width>
+     <height>51</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Draw</string>
+   </property>
+  </widget>
+  <widget class="QComboBox" name="comboBox_Type">
+   <property name="geometry">
+    <rect>
+     <x>290</x>
+     <y>257</y>
+     <width>291</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>200</x>
+     <y>257</y>
+     <width>81</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Type</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_Create">
+   <property name="geometry">
+    <rect>
+     <x>690</x>
+     <y>247</y>
+     <width>141</width>
+     <height>51</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Create</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_Point1">
+   <property name="geometry">
+    <rect>
+     <x>62</x>
+     <y>40</y>
+     <width>211</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Point1</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_point1x">
+   <property name="geometry">
+    <rect>
+     <x>289</x>
+     <y>36</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_point1y">
+   <property name="geometry">
+    <rect>
+     <x>469</x>
+     <y>35</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_point2y">
+   <property name="geometry">
+    <rect>
+     <x>469</x>
+     <y>109</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_Point2">
+   <property name="geometry">
+    <rect>
+     <x>65</x>
+     <y>114</y>
+     <width>211</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Point2</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_point2x">
+   <property name="geometry">
+    <rect>
+     <x>289</x>
+     <y>110</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QCheckBox" name="checkBox_point1">
+   <property name="geometry">
+    <rect>
+     <x>679</x>
+     <y>38</y>
+     <width>92</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Select</string>
+   </property>
+  </widget>
+  <widget class="QCheckBox" name="checkBox_point2">
+   <property name="geometry">
+    <rect>
+     <x>679</x>
+     <y>110</y>
+     <width>92</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Select</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_newpointy">
+   <property name="geometry">
+    <rect>
+     <x>380</x>
+     <y>475</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_4">
+   <property name="geometry">
+    <rect>
+     <x>72</x>
+     <y>480</y>
+     <width>111</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>New Point</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_newpointx">
+   <property name="geometry">
+    <rect>
+     <x>200</x>
+     <y>476</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QCheckBox" name="checkBox_newpointusehdg">
+   <property name="geometry">
+    <rect>
+     <x>740</x>
+     <y>476</y>
+     <width>151</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Use Hdg</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_newpointhdg">
+   <property name="geometry">
+    <rect>
+     <x>560</x>
+     <y>476</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_Radius">
+   <property name="geometry">
+    <rect>
+     <x>66</x>
+     <y>185</y>
+     <width>211</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Radius</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_Radius">
+   <property name="geometry">
+    <rect>
+     <x>290</x>
+     <y>181</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_hdgrange">
+   <property name="geometry">
+    <rect>
+     <x>470</x>
+     <y>180</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+ </widget>
+ <tabstops>
+  <tabstop>lineEdit_point1x</tabstop>
+  <tabstop>lineEdit_point1y</tabstop>
+  <tabstop>checkBox_point1</tabstop>
+  <tabstop>lineEdit_point2x</tabstop>
+  <tabstop>lineEdit_point2y</tabstop>
+  <tabstop>checkBox_point2</tabstop>
+  <tabstop>lineEdit_Radius</tabstop>
+  <tabstop>lineEdit_hdgrange</tabstop>
+  <tabstop>comboBox_Type</tabstop>
+  <tabstop>pushButton_Create</tabstop>
+  <tabstop>lineEdit_newpointx</tabstop>
+  <tabstop>lineEdit_newpointy</tabstop>
+  <tabstop>lineEdit_newpointhdg</tabstop>
+  <tabstop>checkBox_newpointusehdg</tabstop>
+  <tabstop>pushButton_Draw</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>

+ 17 - 1
src/tool/map_lanetoxodr/mainwindow.cpp

@@ -81,6 +81,8 @@ MainWindow::MainWindow(QWidget *parent) :
     mpfb = new FileBackup();
     mpfb->start();
 
+    mpdlgdraw =  new DialogDrawRoad(this);
+
     setWindowTitle("Create Map From Lane Info");
 
 }
@@ -1277,6 +1279,8 @@ void MainWindow::onClickXY(double x, double y)
     mpLE_SelX->setText(QString::number(selx,'f',3));
     mpLE_SelY->setText(QString::number(sely,'f',3));
 
+    emit CurrentPosition(selx,sely);
+
     double x0,y0;
     GaussProjCal(glon0,glat0,&x0,&y0);
     GaussProjInvCal(x0+selx,y0+sely,&lon,&lat);
@@ -4826,6 +4830,12 @@ void MainWindow::onClickCBRoadChange(int index)
        }
        mpCBRoadShowNext->addItem(strout);
    }
+
+   if(mpCBRoad->currentText().length()>0)
+   {
+        int nCurRoadID = mpCBRoad->currentText().toInt();
+        emit CurrentRoadChange(nCurRoadID);
+   }
 }
 
 void MainWindow::updateJunction()
@@ -5727,7 +5737,6 @@ void MainWindow::on_actionMake_All_Road_Contact_triggered()
     AutoRoadContact::MakeAllContact(&mxodr);
 
     updateJunction();
-
     updateCBRoad();
     mbRefresh = true;
     update();
@@ -5782,3 +5791,10 @@ void MainWindow::on_actionHide_Selected_triggered()
     }
     UpdateScene_SelectRoadRefGeo();
 }
+
+void MainWindow::on_actionDraw_Road_triggered()
+{
+    DialogDrawRoad * pdlgdraw = mpdlgdraw;
+    pdlgdraw->setModal(false);
+    pdlgdraw->show();
+}

+ 8 - 0
src/tool/map_lanetoxodr/mainwindow.h

@@ -48,6 +48,7 @@
 #include "dialogcalcs.h"
 #include "dialogroadborrow.h"
 #include "dialoghideroad.h"
+#include "dialogdrawroad.h"
 
 #include "filebackup.h"
 
@@ -104,6 +105,9 @@ private:
 public:
     static void ComboToString(std::string strroadid,QComboBox * pCB);
 
+signals:
+    void CurrentPosition(double x,double y);
+    void CurrentRoadChange(int nroadid);
 
 public:
      void resizeEvent(QResizeEvent *event);
@@ -214,6 +218,8 @@ private slots:
 
     void on_actionHide_Selected_triggered();
 
+    void on_actionDraw_Road_triggered();
+
 private:
 
 
@@ -311,6 +317,8 @@ private:
 
     QComboBox * mpCBViewMode;
 
+    DialogDrawRoad * mpdlgdraw;
+
  //   QLineEdit * mpLE_StartLat, * mpLE_StartLon, * mpLE_StartHeading;
 
 //    QLineEdit * mpLE_EndLat, * mpLE_EndLon;

+ 6 - 0
src/tool/map_lanetoxodr/mainwindow.ui

@@ -55,6 +55,7 @@
     <addaction name="actionEdit_Road"/>
     <addaction name="actionAdd_Road_From_RTK"/>
     <addaction name="actionSummary_Road"/>
+    <addaction name="actionDraw_Road"/>
    </widget>
    <widget class="QMenu" name="menuView">
     <property name="title">
@@ -170,6 +171,11 @@
     <string>Hide Selected</string>
    </property>
   </action>
+  <action name="actionDraw_Road">
+   <property name="text">
+    <string>Draw Road</string>
+   </property>
+  </action>
  </widget>
  <layoutdefault spacing="6" margin="11"/>
  <resources>

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

@@ -32,6 +32,7 @@ SOURCES += \
     autoroadcontact.cpp \
     dialogaddroadfromrtk.cpp \
     dialogcalcs.cpp \
+    dialogdrawroad.cpp \
     dialogeditlane.cpp \
     dialogeditroadmark.cpp \
     dialoghideroad.cpp \
@@ -81,6 +82,7 @@ HEADERS += \
     autoroadcontact.h \
     dialogaddroadfromrtk.h \
     dialogcalcs.h \
+    dialogdrawroad.h \
     dialogeditlane.h \
     dialogeditroadmark.h \
     dialoghideroad.h \
@@ -124,6 +126,7 @@ HEADERS += \
 FORMS += \
         dialogaddroadfromrtk.ui \
         dialogcalcs.ui \
+        dialogdrawroad.ui \
         dialogeditlane.ui \
         dialogeditroadmark.ui \
         dialoghideroad.ui \