mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-21 05:43:37 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
86
indexer/data_header.hpp
Normal file
86
indexer/data_header.hpp
Normal file
@@ -0,0 +1,86 @@
|
||||
#pragma once
|
||||
|
||||
#include "coding/geometry_coding.hpp"
|
||||
|
||||
#include "geometry/rect2d.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
#include "base/buffer_vector.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
class FilesContainerR;
|
||||
class FileWriter;
|
||||
class ModelReaderPtr;
|
||||
|
||||
namespace feature
|
||||
{
|
||||
class DataHeader
|
||||
{
|
||||
public:
|
||||
/// @note An order is important here, @see Load function.
|
||||
enum class MapType : uint8_t
|
||||
{
|
||||
World,
|
||||
WorldCoasts,
|
||||
Country
|
||||
};
|
||||
|
||||
/// Max possible geometry scales. @see arrays in feature_impl.hpp
|
||||
static constexpr size_t kMaxScalesCount = 4;
|
||||
|
||||
DataHeader() = default;
|
||||
explicit DataHeader(std::string const & fileName);
|
||||
explicit DataHeader(FilesContainerR const & cont);
|
||||
|
||||
inline void SetGeometryCodingParams(serial::GeometryCodingParams const & cp)
|
||||
{
|
||||
m_codingParams = cp;
|
||||
}
|
||||
|
||||
inline serial::GeometryCodingParams const & GetDefGeometryCodingParams() const
|
||||
{
|
||||
return m_codingParams;
|
||||
}
|
||||
|
||||
serial::GeometryCodingParams GetGeometryCodingParams(int scaleIndex) const;
|
||||
|
||||
m2::RectD GetBounds() const;
|
||||
void SetBounds(m2::RectD const & r);
|
||||
|
||||
template <size_t N>
|
||||
void SetScales(int const (&arr)[N])
|
||||
{
|
||||
m_scales.assign(arr, arr + N);
|
||||
}
|
||||
|
||||
size_t GetScalesCount() const { return m_scales.size(); }
|
||||
int GetScale(size_t i) const { return static_cast<int>(m_scales[i]); }
|
||||
int GetLastScale() const { return m_scales.back(); }
|
||||
|
||||
std::pair<int, int> GetScaleRange() const;
|
||||
|
||||
void Save(FileWriter & w) const;
|
||||
void Load(FilesContainerR const & cont);
|
||||
|
||||
void SetType(MapType t) { m_type = t; }
|
||||
MapType GetType() const { return m_type; }
|
||||
|
||||
private:
|
||||
void Load(ModelReaderPtr const & r);
|
||||
|
||||
MapType m_type = MapType::World;
|
||||
|
||||
serial::GeometryCodingParams m_codingParams;
|
||||
|
||||
// Rect around region border. Features which cross region border may cross this rect.
|
||||
std::pair<int64_t, int64_t> m_bounds;
|
||||
|
||||
buffer_vector<uint8_t, kMaxScalesCount> m_scales;
|
||||
// Is not used now (see data/countries_meta.txt). Can be reused for something else.
|
||||
buffer_vector<uint8_t, 2> m_langs;
|
||||
};
|
||||
|
||||
std::string DebugPrint(DataHeader::MapType type);
|
||||
} // namespace feature
|
||||
Reference in New Issue
Block a user