mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-08 03:35:35 +08:00
refs #369, adjusted aircraft parts/lights and list to new style
* support of property index * used support classes BlackMisc::ITimestampBased, ITimestampObjectList and ICallsignObjectList * fixed some issues in related aircraft situation class in same step
This commit is contained in:
@@ -20,7 +20,7 @@ namespace BlackMisc
|
||||
s += " gear down: ";
|
||||
s += m_gearDown;
|
||||
s += " flaps pct: ";
|
||||
s += m_flapsPercent;
|
||||
s += m_flapsPercentage;
|
||||
s += " spoilers out: ";
|
||||
s += m_spoilersOut;
|
||||
s += " engines on: ";
|
||||
@@ -29,5 +29,74 @@ namespace BlackMisc
|
||||
s += m_isOnGround;
|
||||
return s;
|
||||
}
|
||||
|
||||
CVariant CAircraftParts::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (ITimestampBased::canHandleIndex(index))
|
||||
{
|
||||
return ITimestampBased::propertyByIndex(index);
|
||||
}
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexCallsign:
|
||||
return m_correspondingCallsign.propertyByIndex(index.copyFrontRemoved());
|
||||
case IndexEngines:
|
||||
return this->m_engines.toCVariant();
|
||||
case IndexFlapsPercentage:
|
||||
return CVariant::fromValue(this->m_flapsPercentage);
|
||||
case IndexGearDown:
|
||||
return CVariant::fromValue(this->m_gearDown);
|
||||
case IndexLights:
|
||||
return this->m_lights.propertyByIndex(index.copyFrontRemoved());
|
||||
case IndexSpoilersOut:
|
||||
return CVariant::fromValue(this->m_spoilersOut);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CAircraftParts::setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index)
|
||||
{
|
||||
if (index.isMyself())
|
||||
{
|
||||
this->convertFromCVariant(variant);
|
||||
return;
|
||||
}
|
||||
if (ITimestampBased::canHandleIndex(index))
|
||||
{
|
||||
ITimestampBased::setPropertyByIndex(variant, index);
|
||||
return;
|
||||
}
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexEngines:
|
||||
this->m_engines.setPropertyByIndex(variant, index.copyFrontRemoved());
|
||||
break;
|
||||
case IndexFlapsPercentage:
|
||||
this->m_flapsPercentage = variant.toInt();
|
||||
break;
|
||||
case IndexGearDown:
|
||||
this->m_gearDown = variant.toBool();
|
||||
break;
|
||||
case IndexLights:
|
||||
this->m_lights.setPropertyByIndex(variant, index.copyFrontRemoved());
|
||||
break;
|
||||
case IndexSpoilersOut:
|
||||
this->m_spoilersOut = variant.toBool();
|
||||
break;
|
||||
case IndexCallsign:
|
||||
this->m_correspondingCallsign.setPropertyByIndex(variant, index.copyFrontRemoved());
|
||||
break;
|
||||
default:
|
||||
CValueObject::setPropertyByIndex(variant, index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user