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

feature_generator.hpp « indexer_tool « indexer - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2aec7d69913204173464e3a73a0aad169b5b8547 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once

#include "../../indexer/osm_decl.hpp"

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

#include "../../coding/file_container.hpp"

#include "../../std/vector.hpp"
#include "../../std/string.hpp"

class FeatureBuilder1;

namespace feature
{
  struct GenerateInfo
  {
    GenerateInfo()
      : maxScaleForWorldFeatures(-1), splitByPolygons(false),
        simplifyCountriesLevel(-1), mergeCoastlines(false) {}
    string tmpDir, datFilePrefix, datFileSuffix;
    /// If not -1, world will be split by buckets with specified level
    int cellBucketingLevel;
    vector<string> bucketNames;
    /// Features with scale level [0..maxScaleForWorldFeatures] will be
    /// included into separate world data file
    /// @note if -1, world file will not be created
    int maxScaleForWorldFeatures;
    bool splitByPolygons;
    int simplifyCountriesLevel;
    bool mergeCoastlines;
  };

  bool GenerateFeatures(GenerateInfo & info, bool lightNodes);
  //bool GenerateCoastlines(GenerateInfo & info, bool lightNodes);

  // Writes features to dat file.
  class FeaturesCollector
  {
  protected:
    FileWriter m_datFile;

    m2::RectD m_bounds;

  protected:
    static uint32_t GetFileSize(FileWriter const & f);

    void WriteFeatureBase(vector<char> const & bytes, FeatureBuilder1 const & fb);

  public:
    // Stores prefix and suffix of a dat file name.
    typedef pair<string, string> InitDataType;

    FeaturesCollector(string const & fName);
    FeaturesCollector(string const & bucket, InitDataType const & prefix);

    void operator() (FeatureBuilder1 const & f);
  };
}