Forráskód Böngészése

change tool/map_lanetoxodr. complete object parkingSpace code.

yuchuli 3 éve
szülő
commit
74dd3f05da

+ 5 - 0
src/common/common/xodr/OpenDrive/ObjectSignal.cpp

@@ -562,6 +562,11 @@ void Object::SetparkingSpace(Object_parkingSpace parkingSpace)
     mObject_parkingSpace.push_back(parkingSpace);
 }
 
+void Object::ResetparkingSpace()
+{
+    if(mObject_parkingSpace.size()>0)mObject_parkingSpace.clear();
+}
+
 vector<Object_repeat> * Object::GetObjectrepeatVector()
 {
     return &mObject_repeat;

+ 1 - 0
src/common/common/xodr/OpenDrive/ObjectSignal.h

@@ -222,6 +222,7 @@ public:
     void Setradius(double radius);
 
     void SetparkingSpace(Object_parkingSpace parkingSpace);
+    void ResetparkingSpace();
 
     vector<Object_repeat> * GetObjectrepeatVector();
     Object_repeat* GetObjectrepeat(unsigned int i);

+ 27 - 0
src/tool/map_lanetoxodr/dialogroadobject.cpp

@@ -115,6 +115,7 @@ void DialogRoadObject::CreateView()
 
     connect(mpPBmaterial,SIGNAL(clicked(bool)),this,SLOT(onClickMaterial()));
     connect(mpPBrepeat,SIGNAL(clicked(bool)),this,SLOT(onClickRepeat()));
+    connect(mpPBparkingspace,SIGNAL(clicked(bool)),this,SLOT(onClickParkingSpace()));
 }
 
 
@@ -498,3 +499,29 @@ void DialogRoadObject::onClickRepeat()
     dlgrepeat.exec();
 }
 
+void DialogRoadObject::onClickParkingSpace()
+{
+    if(mpRoad == 0)return;
+    Road * pRoad = mpRoad;
+    if(pRoad->GetObjectCount() == 0)
+    {
+        QMessageBox::warning(this,"Warning","No Object.",QMessageBox::YesAll);
+        return;
+    }
+
+    int index = ui->comboBox_Object->currentIndex();
+    if(index<0)return;
+    if(index >= mpRoad->GetObjectCount())return;
+
+    Object * pObject = mpRoad->GetObject(index);
+    if(pObject == 0)
+    {
+        QMessageBox::warning(this,"Warning","Can't found Object.",QMessageBox::YesAll);
+        return;
+    }
+
+    DialogRoadObject_parkingSpace dlgparkingspace(pObject);
+
+    dlgparkingspace.exec();
+}
+

+ 2 - 0
src/tool/map_lanetoxodr/dialogroadobject.h

@@ -13,6 +13,7 @@
 
 #include "dialogroadobject_material.h"
 #include "dialogroadobject_repeat.h"
+#include "dialogroadobject_parkingspace.h"
 
 namespace Ui {
 class DialogRoadObject;
@@ -37,6 +38,7 @@ private slots:
 
     void onClickMaterial();
     void onClickRepeat();
+    void onClickParkingSpace();
 
 private:
     Ui::DialogRoadObject *ui;

+ 94 - 0
src/tool/map_lanetoxodr/dialogroadobject_parkingspace.cpp

@@ -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();
+}

+ 36 - 0
src/tool/map_lanetoxodr/dialogroadobject_parkingspace.h

@@ -0,0 +1,36 @@
+#ifndef DIALOGROADOBJECT_PARKINGSPACE_H
+#define DIALOGROADOBJECT_PARKINGSPACE_H
+
+#include <QDialog>
+
+#include <OpenDrive/OpenDrive.h>
+
+namespace Ui {
+class DialogRoadObject_parkingSpace;
+}
+
+class DialogRoadObject_parkingSpace : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit DialogRoadObject_parkingSpace(Object * pObject,QWidget *parent = nullptr);
+    ~DialogRoadObject_parkingSpace();
+
+private slots:
+    void on_pushButton_set_clicked();
+
+    void on_pushButton_clear_clicked();
+
+    void on_pushButton_change_clicked();
+
+private:
+    Ui::DialogRoadObject_parkingSpace *ui;
+
+    Object * mpObject = 0;
+
+private:
+    void UpdateState();
+};
+
+#endif // DIALOGROADOBJECT_PARKINGSPACE_H

+ 127 - 0
src/tool/map_lanetoxodr/dialogroadobject_parkingspace.ui

@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogRoadObject_parkingSpace</class>
+ <widget class="QDialog" name="DialogRoadObject_parkingSpace">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>626</width>
+    <height>411</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <widget class="QLineEdit" name="lineEdit_restrictions">
+   <property name="geometry">
+    <rect>
+     <x>454</x>
+     <y>163</y>
+     <width>121</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>169</y>
+     <width>101</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>access</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>330</x>
+     <y>163</y>
+     <width>101</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>restrictions</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_set">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>309</y>
+     <width>121</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Set</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_clear">
+   <property name="geometry">
+    <rect>
+     <x>240</x>
+     <y>309</y>
+     <width>121</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Clear</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_change">
+   <property name="geometry">
+    <rect>
+     <x>430</x>
+     <y>309</y>
+     <width>121</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Change</string>
+   </property>
+  </widget>
+  <widget class="QComboBox" name="comboBox">
+   <property name="geometry">
+    <rect>
+     <x>140</x>
+     <y>163</y>
+     <width>141</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_state">
+   <property name="geometry">
+    <rect>
+     <x>242</x>
+     <y>60</y>
+     <width>241</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_3">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>66</y>
+     <width>191</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>object_parkingSpace</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 3 - 0
src/tool/map_lanetoxodr/map_lanetoxodr.pro

@@ -45,6 +45,7 @@ SOURCES += \
     dialogroadmove.cpp \
     dialogroadobject.cpp \
     dialogroadobject_material.cpp \
+    dialogroadobject_parkingspace.cpp \
     dialogroadobject_repeat.cpp \
     dialogroadoptimize.cpp \
     dialogroadrotate.cpp \
@@ -99,6 +100,7 @@ HEADERS += \
     dialogroadmove.h \
     dialogroadobject.h \
     dialogroadobject_material.h \
+    dialogroadobject_parkingspace.h \
     dialogroadobject_repeat.h \
     dialogroadoptimize.h \
     dialogroadrotate.h \
@@ -147,6 +149,7 @@ FORMS += \
         dialogroadmove.ui \
         dialogroadobject.ui \
         dialogroadobject_material.ui \
+        dialogroadobject_parkingspace.ui \
         dialogroadobject_repeat.ui \
         dialogroadoptimize.ui \
         dialogroadrotate.ui \