mirror of
https://github.com/vicliu624/trail-mate.git
synced 2026-10-06 10:37:16 +00:00
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>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_presentation/map/map_overlay_snapshot.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace ui
|
||||
{
|
||||
namespace map_overlay
|
||||
{
|
||||
|
||||
class MapOverlayProjector
|
||||
{
|
||||
public:
|
||||
bool projectCurrentPosition(double lat,
|
||||
double lon,
|
||||
bool valid,
|
||||
::ui::map::MapOverlaySnapshot& out) const;
|
||||
|
||||
bool projectTeamMember(uint32_t node_id,
|
||||
const char* label,
|
||||
double lat,
|
||||
double lon,
|
||||
bool valid,
|
||||
::ui::map::MapOverlaySnapshot& out) const;
|
||||
|
||||
private:
|
||||
bool append(::ui::map::MapOverlaySnapshot& out,
|
||||
const ::ui::map::MapOverlayItem& item) const;
|
||||
};
|
||||
|
||||
} // namespace map_overlay
|
||||
} // namespace ui
|
||||
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_map_runtime/map_overlay/map_overlay_projector.h"
|
||||
#include "ui_presentation/map/map_overlay_snapshot.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
namespace ui
|
||||
{
|
||||
namespace map_overlay
|
||||
{
|
||||
|
||||
class IMapOverlayGpsSource
|
||||
{
|
||||
public:
|
||||
virtual ~IMapOverlayGpsSource() = default;
|
||||
|
||||
virtual bool currentFix(double& lat,
|
||||
double& lon,
|
||||
bool& valid) const = 0;
|
||||
};
|
||||
|
||||
class IMapOverlayTeamSource
|
||||
{
|
||||
public:
|
||||
struct TeamPoint
|
||||
{
|
||||
uint32_t node_id = 0;
|
||||
const char* label = nullptr;
|
||||
double lat = 0.0;
|
||||
double lon = 0.0;
|
||||
bool valid = false;
|
||||
};
|
||||
|
||||
virtual ~IMapOverlayTeamSource() = default;
|
||||
|
||||
virtual std::size_t latestTeamPoints(TeamPoint* out,
|
||||
std::size_t capacity) const = 0;
|
||||
};
|
||||
|
||||
class MapOverlayProjectionAdapter
|
||||
{
|
||||
public:
|
||||
bool project(const IMapOverlayGpsSource* gps,
|
||||
const IMapOverlayTeamSource* team,
|
||||
::ui::map::MapOverlaySnapshot& out) const;
|
||||
|
||||
private:
|
||||
MapOverlayProjector projector_{};
|
||||
};
|
||||
|
||||
} // namespace map_overlay
|
||||
} // namespace ui
|
||||
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_map_runtime/map_overlay_projection_adapter.h"
|
||||
#include "ui_presentation/map/map_overlay_source.h"
|
||||
|
||||
namespace ui
|
||||
{
|
||||
namespace map_overlay
|
||||
{
|
||||
|
||||
class MapOverlaySnapshotSource final
|
||||
: public ::ui::map::IMapOverlayPresentationSource
|
||||
{
|
||||
public:
|
||||
MapOverlaySnapshotSource(IMapOverlayGpsSource* gps,
|
||||
IMapOverlayTeamSource* team);
|
||||
|
||||
bool buildMapOverlaySnapshot(
|
||||
::ui::map::MapOverlaySnapshot& out) const override;
|
||||
|
||||
private:
|
||||
IMapOverlayGpsSource* gps_ = nullptr;
|
||||
IMapOverlayTeamSource* team_ = nullptr;
|
||||
MapOverlayProjectionAdapter adapter_{};
|
||||
};
|
||||
|
||||
} // namespace map_overlay
|
||||
} // namespace ui
|
||||
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_map_runtime/map_tiles/map_tile_resolver.h"
|
||||
#include "ui_map_runtime/map_tiles/map_tile_source.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace ui
|
||||
{
|
||||
namespace map_tiles
|
||||
{
|
||||
|
||||
class FilesystemMapTileSource final : public IMapTileSource
|
||||
{
|
||||
public:
|
||||
FilesystemMapTileSource(IMapTileFileSystem& file_system,
|
||||
const char* root_prefix = "");
|
||||
|
||||
MapTileLookupResult lookup(const MapTileRef& ref) const override;
|
||||
|
||||
bool read(const MapTileRef& ref,
|
||||
uint8_t* buffer,
|
||||
std::size_t capacity,
|
||||
std::size_t& out_size,
|
||||
MapTileFormat& out_format) const override;
|
||||
|
||||
bool resolvePath(const MapTileRef& ref, char* out_path, std::size_t out_size) const;
|
||||
bool resolveDirectory(MapTileLayer layer, char* out_path, std::size_t out_size) const;
|
||||
bool layerDirectoryAvailable(MapTileLayer layer) const;
|
||||
bool anyContourDirectoryAvailable() const;
|
||||
|
||||
private:
|
||||
IMapTileFileSystem& file_system_;
|
||||
MapTileResolver resolver_;
|
||||
};
|
||||
|
||||
using LegacyFilesystemMapTileSource [[deprecated("Use FilesystemMapTileSource")]] =
|
||||
FilesystemMapTileSource;
|
||||
|
||||
} // namespace map_tiles
|
||||
} // namespace ui
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_map_runtime/map_tiles/map_tile_types.h"
|
||||
|
||||
namespace ui
|
||||
{
|
||||
namespace map_tiles
|
||||
{
|
||||
|
||||
class IMapTileCache
|
||||
{
|
||||
public:
|
||||
virtual ~IMapTileCache() = default;
|
||||
|
||||
virtual void clear() = 0;
|
||||
virtual bool has(const MapTileRef& ref) const = 0;
|
||||
};
|
||||
|
||||
} // namespace map_tiles
|
||||
} // namespace ui
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_map_runtime/map_tiles/map_tile_types.h"
|
||||
|
||||
namespace ui
|
||||
{
|
||||
namespace map_tiles
|
||||
{
|
||||
|
||||
class IMapTileDecoderCache
|
||||
{
|
||||
public:
|
||||
virtual ~IMapTileDecoderCache() = default;
|
||||
|
||||
virtual void clear() = 0;
|
||||
virtual bool hasDecoded(const MapTileRef& ref) const = 0;
|
||||
};
|
||||
|
||||
} // namespace map_tiles
|
||||
} // namespace ui
|
||||
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_map_runtime/map_tiles/map_tile_types.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
namespace ui
|
||||
{
|
||||
namespace map_tiles
|
||||
{
|
||||
|
||||
struct MapTileScreenRect
|
||||
{
|
||||
int16_t x = 0;
|
||||
int16_t y = 0;
|
||||
int16_t width = 0;
|
||||
int16_t height = 0;
|
||||
};
|
||||
|
||||
enum class MapTileRenderState : uint8_t
|
||||
{
|
||||
Unknown,
|
||||
Missing,
|
||||
Loading,
|
||||
Ready,
|
||||
Error,
|
||||
};
|
||||
|
||||
struct MapTileRenderRef
|
||||
{
|
||||
MapTileRef tile;
|
||||
MapTileScreenRect rect;
|
||||
MapTileRenderState state = MapTileRenderState::Unknown;
|
||||
};
|
||||
|
||||
class MapTileRenderQueue
|
||||
{
|
||||
public:
|
||||
static constexpr std::size_t kMaxTiles = 64;
|
||||
|
||||
void clear();
|
||||
bool push(const MapTileRenderRef& item);
|
||||
std::size_t size() const;
|
||||
const MapTileRenderRef* items() const;
|
||||
|
||||
private:
|
||||
MapTileRenderRef items_[kMaxTiles]{};
|
||||
std::size_t size_ = 0;
|
||||
};
|
||||
|
||||
} // namespace map_tiles
|
||||
} // namespace ui
|
||||
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_map_runtime/map_tiles/map_tile_types.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace ui
|
||||
{
|
||||
namespace map_tiles
|
||||
{
|
||||
|
||||
class MapTileResolver
|
||||
{
|
||||
public:
|
||||
MapTileResolver();
|
||||
explicit MapTileResolver(const char* root_prefix);
|
||||
|
||||
void setRootPrefix(const char* root_prefix);
|
||||
const char* rootPrefix() const;
|
||||
|
||||
bool resolvePath(const MapTileRef& ref, char* out_path, std::size_t out_size) const;
|
||||
bool resolveDirectory(MapTileLayer layer, char* out_path, std::size_t out_size) const;
|
||||
|
||||
private:
|
||||
static constexpr std::size_t kRootPrefixCapacity = 96;
|
||||
|
||||
char root_prefix_[kRootPrefixCapacity]{};
|
||||
};
|
||||
|
||||
} // namespace map_tiles
|
||||
} // namespace ui
|
||||
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_map_runtime/map_tiles/map_tile_types.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
namespace ui
|
||||
{
|
||||
namespace map_tiles
|
||||
{
|
||||
|
||||
class IMapTileSource
|
||||
{
|
||||
public:
|
||||
virtual ~IMapTileSource() = default;
|
||||
|
||||
virtual MapTileLookupResult lookup(const MapTileRef& ref) const = 0;
|
||||
|
||||
virtual bool read(const MapTileRef& ref,
|
||||
uint8_t* buffer,
|
||||
std::size_t capacity,
|
||||
std::size_t& out_size,
|
||||
MapTileFormat& out_format) const = 0;
|
||||
};
|
||||
|
||||
class IMapTileFileSystem
|
||||
{
|
||||
public:
|
||||
virtual ~IMapTileFileSystem() = default;
|
||||
|
||||
virtual bool exists(const char* path) const = 0;
|
||||
virtual bool isDirectory(const char* path) const = 0;
|
||||
virtual bool readFile(const char* path,
|
||||
uint8_t* buffer,
|
||||
std::size_t capacity,
|
||||
std::size_t& out_size) const = 0;
|
||||
};
|
||||
|
||||
} // namespace map_tiles
|
||||
} // namespace ui
|
||||
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
namespace ui
|
||||
{
|
||||
namespace map_tiles
|
||||
{
|
||||
|
||||
enum class MapTileLayer : uint8_t
|
||||
{
|
||||
Osm,
|
||||
Terrain,
|
||||
Satellite,
|
||||
ContourMajor500,
|
||||
ContourMajor200,
|
||||
ContourMajor100,
|
||||
ContourMajor50,
|
||||
ContourMajor25,
|
||||
};
|
||||
|
||||
enum class MapTileFormat : uint8_t
|
||||
{
|
||||
Unknown,
|
||||
Png,
|
||||
Jpeg,
|
||||
};
|
||||
|
||||
enum class MapTileStatus : uint8_t
|
||||
{
|
||||
Unknown,
|
||||
Available,
|
||||
Missing,
|
||||
Error,
|
||||
};
|
||||
|
||||
struct MapTileRef
|
||||
{
|
||||
MapTileLayer layer = MapTileLayer::Osm;
|
||||
uint8_t z = 0;
|
||||
uint32_t x = 0;
|
||||
uint32_t y = 0;
|
||||
};
|
||||
|
||||
struct MapTilePayload
|
||||
{
|
||||
MapTileRef ref;
|
||||
MapTileFormat format = MapTileFormat::Unknown;
|
||||
const uint8_t* data = nullptr;
|
||||
std::size_t size = 0;
|
||||
};
|
||||
|
||||
struct MapTileLookupResult
|
||||
{
|
||||
MapTileStatus status = MapTileStatus::Unknown;
|
||||
MapTileFormat format = MapTileFormat::Unknown;
|
||||
std::size_t size = 0;
|
||||
};
|
||||
|
||||
MapTileLayer mapTileLayerFromBaseSource(uint8_t map_source);
|
||||
MapTileLayer mapTileContourLayerForZoom(int zoom, bool* out_supported = nullptr);
|
||||
MapTileFormat mapTileFormatForLayer(MapTileLayer layer);
|
||||
bool mapTileLayerIsContour(MapTileLayer layer);
|
||||
|
||||
} // namespace map_tiles
|
||||
} // namespace ui
|
||||
Reference in New Issue
Block a user