opendrive_link.h 2.22 KB
Newer Older
1
#ifndef _OPENDRIVE_LINK_H
2
3
#define _OPENDRIVE_LINK_H

4
#include "opendrive_common.h"
5
6
7
8
9
#include "g2_spline.h"
#include "opendrive_line.h"
#include "opendrive_spiral.h"
#include "opendrive_arc.h"
#include "opendrive_param_poly3.h"
10
#include "opendrive_road_node.h"
11

12
13
class COpendriveLink
{
14
  friend class COpendriveRoadSegment;
15
  friend class COpendriveRoadNode;
16
  friend class COpendriveRoad;
17
18
19
  private:
    COpendriveRoadNode *prev;
    COpendriveRoadNode *next;
20
21
    COpendriveRoadSegment *segment;
    COpendriveLane *lane;
22
23
24
25
26
    CG2Spline *spline;
    opendrive_mark_t mark;
    double resolution;
    double scale_factor;    
  protected:
27
28
    COpendriveLink();
    COpendriveLink(const COpendriveLink &object);
29
30
31
    void set_prev(COpendriveRoadNode *node);
    void set_next(COpendriveRoadNode *node);
    void set_road_mark(opendrive_mark_t mark);
32
33
    void set_parent_segment(COpendriveRoadSegment *segment);
    void set_parent_lane(COpendriveLane *lane);
34
35
    void set_resolution(double res);
    void set_scale_factor(double scale);
36
    void generate(double start_curvature,double end_curvature,double length,bool lane);
37
38
    void update_references(segment_up_ref_t &segment_refs,lane_up_ref_t &lanei_refs,node_up_ref_t &node_refs);
    bool clean_references(node_up_ref_t &refs);
39
40
    void update_start_pose(TOpendriveWorldPose *start=NULL);
    void update_end_pose(TOpendriveWorldPose *end=NULL);
41
  public:
42
43
44
    const COpendriveRoadNode &get_prev(void) const;
    const COpendriveRoadNode &get_next(void) const;
    opendrive_mark_t get_road_mark(void) const;
45
46
    const COpendriveRoadSegment &get_parent_segment(void) const;
    const COpendriveLane &get_parent_lane(void) const;
47
48
    double get_resolution(void) const;
    double get_scale_factor(void) const;
49
    double find_closest_world_pose(TOpendriveWorldPose &world,TOpendriveWorldPose &pose);
50
51
    void get_trajectory(std::vector<double> &x, std::vector<double> &y,double start_length=0.0, double end_length=-1.0) const;
    void get_trajectory(std::vector<double> &x, std::vector<double> &y, std::vector<double> &yaw,double start_length=0.0, double end_length=-1.0) const;
52
    double get_length(void) const;
53
54
55
56
57
    friend std::ostream& operator<<(std::ostream& out, COpendriveLink &link);
    ~COpendriveLink();
};

#endif