\( \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
btp3setups.cpp
1 
2 #include "btp3setups.h"
3 void BTP3setups::set_NULL(){
4  ms = NULL;
5  ss = NULL;
6  cs = NULL;
7  ems = NULL;
8  CA = NULL;
9  PS = NULL;
10  MS = NULL;
11 }
12 
13 BTP3setups::BTP3setups(STRONGsetting* ss, STRONGsetting* ms, STRONGsetting* cs){
14  set_NULL();
15  this->ms = ms;
16  ms0 = *ms;
17  this->ss = ss;
18  ss0 = *ss;
19  this->cs = cs;
20  cs0 = *cs;
21  setWindowTitle("MEM Optionen");
22 
23  QLabel* ssl = new QLabel("STRONG (s-mode) settings");
24  QLabel* msl = new QLabel("route hm/km (m-mode) settings");
25  QLabel* csl = new QLabel("maximum climbs (c-mode) settings");
26  L.addWidget(ssl,0,0);
27  L.addWidget(msl,0,1);
28  L.addWidget(csl,0,2);
29 
30  edit[0]= new EditInputs("data radius factor",&(ss0.rfac));
31  edit[1]= new EditInputs("data radius absolut",&(ss0.rabs));
32  edit[2]= new EditInputs("hm steps",&(ss0.hmstep));
33  edit[3]= new EditInputs("hm max",&(ss0.hmmax));
34  edit[4]= new EditInputs("hm/km max",&(ss0.hmperkm));
35  edit[5]= new EditInputs("no climb restrictions",&(ss0.noSTRONGPlus));
36  edit[6]= new EditInputs("restr.: min Hm",&(ss0.dhmin));
37  edit[7]= new EditInputs("restr.: max descent/ascent",&(ss0.downtoupmax));
38  edit[8]= new EditInputs("restr.: min difficulty",&(ss0.minP));
39  edit[8]= new EditInputs("restr.: min difficulty",&(ss0.minP));
40 
41  edit[10]= new EditInputs("data radius factor",&(ms0.rfac));
42  edit[11]= new EditInputs("data radius absolut",&(ms0.rabs));
43  edit[12]= new EditInputs("hm steps",&(ms0.hmstep));
44  edit[13]= new EditInputs("hm max",&(ms0.hmmax));
45  edit[14]= new EditInputs("hm/km max",&(ms0.hmperkm));
46  edit[15]= new EditInputs("no climb restrictions",&(ms0.noSTRONGPlus));
47  edit[16]= new EditInputs("restr.: min Hm",&(ms0.dhmin));
48  edit[17]= new EditInputs("restr.: max descent/ascent",&(ms0.downtoupmax));
49  edit[18]= new EditInputs("restr.: min difficulty",&(ms0.minP));
50 
51  edit[20]= new EditInputs("data radius factor",&(cs0.rfac));
52  edit[21]= new EditInputs("data radius absolut",&(cs0.rabs));
53  edit[22]= new EditInputs("Points steps",&(cs0.hmstep));
54  edit[23]= new EditInputs("Points max",&(cs0.hmmax));
55  edit[24]= new EditInputs("Points/km max",&(cs0.hmperkm));
56  edit[25]= new EditInputs("no climb restrictions",&(cs0.noSTRONGPlus));
57  edit[26]= new EditInputs("restr.: min Hm",&(cs0.dhmin));
58  edit[27]= new EditInputs("restr.: max descent/ascent",&(cs0.downtoupmax));
59  edit[28]= new EditInputs("restr.: min difficulty",&(cs0.minP));
60 
61  for(int i = 0; i < 9; i++){
62  L.addWidget(edit[i ],i+1,0);
63  L.addWidget(edit[i+10],i+1,1);
64  L.addWidget(edit[i+20],i+1,2);
65  }
66 
67 
68 
69  buttons[0].setText("OK");
70  connect(&(buttons[0]), SIGNAL(clicked()), this, SLOT(OK()));
71  buttons[1].setText("Cancel");
72  connect(&(buttons[1]), SIGNAL(clicked()), this, SLOT(cancel()));
73  buttons[2].setText("Default");
74  connect(&(buttons[2]), SIGNAL(clicked()), this, SLOT(init_buffer()));
75 
76  L.addWidget(&(buttons[0]),10,0);
77  L.addWidget(&(buttons[1]),11,0);
78  L.addWidget(&(buttons[2]),11,1);
79  setLayout(&L);
80 }
81 BTP3setups::BTP3setups(ClimbAnalyseSettings* CA){
82  setWindowTitle("Climb Analyse settings");
83  set_NULL();
84  this->CA = CA;
85  CA0 = *CA;
86 
87  edit[0]= new EditInputs("project folder",CA0.ProjectFolder,true);
88  edit[1]= new EditInputs("project name",CA0.ProjectName,false);
89  edit[2]= new EditInputs("max descent/ascent",&(CA0.maxdwnHM));
90  edit[3]= new EditInputs("min Hm",&(CA0.minHM));
91  edit[4]= new EditInputs("min difficulty",&(CA0.minP));
92  edit[5]= new EditInputs("min gradient",&(CA0.minS));
93  edit[6]= new EditInputs("create Climblayer",&(CA0.Climblayer));
94  edit[7]= new EditInputs("create html data",&(CA0.html));
95  edit[8]= new EditInputs("create climb text list",&(CA0.list));
96  edit[9]= new EditInputs("create climb map",&(CA0.map));
97  edit[10]=new EditInputs("mapsize [Mega-px]",&(CA0.mapsize));
98 
99  for(int i = 0; i < 11; i++)
100  L.addWidget(edit[i],i,0);
101 
102  buttons[1].setText("Default");
103  buttons[2].setText("OK");
104  buttons[3].setText("Cancel");
105  connect(&(buttons[1]), SIGNAL(clicked()), this, SLOT(init_buffer()));
106  connect(&(buttons[2]), SIGNAL(clicked()), this, SLOT(OK()));
107  connect(&(buttons[3]), SIGNAL(clicked()), this, SLOT(cancel()));
108  L.addWidget(&(buttons[1]),11,0);
109  L.addWidget(&(buttons[2]),12,0);
110  L.addWidget(&(buttons[3]),13,0);
111 
112  setLayout(&L);
113 }
114 BTP3setups::BTP3setups(ExtMapSettings* ems){
115  setWindowTitle("Map settings");
116  set_NULL();
117  this->ems = ems;
118  ems0 = *ems;
119  edit[0]= new EditInputs("mapsize [Mega-px]",&(ems0.mapsize));
120  edit[1]= new EditInputs("maxlat",&(ems0.maxlat));
121  edit[2]= new EditInputs("minlat",&(ems0.minlat));
122  edit[3]= new EditInputs("maxlon",&(ems0.maxlon));
123  edit[4]= new EditInputs("minlon",&(ems0.minlon));
124  edit[5]= new EditInputs("draw climblayer",&(ems0.drawCL));
125  edit[6]= new EditInputs("draw current track",&(ems0.drawct));
126  edit[7]= new EditInputs("draw STRONG layer",&(ems0.drawSL));
127  for(int i = 0; i < 8; i++)
128  L.addWidget(edit[i],i,0);
129 
130  buttons[1].setText("Default");
131  buttons[2].setText("OK");
132  buttons[3].setText("Cancel");
133 
134  connect(&(buttons[1]), SIGNAL(clicked()), this, SLOT(init_buffer()));
135  connect(&(buttons[2]), SIGNAL(clicked()), this, SLOT(OK()));
136  connect(&(buttons[3]), SIGNAL(clicked()), this, SLOT(cancel()));
137  L.addWidget(&(buttons[1]),8,0);
138  L.addWidget(&(buttons[2]),9,0);
139  L.addWidget(&(buttons[3]),10,0);
140  setLayout(&L);
141 }
142 BTP3setups::BTP3setups(ProfilSettings *PS){
143  setWindowTitle("Profil settings");
144  set_NULL();
145  this->PS = PS;
146  PS0 = *PS;
147 
148  edit[0]= new EditInputs("width [px]",&(PS0.width));
149  edit[1]= new EditInputs("height [px]",&(PS0.height));
150  edit[2]= new EditInputs("font name",PS0.font,0);
151  edit[3]= new EditInputs("titel font size",&(PS0.fstitle));
152  edit[4]= new EditInputs("normal font size",&(PS0.fsnormal));
153  edit[5]= new EditInputs("font color",&(PS0.fontcolor));
154  edit[6]= new EditInputs("background color",&(PS0.bgcolor));
155  edit[7]= new EditInputs("lattice color",&(PS0.latticecolor));
156  edit[8]= new EditInputs("draw title",&(PS0.drawtitle));
157  edit[9]= new EditInputs("draw xlabel",&(PS0.drawxbarlabel));
158  edit[10]= new EditInputs("draw ylabel",&(PS0.drawybarlabel));
159  edit[11]= new EditInputs("draw x grid",&(PS0.drawxlattice));
160  edit[12]= new EditInputs("draw y grid",&(PS0.drawylattice));
161  edit[13]= new EditInputs("xmin",&(PS0.xmin));
162  edit[14]= new EditInputs("xmax",&(PS0.xmax));
163  edit[15]= new EditInputs("ymin",&(PS0.ymin));
164  edit[16]= new EditInputs("ymax",&(PS0.ymax));
165  edit[17]= new EditInputs("margin",&(PS0.margin));
166  edit[18]= new EditInputs("fill single color",&(PS0.singlecolor));
167  edit[19]= new EditInputs("fill color",&(PS0.fillcolor));
168  edit[20]= new EditInputs("draw line",&(PS0.showline));
169  edit[21]= new EditInputs("line color",&(PS0.linecolor));
170  edit[22]= new EditInputs("reduce data",&(PS0.showreduceddata));
171 
172  for(int i = 0; i < 23; i++)
173  L.addWidget(edit[i],i,0);
174 
175  buttons[1].setText("Default");
176  buttons[2].setText("OK");
177  buttons[3].setText("Cancel");
178  connect(&(buttons[1]), SIGNAL(clicked()), this, SLOT(init_buffer()));
179  connect(&(buttons[2]), SIGNAL(clicked()), this, SLOT(OK()));
180  connect(&(buttons[3]), SIGNAL(clicked()), this, SLOT(cancel()));
181  L.addWidget(&(buttons[1]),23,0);
182  L.addWidget(&(buttons[2]),24,0);
183  L.addWidget(&(buttons[3]),25,0);
184 
185  setLayout(&L);
186 }
187 BTP3setups::BTP3setups(MapSettings *MS){
188  setWindowTitle("Map settings");
189  set_NULL();
190  this->MS = MS;
191  MS0 = *MS;
192 
193 
194  edit[0]= new EditInputs("road type 0 width",&(MS0.roadwidth[0]));
195  edit[1]= new EditInputs("road type 1 width",&(MS0.roadwidth[1]));
196  edit[2]= new EditInputs("road type 2 width",&(MS0.roadwidth[2]));
197  edit[3]= new EditInputs("road type 3 width",&(MS0.roadwidth[3]));
198  edit[4]= new EditInputs("road type 4 width",&(MS0.roadwidth[4]));
199  edit[5]= new EditInputs("road type 5 width",&(MS0.roadwidth[5]));
200  edit[6]= new EditInputs("road color 0",&(MS0.roadcolor[0]));
201  edit[7]= new EditInputs("road color 1",&(MS0.roadcolor[1]));
202  edit[8]= new EditInputs("road color 2",&(MS0.roadcolor[2]));
203  edit[9]= new EditInputs("road color 3",&(MS0.roadcolor[3]));
204  edit[10]= new EditInputs("road color 4",&(MS0.roadcolor[4]));
205  edit[11]= new EditInputs("road color 5",&(MS0.roadcolor[5]));
206  for(int i = 0; i < 6; i++){
207  L.addWidget(edit[i] ,i,0);
208  L.addWidget(edit[i+6],i,1);
209  }
210  edit[12]= new EditInputs("metropolos size", &(MS0.pointsize[0]));
211  edit[13]= new EditInputs("city size", &(MS0.pointsize[1]));
212  edit[14]= new EditInputs("town size", &(MS0.pointsize[2]));
213  edit[15]= new EditInputs("village size", &(MS0.pointsize[3]));
214  edit[16]= new EditInputs("locality size", &(MS0.pointsize[4]));
215  edit[17]= new EditInputs("col size", &(MS0.pointsize[5]));
216  edit[18]= new EditInputs("metropolos color",&(MS0.pointcolor[0]));
217  edit[19]= new EditInputs("city color", &(MS0.pointcolor[1]));
218  edit[20]= new EditInputs("town color", &(MS0.pointcolor[2]));
219  edit[21]= new EditInputs("village color", &(MS0.pointcolor[3]));
220  edit[22]= new EditInputs("locality color", &(MS0.pointcolor[4]));
221  edit[23]= new EditInputs("col color", &(MS0.pointcolor[5]));
222 
223  for(int i = 12; i < 18; i++){
224  L.addWidget(edit[i] ,i-6,0);
225  L.addWidget(edit[i+6],i-6,1);
226  }
227  edit[24]= new EditInputs("draw summit",&(MS0.drawsummit));
228  edit[25]= new EditInputs("summit size",&(MS0.summitsize));
229  edit[26]= new EditInputs("summit color",&(MS0.summitcolor));
230  L.addWidget(edit[24],12,0);
231  L.addWidget(edit[25],12,1);
232  L.addWidget(edit[26],13,1);
233 
234  edit[27]= new EditInputs("height 1 [m]",&(MS0.heights[0]));
235  edit[28]= new EditInputs("height 2 [m]",&(MS0.heights[1]));
236  edit[29]= new EditInputs("height 3 [m]",&(MS0.heights[2]));
237  edit[30]= new EditInputs("height 4 [m]",&(MS0.heights[3]));
238  edit[31]= new EditInputs("height 5 [m]",&(MS0.heights[4]));
239  edit[32]= new EditInputs("heights 1 color",&(MS0.heightcolor[0]));
240  edit[33]= new EditInputs("heights 2 color",&(MS0.heightcolor[1]));
241  edit[34]= new EditInputs("heights 3 color",&(MS0.heightcolor[2]));
242  edit[35]= new EditInputs("heights 4 color",&(MS0.heightcolor[3]));
243  edit[36]= new EditInputs("heights 5 color",&(MS0.heightcolor[4]));
244  for(int i = 27; i < 32; i++){
245  L.addWidget(edit[i] ,i-13,0);
246  L.addWidget(edit[i+5],i-13,1);
247  }
248 
249  edit[37]= new EditInputs("draw wood", &(MS0.drawwood ));
250  edit[38]= new EditInputs("draw water", &(MS0.drawater ));
251  edit[39]= new EditInputs("draw contour",&(MS0.drawcontour));
252  edit[40]= new EditInputs("draw points", &(MS0.drawpoints ));
253  edit[41]= new EditInputs("wood color", &(MS0.woodcolor));
254  edit[42]= new EditInputs("water color", &(MS0.watercolor));
255  edit[43]= new EditInputs("draw scale", &(MS0.drawscale ));
256  edit[44]= new EditInputs("draw street label",&(MS0.drawstreetlabel ));
257  for(int i = 37; i < 41; i++){
258  L.addWidget(edit[i],i-18,0);
259  L.addWidget(edit[i+4],i-18,1);
260  }
261  edit[45]= new EditInputs("light intensity",&(MS0.sun.I));
262  L.addWidget(edit[45],25,0);
263  edit[46]= new EditInputs("light azimut [°]",&(MS0.sun.azimut ));
264  L.addWidget(edit[46],25,1);
265  edit[47]= new EditInputs("light elevation [°]",&(MS0.sun.elevation));
266  L.addWidget(edit[47],26,1);
267  edit[48]= new EditInputs("climblayer shading",&(MS0.climblayershading));
268  L.addWidget(edit[48],26,0);
269  edit[49]= new EditInputs("draw street contour",&(MS0.drawstreetcontour));
270  L.addWidget(edit[49],13,0);
271 
272  buttons[1].setText("Default");
273  buttons[2].setText("OK");
274  buttons[3].setText("Cancel");
275  connect(&(buttons[1]), SIGNAL(clicked()), this, SLOT(init_buffer()));
276  connect(&(buttons[2]), SIGNAL(clicked()), this, SLOT(OK()));
277  connect(&(buttons[3]), SIGNAL(clicked()), this, SLOT(cancel()));
278  L.addWidget(&(buttons[1]),27,0);
279  L.addWidget(&(buttons[2]),28,0);
280  L.addWidget(&(buttons[3]),28,1);
281  setLayout(&L);
282 }
284  reject();
285 }
286 void BTP3setups::init(){
287  init_dest();
288  reject();
289 }
291  if(PS != NULL)
292  *PS = PS0;
293  if(ss != NULL)
294  *ss = ss0;
295  if(ms != NULL)
296  *ms = ms0;
297  if(cs != NULL)
298  *cs = cs0;
299  if(CA != NULL)
300  *CA = CA0;
301  if(PS != NULL)
302  *PS = PS0;
303  if(ems != NULL)
304  *ems = ems0;
305  if(MS != NULL){
306  *MS = MS0;
307  MS->sun.cphi = cos(-MS->sun.azimut/180.*M_PI);
308  MS->sun.sphi = sin(-MS->sun.azimut/180.*M_PI);
309  MS->sun.ctheta = cos((90-MS->sun.elevation)/180.*M_PI);
310  MS->sun.stheta = sin((90-MS->sun.elevation)/180.*M_PI);
311  }
312  accept();
313 }
315  if(PS != NULL){
316  ProfilSettings *buf = PS;
317  PS = &PS0;
318  init_dest();
319  PS = buf;
320  for(int i = 0; i < 23; i++)
321  edit[i]->refresh();
322  }
323  if(ss != NULL){
324  STRONGsetting *buf = ss;
325  ss = &ss0;
326  init_dest();
327  ss = buf;
328  for(int i = 0; i < 9; i++)
329  edit[i]->refresh();
330  }
331  if(ms != NULL){
332  STRONGsetting *buf = ms;
333  ms = &ms0;
334  init_dest();
335  ms = buf;
336  for(int i = 10; i < 19; i++)
337  edit[i]->refresh();
338  }
339  if(ms != NULL){
340  STRONGsetting *buf = cs;
341  cs = &cs0;
342  init_dest();
343  cs = buf;
344  for(int i = 20; i < 29; i++)
345  edit[i]->refresh();
346  }
347 
348  if(CA != NULL){
349  ClimbAnalyseSettings *buf = CA;
350  CA = &CA0;
351  init_dest();
352  CA = buf;
353  for(int i = 0; i < 11; i++)
354  edit[i]->refresh();
355  }
356  if(ems != NULL){
357  ExtMapSettings *buf = ems;
358  ems = &ems0;
359  init_dest();
360  ems = buf;
361  for(int i = 0; i < 8; i++)
362  edit[i]->refresh();
363  }
364  if(MS != NULL){
365  MapSettings *buf = MS;
366  MS = &MS0;
367  init_dest();
368  MS = buf;
369  for(int i = 0; i < 50; i++)
370  edit[i]->refresh();
371  }
372 }
374  if(ss != NULL){
375  ss->rfac = 3.;
376  ss->rabs = 200.;
377  ss->hmstep = 15.;
378  ss->hmmax = 10000;
379  ss->hmperkm = 35;
380  ss->dhmin = 200;
381  ss->downtoupmax = 0.1;
382  ss->minP = 5.;
383  ss->noSTRONGPlus = true;
384  }
385  if(ms != NULL){
386  ms->rfac = 1.5;
387  ms->rabs = 5.;
388  ms->hmstep = 40;
389  ms->hmmax = 1500;
390  ms->hmperkm = 35;
391  ms->dhmin = 200;
392  ms->downtoupmax = 0.1;
393  ms->minP = 5.;
394  ms->noSTRONGPlus = true;
395  }
396  if(cs != NULL){
397  cs->rfac = 1.5;
398  cs->rabs = 5.;
399  cs->hmstep = 2;
400  cs->hmmax = 200;
401  cs->hmperkm = 15;
402  cs->dhmin = 200;
403  cs->downtoupmax = 0.1;
404  cs->minP = 5.;
405  cs->noSTRONGPlus = false;
406  }
407 
408  if(CA != NULL){
409  CA->Climblayer = true;
410  CA->html = false;
411  CA->list = true;
412  CA->map = false;
413  CA->mapsize = 8;
414  CA->maxdwnHM = 0.1;
415  CA->minHM = 100;
416  CA->minP = 5;
417  CA->minS = 0.05;
418  strcpy(CA->ProjectFolder,"C:\\");
419  strcpy(CA->ProjectName,"projectname");
420  }
421  if(ems != NULL){
422  ems->drawCL = true;
423  ems->drawct = false;
424  ems->drawSL = true;
425  ems->mapsize = 8;
426  ems->maxlat = 51;
427  ems->minlat = 50;
428  ems->maxlon = 14;
429  ems->minlon = 12;
430  }
431  if(PS != NULL){
432  PS->autoscale = true;
433  PS->bgcolor = QColor(QPalette().color(QPalette::Window)).rgba();
434  PS->drawtitle = true;
435  PS->drawxbarlabel = true;
436  PS->drawybarlabel = true;
437  PS->drawxlattice = true;
438  PS->drawylattice = true;
439  strcpy(PS->font,"Arial");
440  PS->fontcolor = QColor(0,0,0).rgba();
441  PS->fsnormal = 6;
442  PS->fstitle= 10;
443  PS->height = 300;
444  PS->latticecolor = QColor(0,0,0,100).rgba();
445  PS->margin = 5;
446  PS->width = 450;
447  PS->xmin = -1;
448  PS->xmax = 1;
449  PS->ymin = -1;
450  PS->ymax = 1;
451  PS->singlecolor = false;
452  PS->fillcolor = QColor(0,255,0,150).rgba();
453  PS->showline = true;
454  PS->linecolor = QColor(Qt::black).rgba();
455  PS->showreduceddata = true;
456  }
457  if(MS != NULL){
458  MS->minlat = 50;
459  MS->minlon = 13;
460  MS->maxlat = 51;
461  MS->maxlon = 14.5;
462  MS->roadcolor[0] = QColor(0,170,127).rgba();
463  MS->roadcolor[1] = QColor(170,0,0).rgba();
464  MS->roadcolor[2] = QColor(255,170,0).rgba();
465  MS->roadcolor[3] = QColor(255,255,0).rgba();
466  MS->roadcolor[4] = QColor(255,255,255).rgba();
467  MS->roadcolor[5] = QColor(0,0,0).rgba();
468  MS->roadwidth[0] = 6.;
469  MS->roadwidth[1] = 4.;
470  MS->roadwidth[2] = 3.;
471  MS->roadwidth[3] = 2.;
472  MS->roadwidth[4] = 1.;
473  MS->roadwidth[5] = 0.5;
474  MS->summitcolor = QColor(100,15,0).rgba();
475  MS->summitsize = 12;
476  MS->pointsize[0] = 35;
477  MS->pointsize[1] = 25;
478  MS->pointsize[2] = 15;
479  MS->pointsize[3] = 8;
480  MS->pointsize[4] = 4;
481  MS->pointsize[5] = 4;
482  MS->pointcolor[0] = QColor(1,1,1).rgba();
483  MS->pointcolor[1] = QColor(1,1,1).rgba();
484  MS->pointcolor[2] = QColor(1,1,1).rgba();
485  MS->pointcolor[3] = QColor(1,1,1).rgba();
486  MS->pointcolor[4] = QColor(1,1,1).rgba();
487  MS->pointcolor[5] = QColor(100,15,0).rgba();
488  MS->drawcontour = 1;
489  MS->drawsummit = 1;
490  MS->drawpoints = 1;
491  MS->drawwood = 1;
492  MS->woodcolor = QColor(0,80,0,55).rgba();
493  MS->drawater = 1;
494  MS->watercolor = QColor(0,0,200,100).rgba();
495  MS->drawscale = 1;
496  MS->drawstreetlabel = 1;
497  MS->drawstreetcontour = 1;
498  MS->heightcolor[0] = QColor(228,255,206).rgba();
499  MS->heightcolor[1] = QColor(215,255,127).rgba();
500  MS->heightcolor[2] = QColor(255,249,125).rgba();
501  MS->heightcolor[3] = QColor(197,128, 98).rgba();
502  MS->heightcolor[4] = QColor(220,220,220).rgba();
503  MS->heights[0] = 0;
504  MS->heights[1] = 300;
505  MS->heights[2] = 600;
506  MS->heights[3] = 900;
507  MS->heights[4] = 1200;
508  MS->climblayershading = 0.2;
509  MS->sun.I = 5;
510  MS->sun.azimut = -135;
511  MS->sun.elevation = 45;
512  MS->sun.cphi = cos(-MS->sun.azimut/180.*M_PI);
513  MS->sun.sphi = sin(-MS->sun.azimut/180.*M_PI);
514  MS->sun.ctheta = cos((90-MS->sun.elevation)/180.*M_PI);
515  MS->sun.stheta = sin((90-MS->sun.elevation)/180.*M_PI);
516  }
517 }
518 ColorButton::ColorButton(QRgb* color){
519  this->color = color;
520  connect(this,SIGNAL(clicked()),this,SLOT(edit_color()));
521 }
522 void ColorButton::paintEvent(QPaintEvent *){
523  QPainter p(this);
524  p.fillRect(this->rect(),QColor::fromRgba(*color));
525 }
526 void ColorButton::edit_color(){
527  QColor newcolor = QColorDialog::getColor(QColor::fromRgba(*color),NULL,"Select color",
528  QColorDialog::ShowAlphaChannel);
529  *color = newcolor.rgba();
530  update();
531 }
532 EditInputs::EditInputs(QString name, double* v){
533  cv = NULL;
534  iv = NULL;
535  sv = NULL;
536  dv = v;
537  fv = NULL;
538  bv = NULL;
539  rgbv = NULL;
540  folder = NULL;
541  label.setText(name);
542  edit.setText(QString("%1").arg(*v));
543  QBoxLayout* L = new QBoxLayout(QBoxLayout::LeftToRight);
544  L->setContentsMargins(0,0,0,0);
545  L->addWidget(&label,2);
546  L->addWidget(&edit,1);
547  setLayout(L);
548  connect(&edit,SIGNAL(textEdited(QString)),this,SLOT(checkedit(QString)));
549 
550 }
551 EditInputs::EditInputs(QString name, float* v){
552  cv = NULL;
553  iv = NULL;
554  sv = NULL;
555  dv = NULL;
556  fv = v;
557  bv = NULL;
558  rgbv = NULL;
559  folder = NULL;
560  label.setText(name);
561  edit.setText(QString("%1").arg(*v));
562  QBoxLayout* L = new QBoxLayout(QBoxLayout::LeftToRight);
563  L->setContentsMargins(0,0,0,0);
564  L->addWidget(&label,2);
565  L->addWidget(&edit,1);
566  setLayout(L);
567  connect(&edit,SIGNAL(textEdited(QString)),this,SLOT(checkedit(QString)));
568 
569 }
570 
571 EditInputs::EditInputs(QString name, int* v){
572  cv = NULL;
573  iv = v;
574  sv = NULL;
575  dv = NULL;
576  fv = NULL;
577  bv = NULL;
578  rgbv = NULL;
579  folder = NULL;
580  label.setText(name);
581  edit.setText(QString("%1").arg(*v));
582  QBoxLayout* L = new QBoxLayout(QBoxLayout::LeftToRight);
583  L->setContentsMargins(0,0,0,0);
584  L->addWidget(&label,2);
585  L->addWidget(&edit,1);
586  setLayout(L);
587  connect(&edit,SIGNAL(textEdited(QString)),this,SLOT(checkedit(QString)));
588 }
589 EditInputs::EditInputs(QString name, short* v){
590  cv = NULL;
591  iv = NULL;
592  sv = v;
593  dv = NULL;
594  fv = NULL;
595  bv = NULL;
596  rgbv = NULL;
597  folder = NULL;
598  label.setText(name);
599  edit.setText(QString("%1").arg(*v));
600  QBoxLayout* L = new QBoxLayout(QBoxLayout::LeftToRight);
601  L->setContentsMargins(0,0,0,0);
602  L->addWidget(&label,2);
603  L->addWidget(&edit,1);
604  setLayout(L);
605  connect(&edit,SIGNAL(textEdited(QString)),this,SLOT(checkedit(QString)));
606 }
607 
608 EditInputs::EditInputs(QString name, char* v, bool folder){
609  iv = NULL;
610  sv = NULL;
611  dv = NULL;
612  fv = NULL;
613  bv = NULL;
614  rgbv = NULL;
615 
616  if(folder){
617  this->folder = v;
618  cv = NULL;
619  label.setText(QString(v));
620  QPushButton *selectbutton = new QPushButton(name);
621  connect(selectbutton,SIGNAL(clicked()),this,SLOT(select_folder()));
622  QBoxLayout* L = new QBoxLayout(QBoxLayout::LeftToRight);
623  L->setContentsMargins(0,0,0,0);
624  L->addWidget(&label,2);
625  L->addWidget(selectbutton,1);
626  setLayout(L);
627  }
628  else{
629  this->folder = NULL;
630  cv = v;
631  label.setText(name);
632  edit.setText(QString("%1").arg(v));
633  QBoxLayout* L = new QBoxLayout(QBoxLayout::LeftToRight);
634  L->setContentsMargins(0,0,0,0);
635  L->addWidget(&label,2);
636  L->addWidget(&edit,1);
637  setLayout(L);
638  connect(&edit,SIGNAL(textEdited(QString)),this,SLOT(checkedit(QString)));
639  }
640 }
641 EditInputs::EditInputs(QString name, bool* v){
642  cv = NULL;
643  iv = NULL;
644  sv = NULL;
645  dv = NULL;
646  fv = NULL;
647  bv = v;
648  rgbv = NULL;
649  folder = NULL;
650  label.setText(name);
651  check.setChecked(*v);
652  QBoxLayout* L = new QBoxLayout(QBoxLayout::LeftToRight);
653  L->setContentsMargins(0,0,0,0);
654  L->addWidget(&label,2);
655  L->addWidget(&check,1);
656  setLayout(L);
657  connect(&check,SIGNAL(clicked()),this,SLOT(checkbox()));
658 }
659 EditInputs::EditInputs(QString name, QRgb* v){
660  cv = NULL;
661  iv = NULL;
662  sv = NULL;
663  dv = NULL;
664  fv = NULL;
665  bv = NULL;
666  rgbv = v;
667  folder = NULL;
668  label.setText(name);
669  colorbutton = new ColorButton(v);
670  QBoxLayout* L = new QBoxLayout(QBoxLayout::LeftToRight);
671  L->setContentsMargins(0,0,0,0);
672  L->addWidget(&label,2);
673  L->addWidget(colorbutton,1);
674  setLayout(L);
675 }
676 void EditInputs::checkedit(QString newtext){
677  bool OK;
678  if(dv != NULL){
679  double dvb = newtext.toDouble(&OK);
680  if(OK)
681  *dv = dvb;
682  else
683  edit.setText("type float!");
684  }
685  if(fv != NULL){
686  float fvb = newtext.toFloat(&OK);
687  if(OK)
688  *fv = fvb;
689  else
690  edit.setText("type float!");
691  }
692 
693  if(iv != NULL){
694  int ivb = newtext.toInt(&OK);
695  if(OK)
696  *iv = ivb;
697  else
698  edit.setText("type integer");
699  }
700  if(sv != NULL){
701  short svb = newtext.toShort(&OK);
702  if(OK)
703  *sv = svb;
704  else
705  edit.setText("type integer");
706  }
707  if(cv != NULL)
708  strcpy(cv,edit.text().toLocal8Bit().data());
709 }
710 void EditInputs::checkbox(){
711  *bv = check.isChecked();
712 }
713 void EditInputs::refresh(){
714  if(dv != NULL)
715  edit.setText(QString("%1").arg(*dv));
716  if(fv != NULL)
717  edit.setText(QString("%1").arg(*fv));
718  if(iv != NULL)
719  edit.setText(QString("%1").arg(*iv));
720  if(sv != NULL)
721  edit.setText(QString("%1").arg(*sv));
722  if(cv != NULL)
723  edit.setText(QString(cv));
724  if(bv != NULL)
725  check.setChecked(*bv);
726  if(folder != NULL)
727  label.setText(QString(folder));
728  if(rgbv != NULL)
729  colorbutton->update();
730 }
731 void EditInputs::select_folder(){
732  QString foldername = QFileDialog::getExistingDirectory(this,"select directory");
733  if(!foldername.isEmpty()){
734  strcpy(folder,foldername.toLocal8Bit().data());
735  label.setText(QString(folder));
736  }
737 }
double hmperkm
hmmax=max(hmmax,radius*hmperkm)
Definition: DataTyps.h:294
ClimbAnalyseSettings * CA
buffer struct to store user edits
Definition: btp3setups.h:84
bool showreduceddata
average data over multiple screen pixels to sensfully show fill color
Definition: DataTyps.h:211
void cancel()
Definition: btp3setups.cpp:283
ExtMapSettings * ems
buffer struct to store user edits
Definition: btp3setups.h:86
double heights[5]
heights of 5 step color scale
Definition: DataTyps.h:234
bool html
climb analyse dialog
Definition: DataTyps.h:307
double minP
climb analyse dialog
Definition: DataTyps.h:303
double mapsize
picturesize in megapixel
Definition: DataTyps.h:318
float stheta
precalculated sin
Definition: DataTyps.h:190
float sphi
precalculated sin
Definition: DataTyps.h:188
int hmmax
finalization criterium absolute
Definition: DataTyps.h:293
holds data grid information
Definition: HeightData.h:9
float minP
defines climb: min. difficulty
Definition: DataTyps.h:297
QPushButton buttons[4]
buffer struct to store user edits
Definition: btp3setups.h:92
bool Climblayer
climb analyse dialog
Definition: DataTyps.h:313
QRgb roadcolor[6]
color for all different road types
Definition: DataTyps.h:217
generic class to provide editing of specific types
Definition: btp3setups.h:29
QRgb heightcolor[5]
5 step color scale
Definition: DataTyps.h:233
float downtoupmax
defines climb: allowed down Hm
Definition: DataTyps.h:296
void init_buffer()
Definition: btp3setups.cpp:314
int hmstep
Additional criteria for STRONGPlus defining climb.
Definition: DataTyps.h:292
Button to display color and open color dialog.
Definition: btp3setups.h:18
bool drawct
draw current track
Definition: DataTyps.h:321
bool noSTRONGPlus
dont apply climb restrictions
Definition: DataTyps.h:298
bool list
climb analyse dialog
Definition: DataTyps.h:309
double maxlon
Definition: DataTyps.h:216
MapSettings * MS
buffer struct to store user edits
Definition: btp3setups.h:90
void init_dest()
Definition: btp3setups.cpp:373
setting for 2D plot
Definition: DataTyps.h:196
double rfac
Area restricitions of STRONG routing.
Definition: DataTyps.h:290
SunSetting sun
lighting of relief
Definition: DataTyps.h:236
QRgb pointcolor[6]
fontcolor of town, village, ...
Definition: DataTyps.h:222
float I
intensity
Definition: DataTyps.h:187
double minHM
climb analyse dialog
Definition: DataTyps.h:306
bool drawSL
draw stronglayer
Definition: DataTyps.h:320
STRONGsetting * ss
buffer struct to store user edits
Definition: btp3setups.h:82
char ProjectName[260]
climb analyse dialog
Definition: DataTyps.h:311
double mapsize
climb analyse dialog
Definition: DataTyps.h:312
bool drawCL
draw climblayer
Definition: DataTyps.h:319
bool map
climb analyse dialog
Definition: DataTyps.h:308
double minS
climb analyse dialog
Definition: DataTyps.h:304
float pointsize[6]
fontsize of town, village, ...
Definition: DataTyps.h:221
double maxlon
borders
Definition: DataTyps.h:317
char ProjectFolder[260]
climb analyse dialog
Definition: DataTyps.h:310
ProfilSettings * PS
buffer struct to store user edits
Definition: btp3setups.h:88
short dhmin
defines climb: min. Hm
Definition: DataTyps.h:295
double maxdwnHM
climb analyse dialog
Definition: DataTyps.h:305
float roadwidth[6]
width for all different road types
Definition: DataTyps.h:218
float ctheta
precalculated cos
Definition: DataTyps.h:191
container for user settings to run ClimbAnalyse
Definition: DataTyps.h:302
float cphi
precalculated cos
Definition: DataTyps.h:189
container for user settings to manually generate map
Definition: DataTyps.h:316