|
@@ -111,9 +111,6 @@ void MainWindow::AdjustWPos(QSize sizemain)
|
|
|
|
|
|
void MainWindow::ExecPainter()
|
|
void MainWindow::ExecPainter()
|
|
{
|
|
{
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
QTime x;
|
|
QTime x;
|
|
x.start();
|
|
x.start();
|
|
// qDebug("painter.");
|
|
// qDebug("painter.");
|
|
@@ -176,6 +173,11 @@ void MainWindow::ExecPainter()
|
|
painter->setPen(Qt::red);
|
|
painter->setPen(Qt::red);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(IsHidenRoad(atoi(pRoad->GetRoadId().data())))
|
|
|
|
+ {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
if(mxodr.GetRoad(i)->GetGeometryBlockCount()>0)
|
|
if(mxodr.GetRoad(i)->GetGeometryBlockCount()>0)
|
|
{
|
|
{
|
|
GeometryBlock * pgeob = pRoad->GetGeometryBlock(0);
|
|
GeometryBlock * pgeob = pRoad->GetGeometryBlock(0);
|
|
@@ -1288,7 +1290,7 @@ void MainWindow::onClickXY(double x, double y)
|
|
double fdis,nearx,neary,hdg;
|
|
double fdis,nearx,neary,hdg;
|
|
double fs;
|
|
double fs;
|
|
int nlane;
|
|
int nlane;
|
|
- if(xodrfunc::GetNearPoint(rel_x,rel_y,&mxodr,&pRoad,&pgeob,fdis,nearx,neary,hdg,50,&fs,&nlane) == 0)
|
|
|
|
|
|
+ if(xodrfunc::GetNearPointWithHide(rel_x,rel_y,&mxodr,&pRoad,&pgeob,fdis,nearx,neary,hdg,50,mvectorhideroadid,&fs,&nlane) == 0)
|
|
{
|
|
{
|
|
qDebug("s:%f dis is %f nlane is %d",fs,fdis,nlane);
|
|
qDebug("s:%f dis is %f nlane is %d",fs,fdis,nlane);
|
|
char strout[1000];
|
|
char strout[1000];
|
|
@@ -1670,58 +1672,7 @@ void MainWindow::onClickLoadLane()
|
|
*/
|
|
*/
|
|
Road MainWindow::CreateRoad(VectorXd xvals, VectorXd yvals)
|
|
Road MainWindow::CreateRoad(VectorXd xvals, VectorXd yvals)
|
|
{
|
|
{
|
|
-// Road xRoad;
|
|
|
|
-// double LINE_ERROR = 0.15;
|
|
|
|
-// int nsize = xvals.size();
|
|
|
|
-// int nnotfit = nsize;
|
|
|
|
-// int ncurpos = 0;
|
|
|
|
-// int nrange = nsize;
|
|
|
|
-// while(ncurpos < nsize)
|
|
|
|
-// {
|
|
|
|
-// // int N = nrange - ncurpos;
|
|
|
|
-// VectorXd x_veh(nrange);
|
|
|
|
-// VectorXd y_veh(nrange);
|
|
|
|
-
|
|
|
|
-// int j;
|
|
|
|
-// for(j=ncurpos;j<(ncurpos +nrange);j++)
|
|
|
|
-// {
|
|
|
|
-// x_veh[j-ncurpos] = xvals[j];
|
|
|
|
-// y_veh[j - ncurpos] = yvals[j];
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-// auto coeffs = polyfit(x_veh, y_veh, 1);
|
|
|
|
-
|
|
|
|
-// double dismax = 0;
|
|
|
|
-// for(j=ncurpos;j<(ncurpos +nrange);j++)
|
|
|
|
-// {
|
|
|
|
-// double A = coeffs[1];
|
|
|
|
-// double B = -1;
|
|
|
|
-// double C = coeffs[0];
|
|
|
|
-// double dis = fabs(A*x_veh[j-ncurpos] + B*y_veh[j-ncurpos] +C )/sqrt(pow(A,2)+pow(B,2));
|
|
|
|
-// if(dis>dismax)dismax = dis;
|
|
|
|
-// }
|
|
|
|
-// std::cout<<"dis is "<<dismax<<std::endl;
|
|
|
|
-// if((dismax > LINE_ERROR)&&((nsize -(nrange+ncurpos))>50))
|
|
|
|
-// {
|
|
|
|
-// nrange = nrange/2;
|
|
|
|
-// }
|
|
|
|
-// else
|
|
|
|
-// {
|
|
|
|
-// std::cout<<"nrange is "<<nrange<<std::endl;
|
|
|
|
-
|
|
|
|
-// xRoad.AddGeometryBlock();
|
|
|
|
-// GeometryBlock * pgb = xRoad.GetGeometryBlock(xRoad.GetGeometryBlockCount()-1);
|
|
|
|
-// // pgb->AddGeometryLine(1.0,x,y,len);
|
|
|
|
-
|
|
|
|
-// ncurpos = ncurpos + nrange;
|
|
|
|
-// nrange = nsize - ncurpos;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-// std::cout<<"add a geo."<<std::endl;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
|
|
-// return xRoad;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::onClickMarkLane()
|
|
void MainWindow::onClickMarkLane()
|
|
@@ -2684,12 +2635,6 @@ void MainWindow::onClickAddRoad()
|
|
mbRefresh = true;
|
|
mbRefresh = true;
|
|
update();
|
|
update();
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-// OpenDriveXmlWriter x(&mxodr);
|
|
|
|
- // x.WriteFile("/home/nvidia/text.xodr");
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2769,6 +2714,8 @@ void MainWindow::onClickLoad()
|
|
QString str = QFileDialog::getOpenFileName(this,"Load XODR",".","*.xodr");
|
|
QString str = QFileDialog::getOpenFileName(this,"Load XODR",".","*.xodr");
|
|
if(str.isEmpty())return;
|
|
if(str.isEmpty())return;
|
|
|
|
|
|
|
|
+ mvectorhideroadid.clear();
|
|
|
|
+
|
|
QString strfilepath = str;
|
|
QString strfilepath = str;
|
|
|
|
|
|
QString strbak = str + ".bak";
|
|
QString strbak = str + ".bak";
|
|
@@ -5542,6 +5489,10 @@ void MainWindow::UpdateScene()
|
|
}
|
|
}
|
|
for(i=0;i<nsize;i++)
|
|
for(i=0;i<nsize;i++)
|
|
{
|
|
{
|
|
|
|
+ if(IsHidenRoad(atoi(mxodr.GetRoad(i)->GetRoadId().data())))
|
|
|
|
+ {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
std::vector<QGraphicsPathItem *> xvectorlanepath = xodrscenfunc::GetRoadLaneItem(&(xvectorrd[i]));
|
|
std::vector<QGraphicsPathItem *> xvectorlanepath = xodrscenfunc::GetRoadLaneItem(&(xvectorrd[i]));
|
|
int j;
|
|
int j;
|
|
int ncount = xvectorlanepath.size();
|
|
int ncount = xvectorlanepath.size();
|
|
@@ -5556,6 +5507,10 @@ void MainWindow::UpdateScene()
|
|
|
|
|
|
for(i=0;i<nsize;i++)
|
|
for(i=0;i<nsize;i++)
|
|
{
|
|
{
|
|
|
|
+ if(IsHidenRoad(atoi(mxodr.GetRoad(i)->GetRoadId().data())))
|
|
|
|
+ {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
std::vector<QGraphicsPathItem *> xvectormarkpath = xodrscenfunc::GetRoadMarkItem(&(xvectorrd[i]));
|
|
std::vector<QGraphicsPathItem *> xvectormarkpath = xodrscenfunc::GetRoadMarkItem(&(xvectorrd[i]));
|
|
int j;
|
|
int j;
|
|
int ncount = xvectormarkpath.size();
|
|
int ncount = xvectormarkpath.size();
|
|
@@ -5570,6 +5525,10 @@ void MainWindow::UpdateScene()
|
|
|
|
|
|
for(i=0;i<nsize;i++)
|
|
for(i=0;i<nsize;i++)
|
|
{
|
|
{
|
|
|
|
+ if(IsHidenRoad(atoi(mxodr.GetRoad(i)->GetRoadId().data())))
|
|
|
|
+ {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
std::vector<QGraphicsTextItem *> xvectortext;
|
|
std::vector<QGraphicsTextItem *> xvectortext;
|
|
std::vector<QGraphicsPathItem *> xvectorparkmark;
|
|
std::vector<QGraphicsPathItem *> xvectorparkmark;
|
|
std::vector<QGraphicsPathItem *> xvectorparkpath = xodrscenfunc::GetRoadParkingItem(&(xvectorrd[i]),xvectortext,
|
|
std::vector<QGraphicsPathItem *> xvectorparkpath = xodrscenfunc::GetRoadParkingItem(&(xvectorrd[i]),xvectortext,
|
|
@@ -5709,6 +5668,28 @@ void MainWindow::on_actionMake_All_Road_Contact_triggered()
|
|
void MainWindow::on_actionHide_Road_triggered()
|
|
void MainWindow::on_actionHide_Road_triggered()
|
|
{
|
|
{
|
|
std::string strroadid = mpCBRoad->currentText().toStdString();
|
|
std::string strroadid = mpCBRoad->currentText().toStdString();
|
|
- DialogHideRoad hrd(&mxodr,strroadid,this);
|
|
|
|
|
|
+ DialogHideRoad hrd(&mxodr,strroadid,&mvectorhideroadid, this);
|
|
int res = hrd.exec();
|
|
int res = hrd.exec();
|
|
|
|
+ if(res == 0){}
|
|
|
|
+ mbRefresh = true;
|
|
|
|
+ update();
|
|
|
|
+ if(mpCBViewMode->currentIndex() == 1)
|
|
|
|
+ {
|
|
|
|
+ UpdateScene();
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+bool MainWindow::IsHidenRoad(int nroadid)
|
|
|
|
+{
|
|
|
|
+ bool bIsHiden = false;
|
|
|
|
+ unsigned int i;
|
|
|
|
+ for(i=0;i<mvectorhideroadid.size();i++)
|
|
|
|
+ {
|
|
|
|
+ if(nroadid == mvectorhideroadid[i])
|
|
|
|
+ {
|
|
|
|
+ bIsHiden = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return bIsHiden;
|
|
}
|
|
}
|