Project

General

Profile

Statistics
| Revision:

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

History | View | Annotate | Download (2.24 KB)

1
#ifndef _NODE_DATABASE_
2
#define _NODE_DATABASE_
3

    
4
#define NUM_FEATURES 5
5

    
6

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

    
16
 
17
 /********************************
18
 *  Feature TYPES:
19
 *
20
 ********************************/
21
#define INTERSECTION_NODE        0
22
#define ROAD_NODE                1
23
 
24
 /********************************
25
 *  Node TYPES:
26
 *
27
 *
28
 *  SINGLE      0
29
 *  ON_RAMP     1
30
 *  OFF_RAMP    2
31
 *  DOUBLE_C    3
32
 *  DOUBLE_T    4
33
 *
34
 ********************************/
35
 
36
 /********************************
37
 *  More Node TYPES:
38
 *
39
 ********************************/
40
#define ROAD            5 
41
        /*placeholder for all roads atm, until we come up with a better solution */
42

    
43
 /********************************
44
 *  Turn TYPES:
45
 *  
46
 *  ISTRAIGHT                0
47
 *  ILEFT                1
48
 *  IRIGHT                2
49
 *  IUTURN                3
50
 *
51
 ********************************/
52

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

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

    
66
//DOUBLE_C intersection (Cross Intersection) positions
67
//use T-Junction positions
68

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

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

    
95

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

    
108
// Global variable for the intersection database.
109
int NodeData[NUM_FEATURES];
110

    
111
void initializeData();
112
void insertNode(int key, int featureid, int node_type, int node_info);
113
void insertIntersection(int key, int intserction_type, int intersection_position);
114
void insertRoad(int key, int node_type, int road_type);
115

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

    
123
#endif