1 #include "util/util.hpp"
9 #include "mm/mm_type.hpp"
16 << std::fixed << std::setw(4) <<
"step" <<
";"
17 << std::fixed << std::setw(6) <<
"index" <<
";"
18 << std::fixed << std::setw(8) <<
"offset" <<
";"
19 << std::fixed << std::setw(8) <<
"distance" <<
";"
20 << std::fixed << std::setw(8) <<
"edge_id" <<
'\n';
21 for (
auto tr_cs_iter = tr_cs.begin();
22 tr_cs_iter != tr_cs.end(); ++tr_cs_iter) {
23 for (
auto p_cs_iter = tr_cs_iter->begin();
24 p_cs_iter != tr_cs_iter->end();
27 << std::fixed << std::setw(4) << std::distance(tr_cs.begin(),
29 << std::fixed << std::setw(6) << p_cs_iter->index <<
";"
30 << std::fixed << std::setw(8) << p_cs_iter->offset <<
";"
31 << std::fixed << std::setw(8) << p_cs_iter->dist <<
";"
32 << std::fixed << std::setw(8) << p_cs_iter->edge->id <<
'\n';
40 for (
int i = 0; i < opath.size(); ++i) {
42 os << opath[i]->edge->id;
43 if (i != opath.size() - 1)
51 os << std::setprecision(12) << boost::geometry::wkt(geom);
63 if (stat(filename, &buf) != -1) {
75 std::vector<std::string> result;
76 std::stringstream ss(str);
77 std::string intermediate;
78 while (getline(ss, intermediate, delim)) {
79 result.push_back(intermediate);
85 return str ==
"true" || str ==
"t" || str ==
"1";
89 return std::chrono::system_clock::now();
94 const std::chrono::time_point<std::chrono::system_clock> &start_time) {
95 std::time_t start_time_t = std::chrono::system_clock::to_time_t(start_time);
96 std::cout <<
"Time " << std::ctime(&start_time_t) <<
'\n';
100 const std::chrono::time_point<std::chrono::system_clock> &start_time,
101 const std::chrono::time_point<std::chrono::system_clock> &end_time) {
102 std::chrono::duration<double> elapsed_seconds = end_time - start_time;
103 return elapsed_seconds.count();
106 const std::string &extension_list_str) {
108 std::stringstream ss;
109 std::string fn_extension = filename.substr(
110 filename.find_last_of(
'.') + 1);
111 std::vector<std::string> extensions =
113 for (
const auto &extension:extensions) {
114 if (fn_extension == extension)
121 if (folder_name.empty())
return true;
123 if (stat(folder_name.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode)) {
130 std::size_t found = fn.find_last_of(
"/");
131 if (found != std::string::npos) {
132 return fn.substr(0, found);