Browse Source

change map_collectfromveh, not complete.

yuchuli 2 years ago
parent
commit
b70ccc425f

+ 255 - 0
src/tool/map_collectfromveh/editwin.cpp

@@ -0,0 +1,255 @@
+#include "editwin.h"
+#include "ui_editwin.h"
+
+#define VIEW_WIDTH 6000
+#define VIEW_HEIGHT 6000
+
+#include <iostream>
+
+#include "gnss_coordinate_convert.h"
+
+EditWin::EditWin(QWidget *parent) :
+    QMainWindow(parent),
+    ui(new Ui::EditWin)
+{
+    ui->setupUi(this);
+
+    myview = new MyView(this);
+    myview->setObjectName(QStringLiteral("graphicsView"));
+    myview->setGeometry(QRect(820, 10,500, 585));
+
+
+    mpscene = new  QGraphicsScene(0,0,VIEW_WIDTH,VIEW_HEIGHT);
+    mpscene->setBackgroundBrush(Qt::white);
+    myview->setScene(mpscene);
+
+    myview->centerOn(VIEW_WIDTH/2,VIEW_HEIGHT/2);
+
+    connect(myview,SIGNAL(dbclickxy(double,double)),this,SLOT(ondbclickxy(double,double)));
+
+    std::cout<<"init."<<std::endl;
+
+    setWindowTitle("Edit Collect Data");
+
+}
+
+EditWin::~EditWin()
+{
+    delete ui;
+}
+
+void EditWin::showEvent(QShowEvent *event)
+{
+    (void)event;
+    std::cout<<"show"<<std::endl;
+    ResetPointView();
+    updateshow();
+}
+
+
+void EditWin::resizeEvent(QResizeEvent *event)
+{
+    std::cout<<"resize"<<std::endl;
+    (void)event;
+    QSize sizemain = ui->centralwidget->size();
+
+//    ui->plainTextEdit->setGeometry(690,30,sizemain.width()-730,300);
+    myview->setGeometry(690,50,sizemain.width()-730,sizemain.height()-100);
+}
+
+void EditWin::closeEvent(QCloseEvent *event)
+{
+    std::cout<<"close. "<<std::endl;
+    (void)event;
+}
+
+void EditWin::Setcollect(iv::map::collectveh &xcollect)
+{
+    mcollectveh.CopyFrom(xcollect);
+}
+
+void EditWin::updateshow()
+{
+    int i;
+    int j;
+    for(i=0;i<mcollectveh.mroads_size();i++)
+    {
+        iv::map::collectvehroad * proad = mcollectveh.mutable_mroads(i);
+        for(j=0;j<proad->mpoints_size();j++)
+        {
+            iv::map::collectvehroadpoint * pmappoint = proad->mutable_mpoints(j);
+            double x_left,y_left,x_main,y_main,x_right,y_right;
+            double x0,y0;
+            double fhdg = (90 - pmappoint->mfheading())*M_PI/180.0;
+            GaussProjCal(pmappoint->mflon(),pmappoint->mflat(),&x_main,&y_main);
+            GaussProjCal(mcollectveh.mlon0(),mcollectveh.mlat0(),&x0,&y0);
+            x_main = x_main - x0;
+            y_main = y_main - y0;
+            x_left = x_main + pmappoint->mfdis_left()*cos(fhdg + M_PI/2.0);
+            y_left = y_main +  pmappoint->mfdis_left()*sin(fhdg + M_PI/2.0);
+            x_right = x_main + (pmappoint->mfdis_left() - pmappoint->mflanewidth())*cos(fhdg + M_PI/2.0);
+            y_right = y_main + (pmappoint->mfdis_left() - pmappoint->mflanewidth())*sin(fhdg + M_PI/2.0);
+
+            double ratio = myview->getbeishu();
+            double fscale = 1.0/ratio;
+            QGraphicsEllipseItem * pmainitem,* pleftitem,*prightitem;
+            pmainitem = new QGraphicsEllipseItem(0-mfMainSize/2.0,0*(-1)-mfMainSize/2.0,mfMainSize,mfMainSize);
+            pmainitem->setBrush(Qt::darkGray);
+            pmainitem->setPen(Qt::NoPen);
+            pmainitem->setPos(VIEW_WIDTH/2 + x_main,VIEW_HEIGHT/2 -y_main);
+            pmainitem->setScale(fscale);
+            mpscene->addItem(pmainitem);
+            pleftitem = new QGraphicsEllipseItem(0-mfLeftRightSize/2.0,0*(-1)-mfLeftRightSize/2.0,mfLeftRightSize,mfLeftRightSize);
+            pleftitem->setBrush(Qt::darkGray);
+            pleftitem->setPen(Qt::NoPen);
+            pleftitem->setPos(VIEW_WIDTH/2 + x_left,VIEW_HEIGHT/2 -y_left);
+            pleftitem->setScale(fscale);
+            mpscene->addItem(pleftitem);
+            prightitem = new QGraphicsEllipseItem(0-mfLeftRightSize/2.0,0*(-1)-mfLeftRightSize/2.0,mfLeftRightSize,mfLeftRightSize);
+            prightitem->setBrush(Qt::darkGray);
+            prightitem->setPen(Qt::NoPen);
+            prightitem->setPos(VIEW_WIDTH/2 + x_right,VIEW_HEIGHT/2 -y_right);
+            prightitem->setScale(fscale);
+            mpscene->addItem(prightitem);
+
+            mvectorLeftPointItem.push_back(pleftitem);
+            mvectorMainPointItem.push_back(pmainitem);
+            mvectorRightPointItem.push_back(prightitem);
+        }
+    }
+}
+
+void EditWin::ResetPointView()
+{
+    unsigned int i;
+    for(i=0;i<mvectorSelMainPointItem.size();i++)
+    {
+       mpscene->removeItem(mvectorSelMainPointItem[i]);
+       delete mvectorSelMainPointItem[i];
+    }
+    for(i=0;i<mvectorMainPointItem.size();i++)
+    {
+       mpscene->removeItem(mvectorMainPointItem[i]);
+       delete mvectorMainPointItem[i];
+    }
+    for(i=0;i<mvectorLeftPointItem.size();i++)
+    {
+        mpscene->removeItem(mvectorLeftPointItem[i]);
+        delete mvectorLeftPointItem[i];
+    }
+
+    for(i=0;i<mvectorRightPointItem.size();i++)
+    {
+        mpscene->removeItem(mvectorRightPointItem[i]);
+        delete mvectorRightPointItem[i];
+    }
+
+    if(mpSelPointItem != NULL)
+    {
+        mpscene->removeItem(mpSelPointItem);
+        delete mpSelPointItem;
+        mpSelPointItem = NULL;
+    }
+
+    mvectorSelMainPointItem.clear();
+    mvectorLeftPointItem.clear();
+    mvectorMainPointItem.clear();
+    mvectorRightPointItem.clear();
+}
+
+void EditWin::paintEvent(QPaintEvent * event)
+{
+    (void)event;
+    static double foldratio = 1.0;
+
+    double ratio = myview->getbeishu();
+    if(ratio != foldratio)
+    {
+        foldratio = ratio;
+        double fscale = 1.0/ratio;
+        unsigned int i;
+
+        for(i=0;i<mvectorSelMainPointItem.size();i++)
+        {
+            mvectorSelMainPointItem[i]->setScale(fscale);
+        }
+
+        for(i=0;i<mvectorLeftPointItem.size();i++)
+        {
+            mvectorLeftPointItem[i]->setScale(fscale);
+        }
+        for(i=0;i<mvectorMainPointItem.size();i++)
+        {
+            mvectorMainPointItem[i]->setScale(fscale);
+        }
+        for(i=0;i<mvectorRightPointItem.size();i++)
+        {
+            mvectorRightPointItem[i]->setScale(fscale);
+        }
+        if(mpSelPointItem != NULL)
+        {
+            mpSelPointItem->setScale(fscale);
+        }
+
+    }
+    myview->setScene(mpscene);
+}
+
+void EditWin::ondbclickxy(double x, double y)
+{
+    double sel_x,sel_y;
+    sel_x = x - VIEW_WIDTH/2;
+    sel_y = (y - VIEW_HEIGHT/2)*(-1.0);
+
+    int i;
+    int j;
+    double point_x,point_y;
+    iv::map::collectvehroadpoint * pnear = NULL;
+    double fdismin = 100000;
+    for(i=0;i<mcollectveh.mroads_size();i++)
+    {
+        iv::map::collectvehroad * proad = mcollectveh.mutable_mroads(i);
+        for(j=0;j<proad->mpoints_size();j++)
+        {
+            iv::map::collectvehroadpoint * ppoint = proad->mutable_mpoints(j);
+            double gpsx,gpsy;
+            double x0,y0;
+            GaussProjCal(mcollectveh.mlon0(),mcollectveh.mlat0(),&x0,&y0);
+            GaussProjCal(ppoint->mflon(),ppoint->mflat(),&gpsx,&gpsy);
+            double rel_x,rel_y;
+            rel_x = gpsx - x0;
+            rel_y = gpsy - y0;
+            double fdis = sqrt(pow(rel_x - sel_x,2)+pow(rel_y - sel_y,2));
+            if(fdis<fdismin)
+            {
+                fdismin = fdis;
+                if(fdismin < 10.0)
+                {
+                    pnear = ppoint;
+                    point_x = rel_x;
+                    point_y = rel_y;
+                }
+            }
+        }
+    }
+
+    if(pnear != NULL)
+    {
+        if(mpSelPointItem != NULL )
+        {
+            mpscene->removeItem(mpSelPointItem);
+            delete mpSelPointItem;
+            mpSelPointItem = NULL;
+        }
+
+        double ratio = myview->getbeishu();
+        double fscale = 1.0/ratio;
+        mpSelPointItem = new QGraphicsEllipseItem(0-mfSelSize/2.0,0*(-1)-mfSelSize/2.0,mfSelSize,mfSelSize);
+        mpSelPointItem->setBrush(Qt::red);
+        mpSelPointItem->setPen(Qt::NoPen);
+        mpSelPointItem->setPos(VIEW_WIDTH/2 + point_x,VIEW_HEIGHT/2 -point_y);
+        mpSelPointItem->setScale(fscale);
+        mpscene->addItem(mpSelPointItem);
+
+    }
+}

+ 60 - 0
src/tool/map_collectfromveh/editwin.h

@@ -0,0 +1,60 @@
+#ifndef EDITWIN_H
+#define EDITWIN_H
+
+#include <QMainWindow>
+
+#include "myview.h"
+#include "collectveh.pb.h"
+
+namespace Ui {
+class EditWin;
+}
+
+class EditWin : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    explicit EditWin(QWidget *parent = nullptr);
+    ~EditWin();
+
+public:
+     void resizeEvent(QResizeEvent *event);
+     void showEvent(QShowEvent *event);
+     void closeEvent(QCloseEvent *event);
+
+private:
+    Ui::EditWin *ui;
+
+    MyView *myview;
+
+    QGraphicsScene * mpscene;
+
+    std::vector<QGraphicsEllipseItem * > mvectorLeftPointItem;
+    std::vector<QGraphicsEllipseItem * > mvectorRightPointItem;
+    std::vector<QGraphicsEllipseItem * > mvectorMainPointItem;
+
+    std::vector<QGraphicsEllipseItem * > mvectorSelMainPointItem;
+    const double mfNowSize = 5.0;
+    const double mfMainSize = 9.0;
+    const double mfLeftRightSize = 5.0;
+    const double mfSelSize = 15.0;
+
+    QGraphicsEllipseItem * mpSelPointItem = NULL;
+
+private slots:
+    virtual void paintEvent(QPaintEvent *);
+    void ondbclickxy(double x,double y);
+
+private:
+    iv::map::collectveh mcollectveh;
+
+public:
+    void Setcollect(iv::map::collectveh & xcollect);
+
+private:
+    void updateshow();
+    void ResetPointView();
+};
+
+#endif // EDITWIN_H

+ 84 - 0
src/tool/map_collectfromveh/editwin.ui

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>EditWin</class>
+ <widget class="QMainWindow" name="EditWin">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1100</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <widget class="QGroupBox" name="groupBox_SelectMode">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>20</y>
+      <width>301</width>
+      <height>111</height>
+     </rect>
+    </property>
+    <property name="title">
+     <string>选择模式</string>
+    </property>
+    <widget class="QRadioButton" name="radioButton_selectnone">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>52</y>
+       <width>71</width>
+       <height>31</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>无</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_selectpoint">
+     <property name="geometry">
+      <rect>
+       <x>110</x>
+       <y>52</y>
+       <width>81</width>
+       <height>31</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>点</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_selectroad">
+     <property name="geometry">
+      <rect>
+       <x>200</x>
+       <y>52</y>
+       <width>112</width>
+       <height>31</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>路</string>
+     </property>
+    </widget>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>1100</width>
+     <height>28</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 193 - 29
src/tool/map_collectfromveh/mainwindow.cpp

@@ -12,14 +12,12 @@
 #include "commif.h"
 
 MainWindow * gw;
-
 #define VIEW_WIDTH 6000
 #define VIEW_HEIGHT 6000
 
 std::string strtypevalue[]={"None","Solid","Dash","Solid Solid","Dash Dash","Solid Dash","Dash Solid"};
 std::string strcolorvalue[]={"White","Yellow"};
 
-
 void UpdateGPS(const char * strdata,const unsigned int nSize)
 {
     std::shared_ptr<iv::gps::gpsimu> xgpsimu_ptr = std::shared_ptr<iv::gps::gpsimu>(new iv::gps::gpsimu);
@@ -33,8 +31,7 @@ void UpdateGPS(const char * strdata,const unsigned int nSize)
     gw->UpdateGPSIMU(xgpsimu_ptr);
 }
 
-LineItem * gt;
-QGraphicsEllipseItem * gpe;
+
 MainWindow::MainWindow(QWidget *parent)
     : QMainWindow(parent)
     , ui(new Ui::MainWindow)
@@ -71,7 +68,7 @@ MainWindow::MainWindow(QWidget *parent)
     ui->lineEdit_RoadName->setEnabled(false);
 
     ui->radioButton_Auto->setChecked(true);
-    ui->pushButton_ManualCollect->setEnabled(false);
+    ui->pushButton_ManualCollect->setEnabled(true);
 
     myview = new MyView(this);
     myview->setObjectName(QStringLiteral("graphicsView"));
@@ -95,26 +92,14 @@ MainWindow::MainWindow(QWidget *parent)
 
     RegisterRecvGPS((char *)"hcp2_gpsimu",UpdateGPS);
 
-//    LineItem * ptest = new LineItem(QPointF(100,100),QPointF(2000,100),1.0);
-//    mpscene->addItem(ptest);
-//    ptest->setPos(3000,3000);
-//    gt = ptest;
-
-//    QGraphicsEllipseItem * pe = new QGraphicsEllipseItem(-10.0,-10.0,20.0,20.0);
-//    pe->setPos(3000,3000);
-//    QBrush xBrush;
-//    xBrush.setColor(Qt::blue);
-//    pe->setBrush(Qt::green);
-//    pe->setPen(Qt::NoPen);
-//    mpscene->addItem(pe);
-//    gpe = pe;
-
     mpNowPosItem = new QGraphicsEllipseItem(0-mfNowSize/2.0,0-mfNowSize/2.0,mfNowSize,mfNowSize);
     mpNowPosItem->setBrush(Qt::green);
     mpNowPosItem->setPen(Qt::NoPen);
     mpNowPosItem->setPos(3000,3000);
     mpscene->addItem(mpNowPosItem);
 
+    mpEditWin = new EditWin(this);
+
     connect(this,SIGNAL(updategps()),this,SLOT(ongpsupdate()));
 
     setWindowTitle("Collect Data From Vehicle");
@@ -154,8 +139,7 @@ void MainWindow::resizeEvent(QResizeEvent *event)
     (void)event;
     QSize sizemain = ui->centralwidget->size();
 
-    ui->plainTextEdit->setGeometry(690,30,sizemain.width()-730,300);
-    myview->setGeometry(690,360,sizemain.width()-730,sizemain.height()-400);
+    myview->setGeometry(690,50,sizemain.width()-730,sizemain.height()-100);
 }
 
 void MainWindow::on_pushButton_NewRoad_clicked()
@@ -213,13 +197,21 @@ void MainWindow::paintEvent(QPaintEvent * event)
         {
             mvectorCurRightPointItem[i]->setScale(fscale);
         }
-    //    gt->setratio(ratio);
-    //    gpe->setScale(1.0/ratio);
-//        myview->setScene(mpscene);
+
+        for(i=0;i<mvectorLeftPointItem.size();i++)
+        {
+            mvectorLeftPointItem[i]->setScale(fscale);
+        }
+        for(i=0;i<mvectorMainPointItem.size();i++)
+        {
+            mvectorMainPointItem[i]->setScale(fscale);
+        }
+        for(i=0;i<mvectorRightPointItem.size();i++)
+        {
+            mvectorRightPointItem[i]->setScale(fscale);
+        }
     }
-//    mpNowPosItem->setScale(1.0/ratio);
-//    gt->setratio(ratio);
-//    gpe->setScale(1.0/ratio);
+
     myview->setScene(mpscene);
 
 }
@@ -357,7 +349,7 @@ void MainWindow::AddPoint(std::shared_ptr<iv::gps::gpsimu> xgpsimu_ptr)
 
 void MainWindow::ongpsupdate()
 {
-    const double thresh_headingdiff = 1.0;
+    const double thresh_headingdiff = 3.0;
     const double thresh_disdiff = 10.0;
     std::shared_ptr<iv::gps::gpsimu> xgpsimu_ptr;
     mMutex.lock();
@@ -387,9 +379,16 @@ void MainWindow::ongpsupdate()
     }
     if(mbStartCollect == false)return;
 
+    if(mbMaualCollect &&(mbManualClick == false))
+    {
+        return;
+    }
+
+
     if(mpcurroad->mpoints_size() == 0)
     {
         AddPoint(xgpsimu_ptr);
+        mbManualClick = false;
     }
     else
     {
@@ -405,15 +404,25 @@ void MainWindow::ongpsupdate()
         while(fheadingdiff<0)fheadingdiff = fheadingdiff + 360.0;
         while(fheadingdiff>=360)fheadingdiff = fheadingdiff -360.0;
 
-        if((fheadingdiff>=thresh_headingdiff)&&(fheadingdiff<=(360.0 - thresh_headingdiff)))
+        if((fheadingdiff>=thresh_headingdiff)&&(fheadingdiff<=(360.0 - thresh_headingdiff))&&(fdis>0.5))
         {
             AddPoint(xgpsimu_ptr);
+            mbManualClick = false;
         }
         else
         {
             if(fdis >= thresh_disdiff)
             {
                 AddPoint(xgpsimu_ptr);
+                mbManualClick = false;
+            }
+            else
+            {
+                if((fdis>0.5)&&(mbManualClick))
+                {
+                    AddPoint(xgpsimu_ptr);
+                    mbManualClick = false;
+                }
             }
         }
     }
@@ -422,6 +431,11 @@ void MainWindow::ongpsupdate()
 
 void MainWindow::on_actionReset_triggered()
 {
+    if(mbStartCollect)
+    {
+        QMessageBox::warning(this,"Warning",QString(tr("请先停止采集")),QMessageBox::YesAll);
+        return;
+    }
     QMessageBox::StandardButton button;
     button=QMessageBox::question(this,tr("重置采集"),QString(tr("是否重置采集")),QMessageBox::Yes|QMessageBox::No);
     if(button==QMessageBox::No)
@@ -431,6 +445,7 @@ void MainWindow::on_actionReset_triggered()
     else if(button==QMessageBox::Yes)
     {
         mcollectveh.clear_mroads();
+        ResetPointView();
         QMessageBox::information(this,"Info",tr("采集重置成功"),QMessageBox::YesAll);
     }
 
@@ -485,6 +500,11 @@ void MainWindow::on_actionSave_triggered()
 
 void MainWindow::on_actionLoad_triggered()
 {
+    if(mbStartCollect)
+    {
+        QMessageBox::warning(this,"Warning",QString(tr("请先停止采集")),QMessageBox::YesAll);
+        return;
+    }
     if(mcollectveh.mroads_size() > 0)
     {
         QMessageBox::StandardButton button;
@@ -506,6 +526,7 @@ void MainWindow::on_actionLoad_triggered()
     QByteArray ba = xFile.readAll();
     xFile.close();
     mcollectveh.clear_mroads();
+    ResetPointView();
     if(!mcollectveh.ParseFromArray(ba.data(),ba.size()))
     {
         QMessageBox::warning(this,"Warning","Parse File Data Fail.",QMessageBox::YesAll);
@@ -521,13 +542,156 @@ void MainWindow::on_actionLoad_triggered()
         mbSetZero = true;
         mlon0 = mcollectveh.mlon0();
         mlat0 = mcollectveh.mlat0();
+        UpdateLoadVIew();
     }
 
 }
 
+void MainWindow::UpdateLoadVIew()
+{
+    int i;
+    int j;
+    for(i=0;i<mcollectveh.mroads_size();i++)
+    {
+        iv::map::collectvehroad * proad = mcollectveh.mutable_mroads(i);
+        for(j=0;j<proad->mpoints_size();j++)
+        {
+            iv::map::collectvehroadpoint * pmappoint = proad->mutable_mpoints(j);
+            double x_left,y_left,x_main,y_main,x_right,y_right;
+            double x0,y0;
+            double fhdg = (90 - pmappoint->mfheading())*M_PI/180.0;
+            GaussProjCal(pmappoint->mflon(),pmappoint->mflat(),&x_main,&y_main);
+            GaussProjCal(mlon0,mlat0,&x0,&y0);
+            x_main = x_main - x0;
+            y_main = y_main - y0;
+            x_left = x_main + pmappoint->mfdis_left()*cos(fhdg + M_PI/2.0);
+            y_left = y_main +  pmappoint->mfdis_left()*sin(fhdg + M_PI/2.0);
+            x_right = x_main + (pmappoint->mfdis_left() - pmappoint->mflanewidth())*cos(fhdg + M_PI/2.0);
+            y_right = y_main + (pmappoint->mfdis_left() - pmappoint->mflanewidth())*sin(fhdg + M_PI/2.0);
+
+            double ratio = myview->getbeishu();
+            double fscale = 1.0/ratio;
+            QGraphicsEllipseItem * pmainitem,* pleftitem,*prightitem;
+            pmainitem = new QGraphicsEllipseItem(0-mfMainSize/2.0,0*(-1)-mfMainSize/2.0,mfMainSize,mfMainSize);
+            pmainitem->setBrush(Qt::darkGray);
+            pmainitem->setPen(Qt::NoPen);
+            pmainitem->setPos(VIEW_WIDTH/2 + x_main,VIEW_HEIGHT/2 -y_main);
+            pmainitem->setScale(fscale);
+            mpscene->addItem(pmainitem);
+            pleftitem = new QGraphicsEllipseItem(0-mfLeftRightSize/2.0,0*(-1)-mfLeftRightSize/2.0,mfLeftRightSize,mfLeftRightSize);
+            pleftitem->setBrush(Qt::darkGray);
+            pleftitem->setPen(Qt::NoPen);
+            pleftitem->setPos(VIEW_WIDTH/2 + x_left,VIEW_HEIGHT/2 -y_left);
+            pleftitem->setScale(fscale);
+            mpscene->addItem(pleftitem);
+            prightitem = new QGraphicsEllipseItem(0-mfLeftRightSize/2.0,0*(-1)-mfLeftRightSize/2.0,mfLeftRightSize,mfLeftRightSize);
+            prightitem->setBrush(Qt::darkGray);
+            prightitem->setPen(Qt::NoPen);
+            prightitem->setPos(VIEW_WIDTH/2 + x_right,VIEW_HEIGHT/2 -y_right);
+            prightitem->setScale(fscale);
+            mpscene->addItem(prightitem);
+
+            mvectorLeftPointItem.push_back(pleftitem);
+            mvectorMainPointItem.push_back(pmainitem);
+            mvectorRightPointItem.push_back(prightitem);
+        }
+    }
+}
+
 void MainWindow::on_pushButton_Complete_clicked()
 {
     mbStartCollect = false;
     ui->pushButton_Complete->setEnabled(false);
     ui->pushButton_NewRoad->setEnabled(true);
+
+    unsigned int i;
+    for(i=0;i<mvectorCurMainPointItem.size();i++)
+    {
+        mvectorCurMainPointItem[i]->setBrush(Qt::darkGray);
+
+    }
+
+    for(i=0;i<mvectorCurLeftPointItem.size();i++)
+    {
+        mvectorLeftPointItem.push_back(mvectorCurLeftPointItem[i]);
+    }
+    for(i=0;i<mvectorCurMainPointItem.size();i++)
+    {
+        mvectorMainPointItem.push_back(mvectorCurMainPointItem[i]);
+    }
+    for(i=0;i<mvectorCurRightPointItem.size();i++)
+    {
+        mvectorRightPointItem.push_back(mvectorCurRightPointItem[i]);
+    }
+
+    mvectorCurLeftPointItem.clear();
+    mvectorCurMainPointItem.clear();
+    mvectorCurRightPointItem.clear();
+
+}
+
+void MainWindow::on_actionEdit_Collect_triggered()
+{
+    mpEditWin->Setcollect(mcollectveh);
+    mpEditWin->show();
+}
+
+void MainWindow::ResetPointView()
+{
+    unsigned int i;
+    for(i=0;i<mvectorCurMainPointItem.size();i++)
+    {
+       mpscene->removeItem(mvectorCurMainPointItem[i]);
+       delete mvectorCurMainPointItem[i];
+    }
+    for(i=0;i<mvectorCurLeftPointItem.size();i++)
+    {
+        mpscene->removeItem(mvectorCurLeftPointItem[i]);
+        delete mvectorCurLeftPointItem[i];
+    }
+
+    for(i=0;i<mvectorCurRightPointItem.size();i++)
+    {
+        mpscene->removeItem(mvectorCurRightPointItem[i]);
+        delete mvectorCurRightPointItem[i];
+    }
+
+    for(i=0;i<mvectorMainPointItem.size();i++)
+    {
+       mpscene->removeItem(mvectorMainPointItem[i]);
+       delete mvectorMainPointItem[i];
+    }
+    for(i=0;i<mvectorLeftPointItem.size();i++)
+    {
+        mpscene->removeItem(mvectorLeftPointItem[i]);
+        delete mvectorLeftPointItem[i];
+    }
+
+    for(i=0;i<mvectorRightPointItem.size();i++)
+    {
+        mpscene->removeItem(mvectorRightPointItem[i]);
+        delete mvectorRightPointItem[i];
+    }
+
+    mvectorCurLeftPointItem.clear();
+    mvectorCurMainPointItem.clear();
+    mvectorCurRightPointItem.clear();
+    mvectorLeftPointItem.clear();
+    mvectorMainPointItem.clear();
+    mvectorRightPointItem.clear();
+}
+
+void MainWindow::on_radioButton_Auto_clicked()
+{
+    mbMaualCollect = false;
+}
+
+void MainWindow::on_radioButton_Manual_clicked()
+{
+    mbMaualCollect = true;
+}
+
+void MainWindow::on_pushButton_ManualCollect_clicked()
+{
+    mbManualClick = true;
 }

+ 18 - 0
src/tool/map_collectfromveh/mainwindow.h

@@ -6,6 +6,8 @@
 
 #include <memory>
 
+#include "editwin.h"
+
 #include "myview.h"
 
 #include "lineitem.h"
@@ -45,6 +47,14 @@ private slots:
 
     void on_pushButton_Complete_clicked();
 
+    void on_actionEdit_Collect_triggered();
+
+    void on_radioButton_Auto_clicked();
+
+    void on_radioButton_Manual_clicked();
+
+    void on_pushButton_ManualCollect_clicked();
+
 public:
      void resizeEvent(QResizeEvent *event);
 
@@ -60,6 +70,8 @@ signals:
 private:
     void ChangeRightValue();
     void AddPoint(std::shared_ptr<iv::gps::gpsimu> xgpsimu_ptr);
+    void ResetPointView();
+    void UpdateLoadVIew();
 private:
     Ui::MainWindow *ui;
 
@@ -87,10 +99,16 @@ private:
     bool mbSetZero = false;
     bool mbStartCollect = false;
 
+    bool mbManualClick = false;
+    bool mbMaualCollect = false;
+
 private:
     iv::map::collectveh mcollectveh;
     iv::map::collectvehroad * mpcurroad;
     iv::map::collectvehroadpoint * mplastaddpoint;
 
+private:
+    EditWin *  mpEditWin;
+
 };
 #endif // MAINWINDOW_H

+ 15 - 13
src/tool/map_collectfromveh/mainwindow.ui

@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>1207</width>
-    <height>715</height>
+    <width>1300</width>
+    <height>768</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -292,16 +292,6 @@
      </property>
     </widget>
    </widget>
-   <widget class="QPlainTextEdit" name="plainTextEdit">
-    <property name="geometry">
-     <rect>
-      <x>710</x>
-      <y>30</y>
-      <width>471</width>
-      <height>181</height>
-     </rect>
-    </property>
-   </widget>
    <widget class="QLabel" name="label_8">
     <property name="geometry">
      <rect>
@@ -331,7 +321,7 @@
     <rect>
      <x>0</x>
      <y>0</y>
-     <width>1207</width>
+     <width>1300</width>
      <height>28</height>
     </rect>
    </property>
@@ -343,7 +333,14 @@
     <addaction name="actionSave"/>
     <addaction name="actionReset"/>
    </widget>
+   <widget class="QMenu" name="menuEdit">
+    <property name="title">
+     <string>Edit</string>
+    </property>
+    <addaction name="actionEdit_Collect"/>
+   </widget>
    <addaction name="menuFile"/>
+   <addaction name="menuEdit"/>
   </widget>
   <widget class="QStatusBar" name="statusbar"/>
   <action name="actionLoad">
@@ -361,6 +358,11 @@
     <string>Reset</string>
    </property>
   </action>
+  <action name="actionEdit_Collect">
+   <property name="text">
+    <string>Edit Collect</string>
+   </property>
+  </action>
  </widget>
  <resources/>
  <connections/>

+ 3 - 0
src/tool/map_collectfromveh/map_collectfromveh.pro

@@ -13,6 +13,7 @@ SOURCES += \
     ../../include/msgtype/collectveh.pb.cc \
     ../../include/msgtype/gpsimu.pb.cc \
     commif.cpp \
+    editwin.cpp \
     lineitem.cpp \
     main.cpp \
     mainwindow.cpp \
@@ -23,11 +24,13 @@ HEADERS += \
     ../../include/msgtype/collectveh.pb.h \
     ../../include/msgtype/gpsimu.pb.h \
     commif.h \
+    editwin.h \
     lineitem.h \
     mainwindow.h \
     myview.h
 
 FORMS += \
+    editwin.ui \
     mainwindow.ui
 
 # Default rules for deployment.