|
@@ -64,6 +64,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
|
|
|
CreateTab1View(p);
|
|
|
|
|
|
+ mpLabel_Status = new QLabel(this);
|
|
|
+ ui->statusBar->addPermanentWidget(mpLabel_Status);
|
|
|
+
|
|
|
mTabMain = p;
|
|
|
|
|
|
QTimer * timer = new QTimer();
|
|
@@ -177,6 +180,9 @@ void MainWindow::ExecPainter()
|
|
|
GetEndPoint(pRoad,endx,endy,endhdg);
|
|
|
x = (x+endx)/2;
|
|
|
y = (y+endy)/2;
|
|
|
+
|
|
|
+ x = x + mfViewMoveX;
|
|
|
+ y = y + mfViewMoveY;
|
|
|
painter->drawText(x*mnfac,y*mnfac*(-1),mxodr.GetRoad(i)->GetRoadId().data());
|
|
|
}
|
|
|
for(j=0;j<mxodr.GetRoad(i)->GetGeometryBlockCount();j++)
|
|
@@ -196,10 +202,14 @@ void MainWindow::ExecPainter()
|
|
|
y = pg->GetY();
|
|
|
|
|
|
|
|
|
+ x = x + mfViewMoveX;
|
|
|
+ y = y + mfViewMoveY;
|
|
|
+
|
|
|
if(j== 0)
|
|
|
{
|
|
|
if(selid == atoi(pRoad->GetRoadId().data()))
|
|
|
{
|
|
|
+
|
|
|
painter->setPen(Qt::green);
|
|
|
painter->drawEllipse(x*mnfac-5,y*mnfac*(-1)-5,10,10);
|
|
|
painter->setPen(Qt::red);
|
|
@@ -230,6 +240,8 @@ void MainWindow::ExecPainter()
|
|
|
|
|
|
x = rel_x;
|
|
|
y = rel_y;
|
|
|
+ x = x + mfViewMoveX;
|
|
|
+ y = y + mfViewMoveY;
|
|
|
painter->drawPoint((int)(x*mnfac),(int)(y*(-1.0*mnfac)));
|
|
|
|
|
|
}
|
|
@@ -276,6 +288,8 @@ void MainWindow::ExecPainter()
|
|
|
x_draw = x_center + R *cos(hdgnow + M_PI/2.0);
|
|
|
y_draw = y_center + R * sin(hdgnow + M_PI/2.0);
|
|
|
}
|
|
|
+ x_draw = x_draw + mfViewMoveX;
|
|
|
+ y_draw = y_draw + mfViewMoveY;
|
|
|
painter->drawPoint(x_draw * mnfac ,y_draw * mnfac *(-1));
|
|
|
}
|
|
|
}
|
|
@@ -295,6 +309,8 @@ void MainWindow::ExecPainter()
|
|
|
ytem = ppp3->GetvA() + ppp3->GetvB() * s + ppp3->GetvC() * s*s + ppp3->GetvD() * s*s*s;
|
|
|
x = xtem*cos(ppp3->GetHdg()) - ytem * sin(ppp3->GetHdg()) + ppp3->GetX();
|
|
|
y = xtem*sin(ppp3->GetHdg()) + ytem * cos(ppp3->GetHdg()) + ppp3->GetY();
|
|
|
+ x = x + mfViewMoveX;
|
|
|
+ y = y + mfViewMoveY;
|
|
|
painter->drawPoint((int)(x*mnfac),(int)(y*(-1.0*mnfac)));
|
|
|
s = s+ sstep;
|
|
|
}
|
|
@@ -421,6 +437,9 @@ void MainWindow::CreateTab1View(QTabWidget * p)
|
|
|
pLabel->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
|
|
|
nXPos = nXPos + nSpace;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
nXPos = 10;
|
|
|
nYPos = nYPos + mnFontHeight * 2;
|
|
|
|
|
@@ -442,6 +461,26 @@ void MainWindow::CreateTab1View(QTabWidget * p)
|
|
|
mpLEHead0 = pLE;
|
|
|
nXPos = nXPos + nSpace;
|
|
|
|
|
|
+ nXPos = 10;
|
|
|
+ nYPos = nYPos + mnFontHeight * 2;
|
|
|
+
|
|
|
+ pLabel = new QLabel(pGroup);
|
|
|
+ pLabel->setText("ViewMove");
|
|
|
+ pLabel->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
|
|
|
+ nXPos = nXPos + nSpace;
|
|
|
+
|
|
|
+ pLE = new QLineEdit(pGroup);
|
|
|
+ pLE->setText(QString::number(mfViewMoveX,'f',2));
|
|
|
+ pLE->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
|
|
|
+ mpLEViewMoveX = pLE;
|
|
|
+ nXPos = nXPos + nSpace;
|
|
|
+
|
|
|
+ pLE = new QLineEdit(pGroup);
|
|
|
+ pLE->setText(QString::number(mfViewMoveY,'f',2));
|
|
|
+ pLE->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
|
|
|
+ mpLEViewMoveY = pLE;
|
|
|
+ nXPos = nXPos + nSpace;
|
|
|
+
|
|
|
nXPos = 10;
|
|
|
nYPos = nYPos + mnFontHeight * 4;
|
|
|
|
|
@@ -478,49 +517,49 @@ void MainWindow::CreateTab1View(QTabWidget * p)
|
|
|
pLE->setText(QString::number(pSlider->value()));
|
|
|
mpLE_Scale = pLE;
|
|
|
|
|
|
- nXPos = 10;
|
|
|
- nYPos = nYPos + mnFontHeight * 2;
|
|
|
-
|
|
|
- pLabel = new QLabel(pGroup);
|
|
|
- pLabel->setText("MoveX");
|
|
|
- pLabel->setGeometry(nXPos,nYPos,mnFontHeight*3,nLEHeight);
|
|
|
-
|
|
|
- nXPos = nXPos + mnFontHeight * 4;
|
|
|
- pSlider = new QSlider(pGroup);
|
|
|
- pSlider->setOrientation(Qt::Horizontal);
|
|
|
- pSlider->setGeometry(nXPos,nYPos,mnFontHeight * 10,nLEHeight);
|
|
|
- pSlider->setRange(0,100);
|
|
|
- pSlider->setValue(mnMoveX*100/VIEW_WIDTH);
|
|
|
- connect(pSlider,SIGNAL(valueChanged(int)),this,SLOT(onChangeMoveX(int)));
|
|
|
- mpSlider_MoveX = pSlider;
|
|
|
-
|
|
|
- nXPos = nXPos + mnFontHeight*11;
|
|
|
- pLE = new QLineEdit(pGroup);
|
|
|
- pLE->setGeometry(nXPos,nYPos,mnFontHeight*3,nLEHeight);
|
|
|
- pLE->setText(QString::number(pSlider->value()));
|
|
|
- mpLE_MoveX = pLE;
|
|
|
-
|
|
|
- nXPos = 10;
|
|
|
- nYPos = nYPos + mnFontHeight * 2;
|
|
|
+// nXPos = 10;
|
|
|
+// nYPos = nYPos + mnFontHeight * 2;
|
|
|
|
|
|
- pLabel = new QLabel(pGroup);
|
|
|
- pLabel->setText("MoveY");
|
|
|
- pLabel->setGeometry(nXPos,nYPos,mnFontHeight*3,nLEHeight);
|
|
|
+// pLabel = new QLabel(pGroup);
|
|
|
+// pLabel->setText("MoveX");
|
|
|
+// pLabel->setGeometry(nXPos,nYPos,mnFontHeight*3,nLEHeight);
|
|
|
+
|
|
|
+// nXPos = nXPos + mnFontHeight * 4;
|
|
|
+// pSlider = new QSlider(pGroup);
|
|
|
+// pSlider->setOrientation(Qt::Horizontal);
|
|
|
+// pSlider->setGeometry(nXPos,nYPos,mnFontHeight * 10,nLEHeight);
|
|
|
+// pSlider->setRange(0,100);
|
|
|
+// pSlider->setValue(mnMoveX*100/VIEW_WIDTH);
|
|
|
+// connect(pSlider,SIGNAL(valueChanged(int)),this,SLOT(onChangeMoveX(int)));
|
|
|
+// mpSlider_MoveX = pSlider;
|
|
|
+
|
|
|
+// nXPos = nXPos + mnFontHeight*11;
|
|
|
+// pLE = new QLineEdit(pGroup);
|
|
|
+// pLE->setGeometry(nXPos,nYPos,mnFontHeight*3,nLEHeight);
|
|
|
+// pLE->setText(QString::number(pSlider->value()));
|
|
|
+// mpLE_MoveX = pLE;
|
|
|
|
|
|
- nXPos = nXPos + mnFontHeight * 4;
|
|
|
- pSlider = new QSlider(pGroup);
|
|
|
- pSlider->setOrientation(Qt::Horizontal);
|
|
|
- pSlider->setGeometry(nXPos,nYPos,mnFontHeight * 10,nLEHeight);
|
|
|
- pSlider->setRange(0,100);
|
|
|
- pSlider->setValue(mnMoveY*100/VIEW_HEIGHT);
|
|
|
- connect(pSlider,SIGNAL(valueChanged(int)),this,SLOT(onChangeMoveY(int)));
|
|
|
- mpSlider_MoveY = pSlider;
|
|
|
+// nXPos = 10;
|
|
|
+// nYPos = nYPos + mnFontHeight * 2;
|
|
|
|
|
|
- nXPos = nXPos + mnFontHeight*11;
|
|
|
- pLE = new QLineEdit(pGroup);
|
|
|
- pLE->setGeometry(nXPos,nYPos,mnFontHeight*3,nLEHeight);
|
|
|
- pLE->setText(QString::number(pSlider->value()));
|
|
|
- mpLE_MoveY = pLE;
|
|
|
+// pLabel = new QLabel(pGroup);
|
|
|
+// pLabel->setText("MoveY");
|
|
|
+// pLabel->setGeometry(nXPos,nYPos,mnFontHeight*3,nLEHeight);
|
|
|
+
|
|
|
+// nXPos = nXPos + mnFontHeight * 4;
|
|
|
+// pSlider = new QSlider(pGroup);
|
|
|
+// pSlider->setOrientation(Qt::Horizontal);
|
|
|
+// pSlider->setGeometry(nXPos,nYPos,mnFontHeight * 10,nLEHeight);
|
|
|
+// pSlider->setRange(0,100);
|
|
|
+// pSlider->setValue(mnMoveY*100/VIEW_HEIGHT);
|
|
|
+// connect(pSlider,SIGNAL(valueChanged(int)),this,SLOT(onChangeMoveY(int)));
|
|
|
+// mpSlider_MoveY = pSlider;
|
|
|
+
|
|
|
+// nXPos = nXPos + mnFontHeight*11;
|
|
|
+// pLE = new QLineEdit(pGroup);
|
|
|
+// pLE->setGeometry(nXPos,nYPos,mnFontHeight*3,nLEHeight);
|
|
|
+// pLE->setText(QString::number(pSlider->value()));
|
|
|
+// mpLE_MoveY = pLE;
|
|
|
|
|
|
nXPos = 10;
|
|
|
nYPos = nYPos + mnFontHeight * 4;
|
|
@@ -595,6 +634,14 @@ void MainWindow::CreateTab1View(QTabWidget * p)
|
|
|
pLE->setText("360");
|
|
|
mpLE_StartHeading = pLE;
|
|
|
|
|
|
+ nXPos = 10;
|
|
|
+ nYPos = nYPos + mnFontHeight * 2;
|
|
|
+
|
|
|
+ pPB = new QPushButton(pGroup);
|
|
|
+ pPB->setText("Set Move");
|
|
|
+ pPB->setGeometry(nXPos,nYPos,mnFontHeight*10,nLEHeight);
|
|
|
+ connect(pPB,SIGNAL(clicked(bool)),this,SLOT(onClickSetMove()));
|
|
|
+
|
|
|
|
|
|
|
|
|
nXPos = 10;
|
|
@@ -1107,6 +1154,39 @@ void MainWindow::onClickXY(double x, double y)
|
|
|
GaussProjCal(glon0,glat0,&x0,&y0);
|
|
|
GaussProjInvCal(x0+selx,y0+sely,&lon,&lat);
|
|
|
|
|
|
+ double rel_x,rel_y;
|
|
|
+ rel_x = selx - mfViewMoveX;
|
|
|
+ rel_y = sely - mfViewMoveY;
|
|
|
+
|
|
|
+ Road * pRoad;
|
|
|
+ GeometryBlock * pgeob;
|
|
|
+ double fdis,nearx,neary,hdg;
|
|
|
+ double fs;
|
|
|
+ int nlane;
|
|
|
+ if(xodrfunc::GetNearPoint(rel_x,rel_y,&mxodr,&pRoad,&pgeob,fdis,nearx,neary,hdg,50,&fs,&nlane) == 0)
|
|
|
+ {
|
|
|
+ qDebug("s:%f dis is %f nlane is %d",fs,fdis,nlane);
|
|
|
+ char strout[1000];
|
|
|
+ snprintf(strout,1000,"Road:%s s:%f dis:%f nlane:%d",pRoad->GetRoadId().data(),fs,fdis,nlane);
|
|
|
+ mpLabel_Status->setText(strout);
|
|
|
+ ui->statusBar->showMessage(strout,3000);
|
|
|
+ int i;
|
|
|
+ int nsize = mpCBRoad->count();
|
|
|
+ for(i=0;i<nsize;i++)
|
|
|
+ {
|
|
|
+ if(mpCBRoad->itemText(i).toStdString() == pRoad->GetRoadId())
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(i<nsize)
|
|
|
+ {
|
|
|
+ if(i != mpCBRoad->currentIndex())
|
|
|
+ mpCBRoad->setCurrentIndex(i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
mpLE_SelLon->setText(QString::number(lon,'f',7));
|
|
|
mpLE_SelLat->setText(QString::number(lat,'f',7));
|
|
|
update();
|
|
@@ -4822,3 +4902,20 @@ void MainWindow::on_actionAdd_Road_From_RTK_triggered()
|
|
|
update();
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+void MainWindow::onClickSetMove()
|
|
|
+{
|
|
|
+ double fMoveX = mpLE_SelX->text().toDouble();
|
|
|
+ double fMoveY = mpLE_SelY->text().toDouble();
|
|
|
+
|
|
|
+ mfViewMoveX = mfViewMoveX - fMoveX;
|
|
|
+ mfViewMoveY = mfViewMoveY - fMoveY;
|
|
|
+
|
|
|
+ mbRefresh = true;
|
|
|
+ update();
|
|
|
+
|
|
|
+ mpLEViewMoveX->setText(QString::number(mfViewMoveX,'f',2));
|
|
|
+ mpLEViewMoveY->setText(QString::number(mfViewMoveY,'f',2));
|
|
|
+
|
|
|
+ // updateView();
|
|
|
+}
|