File indexing completed on 2024-12-08 09:32:24

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2012 Illya Kovalevskyy <illya.kovalevskyy@gmail.com>
0004 //
0005 
0006 #ifndef VEHICLETRACKING
0007 #define VEHICLETRACKING
0008 
0009 class QTimer;
0010 
0011 #include <marble/GeoDataCoordinates.h>
0012 #include <marble/GeoDataPlacemark.h>
0013 
0014 #include <QWidget>
0015 #include <QObject>
0016 
0017 namespace Marble {
0018 
0019 class MarbleWidget;
0020 
0021 // CarWorker Class
0022 class CarWorker : public QObject
0023 {
0024     Q_OBJECT
0025 public:
0026     CarWorker(const GeoDataCoordinates& city, qreal radius, qreal speed);
0027 
0028 Q_SIGNALS:
0029     void coordinatesChanged(GeoDataCoordinates coord);
0030 
0031 public Q_SLOTS:
0032     void startWork();
0033     void finishWork();
0034 
0035 private Q_SLOTS:
0036     void iterate();
0037 
0038 private:
0039     QTimer *m_timer;
0040     GeoDataCoordinates m_city;
0041     qreal m_radius;
0042     qreal m_speed;
0043     qreal m_alpha;
0044 };
0045 
0046 // Window Class
0047 class Window : public QWidget
0048 {
0049     Q_OBJECT
0050 public:
0051     explicit Window(QWidget *parent = nullptr);
0052     void startCars();
0053 
0054 public Q_SLOTS:
0055     void setCarCoordinates(const GeoDataCoordinates &coord);
0056 
0057 private:
0058     MarbleWidget *m_marbleWidget;
0059     CarWorker *m_firstWorker;
0060     CarWorker *m_secondWorker;
0061     GeoDataPlacemark *m_carFirst;
0062     GeoDataPlacemark *m_carSecond;
0063     QThread *m_threadFirst;
0064     QThread *m_threadSecond;
0065 };
0066 
0067 }
0068 
0069 #endif // VEHICLETRACKING