|
@@ -241,12 +241,16 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
|
|
|
|
|
|
myview_small = new MyView(ui->stackedWidget->widget(1));
|
|
|
myview_small->setObjectName(QStringLiteral("graphicsView_small"));
|
|
|
- myview_small->setGeometry(QRect(1000,100,450,450));
|
|
|
+ myview_small->setGeometry(QRect(1000,100,500,500));
|
|
|
+ myview_small->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
|
|
+// myview_small->scale(0.7,0.7);
|
|
|
+ //myview_small->centerOn(-200,-200);
|
|
|
+
|
|
|
|
|
|
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);
|
|
|
+ image_small = new QImage(1800,1800,QImage::Format_RGB32);
|
|
|
|
|
|
myview->setCacheMode(myview->CacheBackground);
|
|
|
myview_small->setCacheMode(myview_small->CacheBackground);
|
|
@@ -879,6 +883,7 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
// 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));
|
|
@@ -903,11 +908,11 @@ 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];
|
|
@@ -1023,8 +1028,8 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
- double kx_small = (double)(600) / (abs(y_max - y_min));//x轴的系数
|
|
|
- double ky_small = (double)(600) / (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;
|
|
@@ -1057,6 +1062,7 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
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);
|
|
|
|
|
|
+#if 0
|
|
|
// draw plan trace
|
|
|
penPoint.setColor(Qt::green);
|
|
|
penPoint.setWidth(2);
|
|
@@ -1072,8 +1078,10 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
(float)(450+myplan[i+1].x*kx),(float)(700-myplan[i+1].y*ky));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- penPoint.setColor(Qt::blue);
|
|
|
+#endif
|
|
|
+#if 1
|
|
|
+// penPoint.setColor(Qt::gray);
|
|
|
+ penPoint.setColor(QColor(187, 255, 255, 100));
|
|
|
penPoint.setWidth(2);
|
|
|
painter->setPen(penPoint);
|
|
|
QPointF tracePoints_left[myplan_left.size()];
|
|
@@ -1088,9 +1096,9 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- penPoint.setColor(Qt::blue);
|
|
|
- penPoint.setWidth(2);
|
|
|
- painter->setPen(penPoint);
|
|
|
+// penPoint.setColor(Qt::gray);
|
|
|
+// penPoint.setWidth(2);
|
|
|
+// painter->setPen(penPoint);
|
|
|
QPointF tracePoints_right[myplan_right.size()];
|
|
|
if(myplan_right.size()>2)
|
|
|
{
|
|
@@ -1102,7 +1110,7 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
(float)(450+myplan_right[i+1].x*kx),(float)(700-myplan_right[i+1].y*ky));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+#endif
|
|
|
// painter->drawPolyline(tracePoints,myplan.size());
|
|
|
// draw plan trace end
|
|
|
/////////////////////////////////////apollo add car icon 20200409
|
|
@@ -1175,7 +1183,6 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
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);
|
|
@@ -1398,6 +1405,9 @@ void ADCIntelligentVehicle::UpdatePlanTrace_left(const char * strdata,const unsi
|
|
|
mMutexPlan_left.lock();
|
|
|
m_plan_left.clear();
|
|
|
int nplansize = nSize/sizeof(iv::Point2D);
|
|
|
+ if(nplansize < 1)
|
|
|
+ std::cout<<"UpdatePlanTrace_left size is 0................. "<<std::endl;
|
|
|
+// return;
|
|
|
int npsize = sizeof(iv::Point2D);
|
|
|
int i;
|
|
|
for(i=0;i<nplansize;i++)
|
|
@@ -1414,6 +1424,8 @@ void ADCIntelligentVehicle::UpdatePlanTrace_right(const char * strdata,const uns
|
|
|
mMutexPlan_right.lock();
|
|
|
m_plan_right.clear();
|
|
|
int nplansize = nSize/sizeof(iv::Point2D);
|
|
|
+ if(nplansize < 1)
|
|
|
+ std::cout<<"UpdatePlanTrace_right size is 0................. "<<std::endl;
|
|
|
int npsize = sizeof(iv::Point2D);
|
|
|
int i;
|
|
|
for(i=0;i<nplansize;i++)
|