Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / traffic_navigation / intersectData.h @ 1908

History | View | Annotate | Download (2.49 KB)

1
#ifndef _INTERSECTION_DATABASE_
2
#define _INTERSECTION_DATABASE_
3
#define NUM_FEATURES 5
4

    
5
/****************************
6
 * Intersection Information: 5-bit Integer
7
 *         3 bits of intersection type
8
 *         2 bits of entry information
9
 *
10
 * Also contains a "feature id": 4 bits in positions 13,14,15,16
11
 * 
12
 ****************************/
13

    
14
 
15
 /********************************
16
 *  Feature TYPES:
17
 *
18
 ********************************/
19
#define INTERSECTION_NODE        (0 << 12)
20
#define ROAD_NODE                (1 << 12)
21
 
22
 /********************************
23
 *  Intersection TYPES:
24
 *
25
 ********************************/
26

    
27

    
28
#define INTERSECTION_SINGLE         (0 << 2)
29
#define INTERSECTION_ON_RAMP         (1 << 2)
30
#define INTERSECTION_OFF_RAMP         (2 << 2)
31
#define INTERSECTION_DOUBLE_C        (3 << 2)
32
#define INTERSECTION_DOUBLE_T        (4 << 2)
33
#define ROAD                        (5 << 2) /*placeholder for all roads atm, until we come up with a better solution */
34

    
35
 /********************************
36
 *  Intersection Types in lineDrive.h:
37
 *
38
 ********************************/
39
#define DOUBLE                0
40
#define SINGLE                1
41
#define ON_RAMP                2
42
#define OFF_RAMP        3
43

    
44
 /********************************
45
 *  Turn TYPES:
46
 *
47
 ********************************/
48

    
49
#define ISTRAIGHT        0
50
#define ILEFT                1
51
#define IRIGHT                2
52
#define IUTURN                3
53

    
54
 /********************************
55
 *  Road TYPES:
56
 *
57
 ********************************/
58
#define ROAD_DOUBLE        0
59
#define ROAD_SINGLE        1
60
#define HIGHWAY                2
61

    
62
/********************************
63
 *  Intersection ENTRYPOINTS:
64
 *
65
 ********************************/
66

    
67
//DOUBLE intersection (Cross Intersection) positions
68
//use T-Junction positions
69

    
70
//DOUBLE intersection (T-Junction) positions
71
/*
72
TLEFT=======TRIGHT
73
        ||
74
        ||
75
        ||
76
        TMIDDLE
77
*/
78
#define TLEFT                0                        
79
#define TRIGHT                1                        
80
#define TMIDDLE                2
81

    
82
//SINGLE intersection positions
83
/*
84
           /\
85
          /||\
86
           ||
87
SACROSS==========>
88
           ||
89
           ||
90
           ||
91
           SUP
92
*/
93
#define SACROSS                0
94
#define SUP                1
95

    
96

    
97
//ON_RAMP and OFF_RAMP intersection positions
98
/*
99
R_LEFT================R_RIGHT
100
            ||        
101
            ||
102
            ||
103
          R_RAMP
104
*/
105
#define R_LEFT                0
106
#define R_RIGHT                1
107
#define R_RAMP                2
108

    
109
// Global variable for the intersection database. You can change the size here. Size == number of intersections.
110
int IntersectData[NUM_FEATURES];
111

    
112
void initializeData();
113
void insertNode(int key, int featureid, int node_type, int node_info);
114

    
115
// Functions to get data from the Database:
116
int getIntersectType(int key);
117
int getTurningIntersect(int key);
118
int getIntersectPos(int key);
119
int getFeatureId(int key);
120
int getTurnIntType(int intersectiontype);
121
int getRoadType(int key);
122
int getRoadInfo(int key);
123

    
124
#endif