mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
Also made some sample functions private
This commit is contained in:
committed by
Mathew Sutcliffe
parent
dc1d5d8586
commit
20921b79b8
@@ -86,99 +86,6 @@ namespace BlackMisc
|
||||
return station;
|
||||
}
|
||||
|
||||
void CTesting::readStations(const CAtcStationList &stations, bool byPropertyIndex)
|
||||
{
|
||||
foreach (const CAtcStation station, stations)
|
||||
{
|
||||
accessStationData(station, byPropertyIndex);
|
||||
}
|
||||
}
|
||||
|
||||
QString CTesting::accessStationData(const CAtcStation &station, bool byPropertyIndex)
|
||||
{
|
||||
QString r;
|
||||
if (byPropertyIndex)
|
||||
{
|
||||
r.append(station.propertyByIndex({ CAtcStation::IndexCallsign, CCallsign::IndexString}).toQString());
|
||||
r.append(station.propertyByIndex({ CAtcStation::IndexController, CUser::IndexRealName}).toQString());
|
||||
r.append(station.propertyByIndex({ CAtcStation::IndexPosition, CCoordinateGeodetic::IndexLatitudeAsString}).toQString());
|
||||
r.append(station.propertyByIndex({ CAtcStation::IndexPosition, CCoordinateGeodetic::IndexLongitudeAsString}).toQString());
|
||||
r.append(station.propertyByIndex({ CAtcStation::IndexRelativeDistance, CLength::IndexValueRounded2DigitsWithUnit}).toQString());
|
||||
r.append(station.propertyByIndex({ CAtcStation::IndexBookedFrom}).toDateTime().toString("yyyy-MM-dd hh:mm"));
|
||||
r.append(station.propertyByIndex({ CAtcStation::IndexBookedUntil}).toDateTime().toString("yyyy-MM-dd hh:mm"));
|
||||
}
|
||||
else
|
||||
{
|
||||
r.append(station.getCallsignAsString());
|
||||
r.append(station.getController().getRealName());
|
||||
r.append(station.getPosition().latitudeAsString());
|
||||
r.append(station.getPosition().longitudeAsString());
|
||||
r.append(station.getRelativeDistance().toQString(true));
|
||||
r.append(station.getBookedFromUtc().toString("yyyy-MM-dd hh:mm"));
|
||||
r.append(station.getBookedUntilUtc().toString("yyyy-MM-dd hh:mm"));
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
void CTesting::calculateDistance(int n)
|
||||
{
|
||||
if (n < 1) return;
|
||||
CAtcStation atc = createStation(1);
|
||||
QList<CCoordinateGeodetic> pos(
|
||||
{
|
||||
CCoordinateGeodetic(10.0, 10.0, 10.0),
|
||||
CCoordinateGeodetic(20.0, 20.0, 20.0),
|
||||
CCoordinateGeodetic(30.0, 30.0, 30.0),
|
||||
CCoordinateGeodetic(40.0, 40.0, 40.0),
|
||||
CCoordinateGeodetic(50.0, 50.0, 50.0),
|
||||
CCoordinateGeodetic(60.0, 60.0, 60.0),
|
||||
CCoordinateGeodetic(70.0, 70.0, 70.0)
|
||||
}
|
||||
);
|
||||
const int s = pos.size();
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
int p = i % s;
|
||||
atc.calculcateAndUpdateRelativeDistance(pos.at(p));
|
||||
}
|
||||
}
|
||||
|
||||
void CTesting::copy10kStations(int times)
|
||||
{
|
||||
CAtcStationList stations;
|
||||
for (int i = 0; i < times; i++)
|
||||
{
|
||||
stations = stations10k();
|
||||
stations.pop_back(); // make sure stations are really copied (copy-on-write)
|
||||
}
|
||||
}
|
||||
|
||||
void CTesting::parseWgs(int times)
|
||||
{
|
||||
static QStringList wgsLatLng(
|
||||
{
|
||||
"12° 11′ 10″ N", "11° 22′ 33″ W",
|
||||
"48° 21′ 13″ N", "11° 47′ 09″ E",
|
||||
" 8° 21′ 13″ N", "11° 47′ 09″ W",
|
||||
"18° 21′ 13″ S", "11° 47′ 09″ E",
|
||||
"09° 12′ 13″ S", "11° 47′ 09″ W"
|
||||
});
|
||||
|
||||
CCoordinateGeodetic c;
|
||||
const CAltitude a(333, CLengthUnit::m());
|
||||
for (int i = 0; i < times; i++)
|
||||
{
|
||||
int idx = (i % 5) * 2;
|
||||
c = CCoordinateGeodetic::fromWgs84(wgsLatLng.at(idx), wgsLatLng.at(idx + 1), a);
|
||||
}
|
||||
}
|
||||
|
||||
const CAtcStationList &CTesting::stations10k()
|
||||
{
|
||||
static const CAtcStationList s = createAtcStations(10000, false);
|
||||
return s;
|
||||
}
|
||||
|
||||
CAircraftCfgEntriesList CTesting::getAircraftCfgEntries(int number)
|
||||
{
|
||||
CAircraftCfgEntriesList list;
|
||||
|
||||
Reference in New Issue
Block a user