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

traffic_generator.cpp « generator - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c920946eb3d16ecabe7ec7682427ebab0b0867cd (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
#include "generator/traffic_generator.hpp"

#include "routing/car_model.hpp"
#include "routing/routing_helpers.hpp"

#include "traffic/traffic_info.hpp"

#include "platform/mwm_traits.hpp"

#include "indexer/feature_algo.hpp"
#include "indexer/feature_processor.hpp"
#include "indexer/features_offsets_table.hpp"

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

#include "std/vector.hpp"

namespace traffic
{
bool GenerateTrafficKeysFromDataFile(string const & mwmPath)
{
  try
  {
    vector<TrafficInfo::RoadSegmentId> keys;
    TrafficInfo::ExtractTrafficKeys(mwmPath, keys);

    vector<uint8_t> buf;
    TrafficInfo::SerializeTrafficKeys(keys, buf);

    FilesContainerW writeContainer(mwmPath, FileWriter::OP_WRITE_EXISTING);
    FileWriter writer = writeContainer.GetWriter(TRAFFIC_KEYS_FILE_TAG);
    writer.Write(buf.data(), buf.size());
  }
  catch (RootException const & e)
  {
    LOG(LERROR, ("Failed to build traffic keys:", e.Msg()));
    return false;
  }

  return true;
}
}  // namespace traffic