|
|
@ -15,7 +15,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
const char* RallyPoint::_longitudeFactName = "Longitude"; |
|
|
|
const char* RallyPoint::_longitudeFactName = "Longitude"; |
|
|
|
const char* RallyPoint::_latitudeFactName = "Latitude"; |
|
|
|
const char* RallyPoint::_latitudeFactName = "Latitude"; |
|
|
|
const char* RallyPoint::_altitudeFactName = "Altitude"; |
|
|
|
const char* RallyPoint::_altitudeFactName = "Relative Altitude"; |
|
|
|
|
|
|
|
|
|
|
|
QMap<QString, FactMetaData*> RallyPoint::_metaDataMap; |
|
|
|
QMap<QString, FactMetaData*> RallyPoint::_metaDataMap; |
|
|
|
|
|
|
|
|
|
|
@ -63,9 +63,7 @@ RallyPoint::~RallyPoint() |
|
|
|
|
|
|
|
|
|
|
|
void RallyPoint::_factSetup(void) |
|
|
|
void RallyPoint::_factSetup(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (_metaDataMap.isEmpty()) { |
|
|
|
_cacheFactMetadata(); |
|
|
|
_metaDataMap = FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/RallyPoint.FactMetaData.json"), nullptr /* metaDataParent */); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_longitudeFact.setMetaData(_metaDataMap[_longitudeFactName]); |
|
|
|
_longitudeFact.setMetaData(_metaDataMap[_longitudeFactName]); |
|
|
|
_latitudeFact.setMetaData(_metaDataMap[_latitudeFactName]); |
|
|
|
_latitudeFact.setMetaData(_metaDataMap[_latitudeFactName]); |
|
|
@ -80,6 +78,12 @@ void RallyPoint::_factSetup(void) |
|
|
|
connect(&_altitudeFact, &Fact::valueChanged, this, &RallyPoint::_sendCoordinateChanged); |
|
|
|
connect(&_altitudeFact, &Fact::valueChanged, this, &RallyPoint::_sendCoordinateChanged); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RallyPoint::_cacheFactMetadata() { |
|
|
|
|
|
|
|
if (_metaDataMap.isEmpty()) { |
|
|
|
|
|
|
|
_metaDataMap = FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/RallyPoint.FactMetaData.json"), nullptr /* metaDataParent */); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RallyPoint::setCoordinate(const QGeoCoordinate& coordinate) |
|
|
|
void RallyPoint::setCoordinate(const QGeoCoordinate& coordinate) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (coordinate != this->coordinate()) { |
|
|
|
if (coordinate != this->coordinate()) { |
|
|
@ -99,6 +103,15 @@ void RallyPoint::setDirty(bool dirty) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double RallyPoint::getDefaultFactAltitude() { |
|
|
|
|
|
|
|
_cacheFactMetadata(); |
|
|
|
|
|
|
|
auto it = _metaDataMap.find(QString(_altitudeFactName)); |
|
|
|
|
|
|
|
if(it != _metaDataMap.end() && (*it)->defaultValueAvailable()) { |
|
|
|
|
|
|
|
return (*it)->rawDefaultValue().toDouble(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return 0.0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QGeoCoordinate RallyPoint::coordinate(void) const |
|
|
|
QGeoCoordinate RallyPoint::coordinate(void) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
return QGeoCoordinate(_latitudeFact.rawValue().toDouble(), _longitudeFact.rawValue().toDouble(), _altitudeFact.rawValue().toDouble()); |
|
|
|
return QGeoCoordinate(_latitudeFact.rawValue().toDouble(), _longitudeFact.rawValue().toDouble(), _altitudeFact.rawValue().toDouble()); |
|
|
|