#include "platform.h" Platform::Platform(QObject *parent, uint32_t ID, QString Name, double initlon, double initlat, double inith, double vx, double vy, double vz, double ax,double ay, double az) : QObject(parent) { this->ID = ID; this->Name = Name; lon = initlon; lat = initlat; h = inith; x = new double(); y = new double(); z = new double(); blh2xyz(initlat,initlon,inith,x,y,z); this->vx = vx; this->vy = vy; this->vz = vz; this->ax = ax; this->ay = ay; this->az = az; TimerUpdatePos = startTimer(1000); } void Platform::UpdateAcc(double ax, double ay, double az) { this->ax = ax; this->ay = ay; this->az = az; } void Platform::UpdateVel(double vx, double vy, double vz) { this->vx = vx; this->vy = vy; this->vz = vz; } void Platform::timerEvent(QTimerEvent *event) { if (event->timerId() == TimerUpdatePos) { vx = vx + ax; vy = vy + ay; vz = vz + az; double vel = vx*vx + vy*vy +vz*vz; if (vel > 1e-5) { *x = *x + vx; *y = *y + vy; *z = *z + vz; double pos[3] = {*x,*y,*z}; XYZ2ELL(pos,&lat,&lon,&h); qDebug() << this->Name << QString::fromLocal8Bit("位置更新"); } } }