\( \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
MAP Class Reference

generating maps More...

#include <MAP.h>

Collaboration diagram for MAP:

Public Member Functions

 MAP (HeightData *h, OSM *o)
 create with SRTM3 class and OSM-data manager
void settings (MapSettings *MS)
 assigns new settings
void resize (int width, int height)
 adapts size, recalculate borders from desired borders
void set_borders (double latmin0, double latmax0, double lonmin0, double lonmax0)
 sets desired borders, recalculate bordes due to window size
void calc_borders ()
 desired borders to real borders More...
void SRTM3toMAP (short getcmap)
 draws the relief
void OSMtoMAP (short getcmap, short drawroads, short drawnature, short drawpoints)
 draws Open Street Map data
void STRONGlayer_to_Map (QPainter *p, STRONGlayer *SL)
 draws STRONG calculation network
void climblayer_to_map (climblayer *cl)
 draws climbs
void add_BestClimb_Bar (QPainter *p, climblayer *cl)
 projects best climbs to the borders of the picture
void draw_map (STRONGlayer *SL, climblayer *cl, Track *ct, int fastmode)
 universal high quality drawing More...
void save_to_png (QString filename)
 save map as picture to hard disk
QPixmap * get_Map ()
 return pixmap of the last generated map
void draw_line (QPainter *p, KOOlist *k, int kc)
 drawing commends from outside
void draw_line (QPainter *p, KOO **k, int count)
void draw_line (QPainter *p, double **k, int count)
void draw_line (QPainter *p, Track *ct)
int Draw_lighted_text (QPainter *p, KOO *k, QString *w, QColor *lightcolor, QColor *textcolor)
double getminlat ()
 return real borders
double getminlon ()
double getmaxlat ()
double getmaxlon ()
int getwidth ()
int getheight ()
double y_to_lat (int y)
 map coordinate information
double x_to_lon (int x)
double lat_to_y (double lat)
double lon_to_x (double lon)
double xy_to_height (int x, int y)
float zoomsize (float size)
double scale ()
float get_mperlon ()
float get_mperlat ()

Private Member Functions

void add_DEM ()
 transform heighdata with sun settings into colors
void add_contour ()
 adds contours to relief
void htocolorfast (unsigned char *cd, float h, float dxf, float dyf)
 function to height to color operation
double ytolat (int y)
double xtolon (int x)
float lattoy (double lat)
float lontox (double lon)
QColor colorgradient (float x)
 color functions
QColor colorgradientSL (float x)
QColor colorgradientSchading (float x)
void change_intensity (int x, int y, double dI)
void mult_color (unsigned char *cd, QColor *c)
void linetomap (OSM *o, QPainter *p, lines **ll, QColor QColor, float linewidth, float minlinewidth)
 OSM drawing.
void pointtomap (OSM *o, QPainter *p, points **pp, QColor QColor, float size)
void peaktomap (OSM *o, QPainter *p, points **pp, float min, float max, QColor QColor, float size)
void waternametomap (OSM *o, QPainter *p, lines **pp, QColor QColor, float size)
void streetnametomap (OSM *o, QPainter *p, lines **pp, QColor QColor, float size)
void rivernametomap (OSM *o, QPainter *p, lines **pp, QColor QColor, float size)
void add_scale (QPainter *p)
void Draw_lighted_text (QPainter *p, QString *w, QPointF P, QColor *lightcolor, QColor *textcolor)
 draws text with lighted background More...
void Draw_lighted_Path (QPainter *g, QPainterPath *p, QBrush *lightbrush, QBrush *textbrush)
int Draw_aligned_text (QPainter *g, QPointF *path, int pointcount, QString *w, QPointF P, QBrush *lightbrush, QBrush *textbrush)
void reset_Template ()
 clears tamplate
void linestoTemplate (lines *f, char val)
 edge flag algorithm to draw polyedges
void facetoTemplate (lines **ff, char val)
 fills areas marked by edge flag algorithm
void TemplatetoColorData ()
void set (int x, int y, char val)
 edge flag algorithm marking the px(x,y), used by linestoTemplate
short check_TemplateSpace (QRectF R)
 check R on the picture if free
void set_TemplateSpace (QRectF R)
 marks R on the picture as occupied
short check_TemplateSpace (QRectF R, char l)
 check R for l-value on the picture if free
void set_TemplateSpace (QRectF R, char l)
 marks R as l-value on the picture as occupied
int IntSec (QRectF R, char l)
 quantifies l-content in r-region
void SRTM3ClimbtoMAP (climblayer *cl)
 climb layer method: SRTM3 DEM plus shading of climbs
void climblayer_schading (climblayer *cl)
 climb layer method: shading called from SRTM3ClimbtoMAP()
void ClimbTracks (QPainter *p, climblayer *cl)
 climb layer method: draw tracks
void ClimbLabels (QPainter *p, climblayer *cl, int fastmode)
 climb layer method: draw labels

Private Attributes

int width
 specified picture format
int height
int oldwidth
int oldheight
double minlat0
 desired area with ordinary coordinates More...
double maxlat0
double minlon0
double maxlon0
double minlat
 smaller area inside desired conform width picture scales More...
double maxlat
double minlon
double maxlon
double mmaxlat
 marcator projection scaled lattitude
double mminlat
QPixmap * cmap
MapSettings MS0
QPointF HP [28]
 help data to render picture
double ** hc
double ** dhdx
double ** dhdy
short ** h
unsigned char * cd
short lineos
short wxxold
short wyyold
int lowcontour
 small contour step
int highcontour
 big contour step
float mperlat
 meter per SRTM3 cell vertical
float mperlon
 meter per SRTM3 cell horizontal
float pxperlat
 px per SRTM3 cell vertical
float pxperlon
 px per SRTM3 cell horizontal
float zoom
 meter per px
short drawcontour
char ** t

Detailed Description

generating maps

generating maps using SRTM3 und btp (imported OSM data) data in mercator projection. The resulting image of the current map is stored in cmap. The drawing routine is located in draw_map() function.

Definition at line 24 of file MAP.h.

Member Function Documentation

void MAP::calc_borders ( )

desired borders to real borders

Desired borders may not represent the rectangle defined width an height. New borders will be set completely laying inside the old borders. If a to high area was specified, the lattitude range will be reduce, for a to wide area the longitude range will be shrinked. The method also sets tempory memory.

Definition at line 142 of file MAP.cpp.

void MAP::change_intensity ( int  x,
int  y,
double  dI 
ychanges grayvalue(x,y) by dI

Definition at line 342 of file MAP.cpp.

void MAP::Draw_lighted_text ( QPainter *  p,
QString *  w,
QPointF  P,
QColor *  lightcolor,
QColor *  textcolor 

draws text with lighted background

draws text with lighted background; speedtest results for different background renderings: drawText() 28 times surround transparent: 1.4 ms drawPath() 28 times surrounded transparent: 71.6 ms, drawPath() 4 times surrounded transparent: 15.1 ms, drawPath() with 1 penwidthes: 10.6 ms drawPath() with 3 penwidthes: 25.2 ms

Definition at line 736 of file MAP.cpp.

void MAP::draw_map ( STRONGlayer SL,
climblayer cl,
Track ct,
int  fastmode 

universal high quality drawing

main mathod oh the MAP class, including OSM, SRTM3, STRONGlayer, CLimblayer. First renders relief from HeightData, then filling face data of OSM (wood, water) with edge flag algorithm. Then from least important to most important Map content is drawn onto map. If a climb layer is give the climb segments and labels are included in this process. If a STRONGlayer is give, the roads will be painted due to its STRONGindex

Definition at line 1410 of file MAP.cpp.

double MAP::scale ( )

km pro Pixel

Definition at line 1147 of file MAP.cpp.

double MAP::ytolat ( int  y)
coordinate transformation between picture coordinates und geografic


float MAP::zoomsize ( float  size)

normalizes font size to zoom

Definition at line 764 of file MAP.cpp.

Member Data Documentation

unsigned char* MAP::cd
 color data, every px consists of

three bytes, used by all rendering

Definition at line 138 of file MAP.h.

double** MAP::dhdx

gradient in x direction

Definition at line 135 of file MAP.h.

double** MAP::dhdy

gradient in y direction

Definition at line 136 of file MAP.h.

short** MAP::h

SRTM3 grid, used by SRTM3toMap

Definition at line 137 of file MAP.h.

double** MAP::hc

height at px position

Definition at line 134 of file MAP.h.

short MAP::lineos
line offset to meet byte count

divisible by four for a picture line

Definition at line 140 of file MAP.h.

double MAP::maxlat

realized maximum lattitude

Definition at line 105 of file MAP.h.

double MAP::maxlat0

desired maximum lattitude

Definition at line 100 of file MAP.h.

double MAP::maxlon

realized minimum longitude

Definition at line 105 of file MAP.h.

double MAP::maxlon0

desired minimum longitude

Definition at line 100 of file MAP.h.

double MAP::minlat

smaller area inside desired conform width picture scales

realized minimum lattitude

Definition at line 105 of file MAP.h.

double MAP::minlat0

desired area with ordinary coordinates

desired minimum lattitude

Definition at line 100 of file MAP.h.

double MAP::minlon

realized minimum longitude

Definition at line 105 of file MAP.h.

double MAP::minlon0

desired minimum longitude

Definition at line 100 of file MAP.h.

char** MAP::t

templated marking occupied map area 0: unocuppied 1: wood only 10: water only 11: wood and water

Definition at line 192 of file MAP.h.

short MAP::wxxold

SRTM3 data cells in x direction

Definition at line 142 of file MAP.h.

short MAP::wyyold

SRTM3 data cells iny direction

Definition at line 143 of file MAP.h.

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