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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
#pragma once
#include "defines.hpp"
#include "base/logging.hpp"
#include "coding/file_name_utils.hpp"
#include "std/string.hpp"
#include "std/vector.hpp"
namespace feature
{
struct GenerateInfo
{
enum class NodeStorageType
{
Memory,
Index,
File
};
enum class OsmSourceType
{
XML,
O5M
};
// Directory for .mwm.tmp files.
string m_tmpDir;
// Directory for result .mwm files.
string m_targetDir;
// Directory for all intermediate files.
string m_intermediateDir;
// Current generated file name if --output option is defined.
string m_fileName;
NodeStorageType m_nodeStorageType;
OsmSourceType m_osmFileType;
string m_osmFileName;
uint32_t m_versionDate = 0;
vector<string> m_bucketNames;
bool m_createWorld = false;
bool m_splitByPolygons = false;
bool m_makeCoasts = false;
bool m_emitCoasts = false;
bool m_genAddresses = false;
bool m_failOnCoasts = false;
bool m_preloadCache = false;
GenerateInfo() = default;
void SetOsmFileType(string const & type)
{
if (type == "xml")
m_osmFileType = OsmSourceType::XML;
else if (type == "o5m")
m_osmFileType = OsmSourceType::O5M;
else
LOG(LCRITICAL, ("Unknown source type:", type));
}
void SetNodeStorageType(string const & type)
{
if (type == "raw")
m_nodeStorageType = NodeStorageType::File;
else if (type == "map")
m_nodeStorageType = NodeStorageType::Index;
else if (type == "mem")
m_nodeStorageType = NodeStorageType::Memory;
else
LOG(LCRITICAL, ("Incorrect node_storage type:", type));
}
string GetTmpFileName(string const & fileName, char const * ext = DATA_FILE_EXTENSION_TMP) const
{
return my::JoinFoldersToPath(m_tmpDir, fileName + ext);
}
string GetTargetFileName(string const & fileName, char const * ext = DATA_FILE_EXTENSION) const
{
return my::JoinFoldersToPath(m_targetDir, fileName + ext);
}
string GetIntermediateFileName(string const & fileName, char const * ext = DATA_FILE_EXTENSION) const
{
return my::JoinFoldersToPath(m_intermediateDir, fileName + ext);
}
string GetAddressesFileName() const
{
return ((m_genAddresses && !m_fileName.empty()) ? GetTargetFileName(m_fileName, ADDR_FILE_EXTENSION) : string());
}
};
} // namespace feature
|