Browse Source

change map_lanetoxodr.

yuchuli 2 years ago
parent
commit
4f05afb50e
2 changed files with 213 additions and 3 deletions
  1. 124 0
      src/common/common/xodr/OpenDrive/Lane.cpp
  2. 89 3
      src/common/common/xodr/OpenDrive/Lane.h

+ 124 - 0
src/common/common/xodr/OpenDrive/Lane.cpp

@@ -1796,3 +1796,127 @@ void LaneOffset::Setc(double value)
 {   mc = value;}
 void LaneOffset::Setd(double value)
 {   md = value;}
+
+
+
+/**
+* Lane RoadMarkLine class. Contains all the data that describes lane roadmark line record
+*
+*
+*
+*
+*
+*/
+
+/*
+* Constructors
+*/
+LaneRoadMarkLine::LaneRoadMarkLine(double length, double space, double tOffset, double sOffset)
+{
+    mlength = length;
+    mspace = space;
+    mtOffset = tOffset;
+    msOffset = sOffset;
+}
+
+
+/*
+* Methods that return the parameters of the lane offset
+*/
+double LaneRoadMarkLine::Getlength()
+{
+    return mlength;
+}
+
+double LaneRoadMarkLine::Getspace()
+{
+    return mspace;
+}
+
+double LaneRoadMarkLine::GettOffset()
+{
+    return  mtOffset;
+}
+
+double LaneRoadMarkLine::GetsOffset()
+{
+    return msOffset;
+}
+
+int LaneRoadMarkLine::Getrule(std::string & rule)  //If return 1, have vaule, return 0 no this value
+{
+    if(mrule.size() == 0)return 0;
+    rule = mrule[0];
+    return 1;
+}
+
+int LaneRoadMarkLine::Getwidth(double & width) //same with rule
+{
+    if(mwidth.size() == 0)return 0;
+    width = mwidth[0];
+    return 1;
+}
+
+int LaneRoadMarkLine::Getcolor(std::string & color)   //same with rule
+{
+    if(mcolor.size() == 0)return 0;
+    color = mcolor[0];
+    return  1;
+}
+
+
+/*
+* Methods that set the parameters of the lane offset
+*/
+void LaneRoadMarkLine::Setlength(double length)
+{
+    mlength = length;
+}
+
+void LaneRoadMarkLine::Setspace(double space)
+{
+    mspace = space;
+}
+
+void LaneRoadMarkLine::SettOffset(double tOffset)
+{
+    mtOffset = tOffset;
+}
+
+void LaneRoadMarkLine::SetsOffset(double sOffset)
+{
+    msOffset = sOffset;
+}
+
+void LaneRoadMarkLine::Setrule(std::string & rule)
+{
+    if(mrule.size()>0)mrule.clear();
+    mrule.push_back(rule);
+}
+
+void LaneRoadMarkLine::Setwidth(double & width)
+{
+    if(mwidth.size()>0)mwidth.clear();
+    mwidth.push_back(width);
+}
+
+void LaneRoadMarkLine::Setcolor(std::string & color)
+{
+    if(mcolor.size()>0)mcolor.clear();
+    mcolor.push_back(color);
+}
+
+void LaneRoadMarkLine::Resetrule()
+{
+    if(mrule.size()>0)mrule.clear();
+}
+
+void LaneRoadMarkLine::Resetwidth()
+{
+    if(mwidth.size()>0)mwidth.clear();
+}
+
+void LaneRoadMarkLine::Resetcolor()
+{
+    if(mcolor.size()>0)mcolor.clear();
+}

+ 89 - 3
src/common/common/xodr/OpenDrive/Lane.h

@@ -600,6 +600,9 @@ private:
 	string mColor; 
 	double mWidth;
 	string mLaneChange;
+
+    vector<LaneRoadMarkLine> mvetorLaneRoadMarkLine;
+
 public:
 	/*
 	* Constructors
@@ -628,6 +631,57 @@ public:
 	double GetWidth();
 	string GetLaneChange();
 
+    /**
+     * Methods used to add child records to the respective vectors
+     */
+    unsigned int AddLaneRoadMarkLine(double s, double a, double b, double c, double d);
+
+    /**
+     * Methods used to clone child records in the respective vectors
+     */
+    unsigned int CloneLaneRoadMarkLine(unsigned int index);
+
+    /**
+     * Methods used to delete child records from the respective vectors
+     */
+    void DeleteLaneRoadMarkLine(unsigned int index);
+
+
+    /**
+    *	Get pointers to the records vectors
+    */
+    vector <LaneRoadMarkLine> *GetLaneRoadMarkLineVector();
+
+
+
+    /**
+    *	Get the number of elements in a certain vector
+    */
+    unsigned int GetLaneRoadMarkLineCount();
+
+
+    /**
+    *	Get the elements of a certain vectors at position i
+    */
+    LaneWidth* GetLaneRoadMarkLine(unsigned int i);
+
+
+    /**
+    *	Get the last elements of a certain vectors
+    */
+    LaneWidth* GetLastLaneRoadMarkLine();
+
+    /**
+    *	Get the last added elements of a certain vectors (their position might not be at the end of the vector)
+    */
+    LaneWidth* GetLastAddedLaneRoadMarkLine();
+
+
+    /**
+    *	Check the intervals and return the index of the records that applies to the provided s-offset
+    */
+
+
 };
 
 /**
@@ -882,9 +936,41 @@ private:
     double mspace;
     double mtOffset;
     double msOffset;
-    std::string mrule;
-    double width;
-    std::string mcolor;
+    std::vector<std::string> mrule;
+    std::vector<double> mwidth;
+    std::vector<std::string> mcolor;
+public:
+    /*
+    * Constructors
+    */
+    LaneRoadMarkLine(double length, double space, double tOffset, double sOffset);
+
+
+    /*
+    * Methods that return the parameters of the lane offset
+    */
+    double Getlength();
+    double Getspace();
+    double GettOffset();
+    double GetsOffset();
+    int Getrule(std::string & rule);  //If return 1, have vaule, return 0 no this value
+    int Getwidth(double & width); //same with rule
+    int Getcolor(std::string & color);    //same with rule
+
+
+    /*
+    * Methods that set the parameters of the lane offset
+    */
+    void Setlength(double length);
+    void Setspace(double space);
+    void SettOffset(double tOffset);
+    void SetsOffset(double sOffset);
+    void Setrule(std::string & rule);
+    void Setwidth(double & width);
+    void Setcolor(std::string & color);
+    void Resetrule();
+    void Resetwidth();
+    void Resetcolor();
 };
 
 #endif