#ifndef SHOWPLANE3D_H
#define SHOWPLANE3D_H

#include <QObject>
#include <QVector>
#include <QTimer>
#include "scenecontrol.h"
#include "Engine/UGRecordset.h"
using namespace UGC;

class ShowPlane3D : public QObject
{
    Q_OBJECT
public:
    explicit ShowPlane3D(QObject *parent = nullptr);
    ShowPlane3D(SceneControl* m_pSceneControl,UGDatasetVector* dv);

    //显示飞机模型
    void displayPlane(QVector<double> lon,QVector<double> lat,QVector<double> height);
    //设置显示的飞机数量
    void setPlanesCount(int n);

    void startFly();  //开始飞行
    void stopFly();  //停止飞行
    void setRefreshTime(int ms); //设置刷新间隔

signals:

private slots:

private:
    SceneControl* m_pSceneControl;
    UGDatasetVector* dv;
    UGRecordsetPtr res;
    QTimer m_timer;
    int n_planes;
    UGLayer3D* planeLayer;

    QVector<double> lons;
    QVector<double> lats;
    QVector<double> heights;

    void movePlane(QVector<double> lon, QVector<double> lat, QVector<double> height);

    void deletePlane();

    void addPlane();
};

#endif // SHOWPLANE3D_H