\( \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
MAP.h
1 #pragma once
2 #include <QPixmap>
3 #include <QPainter>
4 #include <QPointF>
5 #include <QColor>
6 #include <QRectF>
7 #include <QImage>
8 #include <QFontMetrics>
9 #include <QSize>
10 #include <QPainterPath>
11 #include <QMatrix>
12 #include <QTime>
13 #include "MathExt.h"
14 #include "track.h"
15 #include "HeightData.h"
16 #include "osm.h"
17 #include <QtWidgets/QMessageBox>
18 
20 
24 class MAP
25 {
26 public:
28  MAP(HeightData *h, OSM* o);
29  ~MAP(void);
31  void settings(MapSettings* MS);
33  void resize(int width, int height);
35  void set_borders(double latmin0, double latmax0,
36  double lonmin0, double lonmax0);
38 
45  void calc_borders();
47  void SRTM3toMAP(short getcmap);
49  void OSMtoMAP(short getcmap, short drawroads, short drawnature , short drawpoints);
51  void STRONGlayer_to_Map(QPainter* p,STRONGlayer* SL);
53  void climblayer_to_map(climblayer* cl);
55  void add_BestClimb_Bar(QPainter* p,climblayer* cl);
57 
65  void draw_map(STRONGlayer* SL, climblayer* cl, Track* ct, int fastmode);
67  void save_to_png(QString filename);
69  QPixmap* get_Map();
71  void draw_line(QPainter* p, KOOlist* k, int kc);
72  void draw_line(QPainter* p, KOO** k, int count);
73  void draw_line(QPainter* p, double** k, int count);
74  void draw_line(QPainter* p, Track* ct);
75 
76  int Draw_lighted_text(QPainter* p, KOO *k, QString* w,
77  QColor* lightcolor, QColor* textcolor);
79  double getminlat();
80  double getminlon();
81  double getmaxlat();
82  double getmaxlon();
83  int getwidth();
84  int getheight();
86  double y_to_lat(int y);
87  double x_to_lon(int x);
88  double lat_to_y(double lat);
89  double lon_to_x(double lon);
90  double xy_to_height(int x, int y);
91  float zoomsize(float size);
92  double scale();
93  float get_mperlon();
94  float get_mperlat();
95 
96 private:
98  int width, height, oldwidth, oldheight;
100  double minlat0,
101  maxlat0,
102  minlon0,
103  maxlon0;
104  double minlat,
106  maxlat,
107  minlon,
108  maxlon;
109  double mmaxlat,
111  mminlat;
112 
113  OSM* o;
114  HeightData* hd;
115  QPixmap* cmap;
116  MapSettings *MS,MS0;
118  void add_DEM();
120  void add_contour();
122  void htocolorfast(unsigned char* cd,float h,float dxf,float dyf);
123 
124 
127  double ytolat(int y);
128  double xtolon(int x);
129  float lattoy(double lat);
130  float lontox(double lon);
131 
133  QPointF HP[28];
134  double** hc;
135  double** dhdx;
136  double** dhdy;
137  short** h;
138  unsigned char* cd;
140  short lineos;
142  short wxxold;
143  short wyyold;
146  float mperlat;
147  float mperlon;
148  float pxperlat;
149  float pxperlon;
150  float zoom;
151  short drawcontour;
153  QColor colorgradient(float x);
154  QColor colorgradientSL(float x);
155  QColor colorgradientSchading(float x);
156  void change_intensity(int x, int y,
157  double dI);
158  void mult_color(unsigned char* cd, QColor* c);
160  void linetomap(OSM* o, QPainter *p, lines** ll,QColor QColor,
161  float linewidth, float minlinewidth);
162  void pointtomap(OSM* o, QPainter *p, points** pp,QColor QColor,float size);
163  void peaktomap(OSM* o, QPainter *p, points** pp, float min, float max,
164  QColor QColor,float size);
165  void waternametomap(OSM* o, QPainter *p, lines** pp,QColor QColor,float size);
166  void streetnametomap(OSM* o, QPainter *p, lines** pp,QColor QColor,float size);
167  void rivernametomap(OSM* o, QPainter *p, lines** pp,QColor QColor,float size);
168  void add_scale(QPainter *p);
170 
178  void Draw_lighted_text(QPainter *p, QString* w, QPointF P,
179  QColor* lightcolor, QColor* textcolor);
180  void Draw_lighted_Path(QPainter* g, QPainterPath* p,
181  QBrush* lightbrush,QBrush* textbrush);
182  int Draw_aligned_text(QPainter* g,QPointF* path,int pointcount, QString*w,
183  QPointF P,QBrush* lightbrush, QBrush* textbrush);
184 
185 
192  char** t;
194  void reset_Template();
196  void linestoTemplate(lines* f,char val);
198  void facetoTemplate(lines** ff,char val);
199  void TemplatetoColorData();
201  void set(int x, int y,char val);
203  short check_TemplateSpace(QRectF R);
205  void set_TemplateSpace(QRectF R);
207  short check_TemplateSpace(QRectF R, char l);
209  void set_TemplateSpace(QRectF R, char l);
211  int IntSec(QRectF R, char l);
213  void SRTM3ClimbtoMAP(climblayer* cl);
217  void ClimbTracks(QPainter*p,climblayer* cl);
219  void ClimbLabels(QPainter*p,climblayer* cl, int fastmode);
220 
221 };
222 
void SRTM3ClimbtoMAP(climblayer *cl)
climb layer method: SRTM3 DEM plus shading of climbs
Definition: MAP.cpp:1494
void settings(MapSettings *MS)
assigns new settings
Definition: MAP.cpp:122
float mperlat
meter per SRTM3 cell vertical
Definition: MAP.h:146
void add_contour()
adds contours to relief
Definition: MAP.cpp:265
short ** h
Definition: MAP.h:137
void OSMtoMAP(short getcmap, short drawroads, short drawnature, short drawpoints)
draws Open Street Map data
Definition: MAP.cpp:408
int lowcontour
small contour step
Definition: MAP.h:144
double minlon
Definition: MAP.h:105
void reset_Template()
clears tamplate
Definition: MAP.cpp:862
void draw_line(QPainter *p, KOOlist *k, int kc)
drawing commends from outside
Definition: MAP.cpp:1151
void set(int x, int y, char val)
edge flag algorithm marking the px(x,y), used by linestoTemplate
Definition: MAP.cpp:841
QPointF HP[28]
help data to render picture
Definition: MAP.h:133
float pxperlon
px per SRTM3 cell horizontal
Definition: MAP.h:149
MAP(HeightData *h, OSM *o)
create with SRTM3 class and OSM-data manager
Definition: MAP.cpp:3
double maxlat
Definition: MAP.h:105
double ** dhdy
Definition: MAP.h:136
short lineos
Definition: MAP.h:140
double scale()
Definition: MAP.cpp:1147
void STRONGlayer_to_Map(QPainter *p, STRONGlayer *SL)
draws STRONG calculation network
Definition: MAP.cpp:1250
double maxlat0
Definition: MAP.h:100
void add_DEM()
transform heighdata with sun settings into colors
Definition: MAP.cpp:256
double getminlat()
return real borders
Definition: MAP.cpp:357
double ** hc
Definition: MAP.h:134
list elements to handle multiple STRONGlayers
Definition: DataTyps.h:349
container struct to hold data of a coordinate
Definition: DataTyps.h:82
void SRTM3toMAP(short getcmap)
draws the relief
Definition: MAP.cpp:230
short wxxold
Definition: MAP.h:142
float zoom
meter per px
Definition: MAP.h:150
float zoomsize(float size)
Definition: MAP.cpp:764
int highcontour
big contour step
Definition: MAP.h:145
void facetoTemplate(lines **ff, char val)
fills areas marked by edge flag algorithm
Definition: MAP.cpp:488
void climblayer_schading(climblayer *cl)
climb layer method: shading called from SRTM3ClimbtoMAP()
Definition: MAP.cpp:1513
QColor colorgradient(float x)
color functions
Definition: MAP.cpp:1709
double minlon0
Definition: MAP.h:100
unsigned char * cd
Definition: MAP.h:138
short check_TemplateSpace(QRectF R)
check R on the picture if free
Definition: MAP.cpp:868
float pxperlat
px per SRTM3 cell vertical
Definition: MAP.h:148
void linetomap(OSM *o, QPainter *p, lines **ll, QColor QColor, float linewidth, float minlinewidth)
OSM drawing.
Definition: MAP.cpp:465
holds digital elevation model extracted from SRTM3 data
Definition: HeightData.h:26
void ClimbTracks(QPainter *p, climblayer *cl)
climb layer method: draw tracks
Definition: MAP.cpp:1566
official representation of Track in BTP3
Definition: track.h:14
double mmaxlat
marcator projection scaled lattitude
Definition: MAP.h:110
void save_to_png(QString filename)
save map as picture to hard disk
Definition: MAP.cpp:1197
void resize(int width, int height)
adapts size, recalculate borders from desired borders
Definition: MAP.cpp:126
double ytolat(int y)
double y_to_lat(int y)
map coordinate information
Definition: MAP.cpp:375
double maxlon
Definition: MAP.h:105
int width
specified picture format
Definition: MAP.h:98
float mperlon
meter per SRTM3 cell horizontal
Definition: MAP.h:147
void set_borders(double latmin0, double latmax0, double lonmin0, double lonmax0)
sets desired borders, recalculate bordes due to window size
Definition: MAP.cpp:132
short wyyold
Definition: MAP.h:143
char ** t
Definition: MAP.h:192
double maxlon0
Definition: MAP.h:100
double minlat0
desired area with ordinary coordinates
Definition: MAP.h:100
QPixmap * get_Map()
return pixmap of the last generated map
Definition: MAP.cpp:139
void calc_borders()
desired borders to real borders
Definition: MAP.cpp:142
void set_TemplateSpace(QRectF R)
marks R on the picture as occupied
Definition: MAP.cpp:890
void draw_map(STRONGlayer *SL, climblayer *cl, Track *ct, int fastmode)
universal high quality drawing
Definition: MAP.cpp:1410
BTP3 database, created from OpenStreetMap data.
Definition: osm.h:34
void ClimbLabels(QPainter *p, climblayer *cl, int fastmode)
climb layer method: draw labels
Definition: MAP.cpp:1578
int IntSec(QRectF R, char l)
quantifies l-content in r-region
Definition: MAP.cpp:944
double minlat
smaller area inside desired conform width picture scales
Definition: MAP.h:105
void linestoTemplate(lines *f, char val)
edge flag algorithm to draw polyedges
Definition: MAP.cpp:767
void change_intensity(int x, int y, double dI)
Definition: MAP.cpp:342
void add_BestClimb_Bar(QPainter *p, climblayer *cl)
projects best climbs to the borders of the picture
Definition: MAP.cpp:1292
void htocolorfast(unsigned char *cd, float h, float dxf, float dyf)
function to height to color operation
Definition: MAP.cpp:313
main container for Track, WayHeight and ClimbAnalyse
Definition: DataTyps.h:172
osm data container list for line like data (roads, rivers)
Definition: DataTyps.h:143
osm data container list for point like data (summits, towns, ...)
Definition: DataTyps.h:137
void climblayer_to_map(climblayer *cl)
draws climbs
Definition: MAP.cpp:1200
double ** dhdx
Definition: MAP.h:135
generating maps
Definition: MAP.h:24