|
@@ -5,6 +5,8 @@
|
|
#include <iostream>
|
|
#include <iostream>
|
|
#include <QMessageBox>
|
|
#include <QMessageBox>
|
|
|
|
|
|
|
|
+std::string cda_lanetype_sel[9] = {"shoulder","border","driving","stop","none","parking","biking","sidewalk",
|
|
|
|
+ "median"};
|
|
|
|
|
|
DialogAddRoadFromCDA::DialogAddRoadFromCDA(OpenDrive * pxodr, QWidget *parent) :
|
|
DialogAddRoadFromCDA::DialogAddRoadFromCDA(OpenDrive * pxodr, QWidget *parent) :
|
|
QDialog(parent),
|
|
QDialog(parent),
|
|
@@ -12,9 +14,20 @@ DialogAddRoadFromCDA::DialogAddRoadFromCDA(OpenDrive * pxodr, QWidget *parent) :
|
|
{
|
|
{
|
|
ui->setupUi(this);
|
|
ui->setupUi(this);
|
|
mpxodr = pxodr;
|
|
mpxodr = pxodr;
|
|
- ui->comboBox_Type->addItem(tr("直路"));
|
|
|
|
- ui->comboBox_Type->addItem(tr("弯路"));
|
|
|
|
- ui->comboBox_Type->addItem(tr("路口"));
|
|
|
|
|
|
+
|
|
|
|
+ ui->comboBox_RoadClass->addItem(tr("高速公路"));
|
|
|
|
+ ui->comboBox_RoadClass->addItem(tr("城市"));
|
|
|
|
+ ui->comboBox_RoadClass->addItem(tr("乡村"));
|
|
|
|
+
|
|
|
|
+ ui->comboBox_Ele->addItem(tr("平路"));
|
|
|
|
+ ui->comboBox_Ele->addItem(tr("缓上坡"));
|
|
|
|
+ ui->comboBox_Ele->addItem(tr("上坡"));
|
|
|
|
+ ui->comboBox_Ele->addItem(tr("缓下坡"));
|
|
|
|
+ ui->comboBox_Ele->addItem(tr("下坡"));
|
|
|
|
+
|
|
|
|
+ ui->comboBox_geoType->addItem(tr("直路"));
|
|
|
|
+ ui->comboBox_geoType->addItem(tr("弯路"));
|
|
|
|
+ ui->comboBox_geoType->addItem(tr("路口"));
|
|
|
|
|
|
ui->comboBox_lanecolor->addItem(tr("白色"));
|
|
ui->comboBox_lanecolor->addItem(tr("白色"));
|
|
ui->comboBox_lanecolor->addItem(tr("黄色"));
|
|
ui->comboBox_lanecolor->addItem(tr("黄色"));
|
|
@@ -22,11 +35,22 @@ DialogAddRoadFromCDA::DialogAddRoadFromCDA(OpenDrive * pxodr, QWidget *parent) :
|
|
ui->comboBox_lanemarktype->addItem(tr("虚线"));
|
|
ui->comboBox_lanemarktype->addItem(tr("虚线"));
|
|
ui->comboBox_lanemarktype->addItem(tr("实线"));
|
|
ui->comboBox_lanemarktype->addItem(tr("实线"));
|
|
|
|
|
|
- ui->comboBox_Type->setCurrentIndex(0);
|
|
|
|
|
|
+ int i;
|
|
|
|
+ for(i=0;i<9;i++)ui->comboBox_lanetype->addItem(cda_lanetype_sel[i].data());
|
|
|
|
+
|
|
|
|
+ ui->comboBox_geoType->setCurrentIndex(0);
|
|
ui->comboBox_lanecolor->setCurrentIndex(0);
|
|
ui->comboBox_lanecolor->setCurrentIndex(0);
|
|
ui->comboBox_lanemarktype->setCurrentIndex(0);
|
|
ui->comboBox_lanemarktype->setCurrentIndex(0);
|
|
|
|
|
|
- setWindowTitle(tr("Draw Road From CDA"));
|
|
|
|
|
|
+ ui->comboBox_Ele->setCurrentIndex(0);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ ui->lineEdit_roadlanecount->setReadOnly(true);
|
|
|
|
+ ui->lineEdit_roadlen->setReadOnly(true);
|
|
|
|
+
|
|
|
|
+ UpdateView();
|
|
|
|
+
|
|
|
|
+ setWindowTitle(tr("Draw Road From Label"));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -38,49 +62,103 @@ DialogAddRoadFromCDA::~DialogAddRoadFromCDA()
|
|
void DialogAddRoadFromCDA::on_pushButton_Create_clicked()
|
|
void DialogAddRoadFromCDA::on_pushButton_Create_clicked()
|
|
{
|
|
{
|
|
OpenDrive * pxodr = mpxodr;
|
|
OpenDrive * pxodr = mpxodr;
|
|
- std::string strtype = ui->comboBox_Type->currentText().toStdString();
|
|
|
|
- std::string strradius = ui->lineEdit_radius->text().toStdString();
|
|
|
|
- std::string strlen = ui->lineEdit_len->text().toStdString();
|
|
|
|
- std::string strlanewidth = ui->lineEdit_lanewidth->text().toStdString();
|
|
|
|
- std::string strlanecount = ui->lineEdit_lanecount->text().toStdString();
|
|
|
|
- std::string strlanecolor = ui->comboBox_lanecolor->currentText().toStdString();
|
|
|
|
- std::string strlanemarktype = ui->comboBox_lanemarktype->currentText().toStdString();
|
|
|
|
-
|
|
|
|
- if(atof(strradius.data())<0.0000000001)
|
|
|
|
- {
|
|
|
|
- if(ui->comboBox_Type->currentIndex() == 1)
|
|
|
|
- {
|
|
|
|
- QMessageBox::warning(this,tr("Warning"),tr("Radius is 0"),QMessageBox::YesAll);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+// std::string strtype = ui->comboBox_Type->currentText().toStdString();
|
|
|
|
+// std::string strradius = ui->lineEdit_radius->text().toStdString();
|
|
|
|
+// std::string strlen = ui->lineEdit_len->text().toStdString();
|
|
|
|
+// std::string strlanewidth = ui->lineEdit_lanewidth->text().toStdString();
|
|
|
|
+// std::string strlanecount = ui->lineEdit_lanecount->text().toStdString();
|
|
|
|
+// std::string strlanecolor = ui->comboBox_lanecolor->currentText().toStdString();
|
|
|
|
+// std::string strlanemarktype = ui->comboBox_lanemarktype->currentText().toStdString();
|
|
|
|
+
|
|
|
|
+// if(atof(strradius.data())<0.0000000001)
|
|
|
|
+// {
|
|
|
|
+// if(ui->comboBox_Type->currentIndex() == 1)
|
|
|
|
+// {
|
|
|
|
+// QMessageBox::warning(this,tr("Warning"),tr("Radius is 0"),QMessageBox::YesAll);
|
|
|
|
+// return;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// if(atof(strlen.data())<0.0000000001)
|
|
|
|
+// {
|
|
|
|
+// QMessageBox::warning(this,tr("Warning"),tr("Length is 0"),QMessageBox::YesAll);
|
|
|
|
+// return;
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// if(atof(strlanewidth.data())<0.0000000001)
|
|
|
|
+// {
|
|
|
|
+// QMessageBox::warning(this,tr("Warning"),tr("Lane Width is 0"),QMessageBox::YesAll);
|
|
|
|
+// return;
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// if(atoi(strlanecount.data())<1)
|
|
|
|
+// {
|
|
|
|
+// QMessageBox::warning(this,tr("Warning"),tr("Lane Count is 0"),QMessageBox::YesAll);
|
|
|
|
+// return;
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// int nrtn = CDAProc::ProcRoad(pxodr,strtype,strradius,strlen,strlanewidth,strlanecount," ",strlanecolor,strlanemarktype);
|
|
|
|
+
|
|
|
|
+// if(nrtn == 0)
|
|
|
|
+// {
|
|
|
|
+// this->accept();
|
|
|
|
+// }
|
|
|
|
+// else
|
|
|
|
+// {
|
|
|
|
+// QMessageBox::warning(this,tr("Warning"),tr("CDAProc ProcRoad Fail."),QMessageBox::YesAll);
|
|
|
|
+// }
|
|
|
|
+}
|
|
|
|
|
|
- if(atof(strlen.data())<0.0000000001)
|
|
|
|
|
|
+void DialogAddRoadFromCDA::UpdateView()
|
|
|
|
+{
|
|
|
|
+ iv::cdaroad * pcdaroad = &mcdaroad;
|
|
|
|
+ ui->comboBox_RoadClass->setCurrentIndex(pcdaroad->mnclass);
|
|
|
|
+ int nlanecount = static_cast<int>(pcdaroad->mvectorlane.size());
|
|
|
|
+ ui->lineEdit_roadlanecount->setText(QString::number(nlanecount));
|
|
|
|
+ double fRoadLen = 0;
|
|
|
|
+ int i;
|
|
|
|
+ int ngeosize = static_cast<int>(pcdaroad->mvectorgeo.size());
|
|
|
|
+ ui->comboBox_geo->clear();
|
|
|
|
+ for(i=0;i<ngeosize;i++)
|
|
{
|
|
{
|
|
- QMessageBox::warning(this,tr("Warning"),tr("Length is 0"),QMessageBox::YesAll);
|
|
|
|
- return;
|
|
|
|
|
|
+ ui->comboBox_geo->addItem(QString(tr("路段"))+QString::number(i+1));
|
|
|
|
+ fRoadLen = fRoadLen + pcdaroad->mvectorgeo[i].mflen;
|
|
}
|
|
}
|
|
-
|
|
|
|
- if(atof(strlanewidth.data())<0.0000000001)
|
|
|
|
|
|
+ ui->comboBox_Lane->clear();
|
|
|
|
+ for(i=0;i<nlanecount;i++)
|
|
{
|
|
{
|
|
- QMessageBox::warning(this,tr("Warning"),tr("Lane Width is 0"),QMessageBox::YesAll);
|
|
|
|
- return;
|
|
|
|
|
|
+ ui->comboBox_Lane->addItem(QString(tr("车道"))+QString::number(i+1));
|
|
}
|
|
}
|
|
|
|
+ ui->lineEdit_roadlen->setText(QString::number(fRoadLen));
|
|
|
|
+}
|
|
|
|
|
|
- if(atoi(strlanecount.data())<1)
|
|
|
|
|
|
+void DialogAddRoadFromCDA::on_comboBox_Lane_currentIndexChanged(int index)
|
|
|
|
+{
|
|
|
|
+ iv::cdaroad * pcdaroad = &mcdaroad;
|
|
|
|
+ if(index<0)return;
|
|
|
|
+ if(index>=pcdaroad->mvectorlane.size())
|
|
{
|
|
{
|
|
- QMessageBox::warning(this,tr("Warning"),tr("Lane Count is 0"),QMessageBox::YesAll);
|
|
|
|
|
|
+ std::cout<<" index big than lane size."<<std::endl;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ iv::cdalane * plane = &pcdaroad->mvectorlane[index];
|
|
|
|
+ ui->comboBox_lanecolor->setCurrentIndex(plane->mnlanemarkcolor);
|
|
|
|
+ ui->comboBox_lanemarktype->setCurrentIndex(plane->mnlanemarktype);
|
|
|
|
+ ui->lineEdit_lanewidth->setText(QString::number(plane->mflanewidth,'f',2));
|
|
|
|
+ ui->comboBox_lanetype->setCurrentIndex(plane->mnlanetype);
|
|
|
|
+}
|
|
|
|
|
|
- int nrtn = CDAProc::ProcRoad(pxodr,strtype,strradius,strlen,strlanewidth,strlanecount," ",strlanecolor,strlanemarktype);
|
|
|
|
-
|
|
|
|
- if(nrtn == 0)
|
|
|
|
- {
|
|
|
|
- this->accept();
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
|
|
+void DialogAddRoadFromCDA::on_comboBox_geo_currentIndexChanged(int index)
|
|
|
|
+{
|
|
|
|
+ iv::cdaroad * pcdaroad = &mcdaroad;
|
|
|
|
+ if(index<0)return;
|
|
|
|
+ if(index>=pcdaroad->mvectorgeo.size())
|
|
{
|
|
{
|
|
- QMessageBox::warning(this,tr("Warning"),tr("CDAProc ProcRoad Fail."),QMessageBox::YesAll);
|
|
|
|
|
|
+ std::cout<<" index big than geo size."<<std::endl;
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
+ iv::cdageo * pgeo = &pcdaroad->mvectorgeo[index];
|
|
|
|
+ ui->comboBox_geo->setCurrentIndex(pgeo->mngeotype);
|
|
|
|
+ ui->lineEdit_georadius->setText(QString::number(pgeo->mfradius));
|
|
|
|
+ ui->lineEdit_geolen->setText(QString::number(pgeo->mflen));
|
|
}
|
|
}
|