|
@@ -473,7 +473,7 @@ void MainWindow::onTimer()
|
|
|
void MainWindow::CreateTab1View(QTabWidget * p)
|
|
|
{
|
|
|
QGroupBox * pGroup = new QGroupBox();
|
|
|
- pGroup->setGeometry(0,0,mnFontHeight * 21,mnFontHeight * 110);
|
|
|
+ pGroup->setGeometry(0,0,mnFontHeight * 21,mnFontHeight * 160);
|
|
|
|
|
|
QLabel * pLabel;
|
|
|
QLineEdit * pLE;
|
|
@@ -1011,6 +1011,12 @@ void MainWindow::CreateTab1View(QTabWidget * p)
|
|
|
pPB->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
|
|
|
connect(pPB,SIGNAL(clicked(bool)),this,SLOT(onClickRoadContact()));
|
|
|
|
|
|
+ nXPos = nXPos + nSpace;
|
|
|
+ pPB = new QPushButton(pGroup);
|
|
|
+ pPB->setText("Auto Road Contact");
|
|
|
+ pPB->setGeometry(nXPos,nYPos,nLEWidth*3/2,nLEHeight);
|
|
|
+ connect(pPB,SIGNAL(clicked(bool)),this,SLOT(onClickAutoRoadContact()));
|
|
|
+
|
|
|
nXPos = 10;
|
|
|
nYPos = nYPos + mnFontHeight * 4;
|
|
|
|
|
@@ -2999,6 +3005,114 @@ void MainWindow::onClickSave()
|
|
|
mpfb->Activate(str);
|
|
|
}
|
|
|
|
|
|
+void MainWindow::onClickAutoRoadContact()
|
|
|
+{
|
|
|
+ int ch1,ch2;
|
|
|
+ ch1 = mpCBRoad1->currentIndex();
|
|
|
+ ch2 = mpCBRoad2->currentIndex();
|
|
|
+ if((ch1 == -1)||(ch2 == -1))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+// if(ch1 == ch2)
|
|
|
+// {
|
|
|
+// QMessageBox::warning(this,"warn","road same");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+ int ntype1,ntype2;
|
|
|
+ ntype1 = mpCBRC1->currentIndex();
|
|
|
+ ntype2 = mpCBRC2->currentIndex();
|
|
|
+ Road * p1 = mxodr.GetRoad(ch1);
|
|
|
+ Road * p2 = mxodr.GetRoad(ch2);
|
|
|
+
|
|
|
+ int contactype;
|
|
|
+ int turnstraight;
|
|
|
+ AutoRoadContact::CalcContact(p1,p2,contactype,turnstraight);
|
|
|
+
|
|
|
+ switch (contactype) {
|
|
|
+ case 0:
|
|
|
+ mpCBRC1->setCurrentIndex(0);
|
|
|
+ mpCBRC2->setCurrentIndex(0);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ mpCBRC1->setCurrentIndex(0);
|
|
|
+ mpCBRC2->setCurrentIndex(1);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ mpCBRC1->setCurrentIndex(1);
|
|
|
+ mpCBRC2->setCurrentIndex(0);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ mpCBRC1->setCurrentIndex(1);
|
|
|
+ mpCBRC2->setCurrentIndex(1);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ntype1 = mpCBRC1->currentIndex();
|
|
|
+ ntype2 = mpCBRC2->currentIndex();
|
|
|
+ iv::roadcontact rc;
|
|
|
+ rc.mnroad1id = atoi(p1->GetRoadId().data());
|
|
|
+ rc.mnroad2id = atoi(p2->GetRoadId().data());
|
|
|
+ rc.mncon1 = ntype1;
|
|
|
+ rc.mncon2 = ntype2;
|
|
|
+
|
|
|
+ char strname[256];
|
|
|
+ snprintf(strname,256,"%s_%s_%s_%s",p1->GetRoadId().data(),mpCBRC1->currentText().toLatin1().data(),
|
|
|
+ p2->GetRoadId().data(),mpCBRC2->currentText().toLatin1().data());
|
|
|
+ mpCBRoadCon->clear();
|
|
|
+ mpCBRoadCon->addItem(strname);
|
|
|
+ mpCBLane1->clear();
|
|
|
+ mpCBLane2->clear();
|
|
|
+
|
|
|
+
|
|
|
+ mpCBLane1Lane2->clear();
|
|
|
+ mpCBLane1Lane2op->clear();
|
|
|
+
|
|
|
+ if(p1->GetLaneSectionCount()>0)
|
|
|
+ {
|
|
|
+ LaneSection * pLS;
|
|
|
+ if(ntype1 == 0)
|
|
|
+ pLS = p1->GetLaneSection(0);
|
|
|
+ else
|
|
|
+ pLS = p1->GetLaneSection(p1->GetLaneSectionCount()-1);
|
|
|
+ int i;
|
|
|
+ for(i=0;i<pLS->GetLaneCount();i++)
|
|
|
+ {
|
|
|
+ Lane * pL = pLS->GetLane(i);
|
|
|
+// if((pL->GetId() != 0)&&(strncmp(pL->GetType().data(),"driving",255)==0))
|
|
|
+ if(pL->GetId() != 0)
|
|
|
+ mpCBLane1->addItem(QString::number(pL->GetId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if(p2->GetLaneSectionCount()>0)
|
|
|
+ {
|
|
|
+ LaneSection * pLS;
|
|
|
+ if(ntype1 == 0)
|
|
|
+ pLS = p2->GetLaneSection(0);
|
|
|
+ else
|
|
|
+ pLS = p2->GetLaneSection(p2->GetLaneSectionCount()-1);
|
|
|
+ int i;
|
|
|
+ for(i=0;i<pLS->GetLaneCount();i++)
|
|
|
+ {
|
|
|
+ Lane * pL = pLS->GetLane(i);
|
|
|
+ // if((pL->GetId() != 0)&&(strncmp(pL->GetType().data(),"driving",255)==0))
|
|
|
+ if(pL->GetId() != 0)
|
|
|
+ mpCBLane2->addItem(QString::number(pL->GetId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ mvectorrc.clear();
|
|
|
+ mvectorrc.push_back(rc);
|
|
|
+
|
|
|
+ mpCBRoadType->setCurrentIndex(turnstraight);
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
void MainWindow::onClickRoadContact()
|
|
|
{
|
|
|
int ch1,ch2;
|
|
@@ -3678,6 +3792,9 @@ int MainWindow::GetEndPoint(Road *proad, double &x, double &y, double &hdg)
|
|
|
|
|
|
RoadGeometry * pgeo = pblock->GetLastGeometry();
|
|
|
|
|
|
+ proad->GetGeometryCoords(proad->GetRoadLength(),x,y,hdg);
|
|
|
+ return 0;
|
|
|
+
|
|
|
|
|
|
//0-line, 1-arc, 2-spiral 3-poly3 4-parampoly3
|
|
|
switch (pgeo->GetGeomType()) {
|
|
@@ -3720,21 +3837,35 @@ int MainWindow::GetEndPoint(Road *proad, double &x, double &y, double &hdg)
|
|
|
double s = ppoly3->GetLength();
|
|
|
// xtem = ppoly3->GetuA() + ppoly3->GetuB() * s + ppoly3->GetuC() * s*s + ppoly3->GetuD() * s*s*s ;
|
|
|
// ytem = ppoly3->GetvA() + ppoly3->GetvB() * s + ppoly3->GetvC() * s*s + ppoly3->GetvD() * s*s*s ;
|
|
|
- xtem = ppoly3->GetuA() + ppoly3->GetuB() + ppoly3->GetuC() + ppoly3->GetuD() ;
|
|
|
- ytem = ppoly3->GetvA() + ppoly3->GetvB() + ppoly3->GetvC() + ppoly3->GetvD() ;
|
|
|
+ if(ppoly3->GetNormal())
|
|
|
+ {
|
|
|
+ xtem = ppoly3->GetuA() + ppoly3->GetuB() + ppoly3->GetuC() + ppoly3->GetuD() ;
|
|
|
+ ytem = ppoly3->GetvA() + ppoly3->GetvB() + ppoly3->GetvC() + ppoly3->GetvD() ;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ xtem = ppoly3->GetuA() + ppoly3->GetuB() * s + ppoly3->GetuC() * s*s + ppoly3->GetuD() * s*s*s ;
|
|
|
+ ytem = ppoly3->GetvA() + ppoly3->GetvB() * s + ppoly3->GetvC() * s*s + ppoly3->GetvD() * s*s*s ;
|
|
|
+ }
|
|
|
x = xtem*cos(ppoly3->GetHdg()) - ytem * sin(ppoly3->GetHdg()) + ppoly3->GetX();
|
|
|
y = xtem*sin(ppoly3->GetHdg()) + ytem * cos(ppoly3->GetHdg()) + ppoly3->GetY();
|
|
|
s = ppoly3->GetLength()*0.99;
|
|
|
if(s>0)
|
|
|
{
|
|
|
double frel = 0.99;
|
|
|
- // xtem1 = ppoly3->GetuA() + ppoly3->GetuB() * s + ppoly3->GetuC() * s*s + ppoly3->GetuD() * s*s*s ;
|
|
|
- // ytem1 = ppoly3->GetvA() + ppoly3->GetvB() * s + ppoly3->GetvC() * s*s + ppoly3->GetvD() * s*s*s ;
|
|
|
- xtem1 = ppoly3->GetuA() + ppoly3->GetuB() * frel + ppoly3->GetuC() *frel*frel + ppoly3->GetuD()*frel*frel*frel ;
|
|
|
- ytem1 = ppoly3->GetvA() + ppoly3->GetvB()*frel + ppoly3->GetvC()*frel*frel + ppoly3->GetvD()*frel*frel*frel ;
|
|
|
- x1 = xtem*cos(ppoly3->GetHdg()) - ytem * sin(ppoly3->GetHdg()) + ppoly3->GetX();
|
|
|
- y1 = xtem*sin(ppoly3->GetHdg()) + ytem * cos(ppoly3->GetHdg()) + ppoly3->GetY();
|
|
|
- hdg = geofit::CalcHdg(xtem1,ytem1,x1,y1);
|
|
|
+ if(ppoly3->GetNormal() == false)
|
|
|
+ {
|
|
|
+ xtem1 = ppoly3->GetuA() + ppoly3->GetuB() * s + ppoly3->GetuC() * s*s + ppoly3->GetuD() * s*s*s ;
|
|
|
+ ytem1 = ppoly3->GetvA() + ppoly3->GetvB() * s + ppoly3->GetvC() * s*s + ppoly3->GetvD() * s*s*s ;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ xtem1 = ppoly3->GetuA() + ppoly3->GetuB() * frel + ppoly3->GetuC() *frel*frel + ppoly3->GetuD()*frel*frel*frel ;
|
|
|
+ ytem1 = ppoly3->GetvA() + ppoly3->GetvB()*frel + ppoly3->GetvC()*frel*frel + ppoly3->GetvD()*frel*frel*frel ;
|
|
|
+ }
|
|
|
+ x1 = xtem1*cos(ppoly3->GetHdg()) - ytem1 * sin(ppoly3->GetHdg()) + ppoly3->GetX();
|
|
|
+ y1 = xtem1*sin(ppoly3->GetHdg()) + ytem1 * cos(ppoly3->GetHdg()) + ppoly3->GetY();
|
|
|
+ hdg = geofit::CalcHdg(x1,y1,x,y);
|
|
|
}
|
|
|
else
|
|
|
{
|