Welcome to mirror list, hosted at ThFree Co, Russian Federation.

towns_dumper.hpp « generator - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ac9acf651ab20064b8c64ee7aef6050eab228a14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once

#include "geometry/latlon.hpp"
#include "geometry/mercator.hpp"
#include "geometry/rect2d.hpp"

#include "generator/osm_element.hpp"

#include "base/string_utils.hpp"

#include <string>
#include <vector>

class TownsDumper
{
public:
  TownsDumper();

  void CheckElement(OsmElement const & em);

  void Dump(std::string const & filePath);

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
    {
      return m2::RectD(MercatorBounds::FromLatLon(point), MercatorBounds::FromLatLon(point));
    }
  };

  std::vector<Town> m_records;
};