\( \def\bold#1{\bf #1} \newcommand{\d}{\mathrm{d}} \) BTP: Manual and Source Code Documentation

Power Uphill

bike mass [kg]
body mass [kg]
altitude gain [m]
climb length [km]
gradient [%]
time [s]
speed [km/h]
power [W]
power/mass [W/kg]
climbrate [m/min]

average power on climb stage

BTP  3.0
Routing/ClimbAnalysis/PowerCalculation
OSM Class Reference

BTP3 database, created from OpenStreetMap data. More...

#include <osm.h>

Collaboration diagram for OSM:

Public Member Functions

 OSM (string filename)
 
void read_OSM ()
 read osm file
 
void get_KOO_Waysavl ()
 links node IDs to nodes recursivly
 
void check_lines ()
 delete Way with unresolved nodes
 
void setfilename (string fileName)
 
Wayget_first_Way ()
 returns root of Way-AVL tree
 
KOOget_first_KOO ()
 returns root of node-AVL tree
 
Neighbouradd_Neighbour (KOO *k, KOO **node, KOO *nb, Way *w, float d, int KOOc, readdirection rd)
 add Neighbour cross to k
 
void initiallists ()
 initial class's containers
 
void RelationstoFace (relation **l, lines **f)
 collect all Way to one relation
 
void reset_KOO_status (KOO *k, char i)
 
void calc_peak_index_pro (HeightData *h)
 summit ranking uses t-functions of heighdata
 
void sort_peaks ()
 primitive sort algorithm
 
void calc_brect ()
 refresh bounding rect of dataset
 
double getminlat ()
 return lsat calced bounding rect
 
double getminlon ()
 return lsat calced bounding rect
 
double getmaxlat ()
 return lsat calced bounding rect
 
double getmaxlon ()
 return lsat calced bounding rect
 
int get_status ()
 returns current class state
 
int count_cross (KOO *k)
 counts crossdata recursivly
 
int count_STRONG (KOO *k)
 counts STRONG data recursivly
 
void save (char *filename, double minlat, double maxlat, double minlon, double maxlon)
 save dataset as btp
 
void load (char *filename)
 load btp to dataset
 
void select_cross (double lat, double lon, KOO **kdest, float *d, KOO *ksrc)
 
Wayselect_Way (double lat, double lon)
 
void change_Waytype (Way *w, char newtype)
 
void del_Way (Way *w)
 
void normalize_Hm (KOO *k)
 removes total height differences from Neighbour relation
 
void invert_Hm (KOO *k)
 switches descenting and ascenting vertical meters in Neighbour relation
 
void reset_Hm (KOO *k)
 resets Neighbour Hm to ascenting vertical meters
 
void points_Hm (KOO *k)
 accumulates section difficulties instead of vertical meters in Neighbour relation
 
KOOsearch (qint64 id, KOO *s)
 
void merge (KOO *knew, KOO *kold)
 solves conflictiv KOO and crossdata when loading several btp datasets
 
void deleteRect (double minlat, double maxlat, double minlon, double maxlon)
 delete all data lying within the rectangular area
 
void info ()
 
short isin (lines *l, double minlat, double maxlat, double minlon, double maxlon)
 
short isin (points *l, double minlat, double maxlat, double minlon, double maxlon)
 
short isin (KOO *k, double minlat, double maxlat, double minlon, double maxlon)
 
short isin (Way *w, double minlat, double maxlat, double minlon, double maxlon)
 
short iscompletein (Way *w, double minlat, double maxlat, double minlon, double maxlon)
 

Public Attributes

lines ** ExclCheck [8]
 help array to find exclusive Way to merge relation participants
 
short mintype
 
short maxtype
 
lines ** motorWay
 
lines ** highway
 
lines ** primary
 
lines ** secondary
 
lines ** track
 
lines ** track2
 
lines ** river
 
lines ** creek
 
lines ** wood
 
lines ** water
 
lines ** NoHeight
 
points ** metropolis
 

100000 : tag city


 
points ** city
 

10000


 
points ** town
 

3000 : tag town


 
points ** village
 

20 : tag village, suburban


 
points ** locality
 < 20 : tag hamlet, locality, isolated_dwelling
 
points ** col
 mountain pass
 
points ** peak
 summit
 
relation ** waterr
 
relation ** woodr
 

Private Member Functions

short check_AVL (Way *w)
 
qint64 extract_valuei (char *s, const char *a)
 search for tag a in string s and extract to qint64
 
double extract_valuef (char *s, const char *a)
 search for tag a in string s and extract to double
 
char * extract_valuec (char *s, const char *a)
 search for tag a in string s and returns it
 
void extract_bbox (char *s)
 extrac bounding box specified in osm file
 
void quotationreplace (char *a)
 replaces " by '
 
void htmlreplace (char *c)
 
KOOinsert (qint64 id, KOO *s)
 AVL tree handling: naiv insert of id into data subtree s.
 
KOOrotate (KOO **s, branch b)
 AVL tree handling: subroutine of insert(), returns root element.
 
KOOinsert_AVL (qint64 id, KOO **s)
 AVL tree handling: accurate insert of id into data subtree s.
 
Wayinsert (qint64 id, Way *s)
 AVL tree handling: naiv insert of id into data subtree s.
 
Wayrotate (Way **s, branch b)
 AVL tree handling: subroutine of insert(), returns root element.
 
Wayinsert_AVL (qint64 id, Way **s)
 AVL tree handling: accurate insert of id into data subtree s.
 
Waysearch (qint64 id, Way *s)
 AVL tree handling: search for id and return related Way.
 
void get_KOO_Waysavl (Way *l, short next)
 resolve KOO id to KOO pointer
 
void check_lines_rek (lines **l)
 check recursivly completeness of KOO pointers More...
 
void delete_AVL (Way *l)
 
void delete_AVL (KOO *l)
 
void delete_lines (lines *l)
 
void delete_points (points *l)
 
void delete_relation (relation *l)
 
void nodehandling (FILE *f, char *line, char *lineattr, char *linename)
 $osm-file reading: dealing with node data lines in file
 
void Wayhandling (FILE *f, char *line, char *lineattr, char *linename, qint64 *currentseek)
 $osm-file reading: dealing with way data lines in file
 
void relationhandling (FILE *f, char *line, char *lineattr, char *linename, qint64 *currentseek)
 $osm-file reading: dealing with relation data lines in file
 
void add_line (lines **l, Way *Way, char *name)
 add a Way to a OSM_Data liones element with a given name
 
pointsadd_points (points **l, KOO *KOO, char *name, float index)
 add a KOO to a OSM_Data points element with a given name and index
 
void add_relation (relation **l, relation *r)
 add a relation to a OSM_Data relation element with a given name and index
 
void invert_points (points **l)
 invert elements of a list
 
void calc_brect (points **l)
 refresh bounding rect regarding points data
 
void calc_brect (lines **l)
 refresh bounding rect regarding lines data
 
void equal_crossheight (KOO *k)
 find common cross height if Neighbour relation indicates different
 
void save_node (KOO *k, FILE *f)
 
void save_Way (Way *w, FILE *f)
 
void save_cross (KOO *k, FILE *f, int *c, double minlat, double maxlat, double minlon, double maxlon)
 
void save_lines (lines **l, FILE *f, double minlat, double maxlat, double minlon, double maxlon)
 
void save_points (points **p, FILE *f, double minlat, double maxlat, double minlon, double maxlon)
 
void reset_KOO_status (KOO *k)
 
KOOload_node (FILE *f)
 
Wayload_Way (FILE *f)
 
void load_cross (FILE *f)
 
void load_lines (lines **l, FILE *f)
 
void load_points (points **p, FILE *f)
 
void replace_Way_KOO (Way *w, KOO **newKOO, int newlength)
 
void extract_Way (lines *l, Way *w, Way *k, char mintype, char maxtype)
 
void del_lines (Way *w, lines **l, char *keepname)
 
void del_Neighbour (KOO *k, Way *w)
 
void del_Neighbour (KOO *k, Neighbour *n)
 
void del_Way (Way *w, double minlat, double maxlat, double minlon, double maxlon)
 

Private Attributes

int status
 osm usage status variable More...
 
string filename
 
OSM_Data D
 
double minlat
 bounding rect of the osm data set
 
double maxlat
 
double minlon
 
double maxlon
 
double dminlat
 claimed bounding rect of the &osm data file
 
double dmaxlat
 
double dminlon
 
double dmaxlon
 

Detailed Description

BTP3 database, created from OpenStreetMap data.

This class manages all data content of BTP3. Map rendering as well as routing algorithm directly access this data. The database consists of two AVL trees containing $osm nodes and $osm ways. In BTP3 language this means KOO and Way. Main content of a Way is a KOO reference array. The third big $osm data type - the Relation, a collection of ways - does not eyist in osm class. For Rendering purpose there exist several list classifying the KOO and Way, these lists are points and lines respectivly. The following lines exist:
motorWay, highway, primary, secondary, track, track2, river, creek, wood, water, NoHeight
The following points exist:
metropolis, city, town, village, locality, col, peak;
The classification is done by nodehandling and wayhandling.

This data is generated from OpenStreetMap XML files *.osm. Within this class this kind of file is read by read_OSM.

HeighData of road like lines is calculated by the seperate class WayHeight.

Definition at line 34 of file osm.h.

Member Function Documentation

short OSM::check_AVL ( Way w)
private

check AVL tree construction

Definition at line 2532 of file osm.cpp.

void OSM::check_lines_rek ( lines **  l)
private

check recursivly completeness of KOO pointers

recursivly checks whether all KOO id are have been succesfully transformed into a KOO pointer, if not the concerning lines is deleted.

Definition at line 2310 of file osm.cpp.

void OSM::del_lines ( Way w,
lines **  l,
char *  keepname 
)
private

data set editting functions

Definition at line 2447 of file osm.cpp.

void OSM::del_Neighbour ( KOO k,
Way w 
)
private

data set editting functions

Definition at line 2497 of file osm.cpp.

void OSM::del_Neighbour ( KOO k,
Neighbour n 
)
private

data set editting functions

Definition at line 2514 of file osm.cpp.

void OSM::del_Way ( Way w,
double  minlat,
double  maxlat,
double  minlon,
double  maxlon 
)
private

data set editting functions

Definition at line 2851 of file osm.cpp.

void OSM::extract_Way ( lines l,
Way w,
Way k,
char  mintype,
char  maxtype 
)
private

data set editting functions

Definition at line 2401 of file osm.cpp.

void OSM::htmlreplace ( char *  c)
private

replaces &#39; and &#34;

Definition at line 2333 of file osm.cpp.

short OSM::iscompletein ( Way w,
double  minlat,
double  maxlat,
double  minlon,
double  maxlon 
)

check whether data lies within defined rectangular area

Definition at line 714 of file osm.cpp.

short OSM::isin ( lines l,
double  minlat,
double  maxlat,
double  minlon,
double  maxlon 
)

check whether data lies within defined rectangular area

Definition at line 670 of file osm.cpp.

short OSM::isin ( points l,
double  minlat,
double  maxlat,
double  minlon,
double  maxlon 
)

check whether data lies within defined rectangular area

Definition at line 685 of file osm.cpp.

short OSM::isin ( KOO k,
double  minlat,
double  maxlat,
double  minlon,
double  maxlon 
)

check whether data lies within defined rectangular area

Definition at line 689 of file osm.cpp.

short OSM::isin ( Way w,
double  minlat,
double  maxlat,
double  minlon,
double  maxlon 
)

check whether data lies within defined rectangular area

Definition at line 699 of file osm.cpp.

void OSM::load_cross ( FILE *  f)
private

load btp data from btp file

Definition at line 2150 of file osm.cpp.

void OSM::load_lines ( lines **  l,
FILE *  f 
)
private

load btp data from btp file

Definition at line 2253 of file osm.cpp.

KOO * OSM::load_node ( FILE *  f)
private

load btp data from btp file

Definition at line 2092 of file osm.cpp.

void OSM::load_points ( points **  p,
FILE *  f 
)
private

load btp data from btp file

Definition at line 2277 of file osm.cpp.

Way * OSM::load_Way ( FILE *  f)
private

load btp data from btp file

Definition at line 2107 of file osm.cpp.

void OSM::replace_Way_KOO ( Way w,
KOO **  newKOO,
int  newlength 
)
private

load btp data from btp file

Definition at line 2543 of file osm.cpp.

void OSM::reset_KOO_status ( KOO k,
char  i 
)

reset KOO status to i

Definition at line 1637 of file osm.cpp.

void OSM::reset_KOO_status ( KOO k)
private

load btp data from btp file

Definition at line 2040 of file osm.cpp.

void OSM::save_cross ( KOO k,
FILE *  f,
int *  c,
double  minlat,
double  maxlat,
double  minlon,
double  maxlon 
)
private

save btp data to btp file

save data, at base function check wheter element lies within the bounding rect (minlon,minlat,maxlon,maxlat), eventually count the elements which were finally save with c pointer

Definition at line 1992 of file osm.cpp.

void OSM::save_lines ( lines **  l,
FILE *  f,
double  minlat,
double  maxlat,
double  minlon,
double  maxlon 
)
private

save btp data to btp file

save data, at base function check wheter element lies within the bounding rect (minlon,minlat,maxlon,maxlat), eventually count the elements which were finally save with c pointer

Definition at line 1912 of file osm.cpp.

void OSM::save_node ( KOO k,
FILE *  f 
)
private

save btp data to btp file

save data, at base function check wheter element lies within the bounding rect (minlon,minlat,maxlon,maxlat), eventually count the elements which were finally save with c pointer

Definition at line 1977 of file osm.cpp.

void OSM::save_points ( points **  p,
FILE *  f,
double  minlat,
double  maxlat,
double  minlon,
double  maxlon 
)
private

save btp data to btp file

save data, at base function check wheter element lies within the bounding rect (minlon,minlat,maxlon,maxlat), eventually count the elements which were finally save with c pointer

Definition at line 1944 of file osm.cpp.

void OSM::save_Way ( Way w,
FILE *  f 
)
private

save btp data to btp file

save data, at base function check wheter element lies within the bounding rect (minlon,minlat,maxlon,maxlat), eventually count the elements which were finally save with c pointer

Definition at line 1985 of file osm.cpp.

KOO * OSM::search ( qint64  id,
KOO s 
)

returns KOO with ID starting at branch s

Definition at line 105 of file osm.cpp.

Member Data Documentation

lines ** OSM::creek

container data

Definition at line 70 of file osm.h.

OSM_Data OSM::D
private

main data pointer

Definition at line 150 of file osm.h.

string OSM::filename
private

$osm file name

Definition at line 147 of file osm.h.

lines ** OSM::highway

container data

Definition at line 70 of file osm.h.

short OSM::maxtype

container data

Definition at line 69 of file osm.h.

short OSM::mintype

container data

Definition at line 69 of file osm.h.

lines** OSM::motorWay

container data

Definition at line 70 of file osm.h.

lines ** OSM::NoHeight

container data

Definition at line 70 of file osm.h.

lines ** OSM::primary

container data

Definition at line 70 of file osm.h.

lines ** OSM::river

container data

Definition at line 70 of file osm.h.

lines ** OSM::secondary

container data

Definition at line 70 of file osm.h.

int OSM::status
private

osm usage status variable

status 0: nothing happened but osm class instanciated status 1: $osm file name is determined status 2: $osm file was read status 3: KOO of Way are resolved, i.g. get_KOO_Waysavl() applied

Definition at line 146 of file osm.h.

lines ** OSM::track

container data

Definition at line 70 of file osm.h.

lines ** OSM::track2

container data

Definition at line 70 of file osm.h.

lines ** OSM::water

container data

Definition at line 70 of file osm.h.

relation** OSM::waterr

container data

Definition at line 79 of file osm.h.

lines ** OSM::wood

container data

Definition at line 70 of file osm.h.

relation ** OSM::woodr

container data

Definition at line 79 of file osm.h.


The documentation for this class was generated from the following files: