|
@@ -0,0 +1,94 @@
|
|
|
+#include "dialogroadobject_parkingspace.h"
|
|
|
+#include "ui_dialogroadobject_parkingspace.h"
|
|
|
+
|
|
|
+static std::string gstrparkingSpacetype[] = {"all","car","women","handicapped",
|
|
|
+ "bus","truck","electric","residents"};
|
|
|
+const static int gnparkingSpacetypecount = 8;
|
|
|
+
|
|
|
+DialogRoadObject_parkingSpace::DialogRoadObject_parkingSpace(Object * pObject,QWidget *parent) :
|
|
|
+ QDialog(parent),
|
|
|
+ ui(new Ui::DialogRoadObject_parkingSpace)
|
|
|
+{
|
|
|
+ ui->setupUi(this);
|
|
|
+
|
|
|
+ mpObject = pObject;
|
|
|
+
|
|
|
+ int i;
|
|
|
+ for(i=0;i<gnparkingSpacetypecount;i++)
|
|
|
+ {
|
|
|
+ ui->comboBox->addItem(gstrparkingSpacetype[i].data());
|
|
|
+ }
|
|
|
+
|
|
|
+ UpdateState();
|
|
|
+}
|
|
|
+
|
|
|
+DialogRoadObject_parkingSpace::~DialogRoadObject_parkingSpace()
|
|
|
+{
|
|
|
+ delete ui;
|
|
|
+}
|
|
|
+
|
|
|
+void DialogRoadObject_parkingSpace::UpdateState()
|
|
|
+{
|
|
|
+ if(mpObject == 0)return;
|
|
|
+ Object_parkingSpace xpark;
|
|
|
+
|
|
|
+ std::string straccess,strrestrictions;
|
|
|
+
|
|
|
+ if(mpObject->GetparkingSpace(xpark) == 1)
|
|
|
+ {
|
|
|
+ straccess = xpark.Getaccess();
|
|
|
+ int ntype = 0;
|
|
|
+ int i;
|
|
|
+ for(i=0;i<gnparkingSpacetypecount;i++)
|
|
|
+ {
|
|
|
+ if(gstrparkingSpacetype[i] == straccess)
|
|
|
+ {
|
|
|
+ ntype = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ui->comboBox->setCurrentIndex(ntype);
|
|
|
+ strrestrictions = xpark.Getrestrictions();
|
|
|
+ if(strrestrictions != "")
|
|
|
+ {
|
|
|
+ ui->lineEdit_restrictions->setText(strrestrictions.data());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ui->lineEdit_restrictions->setText("");
|
|
|
+ }
|
|
|
+ ui->lineEdit_state->setText("Have Item");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ui->lineEdit_state->setText("No Item");
|
|
|
+ ui->lineEdit_restrictions->setText("");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void DialogRoadObject_parkingSpace::on_pushButton_set_clicked()
|
|
|
+{
|
|
|
+ Object_parkingSpace xpark;
|
|
|
+ xpark.Setrestrictions(ui->lineEdit_restrictions->text().toStdString());
|
|
|
+ xpark.Setaccess(ui->comboBox->currentText().toStdString());
|
|
|
+
|
|
|
+ if(mpObject == 0)return;
|
|
|
+
|
|
|
+ mpObject->SetparkingSpace(xpark);
|
|
|
+
|
|
|
+ UpdateState();
|
|
|
+}
|
|
|
+
|
|
|
+void DialogRoadObject_parkingSpace::on_pushButton_clear_clicked()
|
|
|
+{
|
|
|
+ if(mpObject == 0)return;
|
|
|
+
|
|
|
+ mpObject->ResetparkingSpace();
|
|
|
+
|
|
|
+ UpdateState();
|
|
|
+}
|
|
|
+
|
|
|
+void DialogRoadObject_parkingSpace::on_pushButton_change_clicked()
|
|
|
+{
|
|
|
+ on_pushButton_set_clicked();
|
|
|
+}
|