|
@@ -0,0 +1,342 @@
|
|
|
|
+#include "dialogroadobject_outline.h"
|
|
|
|
+#include "ui_dialogroadobject_outline.h"
|
|
|
|
+
|
|
|
|
+static std::string gstr_e_outlineFillType[] ={"grass","concrete","cobble","asphalt",
|
|
|
|
+ "pavement","gravel","soil"};
|
|
|
|
+
|
|
|
|
+static const int goutlineFillTypeCount = 7;
|
|
|
|
+
|
|
|
|
+static std::string gstr_e_laneType[] = {"shoulder","border","driving","stop","none",
|
|
|
|
+ "restricted","parking","median","biking","sidewalk",
|
|
|
|
+ "curb","exit","entry","onRamp","offRamp",
|
|
|
|
+ "connectingRamp","bidirectional","special1","special2","special3",
|
|
|
|
+ "roadWorks","tram","rail","bus","taxi",
|
|
|
|
+ "HOV","mwyEntry","mwyExit"};
|
|
|
|
+
|
|
|
|
+static const int glaneTypeCount = 33;
|
|
|
|
+
|
|
|
|
+DialogRoadObject_outline::DialogRoadObject_outline(Object * pObject,QWidget *parent) :
|
|
|
|
+ QDialog(parent),
|
|
|
|
+ ui(new Ui::DialogRoadObject_outline)
|
|
|
|
+{
|
|
|
|
+ ui->setupUi(this);
|
|
|
|
+
|
|
|
|
+ mpObject = pObject;
|
|
|
|
+ CreateView();
|
|
|
|
+
|
|
|
|
+ int i;
|
|
|
|
+ for(i=0;i<goutlineFillTypeCount;i++)
|
|
|
|
+ {
|
|
|
|
+ mpCBfillType->addItem(gstr_e_outlineFillType[i].data());
|
|
|
|
+ }
|
|
|
|
+ mpCBfillType->addItem("NO");
|
|
|
|
+
|
|
|
|
+ for(i=0;i<glaneTypeCount;i++)
|
|
|
|
+ {
|
|
|
|
+ mpCBlaneType->addItem(gstr_e_laneType[i].data());
|
|
|
|
+ }
|
|
|
|
+ mpCBlaneType->addItem("NO");
|
|
|
|
+ mpCBouter->addItem("true");
|
|
|
|
+ mpCBouter->addItem("false");
|
|
|
|
+ mpCBouter->addItem("NO");
|
|
|
|
+ mpCBclosed->addItem("true");
|
|
|
|
+ mpCBclosed->addItem("false");
|
|
|
|
+ mpCBclosed->addItem("NO");
|
|
|
|
+
|
|
|
|
+ UpdateCB();
|
|
|
|
+ setWindowTitle("Edit Road Object Outline");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+DialogRoadObject_outline::~DialogRoadObject_outline()
|
|
|
|
+{
|
|
|
|
+ delete ui;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void DialogRoadObject_outline::CreateView()
|
|
|
|
+{
|
|
|
|
+ int startpos_x = 30;
|
|
|
|
+ int startpos_y = 30;
|
|
|
|
+ int nSpace = 260;
|
|
|
|
+ int nLabelWidth = 80;
|
|
|
|
+ int nLEWidth = 150;
|
|
|
|
+ int nHeight = 35;
|
|
|
|
+ int nVSpace = 60;
|
|
|
|
+ int nVIndex = 0;
|
|
|
|
+
|
|
|
|
+ mpCBOutline = ViewCreate::CreateCB(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"outline",this);
|
|
|
|
+ nVIndex++;
|
|
|
|
+
|
|
|
|
+ mpLEid = ViewCreate::CreateLE(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"id",this);
|
|
|
|
+ mpCBfillType = ViewCreate::CreateCB(startpos_x+1*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"fillType",this);
|
|
|
|
+
|
|
|
|
+ nVIndex++;
|
|
|
|
+ mpCBouter = ViewCreate::CreateCB(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"outer",this);
|
|
|
|
+ mpCBclosed = ViewCreate::CreateCB(startpos_x+1*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"closed",this);
|
|
|
|
+
|
|
|
|
+ nVIndex++;
|
|
|
|
+ mpCBlaneType = ViewCreate::CreateCB(startpos_x+0*nSpace,startpos_y+nVIndex*nVSpace,nLabelWidth,nLEWidth,nHeight,"laneType",this);
|
|
|
|
+
|
|
|
|
+ nVIndex++;
|
|
|
|
+ int nPBSpace = 150;
|
|
|
|
+ int nPBWidth = 100;
|
|
|
|
+ mpPBAdd = ViewCreate::CreatePB(startpos_x+0*nPBSpace,startpos_y+nVIndex*nVSpace,nPBWidth,nHeight,"Add",this);
|
|
|
|
+ mpPBDelete = ViewCreate::CreatePB(startpos_x+1*nPBSpace,startpos_y+nVIndex*nVSpace,nPBWidth,nHeight,"Delete",this);
|
|
|
|
+ mpPBChange = ViewCreate::CreatePB(startpos_x+2*nPBSpace,startpos_y+nVIndex*nVSpace,nPBWidth,nHeight,"Change",this);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ connect(mpCBOutline,SIGNAL(currentIndexChanged(int)),this,SLOT(CurrentOutline(int)));
|
|
|
|
+ connect(mpPBAdd,SIGNAL(clicked(bool)),this,SLOT(onClickAdd()));
|
|
|
|
+ connect(mpPBDelete,SIGNAL(clicked(bool)),this,SLOT(onClickDelete()));
|
|
|
|
+ connect(mpPBChange,SIGNAL(clicked(bool)),this,SLOT(onClickChange()));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void DialogRoadObject_outline::UpdateCB()
|
|
|
|
+{
|
|
|
|
+ mpCBOutline->clear();
|
|
|
|
+ int i;
|
|
|
|
+ if(mpObject == 0)return;
|
|
|
|
+ Object * pObject = mpObject;
|
|
|
|
+
|
|
|
|
+ int nOutlineCount = pObject->GetObjectoutlineCount();
|
|
|
|
+ for(i=0;i<nOutlineCount;i++)
|
|
|
|
+ {
|
|
|
|
+ mpCBOutline->addItem(QString("Outline ")+ QString::number(i));
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void DialogRoadObject_outline::CurrentOutline(int index)
|
|
|
|
+{
|
|
|
|
+ if(index == -1)return;
|
|
|
|
+ if(mpObject == 0)return;
|
|
|
|
+
|
|
|
|
+ Object_outlines_outline * poutline = mpObject->GetObjectoutline(index);
|
|
|
|
+
|
|
|
|
+ if(poutline == 0)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ int id;
|
|
|
|
+ int i;
|
|
|
|
+ if(poutline->Getid(id) == 1)
|
|
|
|
+ {
|
|
|
|
+ mpLEid->setText(QString::number(id));
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ mpLEid->setText("");
|
|
|
|
+ }
|
|
|
|
+ std::string strfillType;
|
|
|
|
+ if(poutline->GetfillType(strfillType) == 1)
|
|
|
|
+ {
|
|
|
|
+ int index = goutlineFillTypeCount;
|
|
|
|
+ for(i=0;i<goutlineFillTypeCount;i++)
|
|
|
|
+ {
|
|
|
|
+ if(strfillType == gstr_e_outlineFillType[i])
|
|
|
|
+ {
|
|
|
|
+ index = i;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ mpCBfillType->setCurrentIndex(index);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ mpCBfillType->setCurrentIndex(goutlineFillTypeCount);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ bool outer;
|
|
|
|
+ if(poutline->Getouter(outer) == 1)
|
|
|
|
+ {
|
|
|
|
+ if(outer)mpCBouter->setCurrentIndex(0);
|
|
|
|
+ else mpCBouter->setCurrentIndex(1);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ mpCBouter->setCurrentIndex(2);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ bool closed;
|
|
|
|
+ if(poutline->Getclosed(closed) == 1)
|
|
|
|
+ {
|
|
|
|
+ if(closed)mpCBclosed->setCurrentIndex(0);
|
|
|
|
+ else mpCBclosed->setCurrentIndex(1);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ mpCBclosed->setCurrentIndex(2);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ std::string strlaneType;
|
|
|
|
+ if(poutline->GetlaneType(strlaneType) == 1)
|
|
|
|
+ {
|
|
|
|
+ int index = glaneTypeCount;
|
|
|
|
+ for(i=0;i<glaneTypeCount;i++)
|
|
|
|
+ {
|
|
|
|
+ if(strlaneType == gstr_e_laneType[i])
|
|
|
|
+ {
|
|
|
|
+ index = i;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ mpCBlaneType->setCurrentIndex(index);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void DialogRoadObject_outline::onClickAdd()
|
|
|
|
+{
|
|
|
|
+ Object * pObject = mpObject;
|
|
|
|
+
|
|
|
|
+ if(mpObject == 0)return;
|
|
|
|
+
|
|
|
|
+ pObject->AddObjectoutline();
|
|
|
|
+
|
|
|
|
+ Object_outlines_outline * poutline = pObject->GetLastAddedObjectoutline();
|
|
|
|
+
|
|
|
|
+ if(poutline == NULL)return;
|
|
|
|
+
|
|
|
|
+ if(ViewCreate::CheckLE(mpLEid,"id",false,this) == true)
|
|
|
|
+ {
|
|
|
|
+ int id = mpLEid->text().toInt();
|
|
|
|
+ poutline->Setid(id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ std::string strFillType;
|
|
|
|
+ if(mpCBfillType->currentIndex() != goutlineFillTypeCount)
|
|
|
|
+ {
|
|
|
|
+ strFillType = mpCBfillType->currentText().toStdString();
|
|
|
|
+ poutline->SetfillType(strFillType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ bool outer;
|
|
|
|
+ if(mpCBouter->currentIndex() == 0)
|
|
|
|
+ {
|
|
|
|
+ outer = true;
|
|
|
|
+ poutline->Setouter(outer);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if(mpCBouter->currentIndex() == 1)
|
|
|
|
+ {
|
|
|
|
+ outer = false;
|
|
|
|
+ poutline->Setouter(outer);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ bool closed;
|
|
|
|
+ if(mpCBclosed->currentIndex() == 0)
|
|
|
|
+ {
|
|
|
|
+ closed = true;
|
|
|
|
+ poutline->Setclosed(closed);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if(mpCBclosed->currentIndex() == 1)
|
|
|
|
+ {
|
|
|
|
+ closed = false;
|
|
|
|
+ poutline->Setclosed(closed);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ std::string strlaneType;
|
|
|
|
+ if(mpCBlaneType->currentIndex() != glaneTypeCount)
|
|
|
|
+ {
|
|
|
|
+ strlaneType = mpCBlaneType->currentText().toStdString();
|
|
|
|
+ poutline->SetlaneType(strlaneType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ UpdateCB();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void DialogRoadObject_outline::onClickDelete()
|
|
|
|
+{
|
|
|
|
+ Object * pObject = mpObject;
|
|
|
|
+
|
|
|
|
+ if(mpObject == 0)return;
|
|
|
|
+
|
|
|
|
+ if(pObject->GetObjectoutlineCount() == 0)
|
|
|
|
+ {
|
|
|
|
+ QMessageBox::warning(this,"Warning","No Outline",QMessageBox::YesAll);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ int index = mpCBOutline->currentIndex();
|
|
|
|
+ pObject->DeleteObjectoutline(index);
|
|
|
|
+
|
|
|
|
+ UpdateCB();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void DialogRoadObject_outline::onClickChange()
|
|
|
|
+{
|
|
|
|
+ Object * pObject = mpObject;
|
|
|
|
+
|
|
|
|
+ if(mpObject == 0)return;
|
|
|
|
+
|
|
|
|
+ if(pObject->GetObjectoutlineCount() == 0)
|
|
|
|
+ {
|
|
|
|
+ QMessageBox::warning(this,"Warning","No Outline",QMessageBox::YesAll);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Object_outlines_outline * poutline = pObject->GetObjectoutline(mpCBOutline->currentIndex());
|
|
|
|
+
|
|
|
|
+ if(poutline == NULL)return;
|
|
|
|
+
|
|
|
|
+ if(ViewCreate::CheckLE(mpLEid,"id",false,this) == true)
|
|
|
|
+ {
|
|
|
|
+ int id = mpLEid->text().toInt();
|
|
|
|
+ poutline->Setid(id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ std::string strFillType;
|
|
|
|
+ if(mpCBfillType->currentIndex() != goutlineFillTypeCount)
|
|
|
|
+ {
|
|
|
|
+ strFillType = mpCBfillType->currentText().toStdString();
|
|
|
|
+ poutline->SetfillType(strFillType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ bool outer;
|
|
|
|
+ if(mpCBouter->currentIndex() == 0)
|
|
|
|
+ {
|
|
|
|
+ outer = true;
|
|
|
|
+ poutline->Setouter(outer);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if(mpCBouter->currentIndex() == 1)
|
|
|
|
+ {
|
|
|
|
+ outer = false;
|
|
|
|
+ poutline->Setouter(outer);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ bool closed;
|
|
|
|
+ if(mpCBclosed->currentIndex() == 0)
|
|
|
|
+ {
|
|
|
|
+ closed = true;
|
|
|
|
+ poutline->Setclosed(closed);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if(mpCBclosed->currentIndex() == 1)
|
|
|
|
+ {
|
|
|
|
+ closed = false;
|
|
|
|
+ poutline->Setclosed(closed);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ std::string strlaneType;
|
|
|
|
+ if(mpCBlaneType->currentIndex() != glaneTypeCount)
|
|
|
|
+ {
|
|
|
|
+ strlaneType = mpCBlaneType->currentText().toStdString();
|
|
|
|
+ poutline->SetlaneType(strlaneType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ UpdateCB();
|
|
|
|
+ QMessageBox::information(this,"Info","Change outline successfully.",QMessageBox::YesAll);
|
|
|
|
+}
|
|
|
|
+
|