123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- #ifndef ROADVIEWITEM_H
- #define ROADVIEWITEM_H
- #include <QGraphicsItem>
- #include <vector>
- #include "OpenDrive/OpenDrive.h"
- #include "xodrfunc.h"
- namespace iv {
- struct lineviewdata
- {
- double mE;
- double mstartx;
- double mstarty;
- double mendx;
- double mendy;
- double mfHdg;
- QPointF mPoints[4];
- };
- }
- namespace iv{
- struct lanesectionpoint
- {
- std::vector<iv::LanePoint> mvectorlanepoint;
- };
- struct lanesectionlinese
- {
- int mnsec = 0;
- std::vector<iv::lanesectionpoint> mvectorlanelinese;
- };
- }
- namespace iv {
- struct laneviewdata
- {
- double mS;
- double mLane;
- int ntype; //0 driving 1 border 2 none 3 sidewalk
- QPointF mPoints[4];
- };
- }
- namespace iv {
- struct lanemark
- {
- int ncolor = 0;//White. 1 yellow
- int mnmarktype;
- QPointF mPoints[4];
- };
- }
- class roadviewitem : public QGraphicsItem
- {
- public:
- roadviewitem(Road * pRoad);
- QRectF boundingRect() const override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
- void setratio(float ratio);
- void setmark(bool bMark);
- Road * GetRoad();
- void setlaneshow(bool bShow);
- void setlineshow(bool bShow);
- void setroadidshow(bool bShow);
- private:
- double mfwidth = 1.0;
- double mfratio = 1.0;
- Road * mpRoad;
- std::vector<iv::lineviewdata> mvectorline;
- std::vector<iv::laneviewdata> mvectorlaneview;
- std::vector<iv::lanemark> mvectorlanemark;
- std::vector<iv::lanesectionlinese> mvectorlaneline;
- void CalcLine();
- void CalcLane();
- float mfoldcalratio;
- bool mbNeedCalc;
- float mfxmin,mfymin,mfxmax,mfymax;
- inline void CalcPoints(iv::lineviewdata * plinedata);
- void CalcMaxMin();
- double mtextx;
- double mtexty;
- bool mbMark = false;
- bool mbShowLane = true;
- bool mbShowLine = false;
- bool mbShowRoadID = true;
- public:
- static bool IsDrawMark(double s);
- };
- #endif // ROADVIEWITEM_H
|