Ref T129, SVFR/VFR discussion

* utility functions in flight plan class
* adjusted flight plan component and client
This commit is contained in:
Klaus Basan
2017-10-04 21:52:37 +02:00
committed by Mathew Sutcliffe
parent 510666622c
commit 3d541a8dd1
4 changed files with 67 additions and 27 deletions

View File

@@ -120,7 +120,8 @@ namespace BlackMisc
m_equipmentIcao(equipmentIcao), m_originAirportIcao(originAirportIcao), m_destinationAirportIcao(destinationAirportIcao), m_alternateAirportIcao(alternateAirportIcao),
m_takeoffTimePlanned(takeoffTimePlanned), m_takeoffTimeActual(takeoffTimeActual), m_enrouteTime(enrouteTime), m_fuelTime(fuelTime),
m_cruiseAltitude(cruiseAltitude), m_cruiseTrueAirspeed(cruiseTrueAirspeed), m_flightRules(flightRules),
m_route(route.trimmed().left(MaxRouteLength).toUpper()), m_remarks(remarks.trimmed().left(MaxRemarksLength).toUpper())
m_route(route.trimmed().left(MaxRouteLength).toUpper()),
m_remarks(remarks.trimmed().left(MaxRemarksLength).toUpper())
{
m_callsign.setTypeHint(CCallsign::Aircraft);
m_enrouteTime.switchUnit(BlackMisc::PhysicalQuantities::CTimeUnit::hrmin());
@@ -145,6 +146,24 @@ namespace BlackMisc
m_remarks = CFlightPlanRemarks(remarks, true);
}
CFlightPlan::FlightRules CFlightPlan::getFlightRulesAsVFRorIFR() const
{
switch (getFlightRules())
{
case IFR:
return IFR;
case VFR:
case SVFR:
case DVFR:
return VFR;
case UNKNOWN:
default:
break;
}
return UNKNOWN;
}
CVariant CFlightPlan::propertyByIndex(const CPropertyIndex &index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
@@ -205,13 +224,26 @@ namespace BlackMisc
{
switch (rule)
{
case VFR: return QLatin1String("VFR");
case IFR: return QLatin1String("IFR");
case SVFR: return QLatin1String("SVFR");
default: return QLatin1String("???");
case VFR: return QLatin1String("VFR");
case IFR: return QLatin1String("IFR");
case SVFR: return QLatin1String("SVFR");
case DVFR: return QLatin1String("DVFR");
case UNKNOWN:
default: return QLatin1String("???");
}
}
CFlightPlan::FlightRules CFlightPlan::stringToFlightRules(const QString &flightRules)
{
if (flightRules.length() < 3) { return UNKNOWN; }
const QString fr(flightRules.toUpper().trimmed());
if (fr.startsWith("DVFR")) { return DVFR; }
if (fr.startsWith("SVFR")) { return SVFR; }
if (fr.startsWith("VFR")) { return VFR; }
if (fr.startsWith("IFR")) { return IFR; }
return UNKNOWN;
}
CIcon CFlightPlan::toIcon() const
{
return CIcon::iconByIndex(CIcons::StandardIconAppFlightPlan16);