mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
Ref T259, Ref T243 prepared sim.env.provider to request elevations
This commit is contained in:
@@ -91,14 +91,21 @@ namespace BlackMisc
|
||||
return delta;
|
||||
}
|
||||
|
||||
CElevationPlane ISimulationEnvironmentProvider::findClosestElevationWithinRange(const ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const
|
||||
CElevationPlane ISimulationEnvironmentProvider::findClosestElevationWithinRange(const ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range, bool autoRequest) const
|
||||
{
|
||||
const CCoordinateGeodetic coordinate = this->getElevationCoordinates().findClosestWithinRange(reference, minRange(range));
|
||||
const bool found = !coordinate.isNull();
|
||||
{
|
||||
QWriteLocker l{&m_lockElvCoordinates };
|
||||
if (found) { m_elvFound++; }
|
||||
else { m_elvMissed++; }
|
||||
if (found)
|
||||
{
|
||||
m_elvFound++;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_elvMissed++;
|
||||
if (autoRequest) { this->requestElevation(reference); }
|
||||
}
|
||||
}
|
||||
return CElevationPlane(coordinate, reference); // plane with radis = distance to reference
|
||||
}
|
||||
@@ -189,10 +196,16 @@ namespace BlackMisc
|
||||
this->clearCGs();
|
||||
}
|
||||
|
||||
CElevationPlane CSimulationEnvironmentAware::findClosestElevationWithinRange(const ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const
|
||||
CElevationPlane CSimulationEnvironmentAware::findClosestElevationWithinRange(const ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range, bool autoRequest) const
|
||||
{
|
||||
if (!this->hasProvider()) { return CElevationPlane::null(); }
|
||||
return this->provider()->findClosestElevationWithinRange(reference, range);
|
||||
return this->provider()->findClosestElevationWithinRange(reference, range, autoRequest);
|
||||
}
|
||||
|
||||
bool CSimulationEnvironmentAware::requestElevation(const ICoordinateGeodetic &reference) const
|
||||
{
|
||||
if (!this->hasProvider()) { return false; }
|
||||
return this->provider()->requestElevation(reference);
|
||||
}
|
||||
|
||||
QPair<int, int> CSimulationEnvironmentAware::getElevationsFoundMissed() const
|
||||
|
||||
@@ -38,7 +38,11 @@ namespace BlackMisc
|
||||
|
||||
//! Find closest elevation
|
||||
//! \threadsafe
|
||||
Geo::CElevationPlane findClosestElevationWithinRange(const Geo::ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const;
|
||||
Geo::CElevationPlane findClosestElevationWithinRange(const Geo::ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range, bool autoRequest = false) const;
|
||||
|
||||
//! Request elevation, there is no guaranteed the requested elevation will be available in the provider
|
||||
//! \threadsafe
|
||||
virtual bool requestElevation(const Geo::ICoordinateGeodetic &reference) const = 0;
|
||||
|
||||
//! Elevations found/missed statistics
|
||||
//! \threadsafe
|
||||
@@ -142,7 +146,10 @@ namespace BlackMisc
|
||||
void setSimulationEnvironmentProvider(ISimulationEnvironmentProvider *provider) { this->setProvider(provider); }
|
||||
|
||||
//! \copydoc ISimulationEnvironmentProvider::findClosestElevationWithinRange
|
||||
Geo::CElevationPlane findClosestElevationWithinRange(const Geo::ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const;
|
||||
Geo::CElevationPlane findClosestElevationWithinRange(const Geo::ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range, bool autoRequest = false) const;
|
||||
|
||||
//! \copydoc ISimulationEnvironmentProvider::findClosestElevationWithinRange
|
||||
bool requestElevation(const Geo::ICoordinateGeodetic &reference) const;
|
||||
|
||||
//! \copydoc ISimulationEnvironmentProvider::getElevationsFoundMissed
|
||||
QPair<int, int> getElevationsFoundMissed() const;
|
||||
|
||||
Reference in New Issue
Block a user