Bläddra i källkod

change map_lanetoxodr. add rtk lane add.

yuchuli 3 år sedan
förälder
incheckning
6066598e47

+ 20 - 0
src/tool/map_lanetoxodr/dialoglanefromrtk.cpp

@@ -211,6 +211,26 @@ void DialogLaneFromRTK::on_pushButton_CreateLane_clicked()
         }
     }
 
+    double favgrealdis = 0;
+
+    for(i=0;i<xvectorrktlanedis.size();i++)
+    {
+        favgrealdis = favgrealdis + xvectorrktlanedis.at(i).frealdis;
+    }
+
+    if(xvectorrktlanedis.size() > 0)favgrealdis = favgrealdis/xvectorrktlanedis.size();
+
+    if(favgrealdis<0.1)
+    {
+        char strout[255];
+        snprintf(strout,255,"lane average width is %f, very small,do you want Create Lane?",favgrealdis);
+        int nrtn = QMessageBox::warning(this,"Warning",QString(strout),QMessageBox::Yes,QMessageBox::No);
+        if(nrtn == QMessageBox::No)
+        {
+            return;
+        }
+    }
+
     Lane * pLane;
     if(brightlane)
     {

+ 62 - 3
src/tool/map_lanetoxodr/mainwindow.cpp

@@ -642,6 +642,13 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     pPB->setGeometry(nXPos,nYPos,mnFontHeight*10,nLEHeight);
     connect(pPB,SIGNAL(clicked(bool)),this,SLOT(onClickSetMove()));
 
+    nXPos = 30 + mnFontHeight*10;
+
+    pPB = new QPushButton(pGroup);
+    pPB->setText("Reset Move");
+    pPB->setGeometry(nXPos,nYPos,mnFontHeight*10,nLEHeight);
+    connect(pPB,SIGNAL(clicked(bool)),this,SLOT(onClickReSetMove()));
+
 
 
     nXPos = 10;
@@ -1279,8 +1286,8 @@ void MainWindow::onClickDefView()
     mnMoveY = mnDefMoveY;
 
     mpSlider_Scale->setValue(mnfac);
-    mpSlider_MoveX->setValue(mnMoveX*100/VIEW_WIDTH);
-    mpSlider_MoveY->setValue(mnMoveY*100/VIEW_HEIGHT);
+//    mpSlider_MoveX->setValue(mnMoveX*100/VIEW_WIDTH);
+//    mpSlider_MoveY->setValue(mnMoveY*100/VIEW_HEIGHT);
 //    mbRefresh = true;
     update();
 }
@@ -2648,6 +2655,13 @@ int MainWindow::CreateJunctionID()
 
 }
 
+
+static bool IsNaN(double dat)
+{
+ qint64 & ref=*(qint64 *)&dat;
+ return (ref&0x7FF0000000000000) == 0x7FF0000000000000 && (ref&0xfffffffffffff)!=0;
+}
+
 void MainWindow::onClickLoad()
 {
     QString str = QFileDialog::getOpenFileName(this,"Load XODR",".","*.xodr");
@@ -2661,6 +2675,20 @@ void MainWindow::onClickLoad()
         return;
     }
 
+    int nroadnum = pxodr->GetRoadCount();
+    int i;
+    for(i=0;i<nroadnum;i++)
+    {
+        Road * pRoad = pxodr->GetRoad(i);
+        if(IsNaN(pRoad->GetRoadLength()))
+        {
+            pxodr->DeleteRoad(i);
+            i--;
+            nroadnum--;
+            qDebug("delete road %s because length is NaN",pRoad->GetRoadId().data());
+        }
+    }
+
 
 
     bool bNeedMove = false;
@@ -2717,7 +2745,7 @@ void MainWindow::onClickLoad()
     int noldjunctioncount = mxodr.GetJunctionCount();
     int nnewcount = pxodr->GetRoadCount();
     int nnewjunctioncount = pxodr->GetJunctionCount();
-    int i;
+//    int i;
 
     if(bNeedAjustID)
     {
@@ -4967,3 +4995,34 @@ void MainWindow::onClickSetMove()
 
  //   updateView();
 }
+
+void MainWindow::onClickReSetMove()
+{
+    mfViewMoveX = 0;
+    mfViewMoveY = 0;
+
+    mbRefresh = true;
+    update();
+
+    mpLEViewMoveX->setText(QString::number(mfViewMoveX,'f',2));
+    mpLEViewMoveY->setText(QString::number(mfViewMoveY,'f',2));
+}
+
+void MainWindow::on_actionSummary_Road_triggered()
+{
+    int nroadnum = mxodr.GetRoadCount();
+    int i;
+    double flen = 0;
+    for(i=0;i<nroadnum;i++)
+    {
+        if(fabs(mxodr.GetRoad(i)->GetRoadLength())>10000)
+        {
+            Road * pRoad = mxodr.GetRoad(i);
+            int a = 1;
+        }
+        flen = flen + mxodr.GetRoad(i)->GetRoadLength();
+    }
+    char strout[256];
+    snprintf(strout,256,"Road Count:%d Length Total:%f",nroadnum,flen);
+    QMessageBox::information(this,"Summary",QString(strout),QMessageBox::YesAll);
+}

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

@@ -160,6 +160,7 @@ private slots:
     void onClickAutoConnect();
 
     void onClickSetMove();
+    void onClickReSetMove();
 
 
     void on_actionLoad_triggered();
@@ -180,6 +181,8 @@ private slots:
 
     void on_actionAdd_Road_From_RTK_triggered();
 
+    void on_actionSummary_Road_triggered();
+
 private:
 
 

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

@@ -50,6 +50,7 @@
     <addaction name="actionMerge_Road"/>
     <addaction name="actionEdit_Road_Lane"/>
     <addaction name="actionAdd_Road_From_RTK"/>
+    <addaction name="actionSummary_Road"/>
    </widget>
    <addaction name="menuFile"/>
    <addaction name="menuFunction"/>
@@ -118,6 +119,11 @@
     <string>Add Road From RTK</string>
    </property>
   </action>
+  <action name="actionSummary_Road">
+   <property name="text">
+    <string>Summary Road</string>
+   </property>
+  </action>
  </widget>
  <layoutdefault spacing="6" margin="11"/>
  <resources>