123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- #ifndef MAINWINDOW_H
- #define MAINWINDOW_H
- #include <QMainWindow>
- #include <QLabel>
- #include <QGroupBox>
- #include <QLineEdit>
- #include <QSlider>
- #include <QComboBox>
- #include <QPushButton>
- #include <QTimer>
- #include <QCheckBox>
- #include "OpenDrive/OpenDrive.h"
- #include "OpenDrive/OpenDriveXmlParser.h"
- #include "myview.h"
- #include "simmodel_shenlan.h"
- #include "decition.pb.h"
- QT_BEGIN_NAMESPACE
- namespace Ui { class MainWindow; }
- QT_END_NAMESPACE
- class MainWindow : public QMainWindow
- {
- Q_OBJECT
- public:
- MainWindow(QWidget *parent = nullptr);
- ~MainWindow();
- private slots:
- virtual void paintEvent(QPaintEvent *);
- void onClickXY(double x,double y);
- void onClickSetCarPos();
- void onClickAddPedObj();
- void onClickAddCarObj();
- void onClickAddCustomObj();
- void onClickDelObj();
- void onTimerShowSelObj();
- void onSimStateChanged(int nState);
- void onCurrentIndexChanged(int index);
- void onCurrentShiftChanged(int index);
- void on_actionLoad_triggered();
- void on_actionMeasuring_Distance_triggered();
- void onTimerUpdateCarPos();
- void on_actionSaveObject_triggered();
- void on_actionLoadObject_triggered();
- void on_actionTrack_triggered();
- private:
- Ui::MainWindow *ui;
- QImage *image;
- QPainter *painter;
- MyView *myview;
- QTimer *timer;
- QGraphicsScene *scene;
- QGraphicsScene * mpscene;
- QGraphicsPixmapItem * mppixcar;
- QLabel * mpLabel_Status;
- QLineEdit * mpLE_SelX, * mpLE_SelY, * mpLE_SelLat, * mpLE_SelLon, *mpLE_SelHeading;
- QPushButton * mpPBSetCarPos;
- QPushButton * mpPBAddPedObj;
- QPushButton * mpPBAddCarObj;
- QPushButton * mpPBAddCustomObj;
- QPushButton * mpPBDelObj;
- QComboBox * mpCBObj;
- QComboBox * mpCBShift;
- QCheckBox * mpCBSim;
- QTimer * mpTimerShowSelObj;
- QTimer * mpTimerUpdateCarPos;
- QTabWidget * mTabMain;
- void CreateTab1View(QTabWidget * p);
- double mfViewMoveX = 0;
- double mfViewMoveY = 0;
- double mfvehwidth;
- double mfvehlen;
- int mnMeasure = 0;
- bool mbSimulate = false;
- bool mbTrack = false;
- private:
- int mnFontHeight;
- OpenDrive mxodr;
- void UpdateScene();
- std::vector<QGraphicsPathItem *> mvectorviewitem;
- std::vector<QGraphicsPathItem *> mvectorgeoitem;
- double mfClickX,mfClickY;
- double mfMoveX,mfMoveY;
- std::vector<iv::simobj> mvectorsimobj;
- int mnshowidindex = 0;
- int mnSelObj = 0;
- int mnSelShowCount = 0;
- simmodel * mpsimmodel;
- void * mpaDecition;
- public:
- void resizeEvent(QResizeEvent *event);
- private:
- void CreateCar();
- void SetCarPos(double x,double y, double fhdg);
- void AddPedObj(double x,double y, double fhdg);
- void AddCarObj(double x,double y, double fhdg);
- void AddCustomObj(double x,double y, double z,double fhdg,double flen,double fwidth,double fheight);
- void AddObjToVector(double x,double y, double z,double fhdg,double flen,double fwidth,double fheight,QGraphicsPathItem * pitem,int ntype = 2);
- void DelObjFromVector(unsigned int index);
- void normalhdg(double & fhdg);
- void UpdateDecition(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
- };
- #endif // MAINWINDOW_H
|