opendrive_road_segment.h 2.59 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
#ifndef _OPENDRIVE_ROAD_SEGMENT_H
#define _OPENDRIVE_ROAD_SEGMENT_H

#ifdef _HAVE_XSD
#include "../src/xml/OpenDRIVE_1.4H.hxx"
#endif

#include "opendrive_lane.h"
#include "opendrive_signal.h"
#include "opendrive_object.h"
11
#include "opendrive_road.h"
12

13
class COpendriveLane;
14
class COpendriveRoad;
15
16
class COpendriveSignal;
class COpendriveObject;
17

18
19
20
21
22
class COpendriveRoadSegment
{
  friend class COpendriveRoad;
  private:
    std::map<int,COpendriveLane *> lanes;
23
    COpendriveRoad *parent_road;
24
25
26
    double resolution;
    double scale_factor;
    double min_road_length;
27
28
    int num_right_lanes;
    int num_left_lanes;
29
30
    std::vector<COpendriveSignal *> signals;
    std::vector<COpendriveObject *> objects;
31
    std::vector<COpendriveRoadSegment *> connecting;
32
33
    std::string name;
    unsigned int id;
34
    opendrive_mark_t center_mark;
35
  protected:
36
37
    COpendriveRoadSegment();
    COpendriveRoadSegment(const COpendriveRoadSegment &object,std::map<COpendriveRoadNode *,COpendriveRoadNode *> &node_refs,COpendriveRoad *road_ref);
38
    void load(OpenDRIVE::road_type &road_info);
39
    void free(void);
40
41
    void set_resolution(double res);
    void set_scale_factor(double scale);
42
    void set_min_road_length(double length);
43
    void set_parent_road(COpendriveRoad *parent);
44
    void update_references(std::map<COpendriveRoadSegment *,COpendriveRoadSegment *> &segment_refs);
45
46
    void add_lanes(lanes::laneSection_type &lane_section);
    void add_nodes(OpenDRIVE::road_type &road_info);
47
48
    void link_neightbour_lanes(lanes::laneSection_type &lane_section);
    void link_segment(COpendriveRoadSegment &segment);
49
    void link_segment(COpendriveRoadSegment &segment,int from,bool from_start, int to,bool to_start);
50
  public:
51
52
53
54
55
    std::string get_name(void) const;
    unsigned int get_id(void) const;
    unsigned int get_num_right_lanes(void) const;
    unsigned int get_num_left_lanes(void) const;
    const COpendriveLane &get_lane(int index) const;
56
    const COpendriveRoad &get_parent_road(void) const;
57
58
    unsigned int get_num_signals(void) const;
    const COpendriveSignal &get_signal(unsigned int index) const;
59
    unsigned int get_num_objects(void) const;
60
    const COpendriveObject &get_object(unsigned int index) const;
61
62
    unsigned int get_num_connecting(void) const;
    const COpendriveRoadSegment &get_connecting(unsigned int index) const;
63
64
    TOpendriveLocalPoint transform_to_local_point(const TOpendriveTrackPoint &track);
    TOpendriveWorldPoint transform_to_world_point(const TOpendriveTrackPoint &track);
65
    friend std::ostream& operator<<(std::ostream& out, COpendriveRoadSegment &segment);
66
67
68
69
    ~COpendriveRoadSegment();
};

#endif