|
@@ -237,19 +237,34 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
|
|
|
// QObject::connect(ui->listWidget,SIGNAL(currentRowChanged(int)),ui->stackedWidget,SLOT(on_listWidget_clicked()));//信号与槽
|
|
|
QObject::connect(ui->listWidget,SIGNAL(currentRowChanged(int)),this,SLOT(on_listWidget_clicked()));//信号与槽
|
|
|
|
|
|
+// /********************************** 百度地图显示 ********************************/
|
|
|
+// mMapview = new QWebEngineView(ui->stackedWidget->widget(0));
|
|
|
+//// qDebug((QDir::currentPath()).toLatin1().data());
|
|
|
+// mMapview->load(QUrl(QString("file:///%1/%2").arg(QApplication::applicationDirPath()).arg("BaiDuMap.html")));
|
|
|
+// mMapview->setGeometry(750,250,400,400);
|
|
|
+// /********************************************************************************/
|
|
|
+
|
|
|
ui->listWidget->setCurrentRow(1); //apollo_fu debug 20200409
|
|
|
|
|
|
myview = new MyView(ui->stackedWidget->widget(1));
|
|
|
myview->setObjectName(QStringLiteral("graphicsView"));
|
|
|
myview->setGeometry(QRect(0, 100, 900, 900)); //从屏幕上(0,100)位置开始(即为最左上角的点),显示一个900*900的界面(宽900,高900)
|
|
|
|
|
|
+#if 0
|
|
|
myview_small = new MyView(ui->stackedWidget->widget(1));
|
|
|
myview_small->setObjectName(QStringLiteral("graphicsView_small"));
|
|
|
myview_small->setGeometry(QRect(1000,100,500,500));
|
|
|
myview_small->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
|
|
+#endif
|
|
|
// myview_small->scale(0.7,0.7);
|
|
|
//myview_small->centerOn(-200,-200);
|
|
|
|
|
|
+ /********************************** 百度地图显示 ********************************/
|
|
|
+ mMapview = new QWebEngineView(ui->stackedWidget->widget(1));
|
|
|
+// qDebug((QDir::currentPath()).toLatin1().data());
|
|
|
+ mMapview->load(QUrl(QString("file:///%1/%2").arg(QApplication::applicationDirPath()).arg("BaiDuMap.html")));
|
|
|
+ mMapview->setGeometry(1000,100,500,500);
|
|
|
+ /********************************************************************************/
|
|
|
|
|
|
image = new QImage(900 * 2, 900 * 2, QImage::Format_RGB32);//画布的初始化大小设为600*500,使用32位颜色
|
|
|
//QImage的32、24、8位图。 图像格式:QImage::Format_RGB32 ,QImage::Format_RGB888,QImage::Format_Indexed8。
|
|
@@ -257,8 +272,9 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
|
|
|
image_small = new QImage(1800,1800,QImage::Format_RGB32);
|
|
|
|
|
|
myview->setCacheMode(myview->CacheBackground);
|
|
|
+#if 0
|
|
|
myview_small->setCacheMode(myview_small->CacheBackground);
|
|
|
-
|
|
|
+#endif
|
|
|
painter = new QPainter(image); //创建QPainter对象
|
|
|
painter_small = new QPainter(image_small); //创建QPainter对象
|
|
|
scene = new QGraphicsScene;
|
|
@@ -290,6 +306,10 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
|
|
|
connect(&mTimerState,SIGNAL(timeout()),this,SLOT(onStateTimer()));//广播发送UDP数据报
|
|
|
mTimerState.start(100); //定时100ms
|
|
|
|
|
|
+ mTimerStateMap.setTimerType(Qt::PreciseTimer); //
|
|
|
+ connect(&mTimerStateMap,SIGNAL(timeout()),this,SLOT(onStateTimerMap()));//
|
|
|
+ mTimerStateMap.start(500); //定时500ms
|
|
|
+
|
|
|
is_show_enable = true;
|
|
|
|
|
|
#ifdef USE_PAD_CTRL
|
|
@@ -753,6 +773,20 @@ void ADCIntelligentVehicle::onStateTimer()
|
|
|
// multicast, 224.0.0.1~224.0.0.255 is multicast address of LAN
|
|
|
|
|
|
// _udp->writeDatagram(str.toUtf8(), QHostAddress("224.0.0.131"), 10002);
|
|
|
+
|
|
|
+}
|
|
|
+void ADCIntelligentVehicle::onStateTimerMap()
|
|
|
+{
|
|
|
+ /*******************************更新百度地图******************************/
|
|
|
+
|
|
|
+ double flat = ServiceCarStatus.location->gps_lat;
|
|
|
+ double flon = ServiceCarStatus.location->gps_lng;
|
|
|
+ double fang = ServiceCarStatus.location->ins_heading_angle;
|
|
|
+
|
|
|
+ char strscript[256];
|
|
|
+ snprintf(strscript,255,"theLocation(%11.7f,%11.7f,%11.7f);",flon,flat,fang);
|
|
|
+ mMapview->page()->runJavaScript(strscript);
|
|
|
+ /************************************************************************/
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -923,7 +957,7 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
mnTimeLastUpdatePaint = mTime.elapsed();
|
|
|
// qDebug("enter paint. time is %d",mTime.elapsed());
|
|
|
painter->begin(image);
|
|
|
- painter_small->begin(image_small);
|
|
|
+// painter_small->begin(image_small);
|
|
|
|
|
|
// image->fill(QColor(60, 60, 60));//对画布进行填充
|
|
|
image->fill(QColor(220, 220, 220));//对画布进行填充
|
|
@@ -955,7 +989,7 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
|
|
|
|
|
|
int pointx = 450, pointy = 700;//确定坐标轴起点坐标,这里定义(35,280)
|
|
|
- int pointx_small = 450, pointy_small = 700;
|
|
|
+// int pointx_small = 450, pointy_small = 700;
|
|
|
// double x0[22000], y0[22000], lng[22000], x1[22000], y1[22000], x2[22000], y2[22000];
|
|
|
|
|
|
double * x0, * y0, * lng, * x1, * y1, * x2, * y2;
|
|
@@ -988,19 +1022,19 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
//先绘制车位置点及框图
|
|
|
static const QPointF points1[2] = { QPointF(300, 700), QPointF(600, 700) };
|
|
|
static const QPointF points2[2] = { QPointF(450, 0), QPointF(450, 900) };
|
|
|
- static const QPointF points1_small[2] = { QPointF(300, 700), QPointF(600, 700) };
|
|
|
- static const QPointF points2_small[2] = { QPointF(450, 0), QPointF(450, 900) };
|
|
|
+// static const QPointF points1_small[2] = { QPointF(300, 700), QPointF(600, 700) };
|
|
|
+// static const QPointF points2_small[2] = { QPointF(450, 0), QPointF(450, 900) };
|
|
|
|
|
|
penPoint.setColor(Qt::red);
|
|
|
penPoint.setWidth(2);
|
|
|
painter->setPen(penPoint);
|
|
|
- painter_small->setPen(penPoint);
|
|
|
+// painter_small->setPen(penPoint);
|
|
|
painter->drawPoint(pointx, pointy);
|
|
|
- painter_small->drawPoint(pointx_small,pointy_small);
|
|
|
+// painter_small->drawPoint(pointx_small,pointy_small);
|
|
|
painter->drawPolyline(points1, 2);
|
|
|
painter->drawPolyline(points2, 2);
|
|
|
- painter_small->drawPolyline(points1_small, 2);
|
|
|
- painter_small->drawPolyline(points2_small, 2);
|
|
|
+// painter_small->drawPolyline(points1_small, 2);
|
|
|
+// painter_small->drawPolyline(points2_small, 2);
|
|
|
|
|
|
//路径点的预处理
|
|
|
for (int i = 0; i < sizeN; i++)
|
|
@@ -1035,7 +1069,7 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
if (ServiceCarStatus.location->gps_x == 0)
|
|
|
{
|
|
|
painter->drawText(rect(), Qt::AlignLeft, QString::fromLocal8Bit("等待车辆实时GPS位置信息"));
|
|
|
- painter_small->drawText(rect(), Qt::AlignLeft, QString::fromLocal8Bit("等待车辆实时GPS位置信息"));
|
|
|
+// painter_small->drawText(rect(), Qt::AlignLeft, QString::fromLocal8Bit("等待车辆实时GPS位置信息"));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -1069,8 +1103,8 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
- double kx_small = (double)(1200) / (abs(y_max - y_min));//x轴的系数
|
|
|
- double ky_small = (double)(1200) / (abs(y_max - y_min));//y方向的比例系数
|
|
|
+// double kx_small = (double)(1200) / (abs(y_max - y_min));//x轴的系数
|
|
|
+// double ky_small = (double)(1200) / (abs(y_max - y_min));//y方向的比例系数
|
|
|
|
|
|
double kx = 10;
|
|
|
double ky = 10;
|
|
@@ -1086,22 +1120,22 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
for (int i = 1; i < sizeN - 1; i++)
|
|
|
{
|
|
|
painter->setPen(penPoint);//蓝色的笔,用于标记各个点
|
|
|
- painter_small->setPen(penPoint);//蓝色的笔,用于标记各个点
|
|
|
+// painter_small->setPen(penPoint);//蓝色的笔,用于标记各个点
|
|
|
painter->drawPoint(pointx + x0[i] * kx, pointy - y0[i] * ky);
|
|
|
- painter_small->drawPoint(pointx_small + x0[i] * kx_small, pointy_small - y0[i] * ky_small);
|
|
|
+// painter_small->drawPoint(pointx_small + x0[i] * kx_small, pointy_small - y0[i] * ky_small);
|
|
|
painter->drawPoint(pointx + x1[i] * kx, pointy - y1[i] * ky);
|
|
|
- painter_small->drawPoint(pointx_small + x1[i] * kx_small, pointy_small - y1[i] * ky_small);
|
|
|
+// painter_small->drawPoint(pointx_small + x1[i] * kx_small, pointy_small - y1[i] * ky_small);
|
|
|
painter->drawPoint(pointx + x2[i] * kx, pointy - y2[i] * ky);
|
|
|
- painter_small->drawPoint(pointx_small + x2[i] * kx_small, pointy_small - y2[i] * ky_small);
|
|
|
+// painter_small->drawPoint(pointx_small + x2[i] * kx_small, pointy_small - y2[i] * ky_small);
|
|
|
}
|
|
|
painter->drawPoint(pointx + x0[sizeN - 1] * kx, pointy - y0[sizeN - 1] * ky);//绘制最后一个点
|
|
|
- painter_small->drawPoint(pointx_small + x0[sizeN - 1] * kx_small, pointy_small - y0[sizeN - 1] * ky_small);//绘制最后一个点
|
|
|
+// painter_small->drawPoint(pointx_small + x0[sizeN - 1] * kx_small, pointy_small - y0[sizeN - 1] * ky_small);//绘制最后一个点
|
|
|
|
|
|
penPoint.setColor(Qt::red);
|
|
|
penPoint.setWidth(2);
|
|
|
|
|
|
painter->drawPoint(pointx + x0[0] * kx, pointy - y0[0] * ky);
|
|
|
- painter_small->drawPoint(pointx_small + x0[0] * kx_small, pointy_small - y0[0] * ky_small);
|
|
|
+// painter_small->drawPoint(pointx_small + x0[0] * kx_small, pointy_small - y0[0] * ky_small);
|
|
|
|
|
|
#if 0
|
|
|
// draw plan trace
|
|
@@ -1159,7 +1193,7 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
//pix.load("car.png");
|
|
|
pix.load(":/ADCIntelligentVehicle/car1.png");
|
|
|
painter->drawPixmap(435,667,30,67,pix);
|
|
|
- painter_small->drawPixmap(442,683,16,34,pix);
|
|
|
+// painter_small->drawPixmap(442,683,16,34,pix);
|
|
|
///////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
@@ -1253,15 +1287,15 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
|
|
|
|
|
|
painter->end();
|
|
|
- painter_small->end();
|
|
|
+// painter_small->end();
|
|
|
scene->clear();
|
|
|
- scene_small->clear();
|
|
|
+// scene_small->clear();
|
|
|
scene->addPixmap(QPixmap::fromImage(*image));
|
|
|
- scene_small->addPixmap(QPixmap::fromImage(*image_small));
|
|
|
+// scene_small->addPixmap(QPixmap::fromImage(*image_small));
|
|
|
myview->setScene(scene);
|
|
|
- myview_small->setScene(scene_small);
|
|
|
+// myview_small->setScene(scene_small);
|
|
|
myview->show();
|
|
|
- myview_small->show();
|
|
|
+// myview_small->show();
|
|
|
navigation_data.clear();
|
|
|
|
|
|
if(mfSOC != 0.0)
|