|
@@ -239,15 +239,22 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
|
|
|
myview->setObjectName(QStringLiteral("graphicsView"));
|
|
|
myview->setGeometry(QRect(0, 100, 900, 900)); //从屏幕上(0,100)位置开始(即为最左上角的点),显示一个900*900的界面(宽900,高900)
|
|
|
|
|
|
+ myview_small = new MyView(ui->stackedWidget->widget(1));
|
|
|
+ myview_small->setObjectName(QStringLiteral("graphicsView_small"));
|
|
|
+ myview_small->setGeometry(QRect(1000,100,450,450));
|
|
|
+
|
|
|
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。
|
|
|
//QImage myImage2 = QImage(width, height, QImage::Format_…); 根据图像宽高来构造一幅图像,程序会自动根据图像格式对齐图像数据。
|
|
|
-
|
|
|
+ image_small = new QImage(900 * 2,900 * 2,QImage::Format_RGB32);
|
|
|
|
|
|
myview->setCacheMode(myview->CacheBackground);
|
|
|
+ myview_small->setCacheMode(myview_small->CacheBackground);
|
|
|
|
|
|
painter = new QPainter(image); //创建QPainter对象
|
|
|
+ painter_small = new QPainter(image_small); //创建QPainter对象
|
|
|
scene = new QGraphicsScene;
|
|
|
+ scene_small = new QGraphicsScene;
|
|
|
look_decition = new Look_decition;
|
|
|
mobileye_info = new Mobileye_info;
|
|
|
timer = new QTimer(this);
|
|
@@ -507,6 +514,7 @@ void ADCIntelligentVehicle::timeoutslot()
|
|
|
|
|
|
ui->lb_current_speed_big->setText(QString::number(ServiceCarStatus.speed,'f',1));
|
|
|
|
|
|
+
|
|
|
// QString is_ok;
|
|
|
// is_ok = (ServiceLidar.did_lidar_ok() == true)?QStringLiteral("ok"):QStringLiteral("error");
|
|
|
// ui->lineEdit_4->setText(is_ok);
|
|
@@ -803,8 +811,10 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
mnTimeLastUpdatePaint = mTime.elapsed();
|
|
|
// qDebug("enter paint. time is %d",mTime.elapsed());
|
|
|
painter->begin(image);
|
|
|
+ painter_small->begin(image_small);
|
|
|
// image->fill(QColor(60, 60, 60));//对画布进行填充
|
|
|
image->fill(QColor(220, 220, 220));//对画布进行填充
|
|
|
+ image_small->fill(QColor(220,220,220));
|
|
|
std::vector<iv::GPSData> navigation_data;
|
|
|
mMutexNavi.lock();
|
|
|
navigation_data = m_navigation_data;
|
|
@@ -822,8 +832,10 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
|
|
|
// std::vector<iv::GPSData> navigation_data = brain->navigation_data;
|
|
|
painter->setRenderHint(QPainter::Antialiasing, true);//设置反锯齿模式,好看一点
|
|
|
+ painter_small->setRenderHint(QPainter::Antialiasing, true);//设置反锯齿模式,好看一点
|
|
|
|
|
|
int pointx = 450, pointy = 700;//确定坐标轴起点坐标,这里定义(35,280)
|
|
|
+ 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;
|
|
@@ -856,13 +868,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) };
|
|
|
|
|
|
penPoint.setColor(Qt::red);
|
|
|
penPoint.setWidth(2);
|
|
|
painter->setPen(penPoint);
|
|
|
+ painter_small->setPen(penPoint);
|
|
|
painter->drawPoint(pointx, pointy);
|
|
|
+ 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);
|
|
|
|
|
|
//路径点的预处理
|
|
|
for (int i = 0; i < sizeN; i++)
|
|
@@ -897,6 +915,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位置信息"));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -923,8 +942,11 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
y2[i] = y0[i] - k2 * 5;
|
|
|
}
|
|
|
|
|
|
- double kx = (double)(700) / (abs(y_max - y_min));//x轴的系数
|
|
|
- double ky = (double)(700) / (abs(y_max - y_min));//y方向的比例系数
|
|
|
+ double kx_small = (double)(600) / (abs(y_max - y_min));//x轴的系数
|
|
|
+ double ky_small = (double)(600) / (abs(y_max - y_min));//y方向的比例系数
|
|
|
+
|
|
|
+ double kx = 10;
|
|
|
+ double ky = 10;
|
|
|
|
|
|
//距离车正前方10m处画一条线
|
|
|
static const QPointF points3[2] = { QPointF(0, 700 - 10 * ky), QPointF(900, 700 - 10 * ky) };
|
|
@@ -937,16 +959,22 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
for (int i = 1; i < sizeN - 1; i++)
|
|
|
{
|
|
|
painter->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->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->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->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);//绘制最后一个点
|
|
|
|
|
|
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);
|
|
|
|
|
|
// draw plan trace
|
|
|
penPoint.setColor(Qt::green);
|
|
@@ -969,6 +997,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);
|
|
|
///////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
@@ -1029,10 +1058,15 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
|
|
|
|
|
|
painter->end();
|
|
|
+ painter_small->end();
|
|
|
scene->clear();
|
|
|
+ scene_small->clear();
|
|
|
scene->addPixmap(QPixmap::fromImage(*image));
|
|
|
+ scene_small->addPixmap(QPixmap::fromImage(*image_small));
|
|
|
myview->setScene(scene);
|
|
|
+ myview_small->setScene(scene_small);
|
|
|
myview->show();
|
|
|
+ myview_small->show();
|
|
|
navigation_data.clear();
|
|
|
|
|
|
if(mfSOC != 0.0)
|