roadeditdialog.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. #include "roadeditdialog.h"
  2. #include "ui_roadeditdialog.h"
  3. #include "mainwindow.h"
  4. #include "math.h"
  5. #define VIEW_WIDTH 850
  6. #define VIEW_HEIGHT 450
  7. RoadEditDialog::RoadEditDialog(OpenDrive * pxodr,std::string strdefroad,QWidget *parent) :
  8. QDialog(parent),
  9. ui(new Ui::RoadEditDialog)
  10. {
  11. mpxodr = pxodr;
  12. ui->setupUi(this);
  13. myview = new MyView(this);
  14. myview->setObjectName(QStringLiteral("graphicsView"));
  15. myview->setGeometry(QRect(30, 350, 900, 500));
  16. // connect(myview,SIGNAL(dbclickxy(double,double)),this,SLOT(onClickXY(double,double)));
  17. image = new QImage(VIEW_WIDTH, VIEW_HEIGHT, QImage::Format_RGB32);//画布的初始化大小设为300*300,使用32位颜色
  18. myview->setCacheMode(myview->CacheBackground);
  19. painter = new QPainter(image);
  20. painter->end();
  21. // scene = new QGraphicsScene;
  22. scene = new QGraphicsScene(-VIEW_WIDTH/2, -VIEW_HEIGHT/2, VIEW_WIDTH, VIEW_HEIGHT);
  23. myview->setScene(scene);
  24. scene->setBackgroundBrush(Qt::darkGreen);
  25. ui->comboBox_geotype->addItem("Line");
  26. ui->comboBox_geotype->addItem("Spiral");
  27. ui->comboBox_geotype->addItem("Arc");
  28. ui->comboBox_geotype->addItem("Poly");
  29. ui->comboBox_geotype->addItem("Param Poly");
  30. ui->lineEdit_hdg->setDisabled(true);
  31. ui->lineEdit_len->setDisabled(true);
  32. ui->lineEdit_roadlen->setDisabled(true);
  33. ui->lineEdit_s->setDisabled(true);
  34. ui->lineEdit_x->setDisabled(true);
  35. ui->lineEdit_y->setDisabled(true);
  36. int i;
  37. int nroadcount = mpxodr->GetRoadCount();
  38. for(i=0;i<nroadcount;i++)
  39. {
  40. const char * strname = mpxodr->GetRoad(i)->GetRoadId().data();
  41. QString str1 = QString(strname);
  42. ui->comboBox_Road->addItem(str1);
  43. }
  44. MainWindow::ComboToString(strdefroad,ui->comboBox_Road);
  45. setWindowTitle(tr("Edit Road"));
  46. }
  47. RoadEditDialog::~RoadEditDialog()
  48. {
  49. delete ui;
  50. }
  51. void RoadEditDialog::ExecPainter()
  52. {
  53. painter->begin(image);
  54. int nkeep = 30;
  55. Road * pRoad = mpCurRoad;
  56. // qDebug("time is %d",x.elapsed());
  57. image->fill(QColor(255, 255, 255));//对画布进行填充
  58. // std::vector<iv::GPSData> navigation_data = brain->navigation_data;
  59. painter->setRenderHint(QPainter::Antialiasing, true);//设置反锯齿模式,好看一点
  60. // painter->translate(mnMoveX,mnMoveY);
  61. // painter->translate(VIEW_WIDTH/2,VIEW_HEIGHT/2);
  62. double froad_xmin,froad_ymin,froad_xmax,froad_ymax;
  63. int nfac = 1;
  64. ServiceXODRTool.GetRoadMaxMin(pRoad,froad_xmin,froad_ymin,froad_xmax,froad_ymax);
  65. double fac_x,fac_y;
  66. fac_x = 100000;
  67. fac_y = 100000;
  68. if(froad_xmax > froad_xmin)
  69. {
  70. fac_x = (VIEW_WIDTH-nkeep*2)/(froad_xmax - froad_xmin);
  71. }
  72. if(froad_ymax > froad_ymin)
  73. {
  74. fac_y = (VIEW_HEIGHT - nkeep*2)/(froad_ymax - froad_ymin);
  75. }
  76. nfac = fac_x;
  77. if(fac_y < nfac)nfac = fac_y;
  78. painter->translate(nkeep,VIEW_HEIGHT-nkeep);
  79. painter->setPen(Qt::black);
  80. // painter->drawLine(VIEW_WIDTH/(-2),0,VIEW_WIDTH/2,0);
  81. // painter->drawLine(0,VIEW_HEIGHT/(-2),0,VIEW_HEIGHT/2);
  82. int i;
  83. // int nfac = 5;;
  84. painter->setPen(Qt::blue);
  85. // if(mbClick)
  86. // {
  87. // painter->setPen(Qt::red);
  88. // painter->drawEllipse(QPoint(mClickX ,mClickY),mnMarkSize,mnMarkSize);
  89. // painter->setPen(Qt::black);
  90. // }
  91. // if(mbSetObj)
  92. // {
  93. // painter->setPen(Qt::green);
  94. // painter->drawRect(mfObjX*nfac-mnMarkSize,mfObjY*nfac*(-1)-mnMarkSize,mnMarkSize*2,mnMarkSize*2);
  95. // painter->setPen(Qt::black);
  96. // }
  97. painter->setPen(Qt::green);
  98. double x0,y0;
  99. // GaussProjCal(glon0,glat0,&x0,&y0);
  100. painter->setPen(Qt::blue);
  101. // int nfac = nfac;
  102. // int selid = mpCBRoad->currentText().toInt();
  103. // continue;
  104. int j;
  105. painter->setPen(Qt::blue);
  106. for(j=0;j<pRoad->GetGeometryBlockCount();j++)
  107. {
  108. GeometryBlock * pgeob = pRoad->GetGeometryBlock(j);
  109. double x,y;
  110. double x_center,y_center;
  111. double R;
  112. RoadGeometry * pg;
  113. GeometryArc * parc;
  114. GeometryParamPoly3 * ppp3;
  115. GeometrySpiral *pSpiral;
  116. double rel_x,rel_y,rel_hdg;
  117. pg = pgeob->GetGeometryAt(0);
  118. x = pg->GetX();
  119. y = pg->GetY();
  120. painter->setPen(Qt::blue);
  121. if(j == mnSelGeo)
  122. {
  123. painter->setPen(Qt::green);
  124. }
  125. // if(j== 0)
  126. // {
  127. // if(selid == atoi(pRoad->GetRoadId().data()))
  128. // {
  129. // painter->setPen(Qt::green);
  130. // painter->drawEllipse(x*nfac-5,y*nfac*(-1)-5,10,10);
  131. // painter->setPen(Qt::red);
  132. // }
  133. // }
  134. switch (pg->GetGeomType()) {
  135. case 0:
  136. painter->drawLine(QPoint((x-froad_xmin)*nfac,(y-froad_ymin)*nfac*(-1)),
  137. QPoint(((x-froad_xmin) + pg->GetLength() * cos(pg->GetHdg()))*nfac,((y-froad_ymin) + pg->GetLength() * sin(pg->GetHdg()))*nfac*(-1)));
  138. break;
  139. case 1:
  140. pSpiral = (GeometrySpiral * )pg;
  141. {
  142. int ncount = pSpiral->GetLength() * nfac;
  143. double sstep = pSpiral->GetLength()/((double)ncount);
  144. int k;
  145. double x0,y0,hdg0,s0;
  146. x0 = pSpiral->GetX();
  147. y0 = pSpiral->GetY();
  148. s0 = pSpiral->GetS();
  149. hdg0 = pSpiral->GetHdg() ;
  150. painter->setPen(Qt::red);
  151. for(k=0;k<ncount;k++)
  152. {
  153. pSpiral->GetCoords(s0+sstep*k,rel_x,rel_y,rel_hdg);
  154. x = rel_x - froad_xmin;
  155. y = rel_y - froad_ymin;
  156. painter->drawPoint((int)(x*nfac),(int)(y*(-1.0*nfac)));
  157. }
  158. painter->setPen(Qt::blue);
  159. }
  160. // qDebug("spi");
  161. break;
  162. case 2:
  163. {
  164. parc = (GeometryArc *)pg;
  165. R = abs(1.0/parc->GetCurvature());
  166. if(parc->GetCurvature() > 0)
  167. {
  168. x_center = pg->GetX() + R *cos(pg->GetHdg() + M_PI/2.0);
  169. y_center = pg->GetY() + R * sin(pg->GetHdg() + M_PI/2.0);
  170. }
  171. else
  172. {
  173. x_center = pg->GetX() + R *cos(pg->GetHdg() -M_PI/2.0);
  174. y_center = pg->GetY() + R * sin(pg->GetHdg() - M_PI/2.0);
  175. }
  176. int k;
  177. int ncount = parc->GetLength() * nfac ;
  178. double curv = parc->GetCurvature();
  179. double hdgstep;
  180. double hdg0 = parc->GetHdg();
  181. double hdgnow = parc->GetHdg();
  182. if(ncount > 0) hdgstep= (parc->GetLength()/R)/ncount;
  183. for(k=0;k<ncount;k++)
  184. {
  185. double x_draw,y_draw;
  186. if(curv > 0)
  187. {
  188. hdgnow = hdg0 + k*hdgstep;
  189. x_draw = x_center + R *cos(hdgnow - M_PI/2.0);
  190. y_draw = y_center + R * sin(hdgnow - M_PI/2.0);
  191. }
  192. else
  193. {
  194. hdgnow = hdg0 - k * hdgstep;
  195. x_draw = x_center + R *cos(hdgnow + M_PI/2.0);
  196. y_draw = y_center + R * sin(hdgnow + M_PI/2.0);
  197. }
  198. x_draw = x_draw - froad_xmin;
  199. y_draw = y_draw - froad_ymin;
  200. painter->drawPoint(x_draw * nfac ,y_draw * nfac *(-1));
  201. }
  202. }
  203. break;
  204. case 4:
  205. {
  206. ppp3 = (GeometryParamPoly3 * )pg;
  207. int ncount = ppp3->GetLength()* nfac;
  208. double sstep;
  209. if(ncount > 0)sstep = ppp3->GetLength()/ncount;
  210. else sstep = 10000.0;
  211. double s = 0;
  212. while(s < ppp3->GetLength())
  213. {
  214. double xtem,ytem;
  215. xtem = ppp3->GetuA() + ppp3->GetuB() * s + ppp3->GetuC() * s*s + ppp3->GetuD() * s*s*s;
  216. ytem = ppp3->GetvA() + ppp3->GetvB() * s + ppp3->GetvC() * s*s + ppp3->GetvD() * s*s*s;
  217. x = xtem*cos(ppp3->GetHdg()) - ytem * sin(ppp3->GetHdg()) + ppp3->GetX();
  218. y = xtem*sin(ppp3->GetHdg()) + ytem * cos(ppp3->GetHdg()) + ppp3->GetY();
  219. x = x - froad_xmin;
  220. y = y- froad_ymin;
  221. painter->drawPoint((int)(x*nfac),(int)(y*(-1.0*nfac)));
  222. s = s+ sstep;
  223. }
  224. }
  225. break;
  226. default:
  227. break;
  228. }
  229. // painter->drawPoint((int)(x*nfac),(int)(y*(-1.0*nfac)));
  230. }
  231. painter->setPen(Qt::green);
  232. painter->end();
  233. }
  234. void RoadEditDialog::paintEvent(QPaintEvent * painter)
  235. {
  236. scene->update();
  237. return;
  238. if(mpCurRoad != 0)
  239. {
  240. ExecPainter();
  241. scene->clear();
  242. scene->addPixmap(QPixmap::fromImage(*image));
  243. myview->setScene(scene);
  244. myview->show();
  245. }
  246. }
  247. void RoadEditDialog::on_comboBox_Road_activated(const QString &arg1)
  248. {
  249. }
  250. bool RoadEditDialog::IsDrawMark(double s)
  251. {
  252. const double dotdis = 10.0;
  253. const double dotlen = 5.0;
  254. double y = fmod(s,dotdis);
  255. if(y>dotlen)return true;
  256. else
  257. {
  258. return false;
  259. }
  260. }
  261. void RoadEditDialog::on_comboBox_Road_currentIndexChanged(int index)
  262. {
  263. Road * pRoad = mpxodr->GetRoad(index);
  264. if(pRoad == 0)
  265. {
  266. // QMessageBox::warning(this,"WARN","MainWindow::onClickCBRoadChange road is NULL");
  267. return;
  268. }
  269. mpCurRoad = pRoad;
  270. int i;
  271. int nsize = mvectorroadview.size();
  272. for(i=0;i<nsize;i++)
  273. {
  274. scene->removeItem(mvectorroadview.at(i));
  275. delete mvectorroadview.at(i);
  276. }
  277. mvectorroadview.clear();
  278. nsize = mvectorviewitem.size();
  279. for(i=0;i<nsize;i++)
  280. {
  281. scene->removeItem(mvectorviewitem.at(i));
  282. delete mvectorviewitem.at(i);
  283. }
  284. mvectorviewitem.clear();
  285. double froad_xmin,froad_ymin,froad_xmax,froad_ymax;
  286. ServiceXODRTool.GetRoadMaxMin(pRoad,froad_xmin,froad_ymin,froad_xmax,froad_ymax);
  287. // roadviewitem * prvw = new roadviewitem(pRoad);
  288. int nfac;
  289. int nkeep = 30;
  290. double fac_x,fac_y;
  291. fac_x = 100000;
  292. fac_y = 100000;
  293. if(froad_xmax > froad_xmin)
  294. {
  295. fac_x = (VIEW_WIDTH-nkeep*2)/(froad_xmax - froad_xmin);
  296. }
  297. if(froad_ymax > froad_ymin)
  298. {
  299. fac_y = (VIEW_HEIGHT - nkeep*2)/(froad_ymax - froad_ymin);
  300. }
  301. nfac = fac_x;
  302. if(fac_y < nfac)nfac = fac_y;
  303. mfViewMoveX = VIEW_WIDTH/2.0 ;
  304. mfViewMoveY = VIEW_HEIGHT/2.0;
  305. mfViewMoveX = 0 - froad_xmin - (froad_xmax - froad_xmin)/2.0;
  306. mfViewMoveY = 0 + froad_ymin + (froad_ymax-froad_ymin)/2.0;
  307. // prvw->setPos(mfViewMoveX,mfViewMoveY);
  308. // prvw->setPos((froad_xmax - froad_xmin)/2.0, (froad_ymax-froad_ymin)/2.0);
  309. // mvectorroadview.push_back(prvw);
  310. // prvw->setratio(1.0);
  311. // scene->addItem(prvw);
  312. mnSelGeo = -1;
  313. ui->lineEdit_roadlen->setText(QString::number(pRoad->GetRoadLength()));
  314. ui->comboBox_Geo->clear();
  315. nsize = pRoad->GetGeometryBlockCount();
  316. // int i;
  317. for(i=0;i<nsize;i++)
  318. {
  319. ui->comboBox_Geo->addItem(QString("Geo ")+QString::number(i));
  320. }
  321. RoadDigit xrd(mpCurRoad,5.0);
  322. std::vector<QGraphicsPathItem *> xvectorlanepath = xodrscenfunc::GetRoadLaneItem(&xrd);
  323. int j;
  324. int ncount = xvectorlanepath.size();
  325. for(j=0;j<ncount;j++)
  326. {
  327. QGraphicsPathItem * pitem = xvectorlanepath[j];
  328. pitem->setPos(mfViewMoveX,mfViewMoveY);
  329. scene->addItem(pitem);
  330. mvectorviewitem.push_back(pitem);
  331. }
  332. std::vector<QGraphicsPathItem *> xvectormarkpath = xodrscenfunc::GetRoadMarkItem(&xrd);
  333. ncount = xvectormarkpath.size();
  334. for(j=0;j<ncount;j++)
  335. {
  336. QGraphicsPathItem * pitem = xvectormarkpath[j];
  337. pitem->setPos(mfViewMoveX,mfViewMoveY);
  338. scene->addItem(pitem);
  339. mvectorviewitem.push_back(pitem);
  340. }
  341. update();
  342. }
  343. void RoadEditDialog::on_comboBox_Geo_currentIndexChanged(int index)
  344. {
  345. if(mpCurRoad == 0 )return;
  346. if(index<0)return;
  347. mnSelGeo = index;
  348. if(index>= mpCurRoad->GetGeometryBlockCount())return;
  349. GeometryBlock * pgb = mpCurRoad->GetGeometryBlock(index);
  350. RoadGeometry * pg = pgb->GetGeometryAt(0);
  351. ui->lineEdit_s->setText(QString::number(pg->GetS()));
  352. ui->lineEdit_x->setText(QString::number(pg->GetX()));
  353. ui->lineEdit_y->setText(QString::number(pg->GetY()));
  354. ui->lineEdit_hdg->setText(QString::number(pg->GetHdg()));
  355. ui->lineEdit_len->setText(QString::number(pg->GetLength()));
  356. if((pg->GetGeomType()>=0)&&(pg->GetGeomType()<5))
  357. {
  358. ui->comboBox_geotype->setCurrentIndex(pg->GetGeomType());
  359. }
  360. }
  361. void RoadEditDialog::on_pushButton_EditLane_clicked()
  362. {
  363. if(mpCurRoad == 0)
  364. {
  365. QMessageBox::warning(this,"Warning","Not Select Road");
  366. return;
  367. }
  368. DialogEditLane laned(mpCurRoad,this);
  369. int res = laned.exec();
  370. on_comboBox_Road_currentIndexChanged(ui->comboBox_Road->currentIndex());
  371. }
  372. void RoadEditDialog::on_pushButton_EditRoadMark_clicked()
  373. {
  374. if(mpCurRoad == 0)
  375. {
  376. QMessageBox::warning(this,"Warning","Not Select Road");
  377. return;
  378. }
  379. DialogEditRoadMark roadmarkd(mpCurRoad,this);
  380. roadmarkd.exec();
  381. on_comboBox_Road_currentIndexChanged(ui->comboBox_Road->currentIndex());
  382. }
  383. void RoadEditDialog::on_pushButton_LaneFromRTK_clicked()
  384. {
  385. #ifdef OPENDRIVE_EDITONLY
  386. QMessageBox::warning(this,"Warning","This Release is Only for Edit OpenDrive. Other Function Need Change conf.",QMessageBox::YesAll);
  387. return;
  388. #endif
  389. if(mpCurRoad == 0)
  390. {
  391. QMessageBox::warning(this,"Warning","Not Select Road");
  392. return;
  393. }
  394. DialogLaneFromRTK lanertk(mpCurRoad,mpxodr,this);
  395. lanertk.exec();
  396. on_comboBox_Road_currentIndexChanged(ui->comboBox_Road->currentIndex());
  397. }
  398. void RoadEditDialog::on_pushButton_RoadSplit_clicked()
  399. {
  400. #ifdef OPENDRIVE_EDITONLY
  401. QMessageBox::warning(this,"Warning","This Release is Only for Edit OpenDrive. Other Function Need Change conf.",QMessageBox::YesAll);
  402. return;
  403. #endif
  404. if(mpCurRoad == 0)
  405. {
  406. QMessageBox::warning(this,"Warning","Not Select Road");
  407. return;
  408. }
  409. DialogRoadSplit roadsplit(mpCurRoad,mpxodr,this);
  410. roadsplit.exec();
  411. unsigned int ncurindex = ui->comboBox_Road->currentIndex();
  412. ui->comboBox_Road->clear();
  413. int i;
  414. int nroadcount = mpxodr->GetRoadCount();
  415. for(i=0;i<nroadcount;i++)
  416. {
  417. const char * strname = mpxodr->GetRoad(i)->GetRoadId().data();
  418. ui->comboBox_Road->addItem(strname);
  419. }
  420. on_comboBox_Road_currentIndexChanged(ncurindex);
  421. }
  422. void RoadEditDialog::on_pushButton_RoadMerge_clicked()
  423. {
  424. #ifdef OPENDRIVE_EDITONLY
  425. QMessageBox::warning(this,"Warning","This Release is Only for Edit OpenDrive. Other Function Need Change conf.",QMessageBox::YesAll);
  426. return;
  427. #endif
  428. DialogRoadMerge roadmerge(mpxodr,this);
  429. roadmerge.exec();
  430. unsigned int ncurindex = ui->comboBox_Road->currentIndex();
  431. ui->comboBox_Road->clear();
  432. int i;
  433. int nroadcount = mpxodr->GetRoadCount();
  434. for(i=0;i<nroadcount;i++)
  435. {
  436. const char * strname = mpxodr->GetRoad(i)->GetRoadId().data();
  437. ui->comboBox_Road->addItem(strname);
  438. }
  439. on_comboBox_Road_currentIndexChanged(ncurindex);
  440. }
  441. void RoadEditDialog::on_pushButton_MoveRoad_clicked()
  442. {
  443. #ifdef OPENDRIVE_EDITONLY
  444. QMessageBox::warning(this,"Warning","This Release is Only for Edit OpenDrive. Other Function Need Change conf.",QMessageBox::YesAll);
  445. return;
  446. #endif
  447. if(mpCurRoad == 0)
  448. {
  449. QMessageBox::warning(this,"Warning","Not Select Road");
  450. return;
  451. }
  452. DialogRoadMove roadmove(mpxodr,mpCurRoad,this);
  453. roadmove.exec();
  454. unsigned int ncurindex = ui->comboBox_Road->currentIndex();
  455. ui->comboBox_Road->clear();
  456. int i;
  457. int nroadcount = mpxodr->GetRoadCount();
  458. for(i=0;i<nroadcount;i++)
  459. {
  460. const char * strname = mpxodr->GetRoad(i)->GetRoadId().data();
  461. ui->comboBox_Road->addItem(strname);
  462. }
  463. on_comboBox_Road_currentIndexChanged(ncurindex);
  464. }
  465. void RoadEditDialog::on_pushButton_RotateRoad_clicked()
  466. {
  467. #ifdef OPENDRIVE_EDITONLY
  468. QMessageBox::warning(this,"Warning","This Release is Only for Edit OpenDrive. Other Function Need Change conf.",QMessageBox::YesAll);
  469. return;
  470. #endif
  471. if(mpCurRoad == 0)
  472. {
  473. QMessageBox::warning(this,"Warning","Not Select Road");
  474. return;
  475. }
  476. DialogRoadRotate roadrotate(mpxodr,mpCurRoad,this);
  477. roadrotate.exec();
  478. unsigned int ncurindex = ui->comboBox_Road->currentIndex();
  479. ui->comboBox_Road->clear();
  480. int i;
  481. int nroadcount = mpxodr->GetRoadCount();
  482. for(i=0;i<nroadcount;i++)
  483. {
  484. const char * strname = mpxodr->GetRoad(i)->GetRoadId().data();
  485. ui->comboBox_Road->addItem(strname);
  486. }
  487. on_comboBox_Road_currentIndexChanged(ncurindex);
  488. }
  489. void RoadEditDialog::on_pushButton_MirrorRoad_clicked()
  490. {
  491. #ifdef OPENDRIVE_EDITONLY
  492. QMessageBox::warning(this,"Warning","This Release is Only for Edit OpenDrive. Other Function Need Change conf.",QMessageBox::YesAll);
  493. return;
  494. #endif
  495. if(mpCurRoad == 0)
  496. {
  497. QMessageBox::warning(this,"Warning","Not Select Road");
  498. return;
  499. }
  500. DialogRoadMirror roadmirror(mpxodr,mpCurRoad,this);
  501. roadmirror.exec();
  502. unsigned int ncurindex = ui->comboBox_Road->currentIndex();
  503. ui->comboBox_Road->clear();
  504. int i;
  505. int nroadcount = mpxodr->GetRoadCount();
  506. for(i=0;i<nroadcount;i++)
  507. {
  508. const char * strname = mpxodr->GetRoad(i)->GetRoadId().data();
  509. ui->comboBox_Road->addItem(strname);
  510. }
  511. on_comboBox_Road_currentIndexChanged(ncurindex);
  512. }
  513. void RoadEditDialog::on_pushButton_EditLaneOffset_clicked()
  514. {
  515. if(mpCurRoad == 0)
  516. {
  517. QMessageBox::warning(this,"Warning","Not Select Road");
  518. return;
  519. }
  520. DialogLaneOffset dlglaneoffset(mpCurRoad,this);
  521. dlglaneoffset.exec();
  522. }
  523. void RoadEditDialog::on_pushButton_EditRoadObjects_clicked()
  524. {
  525. #ifdef OPENDRIVE_EDITONLY
  526. QMessageBox::warning(this,"Warning","This Release is Only for Edit OpenDrive. Other Function Need Change conf.",QMessageBox::YesAll);
  527. return;
  528. #endif
  529. DialogRoadObject roadobject(mpCurRoad,this);
  530. roadobject.exec();
  531. }
  532. void RoadEditDialog::on_pushButton_RoadOptimize_clicked()
  533. {
  534. if(mpCurRoad == 0)
  535. {
  536. QMessageBox::warning(this,"Warning","Not Select Road");
  537. return;
  538. }
  539. DialogRoadOptimize dlgroadopt(mpCurRoad,mpxodr, this);
  540. dlgroadopt.exec();
  541. }
  542. void RoadEditDialog::on_pushButton_EditRoadType_clicked()
  543. {
  544. if(mpCurRoad == 0)
  545. {
  546. QMessageBox::warning(this,"Warning","Not Select Road");
  547. return;
  548. }
  549. DialogRoadType dlgroadtype(mpCurRoad,this);
  550. dlgroadtype.exec();
  551. }
  552. void RoadEditDialog::on_pushButton_ParkingSpaceFromRTK_clicked()
  553. {
  554. if(mpCurRoad == 0)
  555. {
  556. QMessageBox::warning(this,"Warning","Not Select Road");
  557. return;
  558. }
  559. DialogParkingSpaceFromRTK dlgparkrtk(mpCurRoad,this);
  560. dlgparkrtk.exec();
  561. }
  562. void RoadEditDialog::on_pushButton_TurnDirection_clicked()
  563. {
  564. if(mpCurRoad == 0)
  565. {
  566. QMessageBox::warning(this,"Warning","Not Select Road");
  567. return;
  568. }
  569. DialogTurnDirection dlgtd(mpCurRoad,this);
  570. dlgtd.exec();
  571. }
  572. void RoadEditDialog::on_pushButton_ParkingSpaceFromPoint_clicked()
  573. {
  574. if(mpCurRoad == 0)
  575. {
  576. QMessageBox::warning(this,"Warning","Not Select Road");
  577. return;
  578. }
  579. DialogParkingFromPoint dlgparkpoint(mpCurRoad,117.0,39.0,this);
  580. dlgparkpoint.exec();
  581. }