pgRouting  2.2
pgRouting extends the PostGIS / PostgreSQL geospatial database to provide geospatial routing functionality.
 All Classes Functions Variables Pages
pgr_types.h
1 /*PGR-GNU*****************************************************************
2 File: pgr_types.h
3 
4 Copyright (c) 2015 Celia Virginia Vergara Castillo
5 Mail: vicky_vergara@hotmail.com
6 
7 ------
8 
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 
23 ********************************************************************PGR-GNU*/
24 
25 #pragma once
26 
27 #include <stdint.h>
28 #include <stdbool.h>
29 
30 typedef struct edge_astar
31 {
32  int id;
33  int source;
34  int target;
35  double cost;
36  double reverse_cost;
37  double s_x;
38  double s_y;
39  double t_x;
40  double t_y;
41 } edge_astar_t;
42 
43 
44 
45 typedef struct {
46  int64_t vertex_id;
47  int64_t edge_id;
48  double cost;
50 
51 /*
52  * This one is for processing
53  */
54 typedef struct {
55  int64_t node;
56  int64_t edge;
57  double cost;
58  double agg_cost;
59 } Path_t;
60 
61 /*
62  * This ones are for returning the info to postgres
63  */
64 
65 typedef struct {
66  int seq;
67  int64_t start_id;
68  int64_t end_id;
69  int64_t node;
70  int64_t edge;
71  double cost;
72  double agg_cost;
74 
75 
76 typedef struct{
77  int route_id;
78  int path_id;
79  int path_seq;
80  int64_t start_vid;
81  int64_t end_vid;
82  int64_t node;
83  int64_t edge;
84  double cost;
85  double agg_cost;
86  double route_agg_cost;
87 } Routes_t;
88 
89 
90 typedef struct {
91  int64_t id;
92  int64_t source;
93  int64_t target;
94  double cost;
95  double reverse_cost;
96 } pgr_edge_t;
97 
98 typedef struct {
99  int seq;
100  int64_t source;
101  int64_t edge;
102  double cost;
103 } pgr_path_t;
104 
105 typedef struct matrix_cell {
106  int64_t from_vid;
107  int64_t to_vid;
108  double cost;
109 } Matrix_cell_t;
110 
111 // Restrictions used in pgr_turnRestrictions
112 
113 #define MAX_RULE_LENGTH 5
114 typedef struct
115 {
116  int64_t target_id;
117  double to_cost;
118  int64_t via[MAX_RULE_LENGTH];
119 }
120 Restrict_t;
121 
122 typedef struct {
123  int64_t pid;
124  int64_t edge_id;
125  char side; // 'r', 'l', 'b' (default is both)
126  double fraction;
127  int64_t vertex_id; // number is negative and is used for processing
129 
130 // used for getting the data
131 typedef
132 enum {
133  ANY_INTEGER,
134  ANY_NUMERICAL,
135  TEXT,
136  CHAR1
137 } expectType;
138 
139 typedef
140 struct {
141  int colNumber;
142  uint64_t type;
143  bool strict;
144  char *name;
145  expectType eType;
146 
147 } Column_info_t;
148 
149 // used in boost
151  int64_t id;
152 };
153 
155  int64_t id;
156  double cost;
157  int64_t source;
158  int64_t target;
159  bool first; // originally was true (source, target) false (target, source)
160 };
161 
162 
163 enum graphType { UNDIRECTED= 0, DIRECTED};
164 
165 #if 0
166 /**************************************************************************
167  * VRPPDTW types
168  * ***********************************************************************/
169 typedef struct {
170  int64_t id;
171  double x;
172  double y;
173  double demand;
174  double Etime;
175  double Ltime;
176  double Stime;
177  int64_t Pindex;
178  int64_t Dindex;
179  double Ddist;
180 } Customer;
181 
182 typedef struct {
183  int seq;
184  int64_t rid;
185  int64_t nid;
186  double cost;
187 } path_element;
188 
189 /*************************************************************************/
190 #endif