xodrfunc.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef XODRFUNC_H
  2. #define XODRFUNC_H
  3. #include <OpenDrive/OpenDrive.h>
  4. #include <QPointF>
  5. namespace iv {
  6. struct LanePoint
  7. {
  8. int mnlane;
  9. int mnLaneSection;
  10. double mS;
  11. double mflanewidth;
  12. double mflanetocenter;
  13. double mfX;
  14. double mfY;
  15. double mfhdg;
  16. int mnlanetype; //0 driving 1 border 2 none 3 bike
  17. int mnlanemarktype; // -1 no 0 solid 1 broken 2 solidsolid
  18. int mnlanecolor;
  19. double mfGeoX;
  20. double mfGeoY;
  21. };
  22. }
  23. class xodrfunc
  24. {
  25. public:
  26. xodrfunc();
  27. public:
  28. static inline double calcpointdis(QPointF p1,QPointF p2);
  29. static bool pointinarc(GeometryArc * parc,QPointF poingarc,QPointF point1);
  30. static double CalcHdg(QPointF p0, QPointF p1);
  31. static double GetParamPoly3Dis(GeometryParamPoly3 * parc,double xnow,double ynow,double & nearx,
  32. double & neary,double & nearhead,double & frels);
  33. static double GetArcDis(GeometryArc * parc,double x,double y,double & nearx,
  34. double & neary,double & nearhead,double & frels);
  35. static double GetSpiralDis(GeometrySpiral * pspiral,double xnow,double ynow,double & nearx,
  36. double & neary,double & nearhead,double & frels);
  37. static double GetLineDis(GeometryLine * pline,const double x,const double y,double & nearx,
  38. double & neary,double & nearhead,double & frels);
  39. static int GetNearPoint(const double x,const double y,OpenDrive * pxodr,Road ** pObjRoad,GeometryBlock ** pgeo, double & fdis,double & nearx,
  40. double & neary,double & nearhead,const double nearthresh,double * pfs=0,int * pnlane= 0,bool bnotuselane = false);
  41. static double GetAcurateDis(const double x,const double y,Road * pRoad,const double s,const double nearx,
  42. const double neary,const double nearhead,int * pnlane= 0);
  43. static std::vector<iv::LanePoint> GetAllLanePoint(Road * pRoad,const double s,const double x, const double y,const double fhdg);
  44. public:
  45. static Road * GetRoadByID(OpenDrive * pxodr,std::string strroadid);
  46. static int GetRoadXYByS(Road * pRoad,const double s,double &x, double & y, double & hdg);
  47. static int GetLineXY(GeometryLine * pline,double soff,double &x, double & y, double & hdg);
  48. static int GetSpiralXY(GeometrySpiral * pspira,double soff,double &x, double & y, double & hdg);
  49. static int GetArcXY(GeometryArc * parc,double soff,double &x, double & y, double & hdg);
  50. static int GetParamPoly3XY(GeometryParamPoly3 * pparam3d,double soff,double &x, double & y, double & hdg);
  51. static int GetRoadIndex(OpenDrive * pxodr, Road * pRoad);
  52. };
  53. #endif // XODRFUNC_H