diff --git a/include/opendrive_spiral.h b/include/opendrive_spiral.h index a97e3bbb5ceffc6695cc15d2934c609cd04a59ab..73624a06b9b4ad249a7fe5b638b9f41f14a44f4e 100644 --- a/include/opendrive_spiral.h +++ b/include/opendrive_spiral.h @@ -5,21 +5,20 @@ class COpendriveSpiral : public COpendriveGeometry { + friend class COpendriveRoadNode; private: double start_curvature; double end_curvature; protected: + COpendriveSpiral(); + COpendriveSpiral(const COpendriveSpiral &object); virtual bool transform_local_pose(TOpendriveTrackPoint &track,TOpendriveLocalPoint &local) const; virtual void print(std::ostream &out); virtual void load_params(const planView::geometry_type &geometry_info); virtual std::string get_name(void); public: - COpendriveSpiral(); - COpendriveSpiral(double min_s, double max_s, double x, double y, double heading,double start_curv,double end_curv); - COpendriveSpiral(const COpendriveSpiral &object); virtual COpendriveGeometry *clone(void); - double get_start_curvature(void); - double get_end_curvature(void); + virtual void get_curvature(double &start,double &end); void operator=(const COpendriveSpiral &object); ~COpendriveSpiral(); }; diff --git a/src/opendrive_spiral.cpp b/src/opendrive_spiral.cpp index 6880f91d0062396af6ccda4e9bc052cf701c40b4..d11ac2b84781ca36f787a366a06192838628dd80 100644 --- a/src/opendrive_spiral.cpp +++ b/src/opendrive_spiral.cpp @@ -6,12 +6,6 @@ COpendriveSpiral::COpendriveSpiral() this->end_curvature=0.0; } -COpendriveSpiral::COpendriveSpiral(double min_s, double max_s, double x, double y, double heading,double start_curv,double end_curv) : COpendriveGeometry(min_s,max_s,x,y,heading) -{ - this->start_curvature=start_curv; - this->end_curvature=end_curv; -} - COpendriveSpiral::COpendriveSpiral(const COpendriveSpiral &object) : COpendriveGeometry(object) { this->start_curvature=object.start_curvature; @@ -25,8 +19,11 @@ bool COpendriveSpiral::transform_local_pose(TOpendriveTrackPoint &track,TOpendri void COpendriveSpiral::print(std::ostream &out) { + double start_curvature,end_curvature; + COpendriveGeometry::print(out); - out << " start_curvature = " << this->get_start_curvature() << ", end_curvature = " << this->get_end_curvature() << std::endl; + this->get_curvature(start_curvature,end_curvature); + out << " start_curvature = " << start_curvature << ", end_curvature = " << end_curvature << std::endl; } void COpendriveSpiral::load_params(const planView::geometry_type &geometry_info) @@ -47,14 +44,10 @@ COpendriveGeometry *COpendriveSpiral::clone(void) return new_spiral; } -double COpendriveSpiral::get_start_curvature(void) -{ - return this->start_curvature*this->scale_factor; -} - -double COpendriveSpiral::get_end_curvature(void) +void COpendriveSpiral::get_curvature(double &start,double &end) { - return this->end_curvature*this->scale_factor; + start=this->start_curvature*this->scale_factor; + end=this->end_curvature*this->scale_factor; } void COpendriveSpiral::operator=(const COpendriveSpiral &object)