123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #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("位置更新");
- }
- }
- }
|