|
@@ -1,14 +1,112 @@
|
|
|
#include "dialogroadpriority.h"
|
|
|
#include "ui_dialogroadpriority.h"
|
|
|
|
|
|
-DialogRoadPriority::DialogRoadPriority(QWidget *parent) :
|
|
|
+#include "mainwindow.h"
|
|
|
+
|
|
|
+DialogRoadPriority::DialogRoadPriority(OpenDrive * pxodr,std::string strdefroad,QWidget *parent) :
|
|
|
QDialog(parent),
|
|
|
ui(new Ui::DialogRoadPriority)
|
|
|
{
|
|
|
ui->setupUi(this);
|
|
|
+
|
|
|
+ mpxodr = pxodr;
|
|
|
+
|
|
|
+ unsigned int i;
|
|
|
+ unsigned int nroadcount = mpxodr->GetRoadCount();
|
|
|
+ for(i=0;i<nroadcount;i++)
|
|
|
+ {
|
|
|
+ const char * strname = mpxodr->GetRoad(i)->GetRoadId().data();
|
|
|
+ ui->comboBox_Road->addItem(strname);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ MainWindow::ComboToString(strdefroad,ui->comboBox_Road);
|
|
|
+
|
|
|
+ setWindowTitle("Road Priority");
|
|
|
+
|
|
|
}
|
|
|
|
|
|
DialogRoadPriority::~DialogRoadPriority()
|
|
|
{
|
|
|
delete ui;
|
|
|
}
|
|
|
+
|
|
|
+void DialogRoadPriority::on_comboBox_Road_currentIndexChanged(int index)
|
|
|
+{
|
|
|
+ ui->lineEdit_Priority->setText("");
|
|
|
+ Road * pRoad = mpxodr->GetRoad(static_cast<unsigned int >(index) );
|
|
|
+ if(pRoad == 0)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ ui->lineEdit_RoadLen->setText(QString::number(pRoad->GetRoadLength(),'f',3));
|
|
|
+
|
|
|
+ int nPriority;
|
|
|
+ if(pRoad->GetRoadPriority(nPriority) == 1)
|
|
|
+ {
|
|
|
+ ui->lineEdit_Priority->setText(QString::number(nPriority));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void DialogRoadPriority::on_pushButton_Add_clicked()
|
|
|
+{
|
|
|
+ Road * pRoad = mpxodr->GetRoad(static_cast<unsigned int >(ui->comboBox_Road->currentIndex()) );
|
|
|
+ if(pRoad == 0)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ui->lineEdit_Priority->text().toStdString() == "")
|
|
|
+ {
|
|
|
+ QMessageBox::warning(this,"Warning","Priority is empty.",QMessageBox::YesAll);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ pRoad->SetRoadPriority(ui->lineEdit_Priority->text().toInt());
|
|
|
+ on_comboBox_Road_currentIndexChanged(ui->comboBox_Road->currentIndex());
|
|
|
+
|
|
|
+ QMessageBox::information(this,"Information","Add Priority Success.",QMessageBox::YesAll);
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+void DialogRoadPriority::on_pushButton_Delete_clicked()
|
|
|
+{
|
|
|
+ Road * pRoad = mpxodr->GetRoad(static_cast<unsigned int >(ui->comboBox_Road->currentIndex()) );
|
|
|
+ if(pRoad == 0)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ui->lineEdit_Priority->text().toStdString() == "")
|
|
|
+ {
|
|
|
+ QMessageBox::warning(this,"Warning","this Road No Priority.",QMessageBox::YesAll);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ pRoad->ResetPriority();
|
|
|
+
|
|
|
+ QMessageBox::information(this,"Information","Delete Priority Success.",QMessageBox::YesAll);
|
|
|
+
|
|
|
+ on_comboBox_Road_currentIndexChanged(ui->comboBox_Road->currentIndex());
|
|
|
+}
|
|
|
+
|
|
|
+void DialogRoadPriority::on_pushButton_Change_clicked()
|
|
|
+{
|
|
|
+ Road * pRoad = mpxodr->GetRoad(static_cast<unsigned int >(ui->comboBox_Road->currentIndex()) );
|
|
|
+ if(pRoad == 0)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ui->lineEdit_Priority->text().toStdString() == "")
|
|
|
+ {
|
|
|
+ QMessageBox::warning(this,"Warning","Priority is empty.",QMessageBox::YesAll);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ pRoad->SetRoadPriority(ui->lineEdit_Priority->text().toInt());
|
|
|
+ on_comboBox_Road_currentIndexChanged(ui->comboBox_Road->currentIndex());
|
|
|
+
|
|
|
+ QMessageBox::information(this,"Information","Change Priority Success.",QMessageBox::YesAll);
|
|
|
+}
|