mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
In order to better identify the models, the model members have been prefixed with "model"
65 lines
1.8 KiB
C++
65 lines
1.8 KiB
C++
#include "mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
#include "blackgui/atcstationlistmodel.h"
|
|
#include "blackcore/dbus_server.h"
|
|
#include "blackcore/context_network.h"
|
|
|
|
using namespace BlackCore;
|
|
using namespace BlackMisc;
|
|
using namespace BlackGui;
|
|
using namespace BlackMisc::Network;
|
|
using namespace BlackMisc::Aviation;
|
|
using namespace BlackMisc::PhysicalQuantities;
|
|
using namespace BlackMisc::Geo;
|
|
using namespace BlackMisc::Settings;
|
|
using namespace BlackMisc::Voice;
|
|
|
|
/*
|
|
* Read aircrafts
|
|
*/
|
|
void MainWindow::reloadAircraftsInRange()
|
|
{
|
|
if (!this->isContextNetworkAvailableCheck()) return;
|
|
this->m_modelAircraftsInRange->update(this->m_contextNetwork->getAircraftsInRange());
|
|
this->ui->tv_AircraftsInRange->resizeColumnsToContents();
|
|
this->ui->tv_AircraftsInRange->resizeRowsToContents();
|
|
}
|
|
|
|
/*
|
|
* Read own aircraft
|
|
*/
|
|
bool MainWindow::reloadOwnAircraft()
|
|
{
|
|
if (!this->isContextNetworkAvailableCheck()) return false;
|
|
if (this->isCockpitUpdatePending()) return false;
|
|
|
|
// check for changed aircraft
|
|
bool changed = false;
|
|
CAircraft loadedAircraft = this->m_contextNetwork->getOwnAircraft();
|
|
if (loadedAircraft != this->m_ownAircraft)
|
|
{
|
|
this->m_ownAircraft = loadedAircraft;
|
|
this->updateCockpitFromContext();
|
|
changed = true;
|
|
}
|
|
return changed;
|
|
}
|
|
|
|
/*
|
|
* Position
|
|
*/
|
|
void MainWindow::setTestPosition(const QString &wgsLatitude, const QString &wgsLongitude, const CAltitude &altitude)
|
|
{
|
|
CCoordinateGeodetic coordinate(
|
|
CLatitude::fromWgs84(wgsLatitude),
|
|
CLongitude::fromWgs84(wgsLongitude),
|
|
CLength(0, CLengthUnit::m()));
|
|
|
|
this->m_ownAircraft.setPosition(coordinate);
|
|
this->m_ownAircraft.setAltitude(altitude);
|
|
this->m_contextNetwork->updateOwnPosition(
|
|
coordinate,
|
|
altitude
|
|
);
|
|
}
|