|
@@ -0,0 +1,97 @@
|
|
|
+#include "dialoglaneoffset.h"
|
|
|
+#include "ui_dialoglaneoffset.h"
|
|
|
+
|
|
|
+DialogLaneOffset::DialogLaneOffset(Road * pRoad,QWidget *parent) :
|
|
|
+ QDialog(parent),
|
|
|
+ ui(new Ui::DialogLaneOffset)
|
|
|
+{
|
|
|
+ ui->setupUi(this);
|
|
|
+
|
|
|
+ mpRoad = pRoad;
|
|
|
+
|
|
|
+ if(mpRoad == NULL)return;
|
|
|
+
|
|
|
+ unsigned int nlaneoffsetcount = mpRoad->GetLaneOffsetCount();
|
|
|
+ unsigned int i;
|
|
|
+ for(i=0;i<nlaneoffsetcount;i++)
|
|
|
+ {
|
|
|
+ LaneOffset * pLO = mpRoad->GetLaneOffset(i);
|
|
|
+ ui->comboBox_laneoffset->addItem(QString::number(pLO->GetS()));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+DialogLaneOffset::~DialogLaneOffset()
|
|
|
+{
|
|
|
+ delete ui;
|
|
|
+}
|
|
|
+
|
|
|
+void DialogLaneOffset::on_pushButton_AddLaneOffset_clicked()
|
|
|
+{
|
|
|
+ double s,a,b,c,d;
|
|
|
+ s = ui->lineEdit_s->text().toDouble();
|
|
|
+ a = ui->lineEdit_a->text().toDouble();
|
|
|
+ b = ui->lineEdit_b->text().toDouble();
|
|
|
+ c = ui->lineEdit_c->text().toDouble();
|
|
|
+ d = ui->lineEdit_d->text().toDouble();
|
|
|
+ unsigned int nlaneoff = mpRoad->AddLaneOffset(s,a,b,c,d);
|
|
|
+ UpdateCombo();
|
|
|
+ ui->comboBox_laneoffset->setCurrentIndex(nlaneoff);
|
|
|
+}
|
|
|
+
|
|
|
+void DialogLaneOffset::UpdateCombo()
|
|
|
+{
|
|
|
+ ui->comboBox_laneoffset->clear();
|
|
|
+
|
|
|
+ unsigned int nlaneoffsetcount = mpRoad->GetLaneOffsetCount();
|
|
|
+ unsigned int i;
|
|
|
+ for(i=0;i<nlaneoffsetcount;i++)
|
|
|
+ {
|
|
|
+ LaneOffset * pLO = mpRoad->GetLaneOffset(i);
|
|
|
+ ui->comboBox_laneoffset->addItem(QString::number(pLO->GetS()));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void DialogLaneOffset::on_pushButton_DeleteLaneOffset_clicked()
|
|
|
+{
|
|
|
+ unsigned int nlaneoffsetcount = mpRoad->GetLaneOffsetCount();
|
|
|
+ if(nlaneoffsetcount < 1)return;
|
|
|
+ unsigned int index = ui->comboBox_laneoffset->currentIndex();
|
|
|
+ mpRoad->DeleteLaneOffset(index);
|
|
|
+ UpdateCombo();
|
|
|
+}
|
|
|
+
|
|
|
+void DialogLaneOffset::on_pushButton_ChangeLaneOffset_clicked()
|
|
|
+{
|
|
|
+ unsigned int nlaneoffsetcount = mpRoad->GetLaneOffsetCount();
|
|
|
+ if(nlaneoffsetcount < 1)return;
|
|
|
+ unsigned int index = ui->comboBox_laneoffset->currentIndex();
|
|
|
+ LaneOffset * pLO = mpRoad->GetLaneOffset(index);
|
|
|
+ if(pLO == NULL)return;
|
|
|
+ double s,a,b,c,d;
|
|
|
+ s = ui->lineEdit_s->text().toDouble();
|
|
|
+ a = ui->lineEdit_a->text().toDouble();
|
|
|
+ b = ui->lineEdit_b->text().toDouble();
|
|
|
+ c = ui->lineEdit_c->text().toDouble();
|
|
|
+ d = ui->lineEdit_d->text().toDouble();
|
|
|
+ pLO->SetS(s);
|
|
|
+ pLO->Seta(a);
|
|
|
+ pLO->Setb(b);
|
|
|
+ pLO->Setc(c);
|
|
|
+ pLO->Setd(d);
|
|
|
+ UpdateCombo();
|
|
|
+ ui->comboBox_laneoffset->setCurrentIndex(index);
|
|
|
+}
|
|
|
+
|
|
|
+void DialogLaneOffset::on_comboBox_laneoffset_currentIndexChanged(int index)
|
|
|
+{
|
|
|
+ unsigned int nlaneoffsetcount = mpRoad->GetLaneOffsetCount();
|
|
|
+ if(nlaneoffsetcount < 1)return;
|
|
|
+ if(index<0)return;
|
|
|
+ LaneOffset * pLO = mpRoad->GetLaneOffset(index);
|
|
|
+ if(pLO == NULL)return;
|
|
|
+ ui->lineEdit_s->setText(QString::number(pLO->GetS()));
|
|
|
+ ui->lineEdit_a->setText(QString::number(pLO->Geta()));
|
|
|
+ ui->lineEdit_b->setText(QString::number(pLO->Getb()));
|
|
|
+ ui->lineEdit_c->setText(QString::number(pLO->Getc()));
|
|
|
+ ui->lineEdit_d->setText(QString::number(pLO->Getd()));
|
|
|
+}
|