Browse Source

change map_lanetoxodr. complete parkspace add.

yuchuli 5 months ago
parent
commit
6acf8b10dc

+ 149 - 95
src/tool/map_lanetoxodr/mainwindow.cpp

@@ -101,6 +101,7 @@ MainWindow::~MainWindow()
 
 void MainWindow::resizeEvent(QResizeEvent *event)
 {
+    (void)event;
     qDebug("resize");
     QSize sizemain = ui->centralWidget->size();
     qDebug("size x = %d y=%d",sizemain.width(),sizemain.height());
@@ -146,7 +147,8 @@ void MainWindow::ExecPainter()
 
 
         painter->setPen(Qt::blue);
-                int nfac = mnfac;
+        int nfac = mnfac;
+        (void)nfac;
 
         if(mbClick)
         {
@@ -171,7 +173,7 @@ void MainWindow::ExecPainter()
     painter->setPen(Qt::blue);
 //            int nfac = mnfac;
     int selid = mpCBRoad->currentText().toInt();
-    for(i=0;i<mxodr.GetRoadCount();i++)
+    for(i=0;i<static_cast<int>( mxodr.GetRoadCount());i++)
     {
   //     continue;
         int j;
@@ -205,7 +207,7 @@ void MainWindow::ExecPainter()
             y = y + mfViewMoveY;
             painter->drawText(x*mnfac,y*mnfac*(-1),mxodr.GetRoad(i)->GetRoadId().data());
         }
-        for(j=0;j<mxodr.GetRoad(i)->GetGeometryBlockCount();j++)
+        for(j=0;j<static_cast<int>(mxodr.GetRoad(i)->GetGeometryBlockCount());j++)
         {
             GeometryBlock * pgeob = pRoad->GetGeometryBlock(j);
             double x,y;
@@ -250,10 +252,14 @@ void MainWindow::ExecPainter()
                    double sstep = pSpiral->GetLength()/((double)ncount);
                    int k;
                    double x0,y0,hdg0,s0;
-                   x0 = pSpiral->GetX();
-                   y0 = pSpiral->GetY();
+                   (void)x0;
+                   (void)y0;
+                   (void)hdg0;
+  //                 x0 = pSpiral->GetX();
+  //                 y0 = pSpiral->GetY();
                    s0 = pSpiral->GetS();
-                   hdg0 = pSpiral->GetHdg() ;
+  //                 hdg0 = pSpiral->GetHdg() ;
+ //                  (void)x0; (void)y0; (void)hdg0;
                    painter->setPen(Qt::red);
                    for(k=0;k<ncount;k++)
                    {
@@ -291,7 +297,7 @@ void MainWindow::ExecPainter()
                 double curv = parc->GetCurvature();
                 double hdgstep;
                 double hdg0 = parc->GetHdg();
-                double hdgnow = parc->GetHdg();
+                double hdgnow = parc->GetHdg();(void)hdgnow;
                 if(ncount > 0) hdgstep= (parc->GetLength()/R)/ncount;
                 for(k=0;k<ncount;k++)
                 {
@@ -396,7 +402,7 @@ void MainWindow::ExecPainter()
 
 
 
-    for(i=0;i<mvectorlp.size();i++)
+    for(i=0;i<static_cast<int>( mvectorlp.size());i++)
     {
         if(!mbShowLane)continue;
         if(i == mnMarkLane)
@@ -498,6 +504,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     int nYPos = 30;
 
     int i;
+    (void)i;
 
     int nSpace = mnFontHeight * 65/10;
     int nLEWidth = mnFontHeight * 6;
@@ -532,7 +539,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     pLabel = new QLabel(pGroup);
     pLabel->setText("Head0");
     pLabel->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
-    nXPos = nXPos + nSpace;
+ //   nXPos = nXPos + nSpace;
 
 
 
@@ -556,7 +563,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     pLE->setText(QString::number(ghdg0,'f',3));
     pLE->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
     mpLEHead0 = pLE;
-    nXPos = nXPos + nSpace;
+ //   nXPos = nXPos + nSpace;
 
     nXPos = 10;
     nYPos = nYPos + mnFontHeight * 2;
@@ -576,7 +583,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     pLE->setText(QString::number(mfViewMoveY,'f',2));
     pLE->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
     mpLEViewMoveY = pLE;
-    nXPos = nXPos + nSpace;
+ //   nXPos = nXPos + nSpace;
 
     nXPos = 10;
     nYPos = nYPos + mnFontHeight * 4;
@@ -692,6 +699,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     pLabel->setText("SelLat");
     pLabel->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
     nXPos = nXPos + nSpace;
+    (void)nXPos;
 
     nXPos = 10;
     nYPos = nYPos + mnFontHeight * 2;
@@ -706,7 +714,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     pLE->setText("");
     pLE->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
     mpLE_SelY = pLE;
-    nXPos = nXPos + nSpace;
+//    nXPos = nXPos + nSpace;
 
 
 
@@ -760,6 +768,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     pCB = new QComboBox(pGroup);
     pCB->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
     nXPos = nXPos + nSpace;
+    (void)nXPos;
     mpCBLane = pCB;
 
     nXPos = 10;
@@ -782,6 +791,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     pPB->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
     connect(pPB,SIGNAL(clicked(bool)),this,SLOT(onClickClearRoadLane()));
     nXPos = nXPos + nSpace;
+    (void)nXPos;
 
     nXPos = 10;
     nYPos = nYPos + mnFontHeight * 2;
@@ -800,7 +810,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
 
     pLE = new QLineEdit(pGroup);
     pLE->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
-    nXPos = nXPos + nSpace;
+    nXPos = nXPos + nSpace; (void)nXPos;
     mpLE_RoadName = pLE;
 
 
@@ -822,7 +832,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     pPB->setText("Add Road");
     pPB->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
     connect(pPB,SIGNAL(clicked(bool)),this,SLOT(onClickAddRoad()));
-    nXPos = nXPos + nSpace;
+    nXPos = nXPos + nSpace; (void)nXPos;
 
     nXPos = 10;
     nYPos = nYPos + mnFontHeight * 4;
@@ -843,7 +853,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     pPB->setText("Del");
     pPB->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
     connect(pPB,SIGNAL(clicked(bool)),this,SLOT(onClickRoadDel()));
-    nXPos = nXPos + nSpace;
+    nXPos = nXPos + nSpace; (void)nXPos;
 
     nXPos = 10;
     nYPos = nYPos + mnFontHeight * 2;
@@ -863,7 +873,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     pLabel->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
     pLabel->setText("10010");
     mpLabelRoadShowPreID = pLabel;
-    nXPos = nXPos + nSpace;
+    nXPos = nXPos + nSpace; (void)nXPos;
 
     nXPos = 10;
     nYPos = nYPos + mnFontHeight * 2;
@@ -896,7 +906,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     pLabel->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
     pLabel->setText("10010");
     mpLabelRoadShowNxtID = pLabel;
-    nXPos = nXPos + nSpace;
+    nXPos = nXPos + nSpace; (void)nXPos;
 
     nXPos = 10;
     nYPos = nYPos + mnFontHeight * 2;
@@ -935,7 +945,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
 
     pCB = new QComboBox(pGroup);
     pCB->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
-    nXPos = nXPos + nSpace;
+    nXPos = nXPos + nSpace;  (void)nXPos;
     mpCBPreNxtConatact = pCB;
     pCB->addItem("start");
     pCB->addItem("end");
@@ -951,7 +961,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
 
     pPB = new QPushButton(pGroup);
     pPB->setGeometry(nXPos,nYPos,nLEWidth*15/10,nLEHeight);
-    nXPos = nXPos + nSpace*15/10;
+    nXPos = nXPos + nSpace*15/10;  (void)nXPos;
     pPB->setText("Set Successor");
     connect(pPB,SIGNAL(clicked(bool)),this,SLOT(onClickSetRoadSuccessor()));
 
@@ -966,7 +976,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
 
     pPB = new QPushButton(pGroup);
     pPB->setGeometry(nXPos,nYPos,nLEWidth*15/10,nLEHeight);
-    nXPos = nXPos + nSpace*15/10;
+    nXPos = nXPos + nSpace*15/10;  (void)nXPos;
     pPB->setText("Del Successor");
     connect(pPB,SIGNAL(clicked(bool)),this,SLOT(onClickDelRoadSuccessor()));
 
@@ -1034,7 +1044,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
 
     pCB = new QComboBox(pGroup);
     pCB->setGeometry(nXPos,nYPos,nLEWidth*2,nLEHeight);
-    nXPos = nXPos + nSpace;
+//    nXPos = nXPos + nSpace;
     mpCBRoadCon = pCB;
 
     nXPos = 10;
@@ -1047,7 +1057,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
 
     pCB = new QComboBox(pGroup);
     pCB->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
-    nXPos = nXPos + nSpace;
+ //   nXPos = nXPos + nSpace;
     mpCBLane2 = pCB;
 
 
@@ -1062,7 +1072,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
 
     pCB = new QComboBox(pGroup);
     pCB->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
-    nXPos = nXPos + nSpace;
+//    nXPos = nXPos + nSpace;
     mpCBLane1Lane2 = pCB;
 
     nXPos = 10;
@@ -1076,7 +1086,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
 
     pCB = new QComboBox(pGroup);
     pCB->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
-    nXPos = nXPos + nSpace;
+ //   nXPos = nXPos + nSpace;
     mpCBLane1Lane2op = pCB;
 
     nXPos = 10;
@@ -1161,7 +1171,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
 
     pLabel = new QLabel(pGroup);
     pLabel->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
-    nXPos = nXPos + nSpace;
+ //   nXPos = nXPos + nSpace;
     mpLabelJunctionConnectingRoad = pLabel;
 
     nXPos = 10;
@@ -1181,7 +1191,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
 
     pCB = new QComboBox(pGroup);
     pCB->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
-    nXPos = nXPos + nSpace;
+ //   nXPos = nXPos + nSpace;
     mpCBJunctionIncommingRoad = pCB;
     connect(pCB,SIGNAL(currentIndexChanged(int)),this,SLOT(onClickCBJunctionIncommingChange(int)));
 
@@ -1201,7 +1211,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
 
     pCB = new QComboBox(pGroup);
     pCB->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
-    nXPos = nXPos + nSpace;
+ //   nXPos = nXPos + nSpace;
     pCB->addItem("start");
     pCB->addItem("end");
     mpCBJunctionContactPoint = pCB;
@@ -1216,7 +1226,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
 
     pCB = new QComboBox(pGroup);
     pCB->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
-    nXPos = nXPos + nSpace;
+ //   nXPos = nXPos + nSpace;
     mpCBJunctionToLane = pCB;
 
     nXPos = 10;
@@ -1231,7 +1241,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     pPB = new QPushButton(pGroup);
     pPB->setText("Delete Lane Link");
     pPB->setGeometry(nXPos,nYPos,nLEWidth*15/10,nLEHeight);
-    nXPos = nXPos + nSpace*15/10;
+ //   nXPos = nXPos + nSpace*15/10;
     connect(pPB,SIGNAL(clicked(bool)),this,SLOT(onClickDeleteJunctionLaneLink()));
 
     nXPos = 10;
@@ -1240,7 +1250,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     pPB = new QPushButton(pGroup);
     pPB->setText("Auto Connect Road");
     pPB->setGeometry(nXPos,nYPos,nLEWidth*15/10,nLEHeight);
-    nXPos = nXPos + nSpace*15/10;
+ //   nXPos = nXPos + nSpace*15/10;
     connect(pPB,SIGNAL(clicked(bool)),this,SLOT(onClickAutoConnect()));
 
     nXPos = 10;
@@ -1257,7 +1267,7 @@ void MainWindow::CreateTab1View(QTabWidget * p)
     pPB->setText("Load");
     pPB->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
     connect(pPB,SIGNAL(clicked(bool)),this,SLOT(onClickLoad()));
-    nXPos = nXPos + nSpace;
+ //   nXPos = nXPos + nSpace;
 
     QScrollArea * pScroll = new QScrollArea();
     pScroll->setWidget(pGroup);
@@ -1473,6 +1483,9 @@ void MainWindow::onClickSetStart()
 void MainWindow::UpdateMap(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
 {
 
+    (void)index;
+    (void)dt;
+    (void)strmemname;
     //    std::cout<<"update map "<<std::endl;
     int gpsunitsize = sizeof(iv::GPS_INS);
     int nMapSize = nSize/gpsunitsize;
@@ -1509,7 +1522,9 @@ void MainWindow::UpdateMap(const char * strdata,const unsigned int nSize,const u
 
 void MainWindow::UpdateGPSIMU(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
 {
-
+    (void)index;
+    (void)dt;
+    (void)strmemname;
     iv::gps::gpsimu  xgpsimu;
     if(!xgpsimu.ParseFromArray(strdata,nSize))
     {
@@ -1631,7 +1646,7 @@ void MainWindow::onClickLoadLane()
         double x0,y0;
         GaussProjCal(glon0,glat0,&x0,&y0);
         int j;
-        for(j=0;j<lpu.mvectorlpleft.size();j++)
+        for(j=0;j<static_cast<int>( lpu.mvectorlpleft.size());j++)
         {
             double x,y;
             GaussProjCal(lpu.mvectorlpleft[j].mfLon,lpu.mvectorlpleft[j].mfLat,&x,&y);
@@ -1699,7 +1714,10 @@ void MainWindow::onClickLoadLane()
  */
 Road MainWindow::CreateRoad(VectorXd xvals, VectorXd yvals)
 {
-
+    (void)xvals;
+    (void)yvals;
+    Road x;
+    return x;
 }
 
 void MainWindow::onClickMarkLane()
@@ -1712,10 +1730,10 @@ void MainWindow::onClickMarkLane()
 void MainWindow::onClickRemoveLane()
 {
     int i = mpCBLane->currentIndex();
-    if((i>=0) && (i<mvectorlp.size()))
+    if((i>=0) && (i<static_cast<int>( mvectorlp.size())))
     {
         int j;
-        for(j=0;j<mvectorroadlane.size();j++)
+        for(j=0;j< static_cast<int>(mvectorroadlane.size());j++)
         {
             if(mvectorroadlane[j] == i)
             {
@@ -1734,11 +1752,11 @@ void MainWindow::onClickRemoveLane()
 void MainWindow::onClickToRoad()
 {
     int i = mpCBLane->currentIndex();
-    if((i>=0) && (i<mvectorlp.size()))
+    if((i>=0) && (i< static_cast<int>(mvectorlp.size())))
     {
         int j;
         bool bHave = false;
-        for(j=0;j<mvectorroadlane.size();j++)
+        for(j=0;j< static_cast<int>(mvectorroadlane.size());j++)
         {
             if(mvectorroadlane[j] == i)
             {
@@ -1757,11 +1775,11 @@ void MainWindow::onClickToRoad()
 void MainWindow::onClickToOpposite()
 {
     int i = mpCBLane->currentIndex();
-    if((i>=0) && (i<mvectorlp.size()))
+    if((i>=0) && (i< static_cast<int>(mvectorlp.size())))
     {
         int j;
         bool bHave = false;
-        for(j=0;j<mvectorroadopposite.size();j++)
+        for(j=0;j<static_cast<int>(mvectorroadopposite.size());j++)
         {
             if(mvectorroadopposite[j] == i)
             {
@@ -1792,6 +1810,7 @@ void MainWindow::onClickAddRoad()
     std::string strroadname = mpLE_RoadName->text().toStdString();
     nrtn = ServiceXODRMake.AddRoadFromeLanePoint(mvectorlp,mvectorroadlane,mvectorroadopposite,glon0,
                                                  glat0,mxodr,strroadname,strrtn);
+    (void)nrtn;
     mpCBSelLane->clear();
     mpCBSelOpLane->clear();
     mvectorroadlane.clear();
@@ -1898,7 +1917,7 @@ void MainWindow::onClickAddRoad()
     GaussProjCal(glon0,glat0,&xor0,&yor0);
     std::vector<std::vector<iv::distogeo>> xvectordiss;
     std::vector<std::vector<iv::distogeo>> xvectoropdiss;
-    for(i=0;i<mvectorroadlane.size();i++)
+    for(i=0;i<static_cast<int>(mvectorroadlane.size());i++)
     {
         std::vector<iv::distogeo> xvectordistogeo;
         int j;
@@ -1925,7 +1944,7 @@ void MainWindow::onClickAddRoad()
             {
                 kstart= nLast;
             }
-            for(k=kstart;k<mvectorlp[mvectorroadlane[0]].mvectorlpleft.size();k++)
+            for(k=kstart;k<static_cast<int>( mvectorlp[mvectorroadlane[0]].mvectorlpleft.size());k++)
             {
 
                 x0 = mvectorlp[mvectorroadlane[0]].mvectorlpleft[k].mfX;
@@ -1988,7 +2007,7 @@ void MainWindow::onClickAddRoad()
         xvectordiss.push_back(xvectordistogeo);
     }
 
-    for(i=1;i<mvectorroadlane.size();i++)
+    for(i=1;i<static_cast<int>( mvectorroadlane.size());i++)
     {
         std::vector<iv::distogeo> xvectordistogeo;
         int j;
@@ -2013,7 +2032,7 @@ void MainWindow::onClickAddRoad()
             {
                 kstart= nLast;
             }
-            for(k=kstart;k<mvectorlp[mvectorroadlane[0]].mvectorlpleft.size();k++)
+            for(k=kstart;k<static_cast<int>( mvectorlp[mvectorroadlane[0]].mvectorlpleft.size());k++)
             {
                 x0 = mvectorlp[mvectorroadlane[0]].mvectorlpleft[k].mfX;
                 y0 = mvectorlp[mvectorroadlane[0]].mvectorlpleft[k].mfY;
@@ -2075,7 +2094,7 @@ void MainWindow::onClickAddRoad()
     }
 
 
-    for(i=0;i<mvectorroadopposite.size();i++)
+    for(i=0;i<static_cast<int>(mvectorroadopposite.size());i++)
     {
         std::vector<iv::distogeo> xvectordistogeo;
         int j;
@@ -2164,7 +2183,7 @@ void MainWindow::onClickAddRoad()
         xvectoropdiss.push_back(xvectordistogeo);
     }
 
-    for(i=0;i<mvectorroadopposite.size();i++)
+    for(i=0;i<static_cast<int>(mvectorroadopposite.size());i++)
     {
         std::vector<iv::distogeo> xvectordistogeo;
         int j;
@@ -2316,12 +2335,12 @@ void MainWindow::onClickAddRoad()
     //Get Lane Mark Width
     std::vector<double> xvectormarkwidth;
     std::vector<double> xvectoravgdis;
-    for(i=0;i<xvectordiss.size();i++)
+    for(i=0;i< static_cast<int>(xvectordiss.size());i++)
     {
         double fdis = 0;
         int j;
         int ncount = 0;
-        for(j=0;j<xvectordiss[i].size();j++)
+        for(j=0;j<static_cast<int>(xvectordiss[i].size());j++)
         {
             if(xvectordiss[i].at(j).mfs !=  -1)
             {
@@ -2333,7 +2352,7 @@ void MainWindow::onClickAddRoad()
         xvectoravgdis.push_back(fdis);
     }
 
-    for(i=1;i<mvectorroadlane.size();i++)
+    for(i=1;i<static_cast<int>(mvectorroadlane.size());i++)
     {
         xvectormarkwidth.push_back(xvectoravgdis[mvectorroadlane.size()+i-1] - xvectoravgdis[i-1]);
     }
@@ -2341,7 +2360,7 @@ void MainWindow::onClickAddRoad()
     std::vector<double> xvectoropmarkwidth;
     std::vector<double> xvectoropavgdis;
 
-    for(i=0;i<xvectoropdiss.size();i++)
+    for(i=0;i<static_cast<int>(xvectoropdiss.size());i++)
     {
         double fdis = 0;
         int j;
@@ -2360,7 +2379,7 @@ void MainWindow::onClickAddRoad()
     }
 
     if(xvectoropavgdis.size()>0)xvectoropmarkwidth.push_back(xvectoropavgdis[0]);
-    for(i=1;i<mvectorroadopposite.size();i++)
+    for(i=1;i<static_cast<int>(mvectorroadopposite.size());i++)
     {
         xvectoropmarkwidth.push_back(xvectoropavgdis[i] - xvectoropavgdis[i+mvectorroadopposite.size()-1]);
     }
@@ -2371,15 +2390,15 @@ void MainWindow::onClickAddRoad()
     std::vector<iv::distogeo> xlanewidth;
     xlanewidth.clear();
     int j;
-    for(j=0;j<xvectordiss[0].size();j++)
+    for(j=0;j<static_cast<int>(xvectordiss[0].size());j++)
     {
         if(xvectordiss[0].at(j).mfs !=  -1)xlanewidth.push_back(xvectordiss[0].at(j));
     }
     xvectorlanewidth.push_back(xlanewidth);
-    for(i=1;i<mvectorroadlane.size();i++)
+    for(i=1;i<static_cast<int>(mvectorroadlane.size());i++)
     {
         xlanewidth.clear();
-        for(j=0;j<xvectordiss[i].size();j++)
+        for(j=0;j<static_cast<int>(xvectordiss[i].size());j++)
         {
             if((xvectordiss[i].at(j).mfs!=-1)&&(xvectordiss[i-1+nlanesize].at(j).mfs!=-1))
             {
@@ -2474,7 +2493,7 @@ void MainWindow::onClickAddRoad()
         xvectorlanecoff.push_back(xlanecoff);
     }
 
-    for(i=0;i<xvectoroplanewidth.size();i++)
+    for(i=0;i< static_cast<int>(xvectoroplanewidth.size());i++)
     {
         int N = xvectoroplanewidth[i].size();
         VectorXd x_veh(N);
@@ -2539,7 +2558,7 @@ void MainWindow::onClickAddRoad()
 
     j= 0;
     double xroadlen = 0;
-    for(j=0;j<xvectorgeo.size();j++)
+    for(j=0;j<static_cast<int>(xvectorgeo.size());j++)
     {
         xroadlen = xroadlen + xvectorgeo[j].mfLen;
     }
@@ -2552,7 +2571,7 @@ void MainWindow::onClickAddRoad()
         double s = 0;
         j= 0;
 //        for(j=0;j<4;j++)
-        for(j=0;j<xvectorgeo.size();j++)
+        for(j=0;j<static_cast<int>( xvectorgeo.size());j++)
         {
 
             p->AddGeometryBlock();
@@ -2590,7 +2609,7 @@ void MainWindow::onClickAddRoad()
         pLS->SetS(0);
         pLS->AddLane(0,0,"none",false);
         pLL = pLS->GetLane(0);
-        if(noplanesize != xvectoroplanewidth.size())
+        if(noplanesize != static_cast<int>(xvectoroplanewidth.size()))
         {
             pLL->AddRoadMarkRecord(0,"solid","standard","standard",0.15,"false");
         }
@@ -2605,7 +2624,7 @@ void MainWindow::onClickAddRoad()
 
 
         int j;
-        for(j=0;j<xvevelanetype[i].size();j++)
+        for(j=0;j<static_cast<int>(xvevelanetype[i].size());j++)
         {
             std::string strlanetype = "broken";
             if(xvevelanetype[i].at(j).ntype != 0)
@@ -2617,11 +2636,11 @@ void MainWindow::onClickAddRoad()
 
     }
 
-    for(i=0;i<xvectoroplanewidth.size();i++)
+    for(i=0;i<static_cast<int>(xvectoroplanewidth.size());i++)
     {
         pLS->AddLane(1,(i+1)*(1),"driving",false,false);
         pLL = pLS->GetLane(pLS->GetLaneCount() - 1);
-        if((i==0)&&(noplanesize != xvectoroplanewidth.size()))
+        if((i==0)&&(noplanesize != static_cast<int>(xvectoroplanewidth.size())))
         {
             pLL->SetType("shoulder");
             pLL->AddRoadMarkRecord(0,"solid","standard","standard",0.15,"false");
@@ -2632,17 +2651,17 @@ void MainWindow::onClickAddRoad()
 
         int j;
         int index = i;
-        if((i==0)&&(noplanesize != xvectoroplanewidth.size()))
+        if((i==0)&&(noplanesize != static_cast<int>(xvectoroplanewidth.size())))
         {
             continue;
         }
-        if(noplanesize != xvectoroplanewidth.size())
+        if(noplanesize != static_cast<int>(xvectoroplanewidth.size()))
         {
             index = i-1;
         }
         else
             index = i;
-        for(j=0;j<xvectoroplanetype[index].size();j++)
+        for(j=0;j<static_cast<int>(xvectoroplanetype[index].size());j++)
         {
             std::string strlanetype = "broken";
             if(xvectoroplanetype[index].at(j).ntype != 0)
@@ -2694,7 +2713,7 @@ int MainWindow::CreateRoadID(int ntype)
         }
     }
     }while(bUsed);
-    delete proadid;
+    delete [] proadid;
     return nroadidstart;
 
 }
@@ -2724,7 +2743,7 @@ int MainWindow::CreateJunctionID()
         }
     }
     }while(bUsed);
-    delete pjunctionid;
+    delete []pjunctionid;
     return njunctionidstart;
 
 }
@@ -3027,6 +3046,7 @@ void MainWindow::onClickAutoRoadContact()
     int ntype1,ntype2;
     ntype1 = mpCBRC1->currentIndex();
     ntype2 = mpCBRC2->currentIndex();
+    (void)ntype1; (void)ntype2;
     Road * p1 = mxodr.GetRoad(ch1);
     Road * p2 = mxodr.GetRoad(ch2);
 
@@ -3104,7 +3124,7 @@ void MainWindow::onClickAutoRoadContact()
         else
             pLS = p1->GetLaneSection(p1->GetLaneSectionCount()-1);
         int i;
-        for(i=0;i<pLS->GetLaneCount();i++)
+        for(i=0;i<static_cast<int>(pLS->GetLaneCount());i++)
         {
             Lane * pL = pLS->GetLane(i);
 //            if((pL->GetId() != 0)&&(strncmp(pL->GetType().data(),"driving",255)==0))
@@ -3122,7 +3142,7 @@ void MainWindow::onClickAutoRoadContact()
         else
             pLS = p2->GetLaneSection(p2->GetLaneSectionCount()-1);
         int i;
-        for(i=0;i<pLS->GetLaneCount();i++)
+        for(i=0;i<static_cast<int>(pLS->GetLaneCount());i++)
         {
             Lane * pL = pLS->GetLane(i);
  //           if((pL->GetId() != 0)&&(strncmp(pL->GetType().data(),"driving",255)==0))
@@ -3210,7 +3230,7 @@ void MainWindow::onClickRoadContact()
         else
             pLS = p1->GetLaneSection(p1->GetLaneSectionCount()-1);
         int i;
-        for(i=0;i<pLS->GetLaneCount();i++)
+        for(i=0;i<static_cast<int>(pLS->GetLaneCount());i++)
         {
             Lane * pL = pLS->GetLane(i);
 //            if((pL->GetId() != 0)&&(strncmp(pL->GetType().data(),"driving",255)==0))
@@ -3228,7 +3248,7 @@ void MainWindow::onClickRoadContact()
         else
             pLS = p2->GetLaneSection(p2->GetLaneSectionCount()-1);
         int i;
-        for(i=0;i<pLS->GetLaneCount();i++)
+        for(i=0;i<static_cast<int>(pLS->GetLaneCount());i++)
         {
             Lane * pL = pLS->GetLane(i);
  //           if((pL->GetId() != 0)&&(strncmp(pL->GetType().data(),"driving",255)==0))
@@ -3301,7 +3321,7 @@ void MainWindow::onClickCreateRoad()
     int i;
     bool bhavep1 = false;
     bool bhavep2 = false;
-    for(i=0;i<mxodr.GetRoadCount();i++)
+    for(i=0;i<static_cast<int>(mxodr.GetRoadCount());i++)
     {
         if(mvectorrc[0].mnroad1id == atoi(mxodr.GetRoad(i)->GetRoadId().data()))
         {
@@ -3322,7 +3342,7 @@ void MainWindow::onClickCreateRoad()
 
 
 
-    for(i=0;i<mxodr.GetRoadCount();i++)
+    for(i=0;i<static_cast<int>(mxodr.GetRoadCount());i++)
     {
         if(mvectorrc[0].mnroad2id == atoi(mxodr.GetRoad(i)->GetRoadId().data()))
         {
@@ -3494,11 +3514,11 @@ void MainWindow::onClickCreateRoad()
 
     if(mpCBRoadType->currentIndex() == 2)
     {
-        for(i=0;i<xvectorgeo.size()/2;i++)
+        for(i=0;i<static_cast<int>(xvectorgeo.size())/2;i++)
         {
             xvectorgeo1.push_back(xvectorgeo.at(i));
         }
-        for(i=xvectorgeo.size()/2;i<xvectorgeo.size();i++)
+        for(i=static_cast<int>(xvectorgeo.size())/2;i<static_cast<int>(xvectorgeo.size());i++)
         {
             xvectorgeo2.push_back(xvectorgeo.at(i));
         }
@@ -3514,7 +3534,7 @@ void MainWindow::onClickCreateRoad()
 
     if(mpCBRoadType->currentIndex() != 2)
     {
-        for(i=0;i<xvectorgeo.size();i++)xroadlen = xroadlen + xvectorgeo[i].mfLen;
+        for(i=0;i<static_cast<int>(xvectorgeo.size());i++)xroadlen = xroadlen + xvectorgeo[i].mfLen;
 
         mxodr.AddRoad("",xroadlen, QString::number(CreateRoadID()).toStdString(),"-1");
         Road * p = mxodr.GetRoad(mxodr.GetRoadCount() - 1);
@@ -3525,9 +3545,8 @@ void MainWindow::onClickCreateRoad()
         p2 = mxodr.GetRoad(nroad2index);
 
         double s = 0;
-        int j;
-        j= 0;
-        for(j=0;j<xvectorgeo.size();j++)
+        int j =  0;
+        for(j=0;j<static_cast<int>(xvectorgeo.size());j++)
         {
             p->AddGeometryBlock();
             GeometryBlock * pgb = p->GetGeometryBlock(j);
@@ -3653,8 +3672,8 @@ void MainWindow::onClickCreateRoad()
     {
         double xroadlen1 = 0;
         double xroadlen2 = 0;
-        for(i=0;i<xvectorgeo1.size();i++)xroadlen1 = xroadlen1 + xvectorgeo1[i].mfLen;
-        for(i=0;i<xvectorgeo2.size();i++)xroadlen2 = xroadlen2 + xvectorgeo2[i].mfLen;
+        for(i=0;i<static_cast<int>(xvectorgeo1.size());i++)xroadlen1 = xroadlen1 + xvectorgeo1[i].mfLen;
+        for(i=0;i<static_cast<int>(xvectorgeo2.size());i++)xroadlen2 = xroadlen2 + xvectorgeo2[i].mfLen;
 
         int index1 = mxodr.AddRoad("",xroadlen1, QString::number(CreateRoadID()).toStdString(),"-1");
         int index2 = mxodr.AddRoad("",xroadlen2, QString::number(CreateRoadID()).toStdString(),"-1");
@@ -3671,9 +3690,8 @@ void MainWindow::onClickCreateRoad()
 
 //        OpenDrive * px = &mxodr;
         double s = 0;
-        int j;
-        j= 0;
-        for(j=0;j<xvectorgeo1.size();j++)
+        int j = 0;
+        for(j=0;j<static_cast<int>(xvectorgeo1.size());j++)
         {
             proad1->AddGeometryBlock();
             GeometryBlock * pgb = proad1->GetGeometryBlock(j);
@@ -3704,7 +3722,7 @@ void MainWindow::onClickCreateRoad()
         }
 
         s=0.0;
-        for(j=0;j<xvectorgeo2.size();j++)
+        for(j=0;j<static_cast<int>(xvectorgeo2.size());j++)
         {
             proad2->AddGeometryBlock();
             GeometryBlock * pgb = proad2->GetGeometryBlock(j);
@@ -3864,6 +3882,7 @@ int MainWindow::GetEndPoint(Road *proad, double &x, double &y, double &hdg)
     GeometryBlock * pblock = proad->GetLastGeometryBlock();
 
     RoadGeometry * pgeo = pblock->GetLastGeometry();
+    (void)pgeo;
 
     proad->GetGeometryCoords(proad->GetRoadLength(),x,y,hdg);
     return 0;
@@ -3992,6 +4011,8 @@ void MainWindow::onChangeRoadType(int index)
 
 std::vector<geobase> MainWindow::CreateLineGeo(double startx, double starty, double starthdg, double endx, double endy, double endhdg)
 {
+    (void)starthdg;
+    (void)endhdg;
 
 //    std::vector<geobase> xvectorgeo;
 //    geobase xgeobezier;
@@ -4048,6 +4069,7 @@ std::vector<geobase> MainWindow::CreateTurnGeo(double startx, double starty, dou
         c2 = 0-a2*endx - endy;
         a1 = 1;
         c1 = startx *(-1);
+        (void)a1; (void)c1;
         inter_x = startx;
         inter_y = 0 - a2*inter_x-c2;
     }
@@ -4059,6 +4081,7 @@ std::vector<geobase> MainWindow::CreateTurnGeo(double startx, double starty, dou
             c1 = 0-a1*startx - starty;
             a2 = 1;
             c2 = endx *(-1);
+            (void)a2; (void)c2;
             inter_x = endx;
             inter_y = 0 - a1*inter_x-c1;
         }
@@ -4200,10 +4223,12 @@ double MainWindow::getlanewidth(Road * p, int nlane,bool  bstart)
     if(bstart)
     {
         s = 0;
+        (void)s;
     }
     else
     {
         s = p->GetRoadLength();
+        (void)s;
     }
     int i;
     LaneSection * pLS;
@@ -4254,7 +4279,7 @@ double MainWindow::getoff(Road *p, int nlane, bool bstart)
             if(nlane == -1)return 0;
             else
             {
-                for(i=0;i<pLS->GetLaneCount();i++)
+                for(i=0;i<static_cast<int>(pLS->GetLaneCount());i++)
                 {
                     Lane * pL = pLS->GetLane(i);
                     if((pL->GetId()<0)&&(pL->GetId()>nlane))
@@ -4269,7 +4294,7 @@ double MainWindow::getoff(Road *p, int nlane, bool bstart)
             if(nlane == 1)return 0;
             else
             {
-                for(i=0;i<pLS->GetLaneCount();i++)
+                for(i=0;i<static_cast<int>(pLS->GetLaneCount());i++)
                 {
                     Lane * pL = pLS->GetLane(i);
                     if((pL->GetId()>0)&&(pL->GetId()<nlane))
@@ -4289,7 +4314,7 @@ double MainWindow::getoff(Road *p, int nlane, bool bstart)
             if(nlane == -1)return 0;
             else
             {
-                for(i=0;i<pLS->GetLaneCount();i++)
+                for(i=0;i<static_cast<int>(pLS->GetLaneCount());i++)
                 {
                     Lane * pL = pLS->GetLane(i);
                     if((pL->GetId()<0)&&(pL->GetId()>nlane))
@@ -4310,7 +4335,7 @@ double MainWindow::getoff(Road *p, int nlane, bool bstart)
             if(nlane == 1)return 0;
             else
             {
-                for(i=0;i<pLS->GetLaneCount();i++)
+                for(i=0;i<static_cast<int>(pLS->GetLaneCount());i++)
                 {
                     Lane * pL = pLS->GetLane(i);
                     if((pL->GetId()>0)&&(pL->GetId()<nlane))
@@ -4397,7 +4422,9 @@ std::vector<geobase> MainWindow::CreateUTurnGeo(double startx, double starty, do
     }
 
     double p3_x,p3_y,p3_hdg;
+    (void)p3_hdg;
     p3_hdg = hdgse;
+    (void)p3_hdg;
     p3_x = x_center + R* cos(xhdgcentertoarc);
     p3_y = y_center + R* sin(xhdgcentertoarc);
 
@@ -4493,7 +4520,7 @@ void MainWindow::ChangeXODRRoadID(OpenDrive *pxodr, int index, int newid)
     {
         Junction * pjunction = pxodr->GetJunction(i);
         int j;
-        for(j=0;j<pjunction->GetJunctionConnectionCount();j++)
+        for(j=0;j<static_cast<int>(pjunction->GetJunctionConnectionCount());j++)
         {
             JunctionConnection * pjc = pjunction->GetJunctionConnection(j);
             if(atoi(pjc->GetIncomingRoad().data()) == noldid)
@@ -4757,7 +4784,7 @@ void MainWindow::onClickRoadDel()
     {
         pjunction = mxodr.GetJunction(i);
         int j;
-        for(j=0;j<pjunction->GetJunctionConnectionCount();j++)
+        for(j=0;j<static_cast<int>(pjunction->GetJunctionConnectionCount());j++)
         {
             JunctionConnection * pjc = pjunction->GetJunctionConnection(j);
             int nfromid = atoi(pjc->GetIncomingRoad().data());
@@ -4792,7 +4819,8 @@ void MainWindow::updateCBRoad()
     int nroadcount = mxodr.GetRoadCount();
     for(i=0;i<nroadcount;i++)
     {
-        const char * strname = mxodr.GetRoad(i)->GetRoadId().data();
+        const char * strname1 = mxodr.GetRoad(i)->GetRoadId().data();
+        QString strname(strname1);
         mpCBRoad->addItem(strname);
         mpCBRoad1->addItem(strname);
         mpCBRoad2->addItem(strname);
@@ -4843,7 +4871,7 @@ void MainWindow::onClickCBRoadChange(int index)
    int nlanecount = pLS->GetLaneCount();
    for(i=0;i<nlanecount;i++)
    {
-       char strout[255];
+       char strout[256];
        char strtem[255];
 
        Lane * pLane = pLS->GetLane(i);
@@ -4859,7 +4887,7 @@ void MainWindow::onClickCBRoadChange(int index)
    nlanecount = pLS->GetLaneCount();
    for(i=0;i<nlanecount;i++)
    {
-       char strout[255];
+       char strout[256];
        char strtem[255];
 
        Lane * pLane = pLS->GetLane(i);
@@ -4935,7 +4963,7 @@ void MainWindow::onClickCBJunctionConnectionChange(int index)
         return;
     }
 
-    if((index<0)||(index>= pjunction->GetJunctionConnectionCount()))
+    if((index<0)||(index>= static_cast<int>(pjunction->GetJunctionConnectionCount())))
     {
 //        std::cout<<"MainWindow::onClickCBJunctionConnectionChange out range."<<std::endl;
         return;
@@ -5414,7 +5442,7 @@ void MainWindow::on_actionSet_Speed_triggered()
 #endif
     std::string strroadid = mpCBRoad->currentText().toStdString();
     SpeedDialog sd(&mxodr,strroadid,this);
-    int res = sd.exec();
+    int res = sd.exec();(void)res;
 }
 
 void MainWindow::closeEvent(QCloseEvent *event)
@@ -5451,6 +5479,7 @@ void MainWindow::on_actionSet_Traffic_Light_triggered()
     std::string strroadid = mpCBRoad->currentText().toStdString();
     TrafficLightDialog td(&mxodr,strroadid,this);
     int res = td.exec();
+    (void)res;
 }
 
 void MainWindow::on_actionEdit_Road_Lane_triggered()
@@ -5464,6 +5493,7 @@ void MainWindow::on_actionEdit_Road_triggered()
     std::string strroadid = mpCBRoad->currentText().toStdString();
     RoadEditDialog rd(&mxodr,strroadid,this);
     int res = rd.exec();
+    (void)res;
 
 
     updateCBRoad();
@@ -5758,6 +5788,7 @@ void MainWindow::on_actionEdit_Road_Borrow_triggered()
     std::string strroadid = mpCBRoad->currentText().toStdString();
     DialogRoadBorrow rbd(&mxodr,strroadid,this);
     int res = rbd.exec();
+    (void)res;
 
     mpfb->SetOpenDrive(mxodr);
 }
@@ -6215,3 +6246,26 @@ void MainWindow::on_actionOptimize_Road_triggered()
 
 }
 
+
+void MainWindow::on_actionAdd_ParkSpace_triggered()
+{
+    int nroadcount = mxodr.GetRoadCount();
+    if(nroadcount == 0)return;
+    Road * pRoad = mxodr.GetRoad(mpCBRoad->currentIndex());
+    if(pRoad == 0)return;
+    double fLon = mpLE_SelLon->text().toDouble();
+    double fLat = mpLE_SelLat->text().toDouble();
+
+    SaveBack();
+
+    DialogParkingFromPoint dlgparkpoint(pRoad,fLon,fLat,this);
+    dlgparkpoint.exec();
+
+    mbRefresh = true;
+    update();
+    if(mpCBViewMode->currentIndex() == 1)
+    {
+        UpdateScene();
+    }
+}
+

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

@@ -255,6 +255,8 @@ private slots:
 
     void on_actionOptimize_Road_triggered();
 
+    void on_actionAdd_ParkSpace_triggered();
+
 private:
 
 

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

@@ -66,6 +66,7 @@
     <addaction name="actionDraw_Road_From_CDA"/>
     <addaction name="actionAdd_Roads_From_Labels"/>
     <addaction name="actionExport_Current_Road"/>
+    <addaction name="actionAdd_ParkSpace"/>
    </widget>
    <widget class="QMenu" name="menuView">
     <property name="title">
@@ -242,6 +243,11 @@
     <string>Optimize Road</string>
    </property>
   </action>
+  <action name="actionAdd_ParkSpace">
+   <property name="text">
+    <string>Add ParkSpace</string>
+   </property>
+  </action>
  </widget>
  <layoutdefault spacing="6" margin="11"/>
  <resources>

+ 73 - 7
src/tool/map_lanetoxodr/ui/dialogparkingfrompoint.cpp

@@ -1,9 +1,16 @@
 #include "dialogparkingfrompoint.h"
 #include "ui_dialogparkingfrompoint.h"
 
+#include "xodrfunc.h"
+
 #include "gnss_coordinate_convert.h"
 
-DialogParkingFromPoint::DialogParkingFromPoint(Road * pRoad,QWidget *parent)
+#include <iostream>
+
+extern double glon0;
+extern double glat0;
+
+DialogParkingFromPoint::DialogParkingFromPoint(Road * pRoad,double flon ,double flat ,QWidget *parent)
     : QDialog(parent)
     , ui(new Ui::DialogParkingFromPoint)
 {
@@ -12,13 +19,16 @@ DialogParkingFromPoint::DialogParkingFromPoint(Road * pRoad,QWidget *parent)
 
     mpRoad = pRoad;
 
-    ui->lineEdit_Lon->setText("117.0");
-    ui->lineEdit_Lat->setText("39.0");
+    ui->lineEdit_Lon->setText(QString::number(flon,'f',7));
+    ui->lineEdit_Lat->setText(QString::number(flat,'f',7));
     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");
+
+    mLon0 = glon0;
+    mLat0 = glat0;
 }
 
 DialogParkingFromPoint::~DialogParkingFromPoint()
@@ -38,16 +48,72 @@ void DialogParkingFromPoint::on_pushButton_addparkingspace_clicked()
     double fdistofront = ui->lineEdit_DisOfPointAndFront->text().toDouble();
     double fdistoleft = ui->lineEdit_DistanceOfPointAndLeft->text().toDouble();
 
-    double fx,fy;
-    GaussProjCal(fLon,fLat,&fx,&fy);
+    double fx1,fy1;
+    GaussProjCal(fLon,fLat,&fx1,&fy1);
     fhdg = (90 - fhdg)*M_PI/180.0;
+    double fx0,fy0;
+    GaussProjCal(mLon0,mLat0,&fx0,&fy0);
+    fx1 = fx1 - fx0;
+    fy1 = fy1 - fy0;
 
     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);
+    fCenter_x = fx1 + fmovex * cos(fhdg) + fmovey * cos(fhdg + M_PI/2.0);
+    fCenter_y = fy1 + fmovex * sin(fhdg) + fmovey * sin(fhdg + M_PI/2.0);
+
+    double fnears = 0;
+    double froadx,froady,froadhdg;
+    pRoad->GetGeometryCoords(0,froadx,froady,froadhdg);
+    double fx,fy,fh,fs;
+    fx = froadx;
+    fy = froady;
+    fh = froadhdg;
+    fs = 0;
+    double fneart = sqrt(pow(froadx - fCenter_x,2) + pow(froady - fCenter_y,2));
+    double s = 0;
+    double sstep = 0.1;
+    s = s+ sstep;
+    while(s<pRoad->GetRoadLength())
+    {
+        if(pRoad->GetGeometryCoords(s,froadx,froady,froadhdg) >= 0)
+        {
+            double fdis = sqrt(pow(froadx - fCenter_x,2) + pow(froady - fCenter_y,2));
+            if(fdis<fneart)
+            {
+                fneart = fdis;
+                fx = froadx;
+                fy = froady;
+                fh = froadhdg;
+                fs = s;
+            }
+        }
+        else
+        {
+            std::cout<<"DialogParkingFromPoint::on_pushButton_addparkingspace_clicked"<<" GetGeometryCoords error. s "
+                      <<s<<" Road id:"<<pRoad->GetRoadId()<<" len:"<<pRoad->GetRoadLength()<<std::endl;
+        }
+        s= s+sstep;
+    }
+
+    if(fneart > 0)
+    {
+        double fhdg2 = xodrfunc::CalcHdg(QPointF(fx,fy),QPointF(fCenter_x,fCenter_y));
+        double fhdgdiff = fhdg2 - fh;
+        while(fhdgdiff<0)fhdgdiff = fhdgdiff + 2.0*M_PI;
+        while(fhdgdiff >= 2.0*M_PI)fhdgdiff = fhdgdiff - 2.0*M_PI;
+        if(fhdgdiff > M_PI)fneart = fneart * (-1);
+
+    }
+    pRoad->AddObject("0",fs,fneart,0);
+    Object * pObj = pRoad->GetLastAddedObject();
+    pObj->Settype("parkingSpace");
+    pObj->Sethdg(fhdg);
+    pObj->Setlength(flen);
+    pObj->Setwidth(fwidth);
+
+    this->close();
 
 }
 

+ 5 - 1
src/tool/map_lanetoxodr/ui/dialogparkingfrompoint.h

@@ -14,7 +14,7 @@ class DialogParkingFromPoint : public QDialog
     Q_OBJECT
 
 public:
-    explicit DialogParkingFromPoint(Road * pRoad,QWidget *parent = nullptr);
+    explicit DialogParkingFromPoint(Road * pRoad,double flon = 117.0,double flat = 39.0,QWidget *parent = nullptr);
     ~DialogParkingFromPoint();
 
 private slots:
@@ -24,6 +24,10 @@ private:
     Ui::DialogParkingFromPoint *ui;
 
     Road * mpRoad = NULL;
+
+    double mLon0;
+    double mLat0;
+
 };
 
 #endif // DIALOGPARKINGFROMPOINT_H

+ 3 - 2
src/tool/map_lanetoxodr/ui/roadeditdialog.cpp

@@ -53,7 +53,8 @@ RoadEditDialog::RoadEditDialog(OpenDrive * pxodr,std::string strdefroad,QWidget
     for(i=0;i<nroadcount;i++)
     {
         const char * strname = mpxodr->GetRoad(i)->GetRoadId().data();
-        ui->comboBox_Road->addItem(strname);
+        QString str1 = QString(strname);
+        ui->comboBox_Road->addItem(str1);
 
     }
 
@@ -715,7 +716,7 @@ void RoadEditDialog::on_pushButton_ParkingSpaceFromPoint_clicked()
         return;
     }
 
-    DialogParkingFromPoint dlgparkpoint(mpCurRoad,this);
+    DialogParkingFromPoint dlgparkpoint(mpCurRoad,117.0,39.0,this);
     dlgparkpoint.exec();
 }