|
@@ -8,6 +8,8 @@
|
|
|
#include <QFileDialog>
|
|
|
#include <QMessageBox>
|
|
|
|
|
|
+#include "dialogcustomobj.h"
|
|
|
+
|
|
|
#define VIEW_WIDTH 1000
|
|
|
#define VIEW_HEIGHT 1000
|
|
|
|
|
@@ -21,6 +23,9 @@ MainWindow::MainWindow(QWidget *parent)
|
|
|
{
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
+ mfMoveX = VIEW_WIDTH/2;
|
|
|
+ mfMoveY = VIEW_HEIGHT/2;
|
|
|
+
|
|
|
myview = new MyView(ui->centralwidget);
|
|
|
myview->setObjectName(QStringLiteral("graphicsView"));
|
|
|
myview->setGeometry(QRect(30, 30, 600, 600));
|
|
@@ -45,7 +50,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|
|
QTabWidget * p = new QTabWidget(ui->centralwidget);
|
|
|
p->setGeometry(30,30,300,300);
|
|
|
|
|
|
- // CreateTab1View(p);
|
|
|
+ CreateTab1View(p);
|
|
|
|
|
|
mpLabel_Status = new QLabel(this);
|
|
|
ui->statusbar->addPermanentWidget(mpLabel_Status);
|
|
@@ -54,6 +59,10 @@ MainWindow::MainWindow(QWidget *parent)
|
|
|
|
|
|
CreateCar();
|
|
|
|
|
|
+ mpTimerShowSelObj = new QTimer(this);
|
|
|
+ connect(mpTimerShowSelObj,SIGNAL(timeout()),this,SLOT(onTimerShowSelObj()));
|
|
|
+ mpTimerShowSelObj->start(100);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
@@ -69,6 +78,143 @@ void MainWindow::resizeEvent(QResizeEvent *event)
|
|
|
mTabMain->setGeometry(sizemain.width()-mnFontHeight * 22,30,mnFontHeight * 22,sizemain.height()-50);
|
|
|
|
|
|
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::CreateTab1View(QTabWidget * p)
|
|
|
+{
|
|
|
+ (void)p;
|
|
|
+
|
|
|
+ QGroupBox * pGroup = new QGroupBox();
|
|
|
+ pGroup->setGeometry(0,0,mnFontHeight * 21,mnFontHeight * 160);
|
|
|
+
|
|
|
+ QLabel * pLabel;
|
|
|
+ QLineEdit * pLE;
|
|
|
+ QPushButton * pPB;
|
|
|
+ QSlider * pSlider;
|
|
|
+ QComboBox * pCB;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ int nXPos = 10;
|
|
|
+ int nYPos = 30;
|
|
|
+
|
|
|
+ int i;
|
|
|
+
|
|
|
+ int nSpace = mnFontHeight * 65/10;
|
|
|
+ int nLEWidth = mnFontHeight * 6;
|
|
|
+ int nLEHeight = mnFontHeight * 3/2;
|
|
|
+
|
|
|
+ pLE = new QLineEdit(pGroup);
|
|
|
+ pLE->setText("");
|
|
|
+ pLE->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
|
|
|
+ mpLE_SelX = pLE;
|
|
|
+ nXPos = nXPos + nSpace;
|
|
|
+
|
|
|
+ pLE = new QLineEdit(pGroup);
|
|
|
+ pLE->setText("");
|
|
|
+ pLE->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
|
|
|
+ mpLE_SelY = pLE;
|
|
|
+ nXPos = nXPos + nSpace;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ nXPos = 10;
|
|
|
+ nYPos = nYPos + mnFontHeight * 2;
|
|
|
+
|
|
|
+ pLE = new QLineEdit(pGroup);
|
|
|
+ pLE->setText("");
|
|
|
+ pLE->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
|
|
|
+ mpLE_SelLon = pLE;
|
|
|
+ nXPos = nXPos + nSpace;
|
|
|
+
|
|
|
+ pLE = new QLineEdit(pGroup);
|
|
|
+ pLE->setText("");
|
|
|
+ pLE->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
|
|
|
+ mpLE_SelLat = pLE;
|
|
|
+ nXPos = nXPos + nSpace;
|
|
|
+
|
|
|
+ pLE = new QLineEdit(pGroup);
|
|
|
+ pLE->setText("");
|
|
|
+ pLE->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight);
|
|
|
+ pLE->setText("360");
|
|
|
+ mpLE_SelHeading = pLE;
|
|
|
+
|
|
|
+ // nXPos = 10;
|
|
|
+ nYPos = nYPos + mnFontHeight * 2;
|
|
|
+
|
|
|
+ nXPos = 10;
|
|
|
+ nYPos = nYPos + mnFontHeight * 2;
|
|
|
+
|
|
|
+ pPB = new QPushButton(pGroup);
|
|
|
+ pPB->setText(tr("设置主车位置"));
|
|
|
+ pPB->setGeometry(nXPos,nYPos,nLEWidth*2,nLEHeight*3/2);
|
|
|
+ mpPBSetCarPos = pPB;
|
|
|
+
|
|
|
+ connect(mpPBSetCarPos,SIGNAL(clicked(bool)),this,SLOT(onClickSetCarPos()));
|
|
|
+
|
|
|
+ // nXPos = 10;
|
|
|
+ nYPos = nYPos + mnFontHeight * 2;
|
|
|
+
|
|
|
+ nXPos = 10;
|
|
|
+ nYPos = nYPos + mnFontHeight * 2;
|
|
|
+
|
|
|
+ pPB = new QPushButton(pGroup);
|
|
|
+ pPB->setText(tr("设置行人障碍物"));
|
|
|
+ pPB->setGeometry(nXPos,nYPos,nLEWidth*2,nLEHeight*3/2);
|
|
|
+ mpPBAddPedObj = pPB;
|
|
|
+
|
|
|
+ connect(mpPBAddPedObj,SIGNAL(clicked(bool)),this,SLOT(onClickAddPedObj()));
|
|
|
+
|
|
|
+ nYPos = nYPos + mnFontHeight * 2;
|
|
|
+
|
|
|
+ nXPos = 10;
|
|
|
+ nYPos = nYPos + mnFontHeight * 2;
|
|
|
+
|
|
|
+ pPB = new QPushButton(pGroup);
|
|
|
+ pPB->setText(tr("设置车辆障碍物"));
|
|
|
+ pPB->setGeometry(nXPos,nYPos,nLEWidth*2,nLEHeight*3/2);
|
|
|
+ mpPBAddCarObj = pPB;
|
|
|
+
|
|
|
+ connect(mpPBAddCarObj,SIGNAL(clicked(bool)),this,SLOT(onClickAddCarObj()));
|
|
|
+
|
|
|
+ nYPos = nYPos + mnFontHeight * 2;
|
|
|
+
|
|
|
+ nXPos = 10;
|
|
|
+ nYPos = nYPos + mnFontHeight * 2;
|
|
|
+
|
|
|
+ pPB = new QPushButton(pGroup);
|
|
|
+ pPB->setText(tr("设置自定义障碍物"));
|
|
|
+ pPB->setGeometry(nXPos,nYPos,nLEWidth*2,nLEHeight*3/2);
|
|
|
+ mpPBAddCustomObj = pPB;
|
|
|
+
|
|
|
+ connect(mpPBAddCustomObj,SIGNAL(clicked(bool)),this,SLOT(onClickAddCustomObj()));
|
|
|
+
|
|
|
+ nYPos = nYPos + mnFontHeight * 2;
|
|
|
+
|
|
|
+ nXPos = 10;
|
|
|
+ nYPos = nYPos + mnFontHeight * 2;
|
|
|
+
|
|
|
+ pCB = new QComboBox(pGroup);
|
|
|
+ pCB->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight*3/2);
|
|
|
+ mpCBObj = pCB;
|
|
|
+ connect(mpCBObj,SIGNAL(currentIndexChanged(int)),this,SLOT(onCurrentIndexChanged(int)));
|
|
|
+
|
|
|
+ nXPos = nXPos + nSpace;
|
|
|
+
|
|
|
+ pPB = new QPushButton(pGroup);
|
|
|
+ pPB->setText(tr("删除障碍物"));
|
|
|
+ pPB->setGeometry(nXPos,nYPos,nLEWidth,nLEHeight*3/2);
|
|
|
+ mpPBDelObj = pPB;
|
|
|
+
|
|
|
+ connect(mpPBDelObj,SIGNAL(clicked(bool)),this,SLOT(onClickDelObj()));
|
|
|
+
|
|
|
+ QScrollArea * pScroll = new QScrollArea();
|
|
|
+ pScroll->setWidget(pGroup);
|
|
|
+
|
|
|
+ p->addTab(pScroll,"Simulate");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
void MainWindow::paintEvent(QPaintEvent *)
|
|
@@ -79,7 +225,30 @@ void MainWindow::paintEvent(QPaintEvent *)
|
|
|
|
|
|
void MainWindow::onClickXY(double x,double y)
|
|
|
{
|
|
|
+ (void)x;
|
|
|
+ (void)y;
|
|
|
+
|
|
|
+ mfClickX = x - mfMoveX;
|
|
|
+ mfClickY = y - mfMoveY;
|
|
|
|
|
|
+
|
|
|
+ double selx,sely;
|
|
|
+ double lon,lat;
|
|
|
+ selx = mfClickX;
|
|
|
+ sely = mfClickY * (-1);
|
|
|
+
|
|
|
+ mpLE_SelX->setText(QString::number(selx,'f',3));
|
|
|
+ mpLE_SelY->setText(QString::number(sely,'f',3));
|
|
|
+
|
|
|
+ // emit CurrentPosition(selx,sely);
|
|
|
+
|
|
|
+ double x0,y0;
|
|
|
+ GaussProjCal(glon0,glat0,&x0,&y0);
|
|
|
+ GaussProjInvCal(x0+selx,y0+sely,&lon,&lat);
|
|
|
+
|
|
|
+
|
|
|
+ mpLE_SelLon->setText(QString::number(lon,'f',7));
|
|
|
+ mpLE_SelLat->setText(QString::number(lat,'f',7));
|
|
|
}
|
|
|
|
|
|
void MainWindow::on_actionLoad_triggered()
|
|
@@ -271,3 +440,258 @@ void MainWindow::SetCarPos(double x,double y, double fhdg)
|
|
|
|
|
|
}
|
|
|
|
|
|
+void MainWindow::onClickSetCarPos()
|
|
|
+{
|
|
|
+ double fLon = mpLE_SelLon->text().toDouble();
|
|
|
+ double fLat = mpLE_SelLat->text().toDouble();
|
|
|
+ double fHeading = mpLE_SelHeading->text().toDouble();
|
|
|
+
|
|
|
+ double x0,y0;
|
|
|
+ GaussProjCal(glon0,glat0,&x0,&y0);
|
|
|
+ double x1,y1;
|
|
|
+ GaussProjCal(fLon,fLat,&x1,&y1);
|
|
|
+
|
|
|
+ double fHdg = (90 - fHeading) * M_PI/180.0;
|
|
|
+ normalhdg(fHdg);
|
|
|
+
|
|
|
+ SetCarPos(x1-x0,y1-y0,fHdg);
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::onClickAddPedObj()
|
|
|
+{
|
|
|
+ double fLon = mpLE_SelLon->text().toDouble();
|
|
|
+ double fLat = mpLE_SelLat->text().toDouble();
|
|
|
+ double fHeading = mpLE_SelHeading->text().toDouble();
|
|
|
+
|
|
|
+ double x0,y0;
|
|
|
+ GaussProjCal(glon0,glat0,&x0,&y0);
|
|
|
+ double x1,y1;
|
|
|
+ GaussProjCal(fLon,fLat,&x1,&y1);
|
|
|
+
|
|
|
+ double fHdg = (90 - fHeading) * M_PI/180.0;
|
|
|
+ normalhdg(fHdg);
|
|
|
+
|
|
|
+ AddPedObj(x1-x0,y1-y0,fHdg);
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::onClickAddCarObj()
|
|
|
+{
|
|
|
+ double fLon = mpLE_SelLon->text().toDouble();
|
|
|
+ double fLat = mpLE_SelLat->text().toDouble();
|
|
|
+ double fHeading = mpLE_SelHeading->text().toDouble();
|
|
|
+
|
|
|
+ double x0,y0;
|
|
|
+ GaussProjCal(glon0,glat0,&x0,&y0);
|
|
|
+ double x1,y1;
|
|
|
+ GaussProjCal(fLon,fLat,&x1,&y1);
|
|
|
+
|
|
|
+ double fHdg = (90 - fHeading) * M_PI/180.0;
|
|
|
+ normalhdg(fHdg);
|
|
|
+
|
|
|
+ AddCarObj(x1-x0,y1-y0,fHdg);
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::onClickAddCustomObj()
|
|
|
+{
|
|
|
+ double fLon = mpLE_SelLon->text().toDouble();
|
|
|
+ double fLat = mpLE_SelLat->text().toDouble();
|
|
|
+ double fHeading = mpLE_SelHeading->text().toDouble();
|
|
|
+
|
|
|
+ double x0,y0;
|
|
|
+ GaussProjCal(glon0,glat0,&x0,&y0);
|
|
|
+ double x1,y1;
|
|
|
+ GaussProjCal(fLon,fLat,&x1,&y1);
|
|
|
+
|
|
|
+ double fHdg = (90 - fHeading) * M_PI/180.0;
|
|
|
+ normalhdg(fHdg);
|
|
|
+
|
|
|
+ DialogCustomObj xdlgobj;
|
|
|
+ if(xdlgobj.exec() == DialogCustomObj::Accepted)
|
|
|
+ {
|
|
|
+ double fz,flength,fwidth,fheight;
|
|
|
+ xdlgobj.GetValue(fz,flength,fwidth,fheight);
|
|
|
+ AddCustomObj(x1-x0,y1-y0,fz,fHdg,flength,fwidth,fheight);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::AddPedObj(double x,double y, double fhdg)
|
|
|
+{
|
|
|
+ const double fpedwidth = 0.6;
|
|
|
+ const double fpedlen = 0.6;
|
|
|
+ const double fpedheight = 1.8;
|
|
|
+
|
|
|
+ QPainterPath xpath;
|
|
|
+ double xp[4],yp[4];
|
|
|
+ xp[0] = x + (0 - fpedlen/2.0) * cos(fhdg) - (0 - fpedwidth/2.0) * sin(fhdg);
|
|
|
+ yp[0] = y + (0 - fpedlen/2.0) * sin(fhdg) + (0 - fpedwidth/2.0) * cos(fhdg);
|
|
|
+ xp[1] = x + (0 + fpedlen/2.0) * cos(fhdg) - (0 - fpedwidth/2.0) * sin(fhdg);
|
|
|
+ yp[1] = y + (0 + fpedlen/2.0) * sin(fhdg) + (0 - fpedwidth/2.0) * cos(fhdg);
|
|
|
+ xp[2] = x + (0 + fpedlen/2.0) * cos(fhdg) - (0 + fpedwidth/2.0) * sin(fhdg);
|
|
|
+ yp[2] = y + (0 + fpedlen/2.0) * sin(fhdg) + (0 + fpedwidth/2.0) * cos(fhdg);
|
|
|
+ xp[3] = x + (0 - fpedlen/2.0) * cos(fhdg) - (0 + fpedwidth/2.0) * sin(fhdg);
|
|
|
+ yp[3] = y + (0 - fpedlen/2.0) * sin(fhdg) + (0 + fpedwidth/2.0) * cos(fhdg);
|
|
|
+ xpath.moveTo(xp[0],yp[0]*(-1));
|
|
|
+ xpath.lineTo(xp[1],yp[1]*(-1));
|
|
|
+ xpath.lineTo(xp[2],yp[2]*(-1));
|
|
|
+ xpath.lineTo(xp[3],yp[3]*(-1));
|
|
|
+
|
|
|
+ xpath.closeSubpath();
|
|
|
+ QGraphicsPathItem * pitem = new QGraphicsPathItem;
|
|
|
+ pitem->setPath(xpath);
|
|
|
+
|
|
|
+ pitem->setZValue(99.0);
|
|
|
+ pitem->setBrush(Qt::yellow);
|
|
|
+ pitem->setPen(QPen(Qt::yellow,0.001));
|
|
|
+
|
|
|
+ pitem->setPos(mfViewMoveX +VIEW_WIDTH/2,-mfViewMoveY+VIEW_HEIGHT/2);
|
|
|
+ mpscene->addItem(pitem);
|
|
|
+
|
|
|
+ AddObjToVector(x,y,0,fhdg,fpedlen,fpedwidth,fpedheight,pitem);
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::AddCarObj(double x,double y, double fhdg)
|
|
|
+{
|
|
|
+ const double fcarwidth = 1.9;
|
|
|
+ const double fcarlen = 4.9;
|
|
|
+ const double fcarheight = 1.6;
|
|
|
+
|
|
|
+ QPainterPath xpath;
|
|
|
+ double xp[4],yp[4];
|
|
|
+ xp[0] = x + (0 - fcarlen/2.0) * cos(fhdg) - (0 - fcarwidth/2.0) * sin(fhdg);
|
|
|
+ yp[0] = y + (0 - fcarlen/2.0) * sin(fhdg) + (0 - fcarwidth/2.0) * cos(fhdg);
|
|
|
+ xp[1] = x + (0 + fcarlen/2.0) * cos(fhdg) - (0 - fcarwidth/2.0) * sin(fhdg);
|
|
|
+ yp[1] = y + (0 + fcarlen/2.0) * sin(fhdg) + (0 - fcarwidth/2.0) * cos(fhdg);
|
|
|
+ xp[2] = x + (0 + fcarlen/2.0) * cos(fhdg) - (0 + fcarwidth/2.0) * sin(fhdg);
|
|
|
+ yp[2] = y + (0 + fcarlen/2.0) * sin(fhdg) + (0 + fcarwidth/2.0) * cos(fhdg);
|
|
|
+ xp[3] = x + (0 - fcarlen/2.0) * cos(fhdg) - (0 + fcarwidth/2.0) * sin(fhdg);
|
|
|
+ yp[3] = y + (0 - fcarlen/2.0) * sin(fhdg) + (0 + fcarwidth/2.0) * cos(fhdg);
|
|
|
+ xpath.moveTo(xp[0],yp[0]*(-1));
|
|
|
+ xpath.lineTo(xp[1],yp[1]*(-1));
|
|
|
+ xpath.lineTo(xp[2],yp[2]*(-1));
|
|
|
+ xpath.lineTo(xp[3],yp[3]*(-1));
|
|
|
+
|
|
|
+ xpath.closeSubpath();
|
|
|
+ QGraphicsPathItem * pitem = new QGraphicsPathItem;
|
|
|
+ pitem->setPath(xpath);
|
|
|
+
|
|
|
+ pitem->setZValue(99.0);
|
|
|
+ pitem->setBrush(Qt::yellow);
|
|
|
+ pitem->setPen(QPen(Qt::yellow,0.001));
|
|
|
+
|
|
|
+ pitem->setPos(mfViewMoveX +VIEW_WIDTH/2,-mfViewMoveY+VIEW_HEIGHT/2);
|
|
|
+ mpscene->addItem(pitem);
|
|
|
+
|
|
|
+ AddObjToVector(x,y,0,fhdg,fcarlen,fcarwidth,fcarheight,pitem);
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::AddCustomObj(double x,double y, double z,double fhdg,double flen,double fwidth,double fheight)
|
|
|
+{
|
|
|
+ double fcustomwidth = fwidth;
|
|
|
+ double fcustomlen = flen;
|
|
|
+ double fcustomheight = fheight;
|
|
|
+
|
|
|
+ QPainterPath xpath;
|
|
|
+ double xp[4],yp[4];
|
|
|
+ xp[0] = x + (0 - fcustomlen/2.0) * cos(fhdg) - (0 - fcustomwidth/2.0) * sin(fhdg);
|
|
|
+ yp[0] = y + (0 - fcustomlen/2.0) * sin(fhdg) + (0 - fcustomwidth/2.0) * cos(fhdg);
|
|
|
+ xp[1] = x + (0 + fcustomlen/2.0) * cos(fhdg) - (0 - fcustomwidth/2.0) * sin(fhdg);
|
|
|
+ yp[1] = y + (0 + fcustomlen/2.0) * sin(fhdg) + (0 - fcustomwidth/2.0) * cos(fhdg);
|
|
|
+ xp[2] = x + (0 + fcustomlen/2.0) * cos(fhdg) - (0 + fcustomwidth/2.0) * sin(fhdg);
|
|
|
+ yp[2] = y + (0 + fcustomlen/2.0) * sin(fhdg) + (0 + fcustomwidth/2.0) * cos(fhdg);
|
|
|
+ xp[3] = x + (0 - fcustomlen/2.0) * cos(fhdg) - (0 + fcustomwidth/2.0) * sin(fhdg);
|
|
|
+ yp[3] = y + (0 - fcustomlen/2.0) * sin(fhdg) + (0 + fcustomwidth/2.0) * cos(fhdg);
|
|
|
+ xpath.moveTo(xp[0],yp[0]*(-1));
|
|
|
+ xpath.lineTo(xp[1],yp[1]*(-1));
|
|
|
+ xpath.lineTo(xp[2],yp[2]*(-1));
|
|
|
+ xpath.lineTo(xp[3],yp[3]*(-1));
|
|
|
+
|
|
|
+ xpath.closeSubpath();
|
|
|
+ QGraphicsPathItem * pitem = new QGraphicsPathItem;
|
|
|
+ pitem->setPath(xpath);
|
|
|
+
|
|
|
+ pitem->setZValue(99.0);
|
|
|
+ pitem->setBrush(Qt::yellow);
|
|
|
+ pitem->setPen(QPen(Qt::yellow,0.001));
|
|
|
+
|
|
|
+ pitem->setPos(mfViewMoveX +VIEW_WIDTH/2,-mfViewMoveY+VIEW_HEIGHT/2);
|
|
|
+ mpscene->addItem(pitem);
|
|
|
+
|
|
|
+ AddObjToVector(x,y,0,fhdg,fcustomlen,fcustomwidth,fcustomheight,pitem);
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+void MainWindow::AddObjToVector(double x,double y, double z,double fhdg,double flen,double fwidth,double fheight,QGraphicsPathItem * pitem)
|
|
|
+{
|
|
|
+ iv::simobj xsimobj;
|
|
|
+ xsimobj.mfx = x;
|
|
|
+ xsimobj.mfy = y;
|
|
|
+ xsimobj.mfz = z;
|
|
|
+ xsimobj.mfhdg = fhdg;
|
|
|
+ xsimobj.mflen = flen;
|
|
|
+ xsimobj.mfwidth = fwidth;
|
|
|
+ xsimobj.mfheight = fheight;
|
|
|
+ xsimobj.mpobjitem = pitem;
|
|
|
+ xsimobj.nshowid = mnshowidindex;
|
|
|
+ mnshowidindex++;
|
|
|
+ mvectorsimobj.push_back(xsimobj);
|
|
|
+ mpCBObj->addItem(QString("Obj")+ QString::number(xsimobj.nshowid));
|
|
|
+ mpCBObj->setCurrentIndex(mvectorsimobj.size() -1);
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::DelObjFromVector(unsigned int index)
|
|
|
+{
|
|
|
+ if(index>= mvectorsimobj.size())return;
|
|
|
+ iv::simobj xsimobj = mvectorsimobj[index];
|
|
|
+ mpscene->removeItem(xsimobj.mpobjitem);
|
|
|
+ delete xsimobj.mpobjitem;
|
|
|
+ mvectorsimobj.erase(mvectorsimobj.begin() + index);
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::onClickDelObj()
|
|
|
+{
|
|
|
+ if(mvectorsimobj.size() == 0)return;
|
|
|
+ unsigned int index = mpCBObj->currentIndex();
|
|
|
+ DelObjFromVector(index);
|
|
|
+ mpCBObj->removeItem(index);
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::onCurrentIndexChanged(int index)
|
|
|
+{
|
|
|
+ if(index<0)return;
|
|
|
+ mnSelShowCount = 10;
|
|
|
+ mnSelObj = index;
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::onTimerShowSelObj()
|
|
|
+{
|
|
|
+ static bool bShow = true;
|
|
|
+
|
|
|
+ if(mnSelShowCount == 0)return;
|
|
|
+
|
|
|
+ if(bShow)bShow = false;
|
|
|
+ else bShow = true;
|
|
|
+
|
|
|
+ if(mnSelShowCount == 10)bShow = false;
|
|
|
+ if(mnSelShowCount == 1)bShow = true;
|
|
|
+
|
|
|
+ mnSelShowCount--;
|
|
|
+
|
|
|
+ if(mnSelObj<0)return;
|
|
|
+ if(mnSelObj >= static_cast<int>( mvectorsimobj.size()))return;
|
|
|
+
|
|
|
+ iv::simobj xsimobj = mvectorsimobj[mnSelObj];
|
|
|
+
|
|
|
+ xsimobj.mpobjitem->setVisible(bShow);
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::normalhdg(double & fhdg)
|
|
|
+{
|
|
|
+ while(fhdg < 0)fhdg = fhdg + 2.0*M_PI;
|
|
|
+ while(fhdg > (2.0*M_PI))fhdg = fhdg - 2.0*M_PI;
|
|
|
+}
|
|
|
+
|