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