123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- #ifndef MAINWINDOW_H
- #define MAINWINDOW_H
- #include <QMainWindow>
- #include <QLabel>
- #include <QGroupBox>
- #include <QLineEdit>
- #include <QSlider>
- #include <QComboBox>
- #include <QPushButton>
- #include <QTimer>
- #include "OpenDrive/OpenDrive.h"
- #include "OpenDrive/OpenDriveXmlParser.h"
- #include "myview.h"
- QT_BEGIN_NAMESPACE
- namespace Ui { class MainWindow; }
- QT_END_NAMESPACE
- namespace iv {
- struct simobj
- {
- double mfx;
- double mfy;
- double mfz;
- double mfhdg;
- double mflen;
- double mfwidth;
- double mfheight;
- QGraphicsPathItem * mpobjitem;
- int nshowid;
- };
- }
- 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 onCurrentIndexChanged(int index);
- void on_actionLoad_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;
- QTimer * mpTimerShowSelObj;
- QTabWidget * mTabMain;
- void CreateTab1View(QTabWidget * p);
- double mfViewMoveX = 0;
- double mfViewMoveY = 0;
- double mfvehwidth;
- double mfvehlen;
- 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;
- 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);
- void DelObjFromVector(unsigned int index);
- void normalhdg(double & fhdg);
- };
- #endif // MAINWINDOW_H
|