/
form.cpp
1370 lines (1114 loc) · 60.9 KB
/
form.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "form.h"
#include "ui_form.h"
#include <QDebug>
#include <QWebFrame>
#include <QWebElement>
#include <QMessageBox>
#include <QFile>
#include <QStringListModel>
#include <QKeyEvent>
#include <QVariant>
#include <QSqlQuery>
#include <QSqlError>
#include "globalfunctions.h"
#ifdef Q_OS_WIN
#include <windows.h> // for Sleep
#endif
Form::Form(QWidget *parent) :
QWidget(parent),
ui(new Ui::Form)
{
completer = NULL;
matrices_up_to_date = false;
after_calculating_distance_matrix_continue_to_tsp = false;
after_calculating_distance_matrix_continue_to_transportationlist = false;
after_calculating_distance_matrix_continue_to_setTotalDistanceAndTotalTime = false;
normal = new QPalette();
normal->setColor(QPalette::Text,Qt::AutoColor);
warning = new QPalette();
warning->setColor(QPalette::Text,Qt::red);
ui->setupUi(this);
ui->webView->setPage(new myWebPage());
ui->totalWeightEdit->setPalette(*normal);
ui->totalVolumeEdit->setPalette(*normal);
ui->totalBagsKurkEdit->setPalette(*normal);
ui->totalBagsParafineEdit->setPalette(*normal);
ui->totalKilometersEdit->setPalette(*normal);
ui->totalTimeEdit->setPalette(*normal);
ui->testButton->setVisible(false); // test button is for tests only and should not be viewable for the user
connect(ui->goButton, SIGNAL(clicked()), this, SLOT(goClicked()));
connect(ui->lePostalAddress, SIGNAL(returnPressed()), this, SLOT(goClicked()));
connect(&transportationlistWriter, SIGNAL(endOfTransportationListWriter_RemoveCancelButton()), this, SLOT(on_routeLoadedCancel_button_clicked()));
//ui: buttons should be disabled until optimal route has been calculated:
ui->pbOptimizeRoute->setEnabled(true);
ui->pbRemoveMarker->setEnabled(true);
ui->pbShowRouteAsDefined->setEnabled(true);
ui->pbTransportationList->setEnabled(true);
ui->pbRouteOmdraaien->setEnabled(true);
//stylesheet for "routeLoaded" (see http://doc.qt.io/qt-4.8/stylesheet-examples.html#customizing-a-qpushbutton-using-the-box-model)
ui->routeLoaded->setStyleSheet("QLabel { color: blue; padding: 5px; font-weight : bold; text-align: right }");
ui->routeLoadedCancel_button->setStyleSheet("QPushButton { color: blue; }");
//ui: "routeLoaded" should be invisible until a planned route is being opened to edit
disableRouteLabel();
connect(ui->pbShowRouteAsDefined, SIGNAL(clicked()), this, SLOT(drawRoute()));
connect(&m_geocodeDataManager, SIGNAL(coordinatesReady(double,double,QString)), this, SLOT(showCoordinates(double,double,QString)));
connect(&m_geocodeDataManager, SIGNAL(coordinatesReady(double,double,SOphaalpunt)), this, SLOT(showOphaalpunt(double,double,SOphaalpunt)));
connect(&m_geocodeDataManager, SIGNAL(coordinatesReady(double,double,SLevering)), this, SLOT(showLevering(double,double,SLevering)));
connect(&m_geocodeDataManager, SIGNAL(errorOccured(QString)), this, SLOT(errorOccured(QString)));
connect(&m_geocodeDataManager, SIGNAL(putCoordinatesInDatabase(double,double,int)), this, SLOT(putCoordinatesInDatabase(double,double,int)));
connect(&m_distanceMatrix, SIGNAL(errorOccured(QString)), this, SLOT(errorOccured(QString)));
connect(&m_distanceMatrix, SIGNAL(new_order_smarkers(QList<int> *)), this, SLOT(process_result_distancematrix(QList<int> *)));
connect(&m_distanceMatrix, SIGNAL(new_distance_matrices(int**, int**)), this, SLOT(reload_distancematrix(int**, int**)));
connect(ui->webView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(populateJavaScriptWindowObject()));
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
ui->lePostalAddress->setText("");
////// ui->webView->setUrl(QUrl("qrc:/html/google_maps.html"));
ui->webView->setHtml("<!DOCTYPE html><html><head><meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" /><style type=\"text/css\">html { height: 100% } body { height: 100%; margin: 0; padding: 0 } #map_canvas { height: 100% } </style> <script src=\"https://maps.googleapis.com/maps/api/js?v=3&key="+settings.value("apiKey").toString()+"\"> </script> <script> var map; var markers = []; function initialize() { var myOptions = { center: new google.maps.LatLng(50.9801, 4.97517), zoom: 15, mapTypeId: google.maps.MapTypeId.ROADMAP, panControl: true }; map = new google.maps.Map(document.getElementById(\"map_canvas\"), myOptions); } </script> </head> <body onload=\"initialize()\"> <div id=\"map_canvas\" style=\"width:100%; height:100%\"></div> </body></html>");
ui->lwMarkers->setMaximumWidth(180);
reloadCompleter();
ui->lePostalAddress->setText(settings.value("startpunt").toString());
goClicked();
setTotalWeightTotalVolume();
resetTotalDistanceAndTotalTime();
/// call cleanMarkersAndOpenOldRoute() when TransportationListWriter::print() is done and Boolean is set commit 89741718d8520aab7ddb21a1a9bc2b90b7f5ec2c https://github.com/vvim/routetool/commit/89741718d8520aab7ddb21a1a9bc2b90b7f5ec2c
connect(&transportationlistWriter, SIGNAL(signalCleanMarkersAndOpenOldRoute()), this, SLOT(cleanMarkersAndOpenOldRoute()));
}
Form::~Form()
{
vvimDebug() << "start to deconstruct Form()";
delete ui; // does this delete everything? Also the QPalettes ?
if(completer)
delete completer;
vvimDebug() << "<vvim> ~Form() deconstructor: no need to delete distance_matrix_in_meters and distance_matrix_in_seconds, this has been done by the class DistanceMatrix";
vvimDebug() << "<vvim> ~Form() deconstructor: must we also delete all contents of QList <SMarker*> m_markers ?";
vvimDebug() << "Form() deconstructed";
}
void Form::showLevering(double east, double north, SLevering levering, bool saveMarker)
{
vvimDebug() << "Form, showLevering" << east << north;
QString str =
QString("var newLoc = new google.maps.LatLng(%1, %2); ").arg(north).arg(east) +
QString("map.setCenter(newLoc);") +
QString("map.setZoom(%1);").arg(ui->zoomSpinBox->value());
vvimDebug() << str;
ui->webView->page()->currentFrame()->documentElement().evaluateJavaScript(str);
if (saveMarker)
setMarker(east, north, levering);
}
void Form::showOphaalpunt(double east, double north, SOphaalpunt ophaalpunt, bool saveMarker)
{
vvimDebug() << "Form, showOphaalpunt" << east << north;
QString str =
QString("var newLoc = new google.maps.LatLng(%1, %2); ").arg(north).arg(east) +
QString("map.setCenter(newLoc);") +
QString("map.setZoom(%1);").arg(ui->zoomSpinBox->value());
vvimDebug() << str;
ui->webView->page()->currentFrame()->documentElement().evaluateJavaScript(str);
if (saveMarker)
setMarker(east, north, ophaalpunt);
}
void Form::putCoordinatesInDatabase(double east, double north, int ophaalpunt_id)
{
/** this function is only to put the coordinates in the database, NOT to put a marker on the screen **/
vvimDebug() << "update db: lat / lng / ophaalpunt" << north << east << ophaalpunt_id;
QString SQLquery_update_coords = "UPDATE ophaalpunten SET lat = :lat, lng = :lng WHERE id = :ophaalpunt_id";
QSqlQuery query_update_coords;
query_update_coords.prepare(SQLquery_update_coords);
query_update_coords.bindValue(":lat", north);
query_update_coords.bindValue(":lng", east);
query_update_coords.bindValue(":ophaalpunt_id", ophaalpunt_id);
vvimDebug() << "step 1" << "update ophaalpunt with lat/lng";
if(!query_update_coords.exec())
{
if(!reConnectToDatabase(query_update_coords.lastError(), SQLquery_update_coords, QString("[%1]").arg(Q_FUNC_INFO)))
{
vvimDebug() << "unable to reconnect to DB, halting";
QMessageBox::information(this, tr("Fout bij verbinding met de databank ").arg(Q_FUNC_INFO), tr("De databank kon niet geraadpleegd worden.\n\nProbeer later opnieuw. Als deze fout zich blijft voordoen, stuur het logbestand naar Wim of neem contact op met de systeembeheerder."));
return;
}
QSqlQuery query_temp;
query_temp.prepare(SQLquery_update_coords);
query_temp.bindValue(":lat", north);
query_temp.bindValue(":lng", east);
query_temp.bindValue(":ophaalpunt_id", ophaalpunt_id);
query_update_coords = query_temp;
query_update_coords = QSqlQuery(SQLquery_update_coords);
if(!query_update_coords.exec())
{
vvimDebug() << "FATAL:" << "Something went wrong, could not execute query:" << SQLquery_update_coords << query_update_coords.lastError();
qFatal(QString("Something went wrong, could not execute query: %1").arg(SQLquery_update_coords).toStdString().c_str());
QMessageBox::information(this, tr("Fout bij verbinding met de databank ").arg(Q_FUNC_INFO), tr("De databank kon niet geraadpleegd worden.\n\nProbeer later opnieuw. Als deze fout zich blijft voordoen, stuur het logbestand naar Wim of neem contact op met de systeembeheerder."));
return;
}
}
}
void Form::showCoordinates(double east, double north, QString markername, bool saveMarker)
{
vvimDebug() << "Form, showCoordinates" << east << north;
QString str =
QString("var newLoc = new google.maps.LatLng(%1, %2); ").arg(north).arg(east) +
QString("map.setCenter(newLoc);") +
QString("map.setZoom(%1);").arg(ui->zoomSpinBox->value());
vvimDebug() << str;
ui->webView->page()->currentFrame()->documentElement().evaluateJavaScript(str);
if (saveMarker)
setMarker(east, north, markername);
//setMarker(east, north, ui->lePostalAddress->text());
}
void Form::setMarker(double east, double north, QString caption)
{
for (int i=0; i<m_markers.size(); i++)
{
if (m_markers[i]->caption == caption) return;
}
QString str =
QString("var marker = new google.maps.Marker({") +
QString("position: new google.maps.LatLng(%1, %2),").arg(north).arg(east) +
QString("map: map,") +
QString("title: %1").arg("\""+caption+"\"") +
QString("});") +
QString("markers.push(marker);");
vvimDebug() << str;
ui->webView->page()->currentFrame()->documentElement().evaluateJavaScript(str);
SMarker *_marker = new SMarker(east, north, caption);
m_markers.append(_marker);
//adding capton to ListWidget
ui->lwMarkers->addItem(caption);
link_lwMarkers_mmarkers[caption] = _marker;
matrices_up_to_date = false;
resetTotalDistanceAndTotalTime();
}
void Form::setMarker(double east, double north, SOphaalpunt ophaalpunt)
{
QString caption = ophaalpunt.getNameAndAddress();
for (int i=0; i<m_markers.size(); i++)
{
if (m_markers[i]->caption == caption)
{
// overschrijven met info ophaalpunt???
vvimDebug() << "<vvim> TODO: wat als OPHAALPUNT & LEVERING ?";
vvimDebug() << "found marker with the same caption" << caption << "ophaling" << m_markers[i]->ophaling << ", levering" << m_markers[i]->levering << ". Overwriting with SOphaalpunt data.";
m_markers[i]->ophaling = true;
m_markers[i]->ophaalpunt = ophaalpunt;
setTotalWeightTotalVolume();
return;
}
}
QString str =
QString("var marker = new google.maps.Marker({") +
QString("position: new google.maps.LatLng(%1, %2),").arg(north).arg(east) +
QString("map: map,") +
QString("title: %1").arg("\"Ophaalpunt: "+ophaalpunt.naam+"\"") +
QString("});") +
QString("markers.push(marker);");
vvimDebug() << str;
ui->webView->page()->currentFrame()->documentElement().evaluateJavaScript(str);
SMarker *_marker = new SMarker(east, north, ophaalpunt);
m_markers.append(_marker);
//adding capton to ListWidget
ui->lwMarkers->addItem(caption);
link_lwMarkers_mmarkers[caption] = _marker;
matrices_up_to_date = false;
resetTotalDistanceAndTotalTime();
setTotalWeightTotalVolume();
}
void Form::setMarker(double east, double north, SLevering levering)
{
QString caption = levering.getNameAndAddress();
for (int i=0; i<m_markers.size(); i++)
{
if (m_markers[i]->caption == caption)
{
// overschrijven met info levering???
vvimDebug() << "found marker with the same caption" << caption << "ophaling" << m_markers[i]->ophaling << ", levering" << m_markers[i]->levering << ". Overwriting with SLevering data.";
m_markers[i]->levering = true;
m_markers[i]->leveringspunt = levering;
setTotalWeightTotalVolume();
// anders bij levering dan bij ophaling, neen??? Levering wordt eerst gedaan, daarna is de camion leeg, dan de ophaling
return;
}
}
QString str =
QString("var marker = new google.maps.Marker({") +
QString("position: new google.maps.LatLng(%1, %2),").arg(north).arg(east) +
QString("map: map,") +
QString("title: %1").arg("\"Levering: "+levering.name+"\"") +
QString("});") +
QString("markers.push(marker);");
vvimDebug() << str;
ui->webView->page()->currentFrame()->documentElement().evaluateJavaScript(str);
SMarker *_marker = new SMarker(east, north, levering);
m_markers.append(_marker);
//adding capton to ListWidget
ui->lwMarkers->addItem(caption);
link_lwMarkers_mmarkers[caption] = _marker;
matrices_up_to_date = false;
resetTotalDistanceAndTotalTime();
setTotalWeightTotalVolume();
// anders bij levering dan bij ophaling, neen??? Levering wordt eerst gedaan, daarna is de camion leeg, dan de ophaling
}
void Form::goClicked()
{
QString address = ui->lePostalAddress->text();
m_geocodeDataManager.getCoordinates(address);
ui->lePostalAddress->clear();
}
void Form::errorOccured(const QString& error)
{
QMessageBox::warning(this, tr("Geocode Error"), error);
}
void Form::on_lwMarkers_currentRowChanged(int currentRow)
{
if (currentRow < 0) return;
QString str =
QString("var newLoc = new google.maps.LatLng(%1, %2); ").arg(m_markers[currentRow]->north).arg(m_markers[currentRow]->east) +
QString("map.setCenter(newLoc);");
vvimDebug() << str;
ui->webView->page()->currentFrame()->documentElement().evaluateJavaScript(str);
}
void Form::on_pbRemoveMarker_clicked()
{
if (ui->lwMarkers->currentRow() < 0) return;
if((ui->lwMarkers->currentRow()+2) == ui->lwMarkers->count())
{
vvimDebug() << "Dangerous business";
QMessageBox::critical(this, tr("WAARSCHUWING"), tr("Het wissen van de 'voorlaatste' marker in de lijst resulteert in een fout die ik nog niet heb kunnen opsporen.\n\nAls je deze marker echt wilt wissen, versleep hem dan eerst tot onderaan de lijst, en verwijder hem dan."));
return;
}
matrices_up_to_date = false;
resetTotalDistanceAndTotalTime(); // not necessary because 'drawRoute()' will be called, but in case future changes remove that call, this line is for avoiding bugs
//reorder Markers: in case of Drag/Drop vanuit QListWidget
reorderMarkers();
//deleteing caption from markers list
/** THIS LINE GIVES THE TROUBLE, some sort of interaction with lwMarkers? **/
//<vvim> TODO: programma crasht als er maar 2 markers zijn en je wil de tweede verwijderen. Waarom?
delete m_markers.takeAt(ui->lwMarkers->currentRow());
//deleteing caption from ListWidget
delete ui->lwMarkers->takeItem(ui->lwMarkers->currentRow());
setTotalWeightTotalVolume();
drawRoute();
}
void Form::on_zoomSpinBox_valueChanged(int arg1)
{
QString str =
QString("map.setZoom(%1);").arg(arg1);
vvimDebug() << str;
ui->webView->page()->currentFrame()->documentElement().evaluateJavaScript(str);
}
void Form::on_pbOptimizeRoute_clicked()
{
//reorder Markers: in case of Drag/Drop vanuit QListWidget
// reorderMarkers(); -> not necessary, the order will be changed any way
if(matrices_up_to_date)
{
// no need to recalculate the distance matrices, just go straight to TSP:
after_calculating_distance_matrix_continue_to_tsp = false;
after_calculating_distance_matrix_continue_to_transportationlist = false;
after_calculating_distance_matrix_continue_to_setTotalDistanceAndTotalTime = false;
m_distanceMatrix.calculateOptimalRoute();
setTotalDistanceAndTotalTime();
}
else
{
// we need to first calculate the distance matrices
after_calculating_distance_matrix_continue_to_tsp = true;
after_calculating_distance_matrix_continue_to_transportationlist = false;
after_calculating_distance_matrix_continue_to_setTotalDistanceAndTotalTime = false;
m_distanceMatrix.getDistances(m_markers);
}
//extra funcationalities
ui->pbTransportationList->setEnabled(true);
ui->pbRouteOmdraaien->setEnabled(true);
ui->pbShowRouteAsDefined->setEnabled(true);
}
void Form::reload_distancematrix(int** matrix_in_meters, int ** matrix_in_seconds)
{
distance_matrix_in_meters = matrix_in_meters;
distance_matrix_in_seconds = matrix_in_seconds;
matrix_dimensions = m_markers.length();
matrices_up_to_date = true;
if(after_calculating_distance_matrix_continue_to_tsp)
{
// continue to TSP:
after_calculating_distance_matrix_continue_to_tsp = false;
m_distanceMatrix.calculateOptimalRoute();
}
else
/* github 96a8b5577056d3108c6ac36ea4ec78ebf5cbd181
after calculating the distance matrices, we also have to show which
marker corresponds to which index of those matrices. Even if the order
is the same (fixed)
*/
{
QList<int> *refreshindex = new QList<int>();
for(int i = 0 ; i < m_markers.length() ; i++)
{
refreshindex->push_back(i);
}
process_result_distancematrix(refreshindex);
}
if(after_calculating_distance_matrix_continue_to_transportationlist)
{
// continue to Transportation List:
after_calculating_distance_matrix_continue_to_transportationlist = false;
buildTransportationList();
}
if(after_calculating_distance_matrix_continue_to_setTotalDistanceAndTotalTime)
{
vvimDebug() << "set total distance and total time";
// continue to display the total distance and time of the route:
after_calculating_distance_matrix_continue_to_setTotalDistanceAndTotalTime = false;
setTotalDistanceAndTotalTime();
}
}
void Form::process_result_distancematrix(QList<int> *tsp_order_smarkers)
{
/**********************************************************************************
function to re-arrange the QList<SMarker *>
based on the Traveling Salesman Problem run in DistanceMatrix::
good to know: tsp_order_smarkers->length() == m_markers.length() + 1
because tsp_order_smarkers has the same beginning as endpoint (to make a loop)
**********************************************************************************/
/*
QString volgorde = "Volgorde van de oplossing:\n";
foreach(int i, *tsp_order_smarkers)
{
volgorde += " * " + m_markers.at(i)->caption;
volgorde += "\n";
}
volgorde += "\n\nVolgorde van de Markers:\n";
foreach(SMarker* i, m_markers)
{
volgorde += " * " + i->caption;
volgorde += "\n";
}
*/
/////////////////
QList<SMarker*> temp;
ui->lwMarkers->clear();
for(int i = 0; i < m_markers.length(); i++)
{
SMarker * _marker = m_markers.at(tsp_order_smarkers->at(i));
_marker->distancematrixindex = tsp_order_smarkers->at(i);
vvimDebug() << _marker->caption << _marker->distancematrixindex;
temp.push_back(_marker);
ui->lwMarkers->addItem(m_markers.at(tsp_order_smarkers->at(i))->caption);
//vvimDebug() << m_markers.at(tsp_order_smarkers->at(i))->caption;
}
m_markers = temp; // does this leave garbage in memory? should I delete something??
// TODO <vvim> ask StackOverflow
ui->lwMarkers->update();
/*
QMessageBox msgBox;
msgBox.setText("message "+QString::number(tsp_order_smarkers->length())+" "+QString::number(m_markers.length())+" "+QString::number(temp.length()));
msgBox.exec();
volgorde += "\n\nVolgorde van de nieuwe Markers:\n";
foreach(SMarker* i, temp)
{
volgorde += " * " + i->caption;
volgorde += "\n";
}
msgBox.setText(volgorde);
msgBox.exec();
*/
drawRoute();
}
void Form::add_aanmeldingen(QList<SOphaalpunt> *aanmeldingen)
{
m_geocodeDataManager.pushListOfMarkers(aanmeldingen);
}
void Form::add_levering(SLevering levering)
{
m_geocodeDataManager.pushLevering(levering);
}
void Form::keyPressEvent( QKeyEvent *k )
{
if(k->key() == Qt::Key_Delete)
on_pbRemoveMarker_clicked();
}
void Form::showPlannedRoute(QList<SOphaalpunt> *locations, QDate routeCurrentlyBeingEdited)
{
vvimDebug() << "get ready to edit" << "[B] set FLAG / Boolean in Routetool , voor als de gebruiker nu klikt op 'route opslaan', dat we de vorige overschrijven (geef messagebox: overschrijven of nieuwe?)";
vvimDebug() << "Date of route being edited:" << routeCurrentlyBeingEdited;
transportationlistWriter.setCurrentlyEditedRoute(routeCurrentlyBeingEdited);
vvimDebug() << "show ui->routeLoaded to inform user that he is currently editing a planned route";
setRouteLabel(routeCurrentlyBeingEdited);
add_aanmeldingen(locations); // issue #40
}
void Form::drawRoute()
{
vvimDebug() << "function called";
// this only makes sense when there is more than 1 marker in m_markers
// (as the first marker is the STARTING POINT and DESTINATION POINT of the route)
if(m_markers.length() > 1)
{
//reorder Markers: in case of Drag/Drop vanuit QListWidget
reorderMarkers();
/** *********************************************** **
Google API doesn't allow more than 8 WayPoints
the workaround used here is courtesy of 'lemonharpy':
* http://lemonharpy.wordpress.com/2011/12/15/working-around-8-waypoint-limit-in-google-maps-directions-api/
* http://jsfiddle.net/ZyHnk/
** *********************************************** **/
QString html_top = QString("<!DOCTYPE html> <html> <head> <meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" /> <style type=\"text/css\"> html { height: 100% } body { height: 100%; margin: 0; padding: 0 } #map_canvas { height: 100% } </style> <script src=\"https://maps.googleapis.com/maps/api/js?v=3&key=")+
settings.value("apiKey").toString()+
QString("\"> </script> <script> var markers = []; var map; function Tour_startUp(stops) { if (!window.tour) window.tour = { updateStops: function (newStops) { stops = newStops; }, loadMap: function (map, directionsDisplay) { var myOptions = { zoom: 15, center: new window.google.maps.LatLng(50.9801, 4.97517), mapTypeId: window.google.maps.MapTypeId.ROADMAP }; map.setOptions(myOptions); directionsDisplay.setMap(map); }, fitBounds: function (map) { var bounds = new window.google.maps.LatLngBounds(); jQuery.each(stops, function (key, val) { var myLatlng = new window.google.maps.LatLng(val.Geometry.Latitude, val.Geometry.Longitude); bounds.extend(myLatlng); }); map.fitBounds(bounds); }, calcRoute: function (directionsService, directionsDisplay) { var batches = []; var itemsPerBatch = 10; var itemsCounter = 0; var wayptsExist = stops.length > 0; while (wayptsExist) { var subBatch = []; var subitemsCounter = 0; for (var j = itemsCounter; j < stops.length; j++) { subitemsCounter++; subBatch.push({ location: new window.google.maps.LatLng(stops[j].Geometry.Latitude, stops[j].Geometry.Longitude), stopover: true }); if (subitemsCounter == itemsPerBatch) break; } itemsCounter += subitemsCounter; batches.push(subBatch); wayptsExist = itemsCounter < stops.length; itemsCounter--; } var combinedResults; var unsortedResults = [{}]; var directionsResultsReturned = 0; for (var k = 0; k < batches.length; k++) { var lastIndex = batches[k].length - 1; var start = batches[k][0].location; var end = batches[k][lastIndex].location; var waypts = []; waypts = batches[k]; waypts.splice(0, 1); waypts.splice(waypts.length - 1, 1); var request = { origin: start, destination: end, waypoints: waypts, travelMode: window.google.maps.TravelMode.WALKING }; (function (kk) { directionsService.route(request, function (result, status) { if (status == window.google.maps.DirectionsStatus.OK) { var unsortedResult = { order: kk, result: result }; unsortedResults.push(unsortedResult); directionsResultsReturned++; if (directionsResultsReturned == batches.length) { unsortedResults.sort(function (a, b) { return parseFloat(a.order) - parseFloat(b.order); }); var count = 0; for (var key in unsortedResults) { if (unsortedResults[key].result != null) { if (unsortedResults.hasOwnProperty(key)) { if (count == 0) combinedResults = unsortedResults[key].result; else { combinedResults.routes[0].legs = combinedResults.routes[0].legs.concat(unsortedResults[key].result.routes[0].legs); combinedResults.routes[0].overview_path = combinedResults.routes[0].overview_path.concat(unsortedResults[key].result.routes[0].overview_path); combinedResults.routes[0].bounds = combinedResults.routes[0].bounds.extend(unsortedResults[key].result.routes[0].bounds.getNorthEast()); combinedResults.routes[0].bounds = combinedResults.routes[0].bounds.extend(unsortedResults[key].result.routes[0].bounds.getSouthWest()); } count++; } } } directionsDisplay.setDirections(combinedResults); } } }); })(k); } } }; } function initialize() { var stops = [");
QString html_bottom = QString("] ; var myOptions = { center: new google.maps.LatLng(50.9801, 4.97517), zoom: 15, mapTypeId: google.maps.MapTypeId.ROADMAP, panControl: true }; map = new window.google.maps.Map(document.getElementById(\"map_canvas\"), myOptions); var directionsDisplay = new window.google.maps.DirectionsRenderer(); var directionsService = new window.google.maps.DirectionsService(); Tour_startUp(stops); window.tour.loadMap(map, directionsDisplay); if (stops.length > 1) window.tour.calcRoute(directionsService, directionsDisplay); }; </script> </head> <body onLoad='initialize()'> <div id=\"map_canvas\" style=\"width:100%;height:100%\"> </div> </body> </html>");
foreach(SMarker* marker, m_markers)
{
QString str = QString("{\"Geometry\":{\"Latitude\": %1 ,\"Longitude\": %2 }},\n").arg(marker->north).arg(marker->east);
html_top += str;
}
// return again to starting point:
QString str = QString("{\"Geometry\":{\"Latitude\": %1 ,\"Longitude\": %2 }}\n").arg(m_markers[0]->north).arg(m_markers[0]->east);
html_top += str;
vvimDebug() << "complete HTML:" << html_top+html_bottom;
ui->webView->setHtml(html_top+html_bottom);
}
if(!after_calculating_distance_matrix_continue_to_setTotalDistanceAndTotalTime)
{
vvimDebug() << "calling setTotalDistanceAndTotalTime() with matrices_up_to_date =" << matrices_up_to_date;
setTotalDistanceAndTotalTime();
}
//else : function will be called anyway, no use to do it twice
}
void Form::on_pbRouteOmdraaien_clicked()
{
//reorder Markers: in case of Drag/Drop vanuit QListWidget
reorderMarkers();
if(m_markers.length() > 0) // has no use without markers, right?
{
QList<SMarker*> temp;
ui->lwMarkers->clear();
// reverse the route, but keep the same starting point!
temp.push_front(m_markers.front());
ui->lwMarkers->addItem(m_markers.front()->caption);
for(int i = m_markers.length() - 1; i > 0; i--)
{
temp.push_back(m_markers.at(i));
ui->lwMarkers->addItem(m_markers.at(i)->caption);
vvimDebug() << m_markers.at(i)->caption;
}
m_markers = temp; // does this leave garbage in memory? should I delete something??
// TODO <vvim> ask StackOverflow
ui->lwMarkers->update();
}
drawRoute();
}
void Form::reorderMarkers()
{
vvimDebug() << "function was called" << "was it needed?" << testIfLWMarkersHasChanged();
/** in the future we could change this function to
if(testIfLWMarkersHasChanged())
{
**/
QList<SMarker*> temp;
//vvimDebug() << "write out of m_markers BEFORE the reordering";
//logOutputMarkers();
for(int i = 0; i < ui->lwMarkers->count(); i++)
{
temp.push_back(link_lwMarkers_mmarkers[ui->lwMarkers->item(i)->text()]);
}
m_markers = temp; // does this leave garbage in memory? should I delete something??
// TODO <vvim> ask StackOverflow
//vvimDebug() << "write out of m_markers AFTER the reordering";
//logOutputMarkers();
/**
}
no need to change m_markers when there has been no Drag/Drop action.
**/
}
void Form::logOutputMarkers()
{
// function used for debugging
vvimDebug() << "Debug information: output markers. Length: " << m_markers.length();
vvimDebug() << "Are the distance matrices up to date?" << matrices_up_to_date;
for(int i = 0; i < m_markers.length(); i++)
{
vvimDebug() << "Marker" << i << ":";
m_markers[i]->PrintInformation();
}
}
void Form::setTotalWeightTotalVolume()
{
// anders bij levering dan bij ophaling, neen??? Levering wordt eerst gedaan, daarna is de camion leeg, dan de ophaling
double total_weight = 0;
double total_volume = 0;
int total_bags_kurk = 0;
int total_bags_kaarsresten = 0;
for(int i = 0; i < m_markers.length(); i++)
{
if(m_markers[i]->ophaling)
{
//total_weight += m_markers[i]->ophaalpunt.kg_kurk + m_markers[i]->ophaalpunt.kg_kaarsresten;
total_weight += m_markers[i]->ophaalpunt.getWeight();
//total_volume += (m_markers[i]->ophaalpunt.zakken_kurk * settings.value("zak_kurk_volume").toDouble()) + (m_markers[i]->ophaalpunt.zakken_kaarsresten * settings.value("zak_kaarsresten_volume").toDouble());
total_volume += m_markers[i]->ophaalpunt.getVolume();
total_bags_kurk += m_markers[i]->ophaalpunt.zakken_kurk;
total_bags_kaarsresten += m_markers[i]->ophaalpunt.zakken_kaarsresten;
}
if(m_markers[i]->levering)
{
vvimDebug() << ". type: Levering";
vvimDebug() << "... anders bij levering dan bij ophaling, neen??? Levering wordt eerst gedaan, daarna is de camion leeg, dan de ophaling";
}
}
ui->totalWeightEdit->setText(QString("%1 kg").arg(total_weight));
ui->totalVolumeEdit->setText(QString("%1 liter").arg(total_volume));
ui->totalBagsKurkEdit->setText(QString("%1").arg(total_bags_kurk));
ui->totalBagsParafineEdit->setText(QString("%1").arg(total_bags_kaarsresten));
if(total_weight > settings.value("max_gewicht_vrachtwagen").toDouble())
ui->totalWeightEdit->setPalette(*warning);
else
ui->totalWeightEdit->setPalette(*normal);
if(total_volume > settings.value("max_volume_vrachtwagen").toDouble())
ui->totalVolumeEdit->setPalette(*warning);
else
ui->totalVolumeEdit->setPalette(*normal);
}
void Form::resetTotalDistanceAndTotalTime()
{
ui->totalTimeEdit->setText(tr("onbekend"));
ui->totalKilometersEdit->setText(tr("onbekend"));
}
void Form::setTotalDistanceAndTotalTime()
{
vvimDebug() << "is transportationlist ready?" << "\n\ntransportationlistWriter.getReady()?\n\n";
vvimDebug() << "\n\nNAKIJKEN:";
vvimDebug() << " 1. nog iets doen met reorderMarkers() ?? of met DrawRoute() in het algemeen??";
vvimDebug() << " 2. kunnen we de distance_matrices wel berekenen als er GEEN ophaalpunten zijn??";
// 1. check if we need to recalculate the distance matrices
if(!matrices_up_to_date)
{
// first fill in the distance matrices, then go to build the transportation list
after_calculating_distance_matrix_continue_to_tsp = false;
after_calculating_distance_matrix_continue_to_transportationlist = false;
after_calculating_distance_matrix_continue_to_setTotalDistanceAndTotalTime = true;
m_distanceMatrix.getDistances(m_markers);
vvimDebug() << "reset MainForm: total # kilometers and # time is unknown unless distancematrices are updated";
resetTotalDistanceAndTotalTime();
}
else
{
transportationlistWriter.prepare(m_markers, distance_matrix_in_meters, distance_matrix_in_seconds, ui->webView);
int total_distance_in_meters, total_time_on_the_road_in_seconds;
total_distance_in_meters = transportationlistWriter.getTotalMetersOfRoute();
total_time_on_the_road_in_seconds = transportationlistWriter.getTotalSecondsOfRoute();
vvimDebug() << "matrices are up to date" << matrices_up_to_date << "=> set total # kilometers and # time";
vvimDebug() << total_time_on_the_road_in_seconds << " seconds is " << seconds_human_readable(total_time_on_the_road_in_seconds);
ui->totalTimeEdit->setText(tr("%1").arg(seconds_human_readable(total_time_on_the_road_in_seconds)));
double kilometers = (double) total_distance_in_meters / 1000;
vvimDebug() << total_distance_in_meters << " meters is " << kilometers;
ui->totalKilometersEdit->setText(tr("%1 km").arg(kilometers));
}
}
void Form::on_pbTransportationList_clicked()
{
transportationlistWriter.setOverwrite(false);
if(transportationlistWriter.getCurrentlyEditedRoute() != QDate())
{
// -> we are editing an existing route
//QMessageBox: wilt u vorige versie overschrijven met deze nieuwe route?
vvimDebug() << "TESTING: we are overwriting an existing route!!!" << transportationlistWriter.getCurrentlyEditedRoute().toString();
vvimDebug() << "[[issue 42]]: https://github.com/vvim/routetool/issues/42 -> at what point should we reset transportationlistWriter.getCurrentlyEditedRoute() ?";
/// QMessagebox "overwrite transportationlist in database, or save as new route?
/**
WIS VORIGE datum uit de databank (gebruik functie RemoveTransportationList
EN SLA de nieuwe datum op
**/
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Oude route overschrijven?"));
msgBox.setText(tr("Wilt u de oude route van %1 overschrijven?").arg(QLocale().toString(transportationlistWriter.getCurrentlyEditedRoute())));
QAbstractButton *myYesButton = msgBox.addButton(tr("Oude route overschrijven"), QMessageBox::YesRole);
QAbstractButton *myNoButton = msgBox.addButton(tr("Deze route opslaan als een andere route"), QMessageBox::NoRole);
QAbstractButton *myCancelButton = msgBox.addButton(tr("Annuleren"), QMessageBox::RejectRole);
msgBox.setIcon(QMessageBox::Question);
msgBox.exec();
if(msgBox.clickedButton() == myCancelButton)
{
// works also when the user presses ESC or simply closes the QMessageBox
vvimDebug() << "user pressed CANCEL or ESC";
return;
}
if(msgBox.clickedButton() == myYesButton)
{
vvimDebug() << "user pressed YES: " << "REMOVE the old route before continuing";
vvimDebug() << "[TODO] REMOVE from database, confirm again!";
// TODO REMOVE from database
QMessageBox msgBoxToConfirm;
msgBoxToConfirm.setWindowTitle(tr("Weet u het zeker?"));
msgBoxToConfirm.setText(tr("De oude informatie van de route van %1 zal gewist worden en overschreven met de route die u nu heeft ingegeven.\n\nU kan de oude route dan niet meer oproepen. Weet u dit zeker?").arg(QLocale().toString(transportationlistWriter.getCurrentlyEditedRoute())));
/* QAbstractButton *confirmYesButton = */ msgBoxToConfirm.addButton(tr("Oude route wissen en overschrijven"), QMessageBox::YesRole);
QAbstractButton *confirmCancelButton = msgBoxToConfirm.addButton(tr("Annuleren"), QMessageBox::RejectRole);
msgBoxToConfirm.setIcon(QMessageBox::Warning);
msgBoxToConfirm.exec();
if(msgBoxToConfirm.clickedButton() == confirmCancelButton)
{
// works also when the user presses ESC or simply closes the QMessageBox
vvimDebug() << "user did not confirm but pressed CANCEL or ESC";
return;
}
// nu kunnen we de datum in de dialogbox setten als de datum die voorgesteld wordt. Bij 'overschrijven' kan de dialogbox meteen met de juiste datum ingevuld worden
vvimDebug() << "[TODO] remove from database everything from the old route";
transportationlistWriter.setOverwrite(true);
}
if(msgBox.clickedButton() == myNoButton)
{
vvimDebug() << "user pressed NO: " << "do NOT overwrite the current route, SAVE AS NEW ROUTE";
transportationlistWriter.setOverwrite(false);
// nothing special to do
}
}
else
vvimDebug() << "Flag transportationlistWriter.getCurrentlyEditedRoute() is not set, so this is a new route -> save as a new route";
vvimDebug() << "This is where we should work on making the Transportation List (using distance matrices and Document Writer)";
// for the map: see http://qt-project.org/doc/qt-4.8/desktop-screenshot.html
// see http://stackoverflow.com/questions/681148/how-to-print-a-qt-dialog-or-window
vvimDebug() << "Boolean set 'when transportation list is built, we have to remove all markers and open old route?'" << transportationlistWriter.checkIfWeShouldRemoveAllMarkersAndOpenRouteAfterBuildingTransportationList();
// 1. prepare the Maps for a screenshot
drawRoute();
// drawRoute() also calls `reorderMarkers()` so that is taken care of: "make sure Drag and Drop changes are in place"
// 2. check if we need to recalculate the distance matrices
if(!matrices_up_to_date)
{
// first fill in the distance matrices, then go to build the transportation list
after_calculating_distance_matrix_continue_to_tsp = false;
after_calculating_distance_matrix_continue_to_transportationlist = true;
after_calculating_distance_matrix_continue_to_setTotalDistanceAndTotalTime = false;
m_distanceMatrix.getDistances(m_markers);
}
else
buildTransportationList();
}
void Form::buildTransportationList()
{
// 3. distance matrices should be filled in correctly
transportationlistWriter.prepare(m_markers, distance_matrix_in_meters, distance_matrix_in_seconds, ui->webView);
setTotalDistanceAndTotalTime();
transportationlistWriter.show();
return;
}
void Form::logOutputLwMarkers()
{
vvimDebug() << "\n\nSTART lwMarkers";
// function used for debugging
vvimDebug() << "Debug information: output lwmarkers. Count: " << ui->lwMarkers->count();
vvimDebug() << "Current row:" << ui->lwMarkers->currentRow();
for(int i = 0; i < ui->lwMarkers->count(); i++)
{
vvimDebug() << "Row" << i << ":" << ui->lwMarkers->item(i)->text();
}
vvimDebug() << "STOP\n\n";
}
void Form::reloadCompleter()
{
vvimDebug() << "database has been changed, so we should reload the Completer";
/** version from database **/
QStringList words; // "don't come easy, to me, la la la laaa la la"
vvimDebug() << "1. made QStringList words";
#ifndef QT_NO_CURSOR
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
#endif
vvimDebug() << "2. setOverrideCursor";
QString SQLquery = "SELECT naam, straat, nr, bus, postcode, plaats, land FROM ophaalpunten WHERE kurk > 0 OR parafine > 0";
QSqlQuery query(SQLquery);
vvimDebug() << "3. SELECT query ready";
if(!query.exec())
{
if(!reConnectToDatabase(query.lastError(), SQLquery, QString("[%1]").arg(Q_FUNC_INFO)))
{
vvimDebug() << "unable to reconnect to DB, halting";
QMessageBox::information(this, tr("Fout bij verbinding met de databank ").arg(Q_FUNC_INFO), tr("De databank kon niet geraadpleegd worden, probeer opnieuw. Als deze fout zich blijft voordoen, stuur het logbestand naar Wim of neem contact op met de systeembeheerder."));
exit(-1);
}
query = QSqlQuery(SQLquery);
if(!query.exec())
{
vvimDebug() << "query failed after reconnecting to DB, halting" << SQLquery;
QMessageBox::information(this, tr("Fout bij verbinding met heruitvoeren query ").arg(Q_FUNC_INFO), tr("De query kon niet uitgevoerd worden na reconnectie met databank, probeer opnieuw. Als deze fout zich blijft voordoen, stuur het logbestand naar Wim of neem contact op met de systeembeheerder."));
exit(-1);
}
}
vvimDebug() << "4. no SQL query";
while (query.next()) {
QString naam = query.value(0).toString();
QString straat = query.value(1).toString();
QString nr = query.value(2).toString();
QString bus = query.value(3).toString();
QString postcode = query.value(4).toString();
QString plaats = query.value(5).toString();
QString land = query.value(6).toString();
words << naam.append(", %1 %2, %3 %4, %5").arg(straat).arg(nr).arg(postcode).arg(plaats).arg(land);
}
vvimDebug() << "5. TOTAL of ophaalpunten loaded in completer : " << words.length();
vvimDebug() << "6. IF completer -> delete it, thank you" << completer;
vvimDebug() << "6. IF completer -> delete it, thank you - value:" << completer;
vvimDebug() << "!!! check in all classes if completer is set to NULL in constructor, thank you";
if(completer)
{
vvimDebug() << "7. - completer TRUE => delete completer";
delete completer;
}
else
vvimDebug() << "7. - completer FALSE, no need to delete it";
completer = new MyCompleter(words, this);
vvimDebug() << "8. new completer 'words'";
completer->setCaseSensitivity(Qt::CaseInsensitive);
vvimDebug() << "9. Case insensitive";
ui->lePostalAddress->setCompleter(completer);
vvimDebug() << "10. lePostalAddress";
#ifndef QT_NO_CURSOR
QApplication::restoreOverrideCursor();
#endif
vvimDebug() << "done, completer (re)loaded.";
}
void Form::on_showOphaalpunten_clicked()
{
#ifndef QT_NO_CURSOR
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
#endif
vvimDebug() << "toon bekende ophaalpunten!" << "inspiration: https://developers.google.com/maps/documentation/javascript/examples/marker-simple" << "and" << "https://developers.google.com/maps/documentation/javascript/markers";
vvimDebug() << "** [A] ** update the ophaalpunten without lat/lng - Google Maps API doesn't allow more than 15 queries in one go, maximum = 15";
QSqlQuery query_no_lat_lng("SELECT * FROM ophaalpunten WHERE lat is NULL or lng is NULL LIMIT 15");
if(query_no_lat_lng.exec())
vvimDebug() << "query runs";
else
vvimDebug() << "query error:" << query_no_lat_lng.lastError();
QList<SOphaalpunt> * listOfOphaalpunten = new QList<SOphaalpunt>();
vvimDebug() << "QList aangemaakt";
while(query_no_lat_lng.next())
{
vvimDebug() << "inside resultlist of ophaalpunten without lat/lng";
vvimDebug() << "name of ophaalpunt:" << query_no_lat_lng.value(2).toString();
SOphaalpunt _ophaalpunt(
query_no_lat_lng.value(2).toString(), //_naam
query_no_lat_lng.value(7).toString(), //_street
query_no_lat_lng.value(8).toString(), //_housenr
query_no_lat_lng.value(9).toString(), //_busnr
query_no_lat_lng.value(10).toString(), //_postalcode
query_no_lat_lng.value(11).toString(), //_plaats
query_no_lat_lng.value(12).toString(), //_country
0, //_kg_kurk
0, //_kg_kaarsresten
0, //_zakken_kurk
0, //_zakken_kaarsresten
-1, //_aanmelding_id
query_no_lat_lng.value(0).toInt(), //_ophaalpunt_id
query_no_lat_lng.value(23).toString() //_opmerkingen
);
listOfOphaalpunten->append(_ophaalpunt);
_ophaalpunt.PrintInformation();
}
m_geocodeDataManager.lookForCoordinatesToPutInDatabase(listOfOphaalpunten);
vvimDebug() << "** [A] ** done";
/**
de al getoonde markers staan in QList <SMarker*> m_markers;
eerst een lijst maken van de bestaande markers? Die maken automatisch deel uit van de route, en mogen dus
genegeerd worden
**/
vvimDebug() << "** [B] ** lijst maken van bestaande markers om 'doubles' te voorkomen";
QSet<int> *ophaalpunten_in_route = getOphaalpuntIdFromRoute();
vvimDebug() << "aantal ophaalpunten in de huidige route:" << ophaalpunten_in_route->size();