| 69 | } |
| 70 | |
| 71 | void AddLine(const util::Coordinate from, |
| 72 | const util::Coordinate to, |
| 73 | const OSMNodeID from_id, |
| 74 | const OSMNodeID to_id, |
| 75 | const std::string &type) |
| 76 | { |
| 77 | const auto from_lon = static_cast<double>(util::toFloating(from.lon)); |
| 78 | const auto from_lat = static_cast<double>(util::toFloating(from.lat)); |
| 79 | const auto to_lon = static_cast<double>(util::toFloating(to.lon)); |
| 80 | const auto to_lat = static_cast<double>(util::toFloating(to.lat)); |
| 81 | |
| 82 | static bool first = true; |
| 83 | |
| 84 | if (!first) |
| 85 | { |
| 86 | out << ","; |
| 87 | } |
| 88 | |
| 89 | out << "{\"type\":\"Feature\",\"properties\":{\"from\":" << from_id << "," |
| 90 | << "\"to\":" << to_id << ",\"type\":\"" << type |
| 91 | << "\"},\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[" << from_lon << "," |
| 92 | << from_lat << "],[" << to_lon << "," << to_lat << "]]}}"; |
| 93 | |
| 94 | first = false; |
| 95 | } |
| 96 | |
| 97 | ~FeatureWriter() { out << "]}" << std::flush; } |
| 98 | |