|
@@ -112,6 +112,8 @@ void XVMainWindow::LoadXODR(QString strpath)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ mvectorRoadSample.clear();
|
|
|
+
|
|
|
int nroadnum = pxodr->GetRoadCount();
|
|
|
int i;
|
|
|
double froadlen = 0;
|
|
@@ -280,7 +282,7 @@ void XVMainWindow::onClickXY(double x, double y)
|
|
|
mfselx = selx *1.0/mfbeishu ;
|
|
|
mfsely = sely *1.0/mfbeishu;
|
|
|
|
|
|
- qDebug("selx is %f sely is %f ",mfselx,mfsely);
|
|
|
+
|
|
|
// selx = x;
|
|
|
// sely = y;
|
|
|
// mfselx = selx;
|
|
@@ -295,24 +297,46 @@ void XVMainWindow::onClickXY(double x, double y)
|
|
|
rel_x = selx - mfViewMoveX + VIEW_WIDTH/2 ;
|
|
|
rel_y = sely - mfViewMoveY - VIEW_HEIGHT/2;
|
|
|
|
|
|
+ qDebug("selx is %f sely is %f ",rel_x,rel_y);
|
|
|
+
|
|
|
unsigned int nRoadCount = static_cast<unsigned int>(mvectorRoadSample.size());
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
|
int64_t time1 = std::chrono::system_clock::now().time_since_epoch().count();
|
|
|
+ bool bFind = false;
|
|
|
+ char strout[1000];
|
|
|
for(i=0;i<nRoadCount;i++)
|
|
|
{
|
|
|
double s,t;
|
|
|
int nlane;
|
|
|
- if(mvectorRoadSample[i].PointInRoad(rel_x,rel_y,s,t,nlane))
|
|
|
+ std::string strlanetype;
|
|
|
+ if(mvectorRoadSample[i].PointInRoad(rel_x,rel_y,s,t,nlane,strlanetype))
|
|
|
{
|
|
|
std::cout<<" In Road"<<mvectorRoadSample[i].GetRoadID()<<" s:"<<s<<" t:"<<t<<" nlane:"<<nlane<<std::endl;
|
|
|
- char strout[1000];
|
|
|
- snprintf(strout,1000,"Road:%s s:%f t:%f nlane:%d",mvectorRoadSample[i].GetRoadID().data(),s,t,nlane);
|
|
|
+
|
|
|
+ if(bFind == false)
|
|
|
+ {
|
|
|
+ snprintf(strout,1000,"x:%7.3f y:%7.3f |Road:%s s:%f t:%f nlane:%d %s",
|
|
|
+ rel_x,rel_y,mvectorRoadSample[i].GetRoadID().data(),s,t,nlane,strlanetype.data());
|
|
|
// mpLabel_Status->setText(strout);
|
|
|
- ui->statusbar->showMessage(strout,10000);
|
|
|
+ bFind = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ char strtem[1000];
|
|
|
+ snprintf(strtem,1000,"| %s %d",mvectorRoadSample[i].GetRoadID().data(),nlane);
|
|
|
+ strncat(strout,strtem,1000);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if(bFind == false)
|
|
|
+ {
|
|
|
+ snprintf(strout,1000,"x:%7.3f y:%7.3f",rel_x,rel_y);
|
|
|
+ }
|
|
|
+
|
|
|
+ ui->statusbar->showMessage(strout,10000);
|
|
|
int64_t time2 = std::chrono::system_clock::now().time_since_epoch().count();
|
|
|
std::cout<<" find use time: "<<(time2 - time1)<<std::endl;
|
|
|
|