Kaynağa Gözat

change tool/map_lanetoxodr. fix geometry show and fix lane edit problem.

yuchuli 3 yıl önce
ebeveyn
işleme
924fb0550a

+ 33 - 1
src/tool/map_lanetoxodr/dialogeditlane.cpp

@@ -30,6 +30,8 @@ DialogEditLane::DialogEditLane(Road * pRoad,QWidget *parent) :
     }
     if(nsection > 0)on_comboBox_LaneSection_currentIndexChanged(0);
 
+    setWindowTitle("Edit Lane");
+
 }
 
 DialogEditLane::~DialogEditLane()
@@ -39,6 +41,7 @@ DialogEditLane::~DialogEditLane()
 
 void DialogEditLane::on_comboBox_LaneSection_currentIndexChanged(int index)
 {
+    int indexold = ui->comboBox_Lane->currentIndex();
     if(mpRoad == 0)return;
     LaneSection * pLS = mpRoad->GetLaneSection(index);
     ui->comboBox_Lane->clear();
@@ -54,7 +57,17 @@ void DialogEditLane::on_comboBox_LaneSection_currentIndexChanged(int index)
         ui->comboBox_Lane->addItem(stritemname);
     }
 
-    if(nLaneCount > 0)on_comboBox_Lane_currentIndexChanged(0);
+    int indexnew = 0;
+    if((indexold>=0)&&(indexold<nLaneCount))
+    {
+        indexnew = indexold;
+    }
+
+    if(nLaneCount > 0)
+    {
+        ui->comboBox_Lane->setCurrentIndex(indexnew);
+//        on_comboBox_Lane_currentIndexChanged(indexnew);
+    }
 
 
 
@@ -158,6 +171,8 @@ void DialogEditLane::on_pushButton_DeleteLane_clicked()
         return;
     }
 
+
+
     if(mpCurLS == 0)return;
     int nlanecount = mpCurLS->GetLaneCount();
     int i;
@@ -172,6 +187,23 @@ void DialogEditLane::on_pushButton_DeleteLane_clicked()
     }
     mpCurLS->DeleteLane(i);
 
+    nlanecount = mpCurLS->GetLaneCount();
+    for(i=0;i<nlanecount;i++)
+    {
+        Lane * pLane = mpCurLS->GetLane(i);
+        if(((pLane->GetId() * index)>0)&&(abs(pLane->GetId())>abs(index)))
+        {
+            if(pLane->GetId()>0)
+            {
+                pLane->SetId(pLane->GetId()-1);
+            }
+            else
+            {
+                pLane->SetId(pLane->GetId()+1);
+            }
+        }
+    }
+
     on_comboBox_LaneSection_currentIndexChanged(ui->comboBox_LaneSection->currentIndex());
 }
 

+ 4 - 2
src/tool/map_lanetoxodr/dialogroadoptimize.cpp

@@ -33,7 +33,9 @@ DialogRoadOptimize::DialogRoadOptimize(Road * pRoad,OpenDrive * pxodr,QWidget *p
         int i;
         for(i=0;i<nrtn;i++)
         {
-            snprintf(strline,1000,"%d  distance:%f   hdgdiff:%f\n",i,fvectordis[i],fvectorhdg[i]);
+            RoadGeometry * pg = pRoad->GetGeometryBlock(i)->GetGeometryAt(0);
+            snprintf(strline,1000,"%d  distance:%f   hdgdiff:%f geo type:%d s:%f length %f\n",
+                     i,fvectordis[i],fvectorhdg[i],pg->GetGeomType(),pg->GetS(),pg->GetLength());
             strncat(pstrout_ptr.get(),strline,noutbufsize);
         }
     }
@@ -341,6 +343,6 @@ double DialogRoadOptimize::GetGeo1toGeo2MaxDis(GeometryBlock *pgeob1, GeometryBl
         }
     }
 
-    std::cout<<"dismax : "<<fdismax<<std::endl;
+//    std::cout<<"dismax : "<<fdismax<<std::endl;
     return fdismax;
 }

+ 7 - 0
src/tool/map_lanetoxodr/roadeditdialog.cpp

@@ -41,6 +41,13 @@ RoadEditDialog::RoadEditDialog(OpenDrive * pxodr,std::string strdefroad,QWidget
     ui->comboBox_geotype->addItem("Poly");
     ui->comboBox_geotype->addItem("Param Poly");
 
+    ui->lineEdit_hdg->setDisabled(true);
+    ui->lineEdit_len->setDisabled(true);
+    ui->lineEdit_roadlen->setDisabled(true);
+    ui->lineEdit_s->setDisabled(true);
+    ui->lineEdit_x->setDisabled(true);
+    ui->lineEdit_y->setDisabled(true);
+
     int i;
     int nroadcount = mpxodr->GetRoadCount();
     for(i=0;i<nroadcount;i++)