Prechádzať zdrojové kódy

change tool/map_lanetoxodr.add road object material edit dialog code.

yuchuli 3 rokov pred
rodič
commit
82e2990ddf

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

@@ -18,6 +18,21 @@ Object_material::Object_material()
 
 }
 
+void Object_material::Clearsurface()
+{
+    if(msurface.size()>0)msurface.clear();
+}
+
+void Object_material::Clearfriction()
+{
+    if(mfriction.size()>0)mfriction.clear();
+}
+
+void Object_material::Clearroughness()
+{
+    if(mroughness.size()>0)mroughness.clear();
+}
+
 int Object_material::Getsurface(string & surface)
 {
     if(msurface.size()<1)return 0;

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

@@ -45,6 +45,10 @@ public:
     void Setsurface(string surface);
     void Setfriction(double friction);
     void Setroughness(double roughness);
+
+    void Clearsurface();
+    void Clearfriction();
+    void Clearroughness();
 };
 
 class Object_repeat

+ 2 - 2
src/common/common/xodr/OpenDrive/OpenDriveXmlParser.cpp

@@ -1385,14 +1385,14 @@ bool OpenDriveXmlParser::ReadObject(Road *road, TiXmlElement *node)
     while (subNode)
     {
         ReadObjectRepeat(pobject, subNode);
-        subNode = node->FirstChildElement("repeat");
+        subNode = subNode->NextSiblingElement("repeat");
     }
 
     subNode = node->FirstChildElement("material");
     while (subNode)
     {
         ReadObjectMaterial(pobject, subNode);
-        subNode = node->FirstChildElement("material");
+        subNode = subNode->NextSiblingElement("material");
     }
 
     return true;

+ 94 - 88
src/tool/map_lanetoxodr/dialogroadobject.cpp

@@ -66,33 +66,6 @@ DialogRoadObject::~DialogRoadObject()
     delete ui;
 }
 
-
-QLineEdit * DialogRoadObject::CreateLE(int pos_x, int pos_y, int nLabelWidth, int nLEWidth, int nHeight, std::string strname)
-{
-    QLineEdit * pLE;
-    QLabel * pLabel;
-    pLabel = new QLabel(this);
-    pLabel->setGeometry(pos_x,pos_y,nLabelWidth,nHeight);
-    pLabel->setText(strname.data());
-    pLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
-    pLE = new QLineEdit(this);
-    pLE->setGeometry(pos_x+nLabelWidth+10,pos_y,nLEWidth,nHeight);
-    return pLE;
-}
-
-QComboBox * DialogRoadObject::CreateCB(int pos_x, int pos_y, int nLabelWidth, int nLEWidth, int nHeight, std::string strname)
-{
-    QComboBox * pCB;
-    QLabel * pLabel;
-    pLabel = new QLabel(this);
-    pLabel->setGeometry(pos_x,pos_y,nLabelWidth,nHeight);
-    pLabel->setText(strname.data());
-    pLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
-    pCB = new QComboBox(this);
-    pCB->setGeometry(pos_x+nLabelWidth+10,pos_y,nLEWidth,nHeight);
-    return pCB;
-}
-
 void DialogRoadObject::CreateView()
 {
     int startpos_x = 30;
@@ -103,66 +76,73 @@ void DialogRoadObject::CreateView()
     int nHeight = 30;
     int nVSpace = 50;
     int nVIndex = 0;
-    mpLEt = CreateLE(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"t");
-    mpLEzOffset = CreateLE(startpos_x+1*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"zOffset");
-    mpCBtype = CreateCB(startpos_x+2*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"type");
+    mpLEt = ViewCreate::CreateLE(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"t",this);
+    mpLEzOffset = ViewCreate::CreateLE(startpos_x+1*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"zOffset",this);
+    mpCBtype = ViewCreate::CreateCB(startpos_x+2*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"type",this);
     nVIndex++;
-    mpLEvalidLength = CreateLE(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"validLength");
-    mpCBorientation = CreateCB(startpos_x+1*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"orientation");
-    mpLEsubtype = CreateLE(startpos_x+2*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"subtype");
+    mpLEvalidLength = ViewCreate::CreateLE(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"validLength",this);
+    mpCBorientation = ViewCreate::CreateCB(startpos_x+1*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"orientation",this);
+    mpLEsubtype = ViewCreate::CreateLE(startpos_x+2*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"subtype",this);
     nVIndex++;
-    mpCBdynamic = CreateCB(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"dynamic");
-    mpLEhdg = CreateLE(startpos_x+1*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"hdg");
-    mpLEname = CreateLE(startpos_x+2*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"name");
+    mpCBdynamic = ViewCreate::CreateCB(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"dynamic",this);
+    mpLEhdg = ViewCreate::CreateLE(startpos_x+1*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"hdg",this);
+    mpLEname = ViewCreate::CreateLE(startpos_x+2*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"name",this);
     nVIndex++;
-    mpLEpitch = CreateLE(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"pitch");
-    mpLEid = CreateLE(startpos_x+1*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"id");
-    mpLEroll = CreateLE(startpos_x+2*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"roll");
+    mpLEpitch = ViewCreate::CreateLE(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"pitch",this);
+    mpLEid = ViewCreate::CreateLE(startpos_x+1*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"id",this);
+    mpLEroll = ViewCreate::CreateLE(startpos_x+2*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"roll",this);
     nVIndex++;
-    mpLEheight = CreateLE(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"height");
-    mpLEs = CreateLE(startpos_x+1*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"s");
-    mpLElength = CreateLE(startpos_x+2*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"length");
+    mpLEheight = ViewCreate::CreateLE(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"height",this);
+    mpLEs = ViewCreate::CreateLE(startpos_x+1*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"s",this);
+    mpLElength = ViewCreate::CreateLE(startpos_x+2*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"length",this);
     nVIndex++;
-    mpLEwidth = CreateLE(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"width");
-    mpLEradius = CreateLE(startpos_x+1*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"radius");
-}
+    mpLEwidth = ViewCreate::CreateLE(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"width",this);
+    mpLEradius = ViewCreate::CreateLE(startpos_x+1*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"radius",this);
 
-bool DialogRoadObject::CheckLE(QLineEdit *pLE, QString stritemname,bool bWarning)
-{
-    QString str = pLE->text();
-    if(str == "")
-    {
-        if(bWarning)QMessageBox::warning(this,"Warning",stritemname + " is not set",QMessageBox::YesAll);
-        return false;
-    }
-    return true;
+    int nPBSpace = 200;
+    int nPBWidth = 150;
+    nVIndex++;
+    mpPBmaterial = ViewCreate::CreatePB(startpos_x+0*nPBSpace,startpos_y+nVIndex*nVSpace,nPBWidth,nHeight,"material",this);
+    mpPBrepeat = ViewCreate::CreatePB(startpos_x+1*nPBSpace,startpos_y+nVIndex*nVSpace,nPBWidth,nHeight,"repeat",this);
+    mpPBparkingspace = ViewCreate::CreatePB(startpos_x+2*nPBSpace,startpos_y+nVIndex*nVSpace,nPBWidth,nHeight,"parkingspace",this);
+    mpPBoutlines = ViewCreate::CreatePB(startpos_x+3*nPBSpace,startpos_y+nVIndex*nVSpace,nPBWidth,nHeight,"outlines",this);
+
+    nVIndex++;
+    mpPBoutline = ViewCreate::CreatePB(startpos_x+0*nPBSpace,startpos_y+nVIndex*nVSpace,nPBWidth,nHeight,"outline",this);
+    mpPBmarkings = ViewCreate::CreatePB(startpos_x+1*nPBSpace,startpos_y+nVIndex*nVSpace,nPBWidth,nHeight,"markings",this);
+    mpPBborders = ViewCreate::CreatePB(startpos_x+2*nPBSpace,startpos_y+nVIndex*nVSpace,nPBWidth,nHeight,"borders",this);
+    mpPBvalidity = ViewCreate::CreatePB(startpos_x+3*nPBSpace,startpos_y+nVIndex*nVSpace,nPBWidth,nHeight,"validity",this);
+
+    connect(mpPBmaterial,SIGNAL(clicked(bool)),this,SLOT(onClickMaterial()));
 }
 
+
+
 void DialogRoadObject::on_pushButton_add_clicked()
 {
     Road * pRoad = mpRoad;
-    if(CheckLE(mpLEid,"id") == false)return;
+    if(ViewCreate::CheckLE(mpLEid,"id",true,this) == false)return;
     string id = mpLEid->text().toStdString();
 
-    if(CheckLE(mpLEt,"t") == false)return;
+    if(ViewCreate::CheckLE(mpLEt,"t",true,this) == false)return;
     double t = mpLEt->text().toDouble();
 
-    if(CheckLE(mpLEs,"s") == false)return;
+    if(ViewCreate::CheckLE(mpLEs,"s",true,this) == false)return;
     double s = mpLEs->text().toDouble();
 
-    if(CheckLE(mpLEzOffset,"zOffset") == false)return;
+    if(ViewCreate::CheckLE(mpLEzOffset,"zOffset",true,this) == false)return;
     double zOffset = mpLEzOffset->text().toDouble();
 
     double length,width,hdg;
     if(mpCBtype->currentText() == "parkingSpace")
     {
-        if(CheckLE(mpLElength,"length") == false)return;
+        if(ViewCreate::CheckLE(mpLElength,"length",true,this) == false)return;
         length = mpLElength->text().toDouble();
 
-        if(CheckLE(mpLEwidth,"width") == false)return;
+        if(ViewCreate::CheckLE(mpLEwidth,"width",true,this) == false)return;
         width = mpLEwidth->text().toDouble();
 
-        if(CheckLE(mpLEhdg,"hdg") == false)return;
+        if(ViewCreate::CheckLE(mpLEhdg,"hdg",true,this) == false)return;
         hdg = mpLEhdg->text().toDouble();
     }
 
@@ -172,7 +152,7 @@ void DialogRoadObject::on_pushButton_add_clicked()
 
     pObject->Settype(mpCBtype->currentText().toStdString());
 
-    if(CheckLE(mpLEvalidLength,"validLength",false))
+    if(ViewCreate::CheckLE(mpLEvalidLength,"validLength",false,this))
     {
         pObject->SetvalidLength(mpLEvalidLength->text().toDouble());
     }
@@ -182,7 +162,7 @@ void DialogRoadObject::on_pushButton_add_clicked()
         pObject->Setorientation(mpCBorientation->currentText().toStdString());
     }
 
-    if(CheckLE(mpLEsubtype,"subtype",false))
+    if(ViewCreate::CheckLE(mpLEsubtype,"subtype",false,this))
     {
         pObject->Setsubtype(mpLEsubtype->text().toStdString());
     }
@@ -192,42 +172,42 @@ void DialogRoadObject::on_pushButton_add_clicked()
         pObject->Setdynamic(mpCBdynamic->currentText().toStdString());
     }
 
-    if(CheckLE(mpLEname,"name",false))
+    if(ViewCreate::CheckLE(mpLEname,"name",false,this))
     {
         pObject->Setname(mpLEname->text().toStdString());
     }
 
-    if(CheckLE(mpLEhdg,"hdg",false))
+    if(ViewCreate::CheckLE(mpLEhdg,"hdg",false,this))
     {
         pObject->Sethdg(mpLEhdg->text().toDouble());
     }
 
-    if(CheckLE(mpLEpitch,"pitch",false))
+    if(ViewCreate::CheckLE(mpLEpitch,"pitch",false,this))
     {
         pObject->Setpitch(mpLEpitch->text().toDouble());
     }
 
-    if(CheckLE(mpLEroll,"roll",false))
+    if(ViewCreate::CheckLE(mpLEroll,"roll",false,this))
     {
         pObject->Setroll(mpLEroll->text().toDouble());
     }
 
-    if(CheckLE(mpLEheight,"height",false))
+    if(ViewCreate::CheckLE(mpLEheight,"height",false,this))
     {
         pObject->Setheight(mpLEheight->text().toDouble());
     }
 
-    if(CheckLE(mpLElength,"length",false))
+    if(ViewCreate::CheckLE(mpLElength,"length",false,this))
     {
         pObject->Setlength(mpLElength->text().toDouble());
     }
 
-    if(CheckLE(mpLEwidth,"width",false))
+    if(ViewCreate::CheckLE(mpLEwidth,"width",false,this))
     {
         pObject->Setwidth(mpLEwidth->text().toDouble());
     }
 
-    if(CheckLE(mpLEradius,"radius",false))
+    if(ViewCreate::CheckLE(mpLEradius,"radius",false,this))
     {
         pObject->Setradius(mpLEradius->text().toDouble());
     }
@@ -369,29 +349,29 @@ void DialogRoadObject::on_pushButton_change_clicked()
         return;
     }
 
-    if(CheckLE(mpLEid,"id") == false)return;
+    if(ViewCreate::CheckLE(mpLEid,"id",true,this) == false)return;
     string id = mpLEid->text().toStdString();
 
-    if(CheckLE(mpLEt,"t") == false)return;
+    if(ViewCreate::CheckLE(mpLEt,"t",true,this) == false)return;
     double t = mpLEt->text().toDouble();
 
-    if(CheckLE(mpLEs,"s") == false)return;
+    if(ViewCreate::CheckLE(mpLEs,"s",true,this) == false)return;
     double s = mpLEs->text().toDouble();
 
-    if(CheckLE(mpLEzOffset,"zOffset") == false)return;
+    if(ViewCreate::CheckLE(mpLEzOffset,"zOffset",true,this) == false)return;
     double zOffset = mpLEzOffset->text().toDouble();
 
 
     double length,width,hdg;
     if(mpCBtype->currentText() == "parkingSpace")
     {
-        if(CheckLE(mpLElength,"length") == false)return;
+        if(ViewCreate::CheckLE(mpLElength,"length",true,this) == false)return;
         length = mpLElength->text().toDouble();
 
-        if(CheckLE(mpLEwidth,"width") == false)return;
+        if(ViewCreate::CheckLE(mpLEwidth,"width",true,this) == false)return;
         width = mpLEwidth->text().toDouble();
 
-        if(CheckLE(mpLEhdg,"hdg") == false)return;
+        if(ViewCreate::CheckLE(mpLEhdg,"hdg",true,this) == false)return;
         hdg = mpLEhdg->text().toDouble();
     }
 
@@ -402,7 +382,7 @@ void DialogRoadObject::on_pushButton_change_clicked()
 
     pObject->Settype(mpCBtype->currentText().toStdString());
 
-    if(CheckLE(mpLEvalidLength,"validLength",false))
+    if(ViewCreate::CheckLE(mpLEvalidLength,"validLength",false,this))
     {
         pObject->SetvalidLength(mpLEvalidLength->text().toDouble());
     }
@@ -412,7 +392,7 @@ void DialogRoadObject::on_pushButton_change_clicked()
         pObject->Setorientation(mpCBorientation->currentText().toStdString());
     }
 
-    if(CheckLE(mpLEsubtype,"subtype",false))
+    if(ViewCreate::CheckLE(mpLEsubtype,"subtype",false,this))
     {
         pObject->Setsubtype(mpLEsubtype->text().toStdString());
     }
@@ -422,42 +402,42 @@ void DialogRoadObject::on_pushButton_change_clicked()
         pObject->Setdynamic(mpCBdynamic->currentText().toStdString());
     }
 
-    if(CheckLE(mpLEhdg,"hdg",false))
+    if(ViewCreate::CheckLE(mpLEhdg,"hdg",false,this))
     {
         pObject->Sethdg(mpLEhdg->text().toDouble());
     }
 
-    if(CheckLE(mpLEname,"name",false))
+    if(ViewCreate::CheckLE(mpLEname,"name",false,this))
     {
         pObject->Setname(mpLEname->text().toStdString());
     }
 
-    if(CheckLE(mpLEpitch,"pitch",false))
+    if(ViewCreate::CheckLE(mpLEpitch,"pitch",false,this))
     {
         pObject->Setpitch(mpLEpitch->text().toDouble());
     }
 
-    if(CheckLE(mpLEroll,"roll",false))
+    if(ViewCreate::CheckLE(mpLEroll,"roll",false,this))
     {
         pObject->Setroll(mpLEroll->text().toDouble());
     }
 
-    if(CheckLE(mpLEheight,"height",false))
+    if(ViewCreate::CheckLE(mpLEheight,"height",false,this))
     {
         pObject->Setheight(mpLEheight->text().toDouble());
     }
 
-    if(CheckLE(mpLElength,"length",false))
+    if(ViewCreate::CheckLE(mpLElength,"length",false,this))
     {
         pObject->Setlength(mpLElength->text().toDouble());
     }
 
-    if(CheckLE(mpLEwidth,"width",false))
+    if(ViewCreate::CheckLE(mpLEwidth,"width",false,this))
     {
         pObject->Setwidth(mpLEwidth->text().toDouble());
     }
 
-    if(CheckLE(mpLEradius,"radius",false))
+    if(ViewCreate::CheckLE(mpLEradius,"radius",false,this))
     {
         pObject->Setradius(mpLEradius->text().toDouble());
     }
@@ -465,3 +445,29 @@ void DialogRoadObject::on_pushButton_change_clicked()
     QMessageBox::information(this,"Info","Change Object Successfull.",QMessageBox::YesAll);
 }
 
+void DialogRoadObject::onClickMaterial()
+{
+    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_material dlgmaterail(pObject);
+
+    dlgmaterail.exec();
+}
+

+ 17 - 3
src/tool/map_lanetoxodr/dialogroadobject.h

@@ -5,9 +5,14 @@
 #include <QLineEdit>
 #include <QLabel>
 #include <QComboBox>
+#include <QPushButton>
+
+#include "viewcreate.h"
 
 #include <OpenDrive/OpenDrive.h>
 
+#include "dialogroadobject_material.h"
+
 namespace Ui {
 class DialogRoadObject;
 }
@@ -29,6 +34,8 @@ private slots:
 
     void on_pushButton_change_clicked();
 
+    void onClickMaterial();
+
 private:
     Ui::DialogRoadObject *ui;
 
@@ -54,10 +61,17 @@ private:
     QLineEdit * mpLEwidth;
     QLineEdit * mpLEradius;
 
+    QPushButton * mpPBmaterial;
+    QPushButton * mpPBrepeat;
+    QPushButton * mpPBparkingspace;
+    QPushButton * mpPBoutlines;
+    QPushButton * mpPBoutline;
+    QPushButton * mpPBmarkings;
+    QPushButton * mpPBborders;
+    QPushButton * mpPBvalidity;
+
 private:
-    QLineEdit * CreateLE(int pos_x,int pos_y,int nLabelWidth,int nLEWidth,int nHeight,std::string strname);
-    QComboBox * CreateCB(int pos_x,int pos_y,int nLabelWidth,int nLEWidth,int nHeight,std::string strname);
-    bool CheckLE(QLineEdit * pLE,QString stritemname,bool bWarning = true);
+
 private:
     Road * mpRoad;
 };

+ 198 - 0
src/tool/map_lanetoxodr/dialogroadobject_material.cpp

@@ -0,0 +1,198 @@
+#include "dialogroadobject_material.h"
+#include "ui_dialogroadobject_material.h"
+
+#include <QMessageBox>
+
+DialogRoadObject_material::DialogRoadObject_material(Object * pObject,QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::DialogRoadObject_material)
+{
+    ui->setupUi(this);
+
+    mpObject = pObject;
+
+    UpdateList();
+
+    setWindowTitle("Edit Object Material");
+
+
+}
+
+DialogRoadObject_material::~DialogRoadObject_material()
+{
+    delete ui;
+}
+
+void DialogRoadObject_material::UpdateList()
+{
+    ui->comboBox_material->clear();
+    ui->lineEdit_friction->setText("");
+    ui->lineEdit_surface->setText("");
+    ui->lineEdit_roughness->setText("");
+    if(mpObject == 0)return;
+
+    Object * pObject = mpObject;
+
+    if(pObject->GetObjectmaterialCount() == 0)return;
+
+    unsigned int i;
+    for(i=0;i<pObject->GetObjectmaterialCount();i++)
+    {
+        Object_material * pObject_material = pObject->GetObjectmaterial(i);
+        if(pObject_material == 0)return;
+        ui->comboBox_material->addItem("material"+QString::number(i));
+    }
+
+}
+
+void DialogRoadObject_material::on_comboBox_material_currentIndexChanged(int index)
+{
+    if(index<0)return;
+    if(mpObject == 0)return;
+
+    Object * pObject = mpObject;
+
+    Object_material * pobject_material = pObject->GetObjectmaterial(index);
+
+    string surface;
+    double friction,roughness;
+
+    if(pobject_material->Getsurface(surface) == 1)
+    {
+        ui->lineEdit_surface->setText(surface.data());
+    }
+    else
+    {
+        ui->lineEdit_surface->setText("");
+    }
+
+    if(pobject_material->Getfriction(friction) == 1)
+    {
+        ui->lineEdit_friction->setText(QString::number(friction));
+    }
+    else
+    {
+        ui->lineEdit_friction->setText("");
+    }
+
+    if(pobject_material->Getroughness(roughness) == 1)
+    {
+        ui->lineEdit_roughness->setText(QString::number(roughness));
+    }
+    else
+    {
+        ui->lineEdit_roughness->setText("");
+    }
+}
+
+void DialogRoadObject_material::on_pushButton_Add_clicked()
+{
+    if(mpObject == 0)
+    {
+        QMessageBox::warning(this,"Warning","Object is NULL.",QMessageBox::YesAll);
+        return;
+    }
+
+    Object * pObject = mpObject;
+
+    pObject->AddObjectmaterial();
+
+    Object_material * pObject_material = pObject->GetLastAddedObjectmaterial();
+
+    if(pObject_material == 0)return;
+
+    if(ui->lineEdit_surface->text() != "")
+    {
+        string surface = ui->lineEdit_surface->text().toStdString();
+        pObject_material->Setsurface(surface);
+    }
+
+    if(ui->lineEdit_friction->text() != "")
+    {
+        pObject_material->Setfriction(ui->lineEdit_friction->text().toDouble());
+    }
+
+    if(ui->lineEdit_roughness->text() != "")
+    {
+        pObject_material->Setroughness(ui->lineEdit_roughness->text().toDouble());
+    }
+
+    UpdateList();
+}
+
+void DialogRoadObject_material::on_pushButton_Delete_clicked()
+{
+    if(mpObject == 0)
+    {
+        QMessageBox::warning(this,"Warning","Object is NULL.",QMessageBox::YesAll);
+        return;
+    }
+
+    Object * pObject = mpObject;
+
+    if(pObject->GetObjectmaterialCount() == 0)
+    {
+        QMessageBox::information(this,"Info","No material",QMessageBox::YesAll);
+        return;
+    }
+
+    int index = ui->comboBox_material->currentIndex();
+
+    pObject->DeleteObjectmaterial(index);
+    UpdateList();
+}
+
+void DialogRoadObject_material::on_pushButton_Change_clicked()
+{
+    if(mpObject == 0)
+    {
+        QMessageBox::warning(this,"Warning","Object is NULL.",QMessageBox::YesAll);
+        return;
+    }
+
+    Object * pObject = mpObject;
+
+    if(pObject->GetObjectmaterialCount() == 0)
+    {
+        QMessageBox::warning(this,"Warning","No material",QMessageBox::YesAll);
+        return;
+    }
+
+    int index = ui->comboBox_material->currentIndex();
+
+    Object_material * pObject_material = pObject->GetObjectmaterial(index);
+
+    if(pObject_material == 0)return;
+
+    if(ui->lineEdit_surface->text() != "")
+    {
+        string surface = ui->lineEdit_surface->text().toStdString();
+        pObject_material->Setsurface(surface);
+    }
+    else
+    {
+        pObject_material->Clearsurface();
+    }
+
+    if(ui->lineEdit_friction->text() != "")
+    {
+        pObject_material->Setfriction(ui->lineEdit_friction->text().toDouble());
+    }
+    else
+    {
+        pObject_material->Clearfriction();
+    }
+
+    if(ui->lineEdit_roughness->text() != "")
+    {
+        pObject_material->Setroughness(ui->lineEdit_roughness->text().toDouble());
+    }
+    else
+    {
+        pObject_material->Clearroughness();
+    }
+
+    QMessageBox::information(this,"Info","Change Object Material Successfully.",QMessageBox::YesAll);
+    UpdateList();
+    ui->comboBox_material->setCurrentIndex(index);
+}

+ 37 - 0
src/tool/map_lanetoxodr/dialogroadobject_material.h

@@ -0,0 +1,37 @@
+#ifndef DIALOGROADOBJECT_MATERIAL_H
+#define DIALOGROADOBJECT_MATERIAL_H
+
+#include <QDialog>
+
+#include <OpenDrive/OpenDrive.h>
+
+namespace Ui {
+class DialogRoadObject_material;
+}
+
+class DialogRoadObject_material : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit DialogRoadObject_material(Object * pObject,QWidget *parent = nullptr);
+    ~DialogRoadObject_material();
+
+private slots:
+    void on_comboBox_material_currentIndexChanged(int index);
+
+    void on_pushButton_Add_clicked();
+
+    void on_pushButton_Delete_clicked();
+
+    void on_pushButton_Change_clicked();
+
+private:
+    Ui::DialogRoadObject_material *ui;
+
+    Object * mpObject = 0;
+
+    void UpdateList();
+};
+
+#endif // DIALOGROADOBJECT_MATERIAL_H

+ 150 - 0
src/tool/map_lanetoxodr/dialogroadobject_material.ui

@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogRoadObject_material</class>
+ <widget class="QDialog" name="DialogRoadObject_material">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>663</width>
+    <height>463</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <widget class="QComboBox" name="comboBox_material">
+   <property name="geometry">
+    <rect>
+     <x>140</x>
+     <y>40</y>
+     <width>171</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>48</y>
+     <width>91</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>material</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>130</y>
+     <width>81</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>surface</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_surface">
+   <property name="geometry">
+    <rect>
+     <x>140</x>
+     <y>128</y>
+     <width>151</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_friction">
+   <property name="geometry">
+    <rect>
+     <x>140</x>
+     <y>208</y>
+     <width>151</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_3">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>210</y>
+     <width>81</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>friction</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_roughness">
+   <property name="geometry">
+    <rect>
+     <x>440</x>
+     <y>208</y>
+     <width>151</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_4">
+   <property name="geometry">
+    <rect>
+     <x>330</x>
+     <y>210</y>
+     <width>101</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>roughness</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_Add">
+   <property name="geometry">
+    <rect>
+     <x>50</x>
+     <y>320</y>
+     <width>111</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Add</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_Delete">
+   <property name="geometry">
+    <rect>
+     <x>236</x>
+     <y>320</y>
+     <width>111</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Delete</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_Change">
+   <property name="geometry">
+    <rect>
+     <x>420</x>
+     <y>320</y>
+     <width>111</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Change</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 21 - 0
src/tool/map_lanetoxodr/dialogroadobject_repeat.cpp

@@ -0,0 +1,21 @@
+#include "dialogroadobject_repeat.h"
+#include "ui_dialogroadobject_repeat.h"
+
+DialogRoadObject_repeat::DialogRoadObject_repeat(Object * pObject,QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::DialogRoadObject_repeat)
+{
+    ui->setupUi(this);
+
+    mpObject = pObject;
+}
+
+DialogRoadObject_repeat::~DialogRoadObject_repeat()
+{
+    delete ui;
+}
+
+void DialogRoadObject_repeat::UpdateList()
+{
+
+}

+ 28 - 0
src/tool/map_lanetoxodr/dialogroadobject_repeat.h

@@ -0,0 +1,28 @@
+#ifndef DIALOGROADOBJECT_REPEAT_H
+#define DIALOGROADOBJECT_REPEAT_H
+
+#include <QDialog>
+
+#include <OpenDrive/OpenDrive.h>
+
+namespace Ui {
+class DialogRoadObject_repeat;
+}
+
+class DialogRoadObject_repeat : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit DialogRoadObject_repeat(Object * pObject,QWidget *parent = nullptr);
+    ~DialogRoadObject_repeat();
+
+private:
+    Ui::DialogRoadObject_repeat *ui;
+
+    Object * mpObject = 0;
+
+    void UpdateList();
+};
+
+#endif // DIALOGROADOBJECT_REPEAT_H

+ 42 - 0
src/tool/map_lanetoxodr/dialogroadobject_repeat.ui

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogRoadObject_repeat</class>
+ <widget class="QDialog" name="DialogRoadObject_repeat">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>864</width>
+    <height>567</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <widget class="QComboBox" name="comboBox_material">
+   <property name="geometry">
+    <rect>
+     <x>150</x>
+     <y>30</y>
+     <width>171</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>38</y>
+     <width>91</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>material</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

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

@@ -44,6 +44,8 @@ SOURCES += \
     dialogroadmirror.cpp \
     dialogroadmove.cpp \
     dialogroadobject.cpp \
+    dialogroadobject_material.cpp \
+    dialogroadobject_repeat.cpp \
     dialogroadoptimize.cpp \
     dialogroadrotate.cpp \
     dialogroadsplit.cpp \
@@ -59,6 +61,7 @@ SOURCES += \
     trafficlightdialog.cpp \
     trafficlightlanevaliditydialog.cpp \
     trafficlightpositiondialog.cpp \
+    viewcreate.cpp \
     xodr.cpp \
     myview.cpp \
     linedata.cpp \
@@ -95,6 +98,8 @@ HEADERS += \
     dialogroadmirror.h \
     dialogroadmove.h \
     dialogroadobject.h \
+    dialogroadobject_material.h \
+    dialogroadobject_repeat.h \
     dialogroadoptimize.h \
     dialogroadrotate.h \
     dialogroadsplit.h \
@@ -110,6 +115,7 @@ HEADERS += \
     trafficlightdialog.h \
     trafficlightlanevaliditydialog.h \
     trafficlightpositiondialog.h \
+    viewcreate.h \
     xodr.h \
     myview.h \
     boost.h \
@@ -140,6 +146,8 @@ FORMS += \
         dialogroadmirror.ui \
         dialogroadmove.ui \
         dialogroadobject.ui \
+        dialogroadobject_material.ui \
+        dialogroadobject_repeat.ui \
         dialogroadoptimize.ui \
         dialogroadrotate.ui \
         dialogroadsplit.ui \

+ 52 - 0
src/tool/map_lanetoxodr/viewcreate.cpp

@@ -0,0 +1,52 @@
+#include "viewcreate.h"
+
+ViewCreate::ViewCreate()
+{
+
+}
+
+QPushButton * ViewCreate::CreatePB(int pos_x, int pos_y, int nPBWidth, int nHeight, std::string strname,QWidget *parent)
+{
+    QPushButton * pPB;
+    pPB = new QPushButton(parent);
+    pPB->setGeometry(pos_x,pos_y,nPBWidth,nHeight);
+    pPB->setText(strname.data());
+    return pPB;
+}
+
+QLineEdit * ViewCreate::CreateLE(int pos_x, int pos_y, int nLabelWidth, int nLEWidth, int nHeight, std::string strname,QWidget *parent)
+{
+    QLineEdit * pLE;
+    QLabel * pLabel;
+    pLabel = new QLabel(parent);
+    pLabel->setGeometry(pos_x,pos_y,nLabelWidth,nHeight);
+    pLabel->setText(strname.data());
+    pLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+    pLE = new QLineEdit(parent);
+    pLE->setGeometry(pos_x+nLabelWidth+10,pos_y,nLEWidth,nHeight);
+    return pLE;
+}
+
+QComboBox * ViewCreate::CreateCB(int pos_x, int pos_y, int nLabelWidth, int nLEWidth, int nHeight, std::string strname,QWidget *parent)
+{
+    QComboBox * pCB;
+    QLabel * pLabel;
+    pLabel = new QLabel(parent);
+    pLabel->setGeometry(pos_x,pos_y,nLabelWidth,nHeight);
+    pLabel->setText(strname.data());
+    pLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+    pCB = new QComboBox(parent);
+    pCB->setGeometry(pos_x+nLabelWidth+10,pos_y,nLEWidth,nHeight);
+    return pCB;
+}
+
+bool ViewCreate::CheckLE(QLineEdit *pLE, QString stritemname,bool bWarning,QWidget *parent)
+{
+    QString str = pLE->text();
+    if(str == "")
+    {
+        if(bWarning)QMessageBox::warning(parent,"Warning",stritemname + " is not set",QMessageBox::YesAll);
+        return false;
+    }
+    return true;
+}

+ 21 - 0
src/tool/map_lanetoxodr/viewcreate.h

@@ -0,0 +1,21 @@
+#ifndef VIEWCREATE_H
+#define VIEWCREATE_H
+
+#include <QMessageBox>
+#include <QLineEdit>
+#include <QLabel>
+#include <QComboBox>
+#include <QPushButton>
+
+class ViewCreate
+{
+public:
+    ViewCreate();
+public:
+    static QLineEdit * CreateLE(int pos_x,int pos_y,int nLabelWidth,int nLEWidth,int nHeight,std::string strname,QWidget *parent = nullptr);
+    static QComboBox * CreateCB(int pos_x,int pos_y,int nLabelWidth,int nLEWidth,int nHeight,std::string strname,QWidget *parent = nullptr);
+    static QPushButton * CreatePB(int pos_x, int pos_y,int nPBWidth,int nHeight,std::string strname,QWidget *parent = nullptr);
+    static bool CheckLE(QLineEdit * pLE,QString stritemname,bool bWarning = true,QWidget *parent = nullptr);
+};
+
+#endif // VIEWCREATE_H