Files
trail-mate/modules/ui_map_runtime/src/map_overlay_projection_adapter.cpp
T
vicliuandGitHub bf7068b02b 0.1.26-alpha release
* refactor: render chat rows from presentation state

* Fix Meshtastic channel sync and add MeshCore CN preset

* Add granular chat notification settings

* Add SD settings backup and restore

* Prepare 0.1.26-alpha release

---------

Co-authored-by: vicliu624 <vicliu@outlook.com>
2026-05-19 16:04:42 +08:00

58 lines
1.5 KiB
C++

#include "ui_map_runtime/map_overlay_projection_adapter.h"
namespace ui
{
namespace map_overlay
{
namespace
{
constexpr std::size_t kMaxTeamPoints = 16;
} // namespace
bool MapOverlayProjectionAdapter::project(
const IMapOverlayGpsSource* gps,
const IMapOverlayTeamSource* team,
::ui::map::MapOverlaySnapshot& out) const
{
out = ::ui::map::MapOverlaySnapshot{};
out.header.valid = true;
out.header.version = 1;
if (gps != nullptr)
{
double lat = 0.0;
double lon = 0.0;
bool valid = false;
if (gps->currentFix(lat, lon, valid))
{
(void)projector_.projectCurrentPosition(lat, lon, valid, out);
}
}
if (team != nullptr)
{
IMapOverlayTeamSource::TeamPoint points[kMaxTeamPoints]{};
const std::size_t count = team->latestTeamPoints(points, kMaxTeamPoints);
for (std::size_t i = 0; i < count && i < kMaxTeamPoints; ++i)
{
(void)projector_.projectTeamMember(points[i].node_id,
points[i].label,
points[i].lat,
points[i].lon,
points[i].valid,
out);
}
if (count > kMaxTeamPoints)
{
out.truncated = true;
}
}
return true;
}
} // namespace map_overlay
} // namespace ui