mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +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:
43
generator/towns_dumper.hpp
Normal file
43
generator/towns_dumper.hpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include "geometry/latlon.hpp"
|
||||
#include "geometry/mercator.hpp"
|
||||
#include "geometry/rect2d.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct OsmElement;
|
||||
class TownsDumper
|
||||
{
|
||||
public:
|
||||
void CheckElement(OsmElement const & em);
|
||||
void Dump(std::string const & filePath);
|
||||
|
||||
static double GetDistanceThreshold();
|
||||
|
||||
private:
|
||||
void FilterTowns();
|
||||
|
||||
struct Town
|
||||
{
|
||||
ms::LatLon point;
|
||||
uint64_t id;
|
||||
bool capital;
|
||||
uint64_t population;
|
||||
|
||||
Town(double lat, double lon, uint64_t id, bool isCapital, uint64_t population)
|
||||
: point(lat, lon), id(id), capital(isCapital), population(population)
|
||||
{
|
||||
}
|
||||
|
||||
bool operator<(Town const & rhs) const { return population < rhs.population; }
|
||||
m2::RectD GetLimitRect() const
|
||||
{
|
||||
auto const mercPt = mercator::FromLatLon(point);
|
||||
return m2::RectD(mercPt, mercPt);
|
||||
}
|
||||
};
|
||||
|
||||
std::vector<Town> m_records;
|
||||
};
|
||||
Reference in New Issue
Block a user