opendrive_object.h 1.98 KB
Newer Older
1
2
3
4
#ifndef _OPENDRIVE_OBJECT_H
#define _OPENDRIVE_OBJECT_H

#include "opendrive_common.h"
5
#include "opendrive_road_segment.h"
6
#ifdef _HAVE_XSD
7
#include "xml/OpenDRIVE_1.4H.hxx"
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#endif

#define OD_MAX_VERTICES     32

typedef enum {OD_NONE,OD_BOX,OD_CYLINDER,OD_POLYGON} object_type_t;

typedef struct
{
  double length;
  double width;
  double height;
}TOpendriveBox;

typedef struct
{
  double radius;
  double height;
}TOpendriveCylinder;

typedef struct
{  
  TOpendriveTrackPoint vertices[OD_MAX_VERTICES];
  double height[OD_MAX_VERTICES];
  unsigned int num_vertices;
}TOpendrivePolygon;

typedef union
{
  TOpendriveBox box;
  TOpendriveCylinder cylinder;
  TOpendrivePolygon polygon;
}TOpendriveObject;

41
42
class COpendriveRoadSegment;

43
44
class COpendriveObject
{
45
  friend class COpendriveRoadSegment;
46
  private:
47
    COpendriveRoadSegment *segment;
48
49
50
51
52
53
    int id; ///< Object's id.
    TOpendriveTrackPoint pose;
    TOpendriveObject object;
    std::string type; ///< Object's OpenDrive type.
    std::string name; ///< Object's name.
    object_type_t object_type;
54
    double scale_factor;
55
  protected:
56
57
58
    void load(objects::object_type &object_info,COpendriveRoadSegment *segment);
    void update_references(std::map<COpendriveRoadSegment *,COpendriveRoadSegment *> &segment_refs);
    void set_scale_factor(double scale);
59
60
61
  public:
    COpendriveObject();
    COpendriveObject(const COpendriveObject& object);
62
63
64
65
    double get_scale_factor(void);
    TOpendriveTrackPoint get_track_pose(void) const;
    TOpendriveWorldPoint get_world_pose(void) const;
    int get_id(void) const;
66
67
68
69
70
71
72
73
    std::string get_type(void) const;
    std::string get_name(void) const;
    bool is_box(void) const;
    bool is_cylinder(void) const;
    bool is_polygon(void) const;
    TOpendriveBox get_box_data(void) const;
    TOpendriveCylinder get_cylinder_data(void) const;
    TOpendrivePolygon get_polygon_data(void) const;
74
75
76
77
78
    friend std::ostream& operator<<(std::ostream& out, COpendriveObject &object);
    ~COpendriveObject();
};

#endif