Route save dialog development. Added: gps,icon...
[speedfreak] / Client / routedialog.cpp
1 /*
2  * RouteDialog class
3  *
4  * @author     Olavi Pulkkinen <olavi.pulkkinen@fudeco.com>
5  * @copyright  (c) 2010 Speed Freak team
6  * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
7  */
8
9 #include "routedialog.h"
10 #include "ui_routedialog.h"
11 #include <cmath>
12 #include <QPainter>
13 #include <QList>
14 #include <QMessageBox>
15 #include <QFile>
16 #include <QFileDialog>
17 #include <QPolygon>
18
19 /*
20   * Vector class.
21   * In starting Qt 4.6 there is QVector3D.
22   * Later (updating Qt version) this class can be removed.
23   */
24 class Vector
25 {
26     qreal x, y, z;      // Location
27     qreal v;            // Velocity
28 public:
29     Vector() { x=0.; y=0. ; z=0.; };
30     Vector( qreal initX, qreal initY, qreal initZ) { x = initX, y = initY; z = initZ; };
31     void setX( qreal newX) { x = newX; };
32     void setY( qreal newY) { y = newY; };
33     void setZ( qreal newZ) { z = newZ; };
34     void setV( qreal newV) { v = newV; };
35     qreal getX() { return x; };
36     qreal getY() { return y; };
37     qreal getZ() { return z; };
38     qreal getV() { return v; };
39     qreal length() { return sqrt(x*x+y*y+z*z); };
40     Vector operator+(Vector v)
41     {
42         x = x + v.x; y = y + v.y; z = z + v.z;
43         return *this;
44     };
45     Vector operator-(Vector v)
46     {
47         x = x - v.x; y = y - v.y; z = z - v.z;
48         return *this;
49     };
50     Vector operator/(qreal c)
51     {
52         x = x/c; y = y/c; z = z/c;
53         return *this;
54     };
55     Vector crossProduct( Vector a, Vector b)
56     {
57         x = a.y*b.z - a.z*b.y;
58         y = a.z*b.x - a.x*b.z;
59         z = a.x*b.y - a.y*b.x;
60         return *this;
61     };
62 };
63
64
65 class Viewing
66 {
67     Vector atPoint, fromPoint, up, a1, a2, a3;
68     qreal offsx, offsy, offsz;
69     qreal dval;
70     qreal angle;
71 public:
72     qreal getOffsx() { return offsx; };
73     qreal getOffsy() { return offsy; };
74     qreal getOffsz() { return offsz; };
75     qreal getDval() { return dval; };
76     void setAngle( qreal newA) { angle = newA; };
77     void setUp( qreal newUpX, qreal newUpY, qreal newUpZ)
78     {
79         up.setX(newUpX); up.setY(newUpY); up.setZ(newUpZ);
80     };
81     void setAtPoint( qreal newX, qreal newY, qreal newZ)
82     {
83         atPoint.setX(newX); atPoint.setY(newY); atPoint.setZ(newZ);
84     };
85     void setFromPoint(qreal newX, qreal newY, qreal newZ)
86     {
87         fromPoint.setX(newX); fromPoint.setY(newY); fromPoint.setZ(newZ);
88     }
89     void setEye()
90     {
91         double amarkmag, tempmag;
92         Vector temp, dist;
93
94         dval = cos(angle/2.0)/sin(angle/2.0);
95         dist = atPoint-fromPoint;
96         amarkmag = dist.length();
97         a3 = dist/amarkmag;
98
99         temp.crossProduct( dist, up);
100         tempmag = temp.length();
101         a1 = temp/tempmag;
102
103         temp.crossProduct( a1, a3);
104         tempmag = temp.length();
105         a2 = temp/tempmag;
106
107         offsx = -a1.getX()*fromPoint.getX() - a1.getY()*fromPoint.getY() - a1.getZ()*fromPoint.getZ();
108         offsy = -a2.getX()*fromPoint.getX() - a2.getY()*fromPoint.getY() - a2.getZ()*fromPoint.getZ();
109         offsz = -a3.getX()*fromPoint.getX() - a3.getY()*fromPoint.getY() - a3.getZ()*fromPoint.getZ();
110         //QString jono2 = QString("offsx %1 offsy %2 offsz %3").arg(offsx).arg(offsy).arg(offsz);
111         //QMessageBox::about(0,"offs x y z", jono2);
112     } ;
113     Vector getAtPoint() { return atPoint; };
114     Vector getFromPoint() { return fromPoint; };
115     Vector getA1() { return a1; };
116     Vector getA2() { return a2; };
117     Vector getA3() { return a3; };
118     Viewing () {};
119 };
120
121 qreal xmax, xmin, ymin, ymax;       // Limits in world coordinates
122
123 QList<Vector> vertexList;           // Vertecies of route
124
125 qreal objxmin, objxmax, objymin, objymax, objzmin, objzmax; // data ranges
126
127 #define maxof(val1,val2)  ((val1>val2)?val1:val2)
128 #define toradians( degrees) (degrees*0.017453293)
129
130 #define WIDTH 1.8   // For 3d viewing only
131 qreal a, b,c,d; // Used for 3d viewing to calculate screen coordinates
132
133 Viewing view3d;   // Viewing settings for 3d
134
135 // Function prototypes
136 void dataMinMax( void);
137 void setAtPoint( Viewing *v);
138 void setFromPoint( Viewing *v);
139 void transformseg( Viewing *v, Vector *v1, Vector *v2, int *xscreen1, int *yscreen1, int *xscreen2, int *yscreen2 );
140
141 #define R 6378.140 // The radius of the earth by kilometers
142 /*
143   * count distance of two points (defined by longitude & latitude)
144   * on the surface of the earth.
145   */
146 qreal countDistance(Vector *p1, Vector *p2)
147 {
148     qreal dLon, dLat;   // delta of longitude & latitude
149     qreal a, c;
150
151     dLon = p2->getX() - p1->getX();     // longitude difference
152     dLat = p2->getY() - p1->getY();     // latitude difference
153     if (dLon <0) dLon = -dLon;
154     if (dLat <0) dLat = -dLat;
155
156     dLon = dLon*3.14/180;
157     dLat = dLat*3.14/180;
158     a = (sin(dLat/2.))*(sin(dLat/2.)) +
159         (cos(p1->getY())*3.14/180)*(cos(p2->getY())*3.14/180)*(sin(dLon/2.))*(sin(dLon/2.));
160     c = 2.*atan(sqrt(a)/sqrt(1-a));     // c is angle between points p1 & p2 with circel by radius 1.
161
162     return R*c;   // Return distance in kilometers
163 }
164
165 RouteDialog::RouteDialog(QWidget *parent) :
166     QDialog(parent),
167     ui(new Ui::RouteDialog)
168 {
169     ui->setupUi(this);
170     this->setWindowTitle("Route");
171     left = 5; top = 5; right = 495; bottom = 295; // Limits in screen coordinates
172 }
173
174 RouteDialog::~RouteDialog()
175 {
176     delete ui;
177 }
178
179 void RouteDialog::changeEvent(QEvent *e)
180 {
181     QDialog::changeEvent(e);
182     switch (e->type()) {
183     case QEvent::LanguageChange:
184         ui->retranslateUi(this);
185         break;
186     default:
187         break;
188     }
189 }
190 int RouteDialog::getLeft()
191 {
192     return left;
193 }
194 int RouteDialog::getRight()
195 {
196     return right;
197 }
198 int RouteDialog::getTop()
199 {
200     return top;
201 }
202 int RouteDialog::getBottom()
203 {
204     return bottom;
205 }
206
207 void drawFlag( RouteDialog *rD, QPainter *p, int x, int y)
208 {
209     /*QPolygon pg;
210
211     pg.setPoint(0,x, y-25);
212     pg.setPoint(1,x+10,y-20);
213     pg.setPoint(2,x, y-15);
214     pg.setPoint(3,x,y-20);*/
215     if (y> (rD->getTop() + 25))
216     {
217         // Upside
218         p->drawLine(x,y,x,y-15);
219         if (x <= (rD->getRight()-20))
220         {
221             // flag right
222             p->drawLine( x,    y-25, x+10, y-20);
223             p->drawLine( x+10, y-20, x,    y-15);
224             p->drawLine( x,    y-15, x,    y-25);
225         }
226         else
227         {
228             // Flag left
229             p->drawLine( x,    y-25, x-10, y-20);
230             p->drawLine( x-10, y-20, x,    y-15);
231             p->drawLine( x,    y-15, x,    y-25);
232         }
233
234     }
235     else if (y <= (rD->getTop() + 25))
236     {
237         // downside
238         p->drawLine(x,y,x,y+15);
239         if (x <= (rD->getRight()-20))
240         {
241             // flag right
242             p->drawLine( x,    y+25, x+10, y+20);
243             p->drawLine( x+10, y+20, x,    y+15);
244             p->drawLine( x,    y+15, x,    y+25);
245         }
246         else
247         {
248             // Flag left
249             p->drawLine( x,    y+25, x-10, y+20);
250             p->drawLine( x-10, y+20, x,    y+15);
251             p->drawLine( x,    y+15, x,    y+25);
252         }
253     }
254     //p->drawPolygon();
255    // p->drawPolygon( pg,Qt::OddEvenFill);
256     //p->drawPolyline( &pg);
257     //p->drawPoints( pg);
258 }
259
260 /**
261   * Draws route to the route dialog.
262   * Type 0 is 2d viewing and type 1 is for 3d viewing
263   * @param QPaintEvent
264  */
265 /* */
266 void RouteDialog::paintEvent(QPaintEvent *)
267 {
268     int type = 0; //  0 for 2d, 1 for 3d
269     int startx, starty; // Starting point of the route
270     int i, maxi;
271     qreal x1, y1, x2, y2;
272     int x1Screen, y1Screen, x2Screen, y2Screen;
273     Vector v1, v2;
274     QPainter painter(this);
275
276     painter.setRenderHint(QPainter::Antialiasing, true);
277     painter.setPen(QPen((Qt::white),2));
278     painter.setBrush(QBrush((Qt::yellow), Qt::SolidPattern));
279
280     // Draw route window frame
281     /*painter.drawLine(left,top,right,top);
282     painter.drawLine(right,top,right,bottom);
283     painter.drawLine(left,top,left,bottom);
284     painter.drawLine(left,bottom,right,bottom);*/
285
286     maxi = vertexList.size();
287
288     for (i=0; i<maxi-1; i++)
289     {
290        v1 = vertexList.at(i);
291        v2 = vertexList.at(i+1);
292
293        if (type == 0)
294        {    // 2d
295             x1 = v1.getX(); y1 = v1.getY();
296             x2 = v2.getX(); y2 = v2.getY();
297             //QString jono = QString("x: %1 y: %2").arg(x1).arg(y1);
298             //QMessageBox::about(0,"Tark",jono);
299
300             x1Screen = left + (x1-xmin)/(xmax-xmin)*(right-left);
301             y1Screen = top + (ymax-y1)/(ymax-ymin)*(bottom-top);
302             x2Screen = left + (x2-xmin)/(xmax-xmin)*(right-left);
303             y2Screen = top + (ymax-y2)/(ymax-ymin)*(bottom-top);
304         }
305         else if (type == 1)
306         {   // 3d
307             transformseg( &view3d, &v1,&v2, &x1Screen, &y1Screen, &x2Screen, &y2Screen);
308         }
309
310         // Show with circle if starting point
311         if (i==0)
312         {
313             // Starting point
314             startx = x1Screen; starty = y1Screen;
315            // painter.drawEllipse( x1Screen-5, y1Screen-5, 10, 10);
316            drawFlag( this, &painter,  x1Screen ,  y1Screen);
317         }
318         painter.drawLine( x1Screen, y1Screen, x2Screen, y2Screen);
319     }
320     // Show the endig point if different than the starting point
321     if (x2Screen != startx || y2Screen != starty)
322     {
323         //painter.drawEllipse( x2Screen-5, y2Screen-5, 10, 10);
324         drawFlag( this, &painter,x2Screen, y2Screen );
325     }
326
327     {
328         qreal maxvx, maxvy; // max speed point coordinates
329         qreal maxv;         // max speed
330         Vector v;
331
332         maxv = 0.0;
333         for (i=0; i<maxi-1; i++)
334         {
335             v = vertexList.at(i);
336             if (v.getV() > maxv)
337             {
338                 maxv = v.getV();
339                 maxvx = v.getX();
340                 maxvy = v.getY();
341             }
342         }
343         // Translate world coordinates to screen coordinates
344         x1Screen = left + (maxvx-xmin)/(xmax-xmin)*(right-left);
345         y1Screen = top + (ymax-maxvy)/(ymax-ymin)*(bottom-top);
346
347         // Show max velocity point by yellow circle
348         painter.drawEllipse( x1Screen-5, y1Screen-5, 10, 10);
349
350         QString jono;
351         jono = QString("%1 m/s").arg(maxv);
352         ui->speedValueLabel->setText(jono);
353     }
354 }
355
356 bool RouteDialog::readRouteFromFile( QString &routeFile)
357  {
358     Vector temp;
359     QString rivi;
360     QFile file;
361
362     QString fileName = QFileDialog::getOpenFileName(this,
363          tr("Read Route"), "./", tr("Route Files (*.txt)"));
364
365     file.setFileName( fileName);
366     if (!file.open(QIODevice::ReadOnly))
367     {
368         QMessageBox::about(0, "Error", "File not found");
369         return false;
370     }
371
372     vertexList.clear();
373     while(!file.atEnd())
374     {
375         QString str1, str2, str3, str4;
376         rivi = file.readLine();
377
378         str1 = rivi.section(" ", 0, 0);
379         if (str1.compare("Start:") != 0 && str1.compare("Stop:") != 0)
380         {
381             str1 = rivi.section(" ", 2, 2); // latitude y-value
382             str2 = rivi.section(" ", 4, 4); // longitude x-value
383             str3 = rivi.section(" ", 6, 6); // altitude z-value
384             str4 = rivi.section(" ", 8, 8); // speed m/s
385             //QString str = QString("la: %1 lo: %2 al: %3").arg(str1).arg(str2).arg(str3);
386             //QMessageBox::about(0, "LUKEE", str);
387
388             if (str1.length() > 0)
389             {
390                 double x, y, z, v;
391                 x = str2.toDouble();
392                 y = str1.toDouble();
393                 z = str3.toDouble();
394                 v = str4.toDouble();
395                 temp.setX( x); // Longitude
396                 temp.setY( y); // Latitude
397                 temp.setZ( z); // altitude
398                 temp.setV( v);
399
400                 vertexList.append(temp);
401             }
402         }
403     }
404
405     file.close();
406
407      /********  in 3d use only */
408      a = 400/2.;
409      b = 1 - a*(-1);
410      c = -300/2.;
411      d = 300 - c*(-1);
412      //angle = toradians(60);
413
414      view3d.setUp( 1.0, 0.0, 0.0);
415      view3d.setAngle(toradians(60));
416      setAtPoint( &view3d);
417      xmin = objxmin; xmax = objxmax; ymin = objymin; ymax = objymax; // 2d viewing needs this !!!!
418      setFromPoint( &view3d);
419      view3d.setEye();
420      /****** end of 3d *****/
421
422      /*
423      //Testing distance counting
424      Vector a1, a2;
425      qreal dist;
426      //a1.setX( xmin); a1.setY( ymin);
427      //a2.setX( xmax); a2.setY( ymax);
428      a1.setX( 25.483); a1.setY( 65.017); // Oulu
429      a2.setX( 27.767); a2.setY( 64.283); // Kajaani
430      dist = countDistance( &a1, &a2);
431      QString str = QString("Min & Max datan välimatka %1").arg(dist);
432      QMessageBox::about( 0, "Testi", str);
433      */
434
435      return true;
436  }
437
438 /*
439   * Find out data range for x-, y- and z-coordinates
440   */
441 void dataMinMax( void)
442 {
443     int i, maxi;
444     qreal x,y,z;
445     Vector temp;
446
447     temp = vertexList.at(0);
448     objxmax = objxmin = temp.getX();
449     objymax = objymin = temp.getY();
450     objzmax = objzmin = temp.getZ();
451
452     maxi = vertexList.size();
453     for (i=1; i<maxi; i++)
454     {
455         temp = vertexList.at(i);
456         x = temp.getX();
457         y = temp.getY();
458         z = temp.getZ();
459
460         if (x < objxmin)
461         {
462                 objxmin = x;
463         }
464         else if (x > objxmax)
465         {
466                objxmax = x;
467         }
468
469         if (y < objymin)
470         {
471                 objymin = y;
472         }
473         else if (y > objymax)
474         {
475                objymax = y;
476         }
477
478         if (z < objzmin)
479         {
480                 objzmin = z;
481         }
482         else if (z > objzmax)
483         {
484                objzmax = z;
485         }
486     }
487     //QString jono = QString("ojxmin %1 objxmax %2").arg(objxmin).arg(objxmax);
488     //QString jono = QString("ojymin %1 objymax %2").arg(objymin).arg(objymax);
489     //QString jono = QString("ojzmin %1 objzmax %2").arg(objzmin).arg(objzmax);
490     //QMessageBox::about(0,"Tark", jono);
491 }
492
493 /*
494   * Setting the point where the viewed object is. In the middle of datapoints.
495   */
496 void setAtPoint( Viewing *v)
497 {
498     qreal x, y, z;
499     dataMinMax();
500     //Vector test;
501
502     x = (objxmax+objxmin)/2.0;
503     y= (objymax+objymin)/2.0;
504     z= (objzmax+objzmin)/2.0;
505
506     v->setAtPoint( x, y, z);
507     //QString jono = QString("AtX %1 Aty %2 AtZ %3").arg(atPoint.x()).arg(atPoint.y()).arg(atPoint.z());
508     //QString jono = QString("AtX %1 Aty %2 AtZ %3").arg(atPoint.x).arg(atPoint.y).arg(atPoint.z);
509
510     /* *
511     test = v->getAtPoint();
512     QString jono = QString("AtX %1 Aty %2 AtZ %3").arg(test.getX()).arg(test.getY()).arg(test.getZ());
513     QMessageBox::about(0,"At point", jono);
514     * */
515 }
516
517 /*
518   * Setting the point where the object is viewed by eye.
519   */
520 void setFromPoint( Viewing *v)
521 {
522     qreal x, y, z;
523     Vector point;
524     point = v->getAtPoint();
525     //Vector test;
526     //fromPoint.setX( atPoint.getX() + (objxmax-objxmin)/2.0 + WIDTH*maxof((objzmax-objzmin)/2.0,(objymax-objymin)/2.0));
527     //x = 3.0;
528     //x = point.getX() + (objxmax-objxmin)/2.0 + WIDTH*maxof((objzmax-objzmin)/2.0,(objymax-objymin)/2.0);
529     x = point.getX();
530     //y = point.getY();
531     y = point.getY() + 40; // + (objymax-objymin)/2.0 + WIDTH*maxof((objzmax-objzmin)/2.0,(objxmax-objxmin)/2.0);
532     z = point.getZ();
533
534     v->setFromPoint(x,y,z);
535     //QString jono = QString("FromX %1 FromY %2 FromZ %3").arg(fromPoint.x()).arg(fromPoint.y()).arg(fromPoint.z());
536     //QString jono = QString("FromX %1 FromY %2 FromZ %3").arg(fromPoint.x).arg(fromPoint.y).arg(fromPoint.z);
537     /* *
538     test = v->getFromPoint();
539     QString jono = QString("FromX %1 FromY %2 FromZ %3").arg(test.getX()).arg(test.getY()).arg(test.getZ());
540     QMessageBox::about(0,"From point", jono); // (1.9, 0.5, 0.5)
541     * */
542 }
543
544
545 #define NOEDGE     0x00
546 #define LEFTEDGE   0x01
547 #define RIGHTEDGE  0x02
548 #define BOTTOMEDGE 0x04
549 #define TOPEDGE    0x08
550 /*
551   * Returns a code specifying which edge in the viewing pyramid was crossed.
552   * There may be more than one.
553   */
554 int code( qreal x, qreal y, qreal z)
555 {
556     int c;
557
558     c = NOEDGE;
559     if (x<-z) c |= LEFTEDGE;
560     if (x>z) c |= RIGHTEDGE;
561     if (y<-z) c |= BOTTOMEDGE;
562     if (y>z) c |= TOPEDGE;
563
564     return c;
565 }
566
567 /*
568   * Converts clipped world coordinates to screen coordinates.
569   */
570 void WORLDtoSCREEN( qreal xWorld, qreal yWorld, int *xScreen, int *yScreen)
571 {
572    *xScreen = (int) (a*xWorld+b);
573    *yScreen = (int) (c*yWorld+d);
574 }
575
576 /*
577   * Clips the line segment in three-dimensional coordinates to the
578   * viewing pyramid.
579   */
580 void clip3d( qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2, int *xscreen1, int *yscreen1, int *xscreen2, int *yscreen2)
581 {
582     int c,c1,c2;
583     qreal x,y,z,t;
584
585     c1 = code(x1,y1,z1);
586     c2 = code(x2,y2,z2);
587
588     while (c1!= NOEDGE || c2 != NOEDGE)
589     {
590         if ((c1 & c2 ) != NOEDGE) return;
591         c = c1;
592         if (c == NOEDGE) c = c2;
593         if ((c&LEFTEDGE) == LEFTEDGE)
594         {
595                 // Crosses left edge
596                 t = (z1+x1)/((x1-x2)-(z2-z1));
597                 z = t*(z2-z1)+z1;
598                 x = -z;
599                 y = t*(y2-y1)+y1;
600         }
601         else if ((c&RIGHTEDGE) == RIGHTEDGE)
602         {
603                 // Crosses right edge
604                 t = (z1-x1)/((x2-x1)-(z2-z1));
605                 z = t*(z2-z1)+z1;
606                 x = z;
607                 y = t*(y2-y1)+y1;
608         }
609         else if ((c&BOTTOMEDGE) == BOTTOMEDGE)
610         {
611                 // Crosses bottom edge
612                 t = (z1+y1)/((y1-y2)-(z2-z1));
613                 z = t*(z2-z1)+z1;
614                 x = t*(x2-x1)+x1;
615                 y = -z;
616         }
617         else if ((c&TOPEDGE) == TOPEDGE)
618         {
619                 // Crosses top edge
620                 t = (z1-y1)/((y2-y1)-(z2-z1));
621                 z = t*(z2-z1)+z1;
622                 x = t*(x2-x1)+x1;
623                 y = z;
624         }
625
626         if (c == c1)
627         {
628             x1=x; y1=y; z1=z;
629             c1 = code(x,y,z);
630         }
631         else
632         {
633             x2=x; y2=y; z2=z;
634             c2 = code(x,y,z);
635         }
636     }
637
638     if (z1 != 0)
639     {
640         WORLDtoSCREEN(x1/z1,y1/z1,xscreen1, yscreen1);
641         WORLDtoSCREEN(x2/z2,y2/z2,xscreen2, yscreen2);
642     }
643     else
644     {
645         WORLDtoSCREEN(x1,y1,xscreen1, yscreen1);
646         WORLDtoSCREEN(x2,y2,xscreen2, yscreen2);
647     }
648     //Now ready to draw line( xscreen1, yscreen1, xscreen2, yscreen2);
649 }
650
651 /*
652   * Transform the segment connecting the two vectors into the viewing plane.
653   * clip3d() clips the line if needed.
654   */
655 void transformseg( Viewing *v, Vector *v1, Vector *v2, int *xscreen1, int *yscreen1, int *xscreen2, int *yscreen2)
656
657 {
658     qreal x1, y1, z1, x2, y2, z2;
659     Vector a1, a2, a3;
660
661     a1 = v->getA1();
662     a2 = v->getA2();
663     a3 = v->getA3();
664
665     x1 = (a1.getX()*v1->getX() + a1.getY()*v1->getY() + a1.getZ()*v1->getZ() + v->getOffsx())*v->getDval();
666     y1 = (a2.getX()*v1->getX() + a2.getY()*v1->getY() + a2.getZ()*v1->getZ() + v->getOffsy())*v->getDval();
667     z1 = a3.getX()*v1->getX() + a3.getY()*v1->getY() + a3.getZ()*v1->getZ() + v->getOffsz();
668
669     x2 = (a1.getX()*v2->getX() + a1.getY()*v2->getY() + a1.getZ()*v2->getZ() + v->getOffsx())*v->getDval();
670     y2 = (a2.getX()*v2->getX() + a2.getY()*v2->getY() + a2.getZ()*v2->getZ() + v->getOffsy())*v->getDval();
671     z2 = a3.getX()*v2->getX() + a3.getY()*v2->getY() + a3.getZ()*v2->getZ() + v->getOffsz();
672
673     clip3d(x1,y1,z1,x2,y2,z2, xscreen1, yscreen1, xscreen2, yscreen2 );
674 }
675
676 void RouteDialog::on_newPushButton_clicked()
677 {
678     close();    // go back to previous dialog
679 }
680
681 void RouteDialog::on_sendPushButton_clicked()
682 {
683     // Send route points file to server
684 }