refs #484 Added value class for working with X-Plane nav data, CNavDataReference.

This commit is contained in:
Mathew Sutcliffe
2015-10-19 23:29:13 +01:00
parent c45157078f
commit ca18f98c43
4 changed files with 161 additions and 1 deletions

View File

@@ -0,0 +1,58 @@
/* Copyright (C) 2015
* swift Project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#include "blackmisc/simulation/xplane/navdatareference.h"
namespace BlackMisc
{
namespace Simulation
{
namespace XPlane
{
CNavDataReference::CNavDataReference() = default;
CNavDataReference::CNavDataReference(int id, const Geo::CLatitude &latitude, const Geo::CLongitude &longitude) :
m_id(id),
m_position(latitude, longitude, {})
{}
CNavDataReference::CNavDataReference(int id, float latitudeDegrees, float longitudeDegrees) :
m_id(id),
m_position(latitudeDegrees, longitudeDegrees, 0)
{}
CVariant CNavDataReference::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
return ICoordinateGeodetic::canHandleIndex(index) ?
ICoordinateGeodetic::propertyByIndex(index) :
CValueObject::propertyByIndex(index);
}
void CNavDataReference::setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index)
{
if (index.isMyself()) { (*this) = variant.to<CNavDataReference>(); return; }
CValueObject::setPropertyByIndex(variant, index);
}
QString CNavDataReference::convertToQString(bool i18n) const
{
return QString::number(id()) + ":" + m_position.convertToQString(i18n);
}
CNavDataReferenceList::CNavDataReferenceList() = default;
CNavDataReferenceList::CNavDataReferenceList(const CSequence<CNavDataReference> &other) :
CSequence<CNavDataReference>(other)
{}
}
}
}