2 #include "btp3setups.h"
3 void BTP3setups::set_NULL(){
21 setWindowTitle(
"MEM Optionen");
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");
31 edit[1]=
new EditInputs(
"data radius absolut",&(ss0.rabs));
42 edit[11]=
new EditInputs(
"data radius absolut",&(ms0.rabs));
52 edit[21]=
new EditInputs(
"data radius absolut",&(cs0.rabs));
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);
70 connect(&(
buttons[0]), SIGNAL(clicked()),
this, SLOT(
OK()));
72 connect(&(
buttons[1]), SIGNAL(clicked()),
this, SLOT(
cancel()));
76 L.addWidget(&(
buttons[0]),10,0);
77 L.addWidget(&(
buttons[1]),11,0);
78 L.addWidget(&(
buttons[2]),11,1);
82 setWindowTitle(
"Climb Analyse settings");
99 for(
int i = 0; i < 11; i++)
100 L.addWidget(edit[i],i,0);
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);
115 setWindowTitle(
"Map settings");
120 edit[1]=
new EditInputs(
"maxlat",&(ems0.maxlat));
121 edit[2]=
new EditInputs(
"minlat",&(ems0.minlat));
123 edit[4]=
new EditInputs(
"minlon",&(ems0.minlon));
127 for(
int i = 0; i < 8; i++)
128 L.addWidget(edit[i],i,0);
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);
143 setWindowTitle(
"Profil settings");
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));
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));
172 for(
int i = 0; i < 23; i++)
173 L.addWidget(edit[i],i,0);
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);
188 setWindowTitle(
"Map settings");
206 for(
int i = 0; i < 6; i++){
207 L.addWidget(edit[i] ,i,0);
208 L.addWidget(edit[i+6],i,1);
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);
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);
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);
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);
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);
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);
286 void BTP3setups::init(){
307 MS->
sun.
cphi = cos(-MS->
sun.azimut/180.*M_PI);
308 MS->
sun.
sphi = sin(-MS->
sun.azimut/180.*M_PI);
320 for(
int i = 0; i < 23; i++)
328 for(
int i = 0; i < 9; i++)
336 for(
int i = 10; i < 19; i++)
344 for(
int i = 20; i < 29; i++)
353 for(
int i = 0; i < 11; i++)
361 for(
int i = 0; i < 8; i++)
369 for(
int i = 0; i < 50; i++)
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();
444 PS->latticecolor = QColor(0,0,0,100).rgba();
451 PS->singlecolor =
false;
452 PS->fillcolor = QColor(0,255,0,150).rgba();
454 PS->linecolor = QColor(Qt::black).rgba();
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();
474 MS->summitcolor = QColor(100,15,0).rgba();
492 MS->woodcolor = QColor(0,80,0,55).rgba();
494 MS->watercolor = QColor(0,0,200,100).rgba();
496 MS->drawstreetlabel = 1;
497 MS->drawstreetcontour = 1;
508 MS->climblayershading = 0.2;
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);
518 ColorButton::ColorButton(QRgb* color){
520 connect(
this,SIGNAL(clicked()),
this,SLOT(edit_color()));
522 void ColorButton::paintEvent(QPaintEvent *){
524 p.fillRect(this->
rect(),QColor::fromRgba(*color));
526 void ColorButton::edit_color(){
527 QColor newcolor = QColorDialog::getColor(QColor::fromRgba(*color),NULL,
"Select color",
528 QColorDialog::ShowAlphaChannel);
529 *color = newcolor.rgba();
532 EditInputs::EditInputs(QString name,
double* v){
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);
548 connect(&edit,SIGNAL(textEdited(QString)),
this,SLOT(checkedit(QString)));
551 EditInputs::EditInputs(QString name,
float* v){
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);
567 connect(&edit,SIGNAL(textEdited(QString)),
this,SLOT(checkedit(QString)));
571 EditInputs::EditInputs(QString name,
int* v){
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);
587 connect(&edit,SIGNAL(textEdited(QString)),
this,SLOT(checkedit(QString)));
589 EditInputs::EditInputs(QString name,
short* v){
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);
605 connect(&edit,SIGNAL(textEdited(QString)),
this,SLOT(checkedit(QString)));
608 EditInputs::EditInputs(QString name,
char* v,
bool folder){
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);
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);
638 connect(&edit,SIGNAL(textEdited(QString)),
this,SLOT(checkedit(QString)));
641 EditInputs::EditInputs(QString name,
bool* v){
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);
657 connect(&check,SIGNAL(clicked()),
this,SLOT(checkbox()));
659 EditInputs::EditInputs(QString name, QRgb* 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);
676 void EditInputs::checkedit(QString newtext){
679 double dvb = newtext.toDouble(&OK);
683 edit.setText(
"type float!");
686 float fvb = newtext.toFloat(&OK);
690 edit.setText(
"type float!");
694 int ivb = newtext.toInt(&OK);
698 edit.setText(
"type integer");
701 short svb = newtext.toShort(&OK);
705 edit.setText(
"type integer");
708 strcpy(cv,edit.text().toLocal8Bit().data());
710 void EditInputs::checkbox(){
711 *bv = check.isChecked();
713 void EditInputs::refresh(){
715 edit.setText(QString(
"%1").arg(*dv));
717 edit.setText(QString(
"%1").arg(*fv));
719 edit.setText(QString(
"%1").arg(*iv));
721 edit.setText(QString(
"%1").arg(*sv));
723 edit.setText(QString(cv));
725 check.setChecked(*bv);
727 label.setText(QString(folder));
729 colorbutton->update();
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));
double hmperkm
hmmax=max(hmmax,radius*hmperkm)
ClimbAnalyseSettings * CA
buffer struct to store user edits
bool showreduceddata
average data over multiple screen pixels to sensfully show fill color
ExtMapSettings * ems
buffer struct to store user edits
double heights[5]
heights of 5 step color scale
bool html
climb analyse dialog
double minP
climb analyse dialog
double mapsize
picturesize in megapixel
float stheta
precalculated sin
float sphi
precalculated sin
int hmmax
finalization criterium absolute
holds data grid information
float minP
defines climb: min. difficulty
QPushButton buttons[4]
buffer struct to store user edits
bool Climblayer
climb analyse dialog
QRgb roadcolor[6]
color for all different road types
QRgb heightcolor[5]
5 step color scale
float downtoupmax
defines climb: allowed down Hm
int hmstep
Additional criteria for STRONGPlus defining climb.
bool drawct
draw current track
bool noSTRONGPlus
dont apply climb restrictions
bool list
climb analyse dialog
MapSettings * MS
buffer struct to store user edits
double rfac
Area restricitions of STRONG routing.
SunSetting sun
lighting of relief
QRgb pointcolor[6]
fontcolor of town, village, ...
double minHM
climb analyse dialog
bool drawSL
draw stronglayer
STRONGsetting * ss
buffer struct to store user edits
char ProjectName[260]
climb analyse dialog
double mapsize
climb analyse dialog
bool drawCL
draw climblayer
bool map
climb analyse dialog
double minS
climb analyse dialog
float pointsize[6]
fontsize of town, village, ...
char ProjectFolder[260]
climb analyse dialog
ProfilSettings * PS
buffer struct to store user edits
short dhmin
defines climb: min. Hm
double maxdwnHM
climb analyse dialog
float roadwidth[6]
width for all different road types
float ctheta
precalculated cos
container for user settings to run ClimbAnalyse
float cphi
precalculated cos
container for user settings to manually generate map