3 Routing::Routing(
OSM *o){
6 Routing::~Routing(
void){
15 s->cd->
s[Si].
via = NULL;
21 while(t != NULL && t->
d >-1){
29 if( n->
nb->cd->
s[Si].
from == NULL
30 && n->
nb->cd->
s[Si].
via == NULL){
32 t2 = f.ins(t->
d + n->
d);
34 t2->from = &(t->
k->cd->
s[Si]);
42 if( n->
nb->cd->
s[Si].
via == NULL &&
46 t2 = f.ins(t->
d + n->
d);
48 t2->from = &(t->
k->cd->
s[Si]);
65 }
while(t != NULL && t->
d < 0);
85 s->cd->
s[Si].
via = NULL;
91 while(t != NULL && t->
d >-1){
99 if(n->
nb->cd->
s[Si].
from == NULL && n->
nb->cd->
s[Si].
via == NULL){
101 t2 = f.ins(t->
d + n->
hm);
103 t2->from = &(t->
k->cd->
s[Si]);
111 if( n->
nb->cd->
s[Si].
via == NULL &&
115 t2 = f.ins(t->
d + n->
hm);
117 t2->from = &(t->
k->cd->
s[Si]);
134 }
while(t != NULL && t->
d < 0);
150 if(k->cd->
s != NULL){
151 k->cd->
s[STRONGindex].
from = NULL;
152 k->cd->
s[STRONGindex].
via = NULL;
161 if( s == NULL || e == NULL ||
162 distance(k->
lat,k->lon,s->
lat,s->lon)
163 +distance(k->
lat,k->lon,e->
lat,e->lon) < radius){
166 for(
int i = 0; i < n; i++){
167 k->cd->
s[i].
from = NULL;
168 k->cd->
s[i].
via = NULL;
193 (*nl)[nct] = st->
via;
235 if(n->
rd == fw) (*nbc)++;
247 && k->cd->
s[si].
from != NULL)
278 double gridperkm = 0.5;
288 for(
int x = 0; x <
nlon; x++){
293 for(
int x = 0; x <
nlon; x++)
294 for(
int y = 0; y <
nlat; y++)
300 if( x >= 0 && x < nlon && y >= 0 && y < nlat &&
SLgrid[x][y] == 0){
308 for(
int x = 0; x <
nlon; x++)
321 for(
int j = 0; j < SL->ncount; j++){
335 SL->data[j].
index = SL->data[j].n->
d;
342 for(
int j = 0; j < SL->ncount; j++){
343 if(SL->data[j].
index > max)
344 max = SL->data[j].
index;
346 for(
int j = 0; j < SL->ncount; j++){
371 qint64 kid,knid;
KOO* k;
372 FILE* f = fopen(filename,
"rb");
374 fread(&(SL->ncount),
sizeof(
int),1,f);
377 for(
int j = 0; j < SL->ncount; j++){
378 fread(&(kid),
sizeof(qint64),1,f);
379 fread(&(knid),
sizeof(qint64),1,f);
380 fread(&(SL->data[j].
index),
sizeof(
float),1,f);
382 if(k != NULL && k->cd != NULL){
384 while( n!= NULL && n->
nb->
id != knid){
390 SL->data[j].n = NULL;
393 SL->data[j].n = NULL;
400 FILE* f = fopen(filename,
"wb");
401 fwrite(&(SL->ncount),
sizeof(
int),1,f);
402 for(
int j = 0; j < SL->ncount; j++){
403 fwrite(&(SL->data[j].n->
node[0]->
id),
sizeof(qint64),1,f);
404 fwrite(&(SL->data[j].n->
nb->
id),
sizeof(qint64),1,f);
405 fwrite(&(SL->data[j].
index),
sizeof(
float),1,f);
412 float p = SL->data[(s+e)/2].index;
414 while(SL->data[l].
index < p) l++;
415 while(SL->data[r].
index > p) r--;
418 SL->data[l] = SL->data[r];
Neighbour * via
connection to reach this STRONG
void STRONGlayer_save(char *filename, STRONGlayer *SL)
saves STRONGlayer to file
float index
connection to be drawn
Way * way
Neighbour lives uses this Way.
void STRONGlayer_count_neighbours(KOO *k, int *nbc)
counts total Neighbour count on osm data set
list elements to handle multiple STRONGlayers
KOO * get_first_KOO()
returns root of node-AVL tree
container struct to hold data of a coordinate
STRONGlayer * STRONGlayer_load(char *filename)
loades STRONGlayer from file
STRONG * from
pointer to related STRONG struct
KOO ** node
reference to KOO (of way)
void extract_neighbourlist(STRONG *s, STRONG *e, Neighbour ***nl, int *nc)
collects a Neighbour list from STRONG network
void finish_STRONG()
resets STRONG network of a STRONGcalc to normal Dijkstra state
FibunacciHeap element to store STRONG data.
short STRONGlayer_grid_free(KOO *k)
routing container struct, connects cross via Way with each other
Neighbour * next
next Neighbour, set to NULL if last
void STRONGlayer_grid_new()
base information to draw road section in STRONGlayers
STRONG * s
memory for routing algorithms
qint64 id
id inherited from OSM data
float d
current distance at STRONG
Neighbour * via
connection to STRONG
KOO * search(qint64 id, KOO *s)
void * from
< pointer to STRONG or FibunacciHeap
void resetSTRONG(KOO *k, int STRONGindex)
resets the STRONG network to begin calculation
void setSTRONG(KOO *k, KOO *s, KOO *e, float radius, int n)
body of finish_STRONG();
void STRONGlayer_mark_neighbours(KOO *k, int si)
increment Neighbour attribute d by its usage rate on STRONG network
short DijkstraFib_minHM(KOO *s, KOO *e, char max, char min, OSM *o, int Si)
see DijkstraFib(), but minimizing Hm instead of distance
void STRONGlayer_grid_delete()
STRONGlayer * STRONGlayer_create(STRONGlayer *SL, int N)
creates STRONGlayer from a unfinalized STRONG network
int tpc
count of trackpoint
Neighbour * neighbours
neigbours to link to other cross
BTP3 database, created from OpenStreetMap data.
void STRONGlayer_reconstruct_d(KOO *k)
reconstructs Neighbour distance attribute d from Way data
short DijkstraFib(KOO *s, KOO *e, char max, char min, OSM *o, int Si)
this is famous Dijkstra shortes path algothim
void STRONGlayer_sort(STRONGlayer *SL, long s, long e)
quicksort neighbours by its usage rate
void STRONGlayer_fill_neighbours(KOO *k, STRONGlayerele *data, int *nbc)
copy Neighbour attribut d to STRONGlayer data
float hm
total height meter, for routing
trackpoint * tp
heighdata of this Neighbour
void STRONGlayer_grid_reset()
void STRONGlayer_reset_d(KOO *k)
sets Neighbour distance attribute d to zero
Neighbour * brthr
related Neighbour with opposite read direction supposed to store brthr
main struct for routing purpose