Browse Source

change ADCIntelligentShow_grpc. Add xodr view show.

yuchuli 1 year ago
parent
commit
649db1082a

+ 20 - 0
src/driver/driver_grpc_client/grpcclientthread.cpp

@@ -21,6 +21,24 @@ grpcclientthread::grpcclientthread()
     ggrpcclient = this;
 }
 
+grpcclientthread::~grpcclientthread()
+{
+    ggrpcclient = this;
+    requestInterruption();
+    int n = 0;
+    while(n<10)
+    {
+        n++;
+        std::cout<<" n: "<<n<<std::endl;
+        if(mbRuning == false)
+        {
+            break;
+        }
+
+        std::this_thread::sleep_for(std::chrono::milliseconds(100));
+    }
+}
+
 void grpcclientthread::dec_yaml(const char * stryamlpath)
 {
 
@@ -336,6 +354,8 @@ void grpcclientthread::run()
         }
 
     }
+
+    mbRuning = false;
 }
 
 void grpcclientthread::sharequerymsg(const iv::ModuleMsg *pxmsg)

+ 2 - 0
src/driver/driver_grpc_client/grpcclientthread.h

@@ -39,12 +39,14 @@ class grpcclientthread  : public QThread
 {
 public:
     grpcclientthread();
+    ~grpcclientthread();
 
 private:
     std::string mstrserverip =  "192.168.1.102";//"123.57.212.138";
     std::string mstrserverport = "30051";//"9000";
     std::string mstrqueryinterval = "10";
     std::string mstrdevname = "PAD";
+    bool mbRuning = true;
     void * mpa;
     QMutex mMutexMsg;
     std::thread * guploadthread;

+ 13 - 3
src/ui/ADCIntelligentShow_grpc/adcintelligentshow.cpp

@@ -227,7 +227,10 @@ ADCIntelligentShow::ADCIntelligentShow(QWidget *parent) :
                         "QCheckBox#checkBox::indicator:checked\n{ border-image:url(:/new/pic/call1.png);\n}"
                         "QCheckBox#checkBox_2::indicator\n{width: 110px;height: 110px;\n}"
                         "QCheckBox#checkBox_2::indicator:unchecked\n{ border-image:url(:/new/pic/mulcar_gray.png);\n}"
-                        "QCheckBox#checkBox_2::indicator:checked\n{ border-image:url(:/new/pic/mulcar.png);\n}");
+                        "QCheckBox#checkBox_2::indicator:checked\n{ border-image:url(:/new/pic/mulcar.png);\n}"
+                        "QCheckBox#checkBox_HDMap::indicator\n{width: 110px;height: 110px;\n}"
+                        "QCheckBox#checkBox_HDMap::indicator:unchecked\n{ border-image:url(:/new/pic/hdmapblack.png);\n}"
+                        "QCheckBox#checkBox_HDMap::indicator:checked\n{ border-image:url(:/new/pic/hdmapcolor.png);\n}");
 
 
     QDesktopWidget *desktopWidget = QApplication::desktop();
@@ -360,6 +363,7 @@ ADCIntelligentShow::ADCIntelligentShow(QWidget *parent) :
 
     mpivmapview->setMapMode(1);
     ui->checkBox_HDMap->setChecked(true);
+//    ui->checkBox_HDMap->setStyleSheet("border-image: url(:/new/pic/hdmapcolor.png);");
 
 #ifdef ANDROID
 
@@ -399,6 +403,8 @@ ADCIntelligentShow::ADCIntelligentShow(QWidget *parent) :
 
 ADCIntelligentShow::~ADCIntelligentShow()
 {
+
+    mpivmapview->requestInterruption();
     iv::modulecomm::Unregister(mpabrainstate);
     iv::modulecomm::Unregister(mpadecision);
     iv::modulecomm::Unregister(mpagps);
@@ -407,7 +413,7 @@ ADCIntelligentShow::~ADCIntelligentShow()
     iv::modulecomm::Unregister(mparadar);
     iv::modulecomm::Unregister(mpatracemap);
     iv::modulecomm::Unregister(mpadst);
-//    std::this_thread::sleep_for(std::chrono::milliseconds(50));
+    std::this_thread::sleep_for(std::chrono::milliseconds(500));
     delete ui;
 
     if(soundAlarm){
@@ -430,7 +436,7 @@ void ADCIntelligentShow::resizeEvent(QResizeEvent *event)
     ui->pushButton_go->setGeometry(490,30,100,50);
     ui->pushButton_AddStation->setGeometry(600,30,100,50);
     ui->pushButton_DelStation->setGeometry(730,30,100,50);
-    ui->checkBox_HDMap->setGeometry(860,30,100,100);
+    ui->checkBox_HDMap->setGeometry(910,30,100,100);
 #else
 
 //    ui->pushButton_prestation->setGeometry(30,30,150,100);
@@ -1198,6 +1204,8 @@ void ADCIntelligentShow::on_pushButton_nextstation_clicked()
     mnStationIndex++;
     if(mnStationIndex>=gvectorpos.size())mnStationIndex = 0;
     ui->label_station->setText(gvectorpos[mnStationIndex].mstrstationname.data());
+
+    mpivmapview->setStationIndex(mnStationIndex);
 }
 
 void ADCIntelligentShow::on_pushButton_prestation_clicked()
@@ -1206,6 +1214,8 @@ void ADCIntelligentShow::on_pushButton_prestation_clicked()
     mnStationIndex--;
     if(mnStationIndex<0)mnStationIndex = gvectorpos.size()-1;
     ui->label_station->setText(gvectorpos[mnStationIndex].mstrstationname.data());
+
+    mpivmapview->setStationIndex(mnStationIndex);
 }
 
 void ADCIntelligentShow::on_pushButton_go_clicked()

+ 2 - 0
src/ui/ADCIntelligentShow_grpc/adcintelligentshow.qrc

@@ -33,6 +33,8 @@
         <file>pre.png</file>
         <file>next2.png</file>
         <file>pre2.png</file>
+        <file>hdmapblack.png</file>
+        <file>hdmapcolor.png</file>
     </qresource>
     <qresource prefix="/">
         <file>Car-Control-icon/JinGuang-Guan.svg</file>

+ 1 - 1
src/ui/ADCIntelligentShow_grpc/adcintelligentshow.ui

@@ -636,7 +636,7 @@ font: 30px &quot;Ubuntu&quot;;</string>
       </rect>
      </property>
      <property name="text">
-      <string>HD</string>
+      <string/>
      </property>
     </widget>
    </widget>

BIN
src/ui/ADCIntelligentShow_grpc/hdmapblack.png


BIN
src/ui/ADCIntelligentShow_grpc/hdmapcolor.png


+ 486 - 2
src/ui/ADCIntelligentShow_grpc/ivmapview.cpp

@@ -1,7 +1,17 @@
 #include "ivmapview.h"
 
 #define VIEW_WIDTH  1100
-#define VIEW_HEIGHT 1100
+#define VIEW_HEIGHT 900
+
+double glon0 = 117.0866293;
+double glat0 = 39.1364713;
+//double glon0 = 117;
+//double glat0 = 39;
+double ghdg0 = 360;
+
+#include "pos_def.h"
+
+extern std::vector<iv::pos_def> gvectorpos;
 
 #include <math.h>
 //高斯投影由经纬度(Unit:DD)反算大地坐标(含带号,Unit:Metres)
@@ -46,6 +56,114 @@ static bool LoadXODR(std::string strpath,OpenDrive & xxodr)
     xp.ReadFile(strpath);
 }
 
+static int getmnfac(OpenDrive & mxodr,double & fmovex,double & fmovey)
+{
+    int nrtn = 1;
+
+    int i;
+    double fxmin,fxmax,fymin,fymax;
+    fxmin = std::numeric_limits<double>::max() *(1.0);
+    fxmax = std::numeric_limits<double>::max()*(-1.0);
+    fymin = std::numeric_limits<double>::max() *(1.0);
+    fymax = std::numeric_limits<double>::max()*(-1.0);
+    bool bHaveRealRoad = false;
+    for(i=0;i<mxodr.GetRoadCount();i++)
+    {
+        int j;
+
+        Road * pRoad = mxodr.GetRoad(i);
+        if(pRoad->GetRoadLength()<0.1)
+        {
+            continue;
+        }
+        bHaveRealRoad = true;
+        for(j=0;j<mxodr.GetRoad(i)->GetGeometryBlockCount();j++)
+        {
+            GeometryBlock * pgeob = pRoad->GetGeometryBlock(j);
+            double x,y;
+
+            RoadGeometry * pg;
+            pg = pgeob->GetGeometryAt(0);
+
+            x = pg->GetX();
+            y = pg->GetY();
+
+            if(x>fxmax)fxmax = x;
+            if(x<fxmin)fxmin = x;
+            if(y>fymax)fymax = y;
+            if(y<fymin)fymin = y;
+
+        }
+
+        double x,y,hdg;
+
+        int nco = pRoad->GetGeometryCoords(pRoad->GetRoadLength()-0.1,x,y,hdg);
+        if(nco >= 0)
+        {
+            if(x>fxmax)fxmax = x;
+            if(x<fxmin)fxmin = x;
+            if(y>fymax)fymax = y;
+            if(y<fymin)fymin = y;
+        }
+    }
+
+    if(bHaveRealRoad == false)
+    {
+        std::cout<<"No Real Road."<<std::endl;
+        return 1.0;
+    }
+
+    fmovex = 0;
+    fmovey = 0;
+    if(((fxmax>1000)&&(fxmin>1000))||((fxmax<-1000)&&(fxmin<-1000)))
+    {
+        fmovex = (fxmax + fxmin)/2.0;
+    }
+
+    if(((fymax>1000)&&(fymin>1000))||((fymax<-1000)&&(fymin<-1000)))
+    {
+        fmovey = (fymax + fymin)/2.0;
+    }
+
+    double fabsxmax = fabs(fxmax);
+    if(fabsxmax < fabs(fxmin))fabsxmax = fabs(fxmin);
+    double fabsymax = fabs(fymax);
+    if(fabsymax < fabs(fymin))fabsymax = fabs(fymin);
+    int nfacx=1;
+    if(fabsxmax!= 0)
+    {
+        nfacx = (VIEW_WIDTH/2)/(fabsxmax*1.2);
+    }
+    int nfacy = 1;
+    if(fabsymax != 0)
+    {
+        nfacy = (VIEW_HEIGHT/2)/(fabsymax*1.2);
+    }
+    if(nfacx<1)nfacx = 1;
+    if(nfacy<1)nfacy = 1;
+
+
+
+    if(nfacx < nfacy)nrtn = nfacx;
+    else nrtn = nfacy;
+
+    if(nrtn<=1)
+    {
+        nrtn = 1;
+        return nrtn;
+    }
+
+    if(nrtn >(VIEW_WIDTH/1600))
+    {
+        nrtn = nrtn/(VIEW_WIDTH/1600);
+    }
+
+
+
+    return nrtn;
+}
+
+
 ivmapview::ivmapview()
 {
     image = new QImage(VIEW_WIDTH, VIEW_HEIGHT, QImage::Format_RGB32);//画布的初始化大小设为300*300,使用32位颜色
@@ -55,6 +173,36 @@ ivmapview::ivmapview()
     std::vector<iv::ObstacleBasic> * pobs = new std::vector<iv::ObstacleBasic>();
     mobs.reset(pobs);
     mnavigation_data.clear();
+
+    LoadXODR("./map.xodr",mxodr);
+
+    double fmovex,fmovey;
+    mnfac = getmnfac(mxodr,fmovex,fmovey);
+
+    mfViewMoveX = mfViewMoveX - fmovex;
+    mfViewMoveY = mfViewMoveY - fmovey;
+
+    mnMoveX = VIEW_WIDTH/2;
+    mnMoveY = VIEW_HEIGHT/2;
+
+    mnDefmnfac = mnfac;
+    mnDefMoveX = mnMoveX;
+    mnDefMoveY = mnMoveY;
+
+//    mnfac = 100;
+//    mnfac = 20;
+
+    unsigned short int revMajor,revMinor;
+    std::string name,date;
+    float version;
+    double north,south,east,west,lat0,lon0,hdg0;
+    if(mxodr.GetHeader() != 0)
+    {
+        mxodr.GetHeader()->GetAllParams(revMajor,revMinor,name,version,date,north,south,east,west,lat0,lon0,hdg0);
+        glat0 = lat0;
+        glon0 = lon0;
+    }
+    GaussProjCal(glon0,glat0,&mx0,&my0);
 }
 
 void ivmapview::run()
@@ -62,6 +210,8 @@ void ivmapview::run()
     while(!QThread::isInterruptionRequested())
     {
         bool bNeedUpdate = false;
+        if(mnMapMode == 0 )
+        {
         qint64 xTime = QDateTime::currentMSecsSinceEpoch();
         if(mnavigation_data.size()> 0)
         {
@@ -83,10 +233,339 @@ void ivmapview::run()
 
         if(bNeedUpdate)paint();
         msleep(100);
+        }
+        else
+        {
+            paintxodr();
+            msleep(100);
+            std::cout<<"paint."<<std::endl;
+        }
     }
 }
 
 
+void ivmapview::paintxodr()
+{
+    QTime x;
+    x.start();
+    //    qDebug("painter.");
+
+
+    qint64 xTime = QDateTime::currentMSecsSinceEpoch();
+    std::vector<iv::MAP_GPS_INS> xnavigation_data;
+    iv::gps::gpsimu xgpsimu;
+    mMutexMap.lock();
+    xnavigation_data = mnavigation_data;
+    mMutexMap.unlock();
+
+     mMutexPaint.lock();
+
+    painter->begin(image);
+    qDebug("time is %d",x.elapsed());
+    image->fill(QColor(255, 255, 255));//对画布进行填充
+
+    //    std::vector<iv::GPSData> navigation_data = brain->navigation_data;
+    painter->setRenderHint(QPainter::Antialiasing, true);//设置反锯齿模式,好看一点
+
+    painter->translate(mnMoveX,mnMoveY);
+
+
+    painter->setPen(Qt::black);
+
+//    painter->drawLine(VIEW_WIDTH/(-2),0,VIEW_WIDTH/2,0);
+//    painter->drawLine(0,VIEW_HEIGHT/(-2),0,VIEW_HEIGHT/2);
+
+    int i;
+
+
+    //         int nfac = 5;;
+
+
+
+    painter->setPen(Qt::blue);
+    int nfac = mnfac;
+    for(i=0;i<mxodr.GetRoadCount();i++)
+    {
+        int j;
+        Road * pRoad = mxodr.GetRoad(i);
+        for(j=0;j<mxodr.GetRoad(i)->GetGeometryBlockCount();j++)
+        {
+            GeometryBlock * pgeob = pRoad->GetGeometryBlock(j);
+            double x,y;
+            double x_center,y_center;
+            double R;
+            RoadGeometry * pg;
+            GeometryArc * parc;
+            GeometryParamPoly3 * ppp3;
+            GeometrySpiral *pSpiral;
+            GeometryPoly3 *ppoly;
+            double rel_x,rel_y,rel_hdg;
+            pg = pgeob->GetGeometryAt(0);
+
+            x = pg->GetX();
+            y = pg->GetY();
+
+            switch (pg->GetGeomType()) {
+            case 0:
+                x = x + mfViewMoveX;
+                y = y + mfViewMoveY;
+                painter->drawLine(QPoint(x*mnfac,y*mnfac*(-1)),
+                                  QPoint((x + pg->GetLength() * cos(pg->GetHdg()))*mnfac,(y + pg->GetLength() * sin(pg->GetHdg()))*mnfac*(-1)));
+                break;
+
+            case 1:
+                pSpiral = (GeometrySpiral * )pg;
+            {
+                int ncount = pSpiral->GetLength() * mnfac;
+                double sstep = pSpiral->GetLength()/((double)ncount);
+                int k;
+                double x0,y0,hdg0,s0;
+                x0 = pSpiral->GetX();
+                y0 = pSpiral->GetY();
+                s0 = pSpiral->GetS();
+                hdg0 = pSpiral->GetHdg() ;
+   //             painter->setPen(Qt::red);
+                for(k=0;k<ncount;k++)
+                {
+                    pSpiral->GetCoords(s0+sstep*k,rel_x,rel_y,rel_hdg);
+
+                    x = rel_x;
+                    y = rel_y;
+                    x = x + mfViewMoveX;
+                    y = y + mfViewMoveY;
+                    painter->drawPoint((int)(x*mnfac),(int)(y*(-1.0*mnfac)));
+
+                }
+//                painter->setPen(Qt::blue);
+            }
+
+                //                    qDebug("spi");
+                break;
+            case 2:
+            {
+                parc = (GeometryArc *)pg;
+                R = abs(1.0/parc->GetCurvature());
+                if(parc->GetCurvature() > 0)
+                {
+                    x_center = pg->GetX() + R *cos(pg->GetHdg() + M_PI/2.0);
+                    y_center = pg->GetY() + R * sin(pg->GetHdg() + M_PI/2.0);
+                }
+                else
+                {
+                    x_center = pg->GetX() + R *cos(pg->GetHdg() -M_PI/2.0);
+                    y_center = pg->GetY() + R * sin(pg->GetHdg() - M_PI/2.0);
+                }
+
+                int k;
+                int ncount = parc->GetLength() * mnfac ;
+                double curv = parc->GetCurvature();
+                double hdgstep;
+                double hdg0 = parc->GetHdg();
+                double hdgnow = parc->GetHdg();
+                if(ncount > 0) hdgstep= (parc->GetLength()/R)/ncount;
+                for(k=0;k<ncount;k++)
+                {
+                    double x_draw,y_draw;
+
+                    if(curv > 0)
+                    {
+                        hdgnow =  hdg0 + k*hdgstep;
+                        x_draw = x_center + R *cos(hdgnow - M_PI/2.0);
+                        y_draw = y_center + R * sin(hdgnow - M_PI/2.0);
+                    }
+                    else
+                    {
+                        hdgnow = hdg0 - k * hdgstep;
+                        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));
+                }
+            }
+                break;
+            case 3:
+            {
+                painter->setPen(Qt::red);
+                ppoly = (GeometryPoly3 *)pg;
+                x = pg->GetX();
+                y = pg->GetY();
+                double A,B,C,D;
+                A = ppoly->GetA();
+                B = ppoly->GetB();
+                C = ppoly->GetC();
+                D = ppoly->GetD();
+                const double steplim = 0.1;
+                double du = steplim;
+                double u = 0;
+                double v = 0;
+                double oldx,oldy;
+                oldx = x;
+                oldy = y;
+                double xstart,ystart;
+                xstart = x;
+                ystart = y;
+                double hdgstart = ppoly->GetHdg();
+                double flen = 0;
+                while(flen < ppoly->GetLength())
+                {
+                    //                        double fdis = 0;
+                    //                        v = A + B*u + C*u*u + D*u*u*u;
+                    //                        x = xstart + u*cos(hdgstart) - v*sin(hdgstart);
+                    //                        y = ystart + u*sin(hdgstart) + v*cos(hdgstart);
+                    //                        fdis = sqrt(pow(x- oldx,2)+pow(y-oldy,2));
+                    //                        oldx = x;
+                    //                        oldy = y;
+                    //                        if(fdis>(steplim*2.0))du = du/2.0;
+                    //                        flen = flen + fdis;
+                    //                        u = u + du;
+                    double fHdg;
+                    ppoly->GetCoords(flen,x,y,fHdg);
+                    //                       std::cout<<" x: "<<x<<" y:"<<y<<std::endl;
+                    x = x + mfViewMoveX;
+                    y = y + mfViewMoveY;
+                    painter->drawPoint((int)(x*mnfac),(int)(y*(-1.0*mnfac)));
+                    flen = flen + steplim;
+                }
+//                painter->setPen(Qt::blue);
+            }
+                break;
+            case 4:
+            {
+                ppp3 = (GeometryParamPoly3 * )pg;
+                int ncount = ppp3->GetLength()* mnfac;
+                double sstep;
+                if(ncount > 0)sstep = ppp3->GetLength()/ncount;
+                else sstep = 10000.0;
+                double s = 0;
+                while(s < ppp3->GetLength())
+                {
+                    double fhdg;
+                    ppp3->GetCoords(ppp3->GetS() + s,x,y,fhdg);
+//                    double xtem,ytem;
+//                    xtem = ppp3->GetuA() +  ppp3->GetuB() * s +  ppp3->GetuC() * s*s +  ppp3->GetuD() * s*s*s;
+//                    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;
+                }
+            }
+                break;
+            default:
+                break;
+            }
+
+            //         painter->drawPoint((int)(x*mnfac),(int)(y*(-1.0*mnfac)));
+
+        }
+    }
+
+
+    QPen pen;
+    pen.setWidth(3);
+    pen.setColor(Qt::green);
+    painter->setPen(pen);
+
+    double x0,y0;
+    GaussProjCal(glon0,glat0,&x0,&y0);
+    int nMapSize = xnavigation_data.size();
+    for(i=0;i<nMapSize;i++)
+    {
+        double x,y;
+//        GaussProjCal(xnavigation_data.at(i).gps_lng,xnavigation_data.at(i).gps_lat,&x,&y);
+        x = xnavigation_data.at(i).gps_x;
+        y = xnavigation_data.at(i).gps_y;
+        x = x-x0;
+        y= y-y0;
+
+        x = x + mfViewMoveX;
+        y = y + mfViewMoveY;
+        painter->drawPoint((int)(x*mnfac),(int)(y*(-1.0*mnfac)));
+    }
+
+    painter->setPen(Qt::blue);
+
+
+    if((xTime - mnTimeGPSUpdate)<3000)
+    {
+        mMutexGPS.lock();
+        xgpsimu.CopyFrom(mgpsimu);
+        mMutexGPS.unlock();
+
+        painter->setPen(Qt::green);
+        QPoint xP[4];
+
+        double x[4],y[4];
+        double x0[4],y0[4];
+        double xu = mnMarkSize*3;
+        x0[0] = -xu;y0[0] = -xu;
+        x0[1] = xu*2; y0[1] = 0;
+        x0[2] = -xu;y0[2] =xu;
+        x0[3] = 0; y0[3] = 0;
+
+        double xnow,ynow,hdgnow;
+        hdgnow = (90- xgpsimu.heading()) * M_PI/180.0;
+        GaussProjCal(xgpsimu.lon(),xgpsimu.lat(),&xnow,&ynow);
+        double xz,yz;
+        GaussProjCal(glon0,glat0,&xz,&yz);
+        xnow = xnow - xz;
+        ynow = ynow - yz;
+
+        double hr= hdgnow;
+        for(i=0;i<4;i++)
+        {
+            x[i] = x0[i]*cos(hr) +y0[i]*sin(hr);
+            y[i] = y0[i]*cos(hr) - x0[i]*sin(hr);
+            xP[i].setX((xnow + mfViewMoveX)*mnfac  + x[i]);
+            xP[i].setY((ynow + mfViewMoveY)*mnfac*(-1) + y[i]);
+        }
+
+        //        painter->drawRect(mfManualX*mnfac-5,mfManualY*mnfac*(-1)-5,10,10);
+
+        painter->drawPolygon(xP,4);
+        painter->setPen(Qt::black);
+    }
+
+    int nstationsize = gvectorpos.size();
+
+    for(i=0;i<nstationsize;i++)
+    {
+
+        double xpos,ypos;
+        GaussProjCal(gvectorpos[i].mflon,gvectorpos[i].mflat,&xpos,&ypos);
+        double xz,yz;
+        GaussProjCal(glon0,glat0,&xz,&yz);
+
+        xpos = xpos - xz;
+        ypos = ypos - yz;
+
+
+        painter->setPen(Qt::red);
+        painter->setBrush(Qt::red)
+;        if(i != mnStationIndex)
+            painter->drawEllipse(QPoint((xpos + mfViewMoveX)*mnfac ,(ypos + mfViewMoveX)*mnfac*(-1)),mnMarkSize,mnMarkSize);
+        else
+            painter->drawEllipse(QPoint((xpos + mfViewMoveX)*mnfac ,(ypos + mfViewMoveX)*mnfac*(-1)),2*mnMarkSize,2*mnMarkSize);
+
+        painter->setBrush(Qt::NoBrush);
+        painter->setPen(Qt::black);
+    }
+
+
+
+
+    painter->end();
+
+    mMutexPaint.unlock();
+    mbImageUpdate = true;
+
+    std::cout<<" draw map use: "<<(QDateTime::currentMSecsSinceEpoch() - xTime)<<std::endl;
+
+}
 
 void ivmapview::paint()
 {
@@ -443,7 +922,12 @@ void ivmapview::setfusion(iv::fusion::fusionobjectarray &xfusion)
 
 void ivmapview::setMapMode(int nMode)
 {
-    mnMapMode = 1;
+    mnMapMode = nMode;
+}
+
+void ivmapview::setStationIndex(int nStationIndex)
+{
+    mnStationIndex = nStationIndex;
 }
 
 

+ 33 - 0
src/ui/ADCIntelligentShow_grpc/ivmapview.h

@@ -17,6 +17,18 @@
 
 #include "OpenDrive/OpenDriveXmlParser.h"
 
+namespace iv {
+
+struct mapline
+{
+    int x1;
+    int y1;
+    int x2;
+    int y2;
+};
+
+}
+
 
 class ivmapview : public IVView
 {
@@ -41,6 +53,7 @@ private:
 
 private:
     void paint();
+    void paintxodr();
     QImage * mimagepaint;
 
 private:
@@ -64,6 +77,25 @@ private:
 
     int mnMapMode = 1; // 0 nomal  1 opendrive view
 
+    OpenDrive mxodr;
+
+    int mnMoveX;
+    int mnMoveY;
+
+    double mfViewMoveX = 0;
+    double mfViewMoveY = 0;
+
+    int  mnfac = 1;
+    double mfSampleDis = 1.0;
+
+     double mx0,my0;
+
+     int mnMarkSize = 5;
+
+     int mnDefmnfac,mnDefMoveX,mnDefMoveY;
+
+     int mnStationIndex = 0;
+
 
 public:
     void setgps(iv::gps::gpsimu * pxgpsimu);
@@ -72,6 +104,7 @@ public:
     void setradar(iv::radar::radarobjectarray * pradarobj);
     void setfusion(iv::fusion::fusionobjectarray & xfusion);
     void setMapMode(int nMode);
+    void setStationIndex(int nStationIndex);
 };
 
 #endif // IVMAPVIEW_H

+ 1 - 0
src/ui/ADCIntelligentShow_grpc/main.cpp

@@ -235,6 +235,7 @@ int main(int argc, char *argv[])
 
 #else
      w.show();
+     w.showMaximized();
 #endif
 
     return a.exec();