#ifndef MAINWINDOW_H #define MAINWINDOW_H #include #include #include #include #include #include #include #include #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 mvectorviewitem; std::vector mvectorgeoitem; double mfClickX,mfClickY; double mfMoveX,mfMoveY; std::vector 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