mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Ref T261, improved "finding" for elevation, "findFirst" for small radius
This commit is contained in:
committed by
Roland Winklmeier
parent
ae8d9abf0d
commit
ad10470eb1
@@ -53,6 +53,15 @@ namespace BlackMisc
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class OBJ, class CONTAINER>
|
||||||
|
OBJ IGeoObjectList<OBJ, CONTAINER>::findFirstWithinRangeOrDefault(const ICoordinateGeodetic &coordinate, const CLength &range) const
|
||||||
|
{
|
||||||
|
return this->container().findFirstByOrDefault([&](const OBJ & geoObj)
|
||||||
|
{
|
||||||
|
return calculateGreatCircleDistance(geoObj, coordinate) <= range;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
template<class OBJ, class CONTAINER>
|
template<class OBJ, class CONTAINER>
|
||||||
CONTAINER IGeoObjectList<OBJ, CONTAINER>::findWithGeodeticMSLHeight() const
|
CONTAINER IGeoObjectList<OBJ, CONTAINER>::findWithGeodeticMSLHeight() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ namespace BlackMisc
|
|||||||
//! \param range within range of other position
|
//! \param range within range of other position
|
||||||
CONTAINER findWithinRange(const ICoordinateGeodetic &coordinate, const PhysicalQuantities::CLength &range) const;
|
CONTAINER findWithinRange(const ICoordinateGeodetic &coordinate, const PhysicalQuantities::CLength &range) const;
|
||||||
|
|
||||||
|
//! Find first in range
|
||||||
|
OBJ findFirstWithinRangeOrDefault(const ICoordinateGeodetic &coordinate, const PhysicalQuantities::CLength &range) const;
|
||||||
|
|
||||||
//! Elements with geodetic height (only MSL)
|
//! Elements with geodetic height (only MSL)
|
||||||
CONTAINER findWithGeodeticMSLHeight() const;
|
CONTAINER findWithGeodeticMSLHeight() const;
|
||||||
|
|
||||||
|
|||||||
@@ -91,9 +91,13 @@ namespace BlackMisc
|
|||||||
return delta;
|
return delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
CElevationPlane ISimulationEnvironmentProvider::findClosestElevationWithinRange(const ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const
|
CElevationPlane ISimulationEnvironmentProvider::findClosestElevationWithinRange(const ICoordinateGeodetic &reference, const CLength &range) const
|
||||||
{
|
{
|
||||||
const CCoordinateGeodetic coordinate = this->getElevationCoordinates().findClosestWithinRange(reference, minRange(range));
|
// for single point we use a slightly optimized version
|
||||||
|
const bool singlePoint = (range <= CElevationPlane::singlePointRadius());
|
||||||
|
const CCoordinateGeodetic coordinate = singlePoint ?
|
||||||
|
this->getElevationCoordinates().findFirstWithinRangeOrDefault(reference, CElevationPlane::singlePointRadius()) :
|
||||||
|
this->getElevationCoordinates().findClosestWithinRange(reference, range);
|
||||||
const bool found = !coordinate.isNull();
|
const bool found = !coordinate.isNull();
|
||||||
{
|
{
|
||||||
QWriteLocker l{&m_lockElvCoordinates };
|
QWriteLocker l{&m_lockElvCoordinates };
|
||||||
|
|||||||
Reference in New Issue
Block a user