| 147 | namespace routing::transit |
| 148 | { |
| 149 | void DeserializeFromJson(OsmIdToFeatureIdsMap const & mapping, std::string const & transitJsonPath, GraphData & data) |
| 150 | { |
| 151 | Platform::EFileType fileType; |
| 152 | Platform::EError const errCode = Platform::GetFileType(transitJsonPath, fileType); |
| 153 | CHECK_EQUAL(errCode, Platform::EError::ERR_OK, ("Transit graph was not found:", transitJsonPath)); |
| 154 | CHECK_EQUAL(fileType, Platform::EFileType::Regular, ("Transit graph was not found:", transitJsonPath)); |
| 155 | |
| 156 | std::string jsonBuffer; |
| 157 | try |
| 158 | { |
| 159 | GetPlatform().GetReader(transitJsonPath)->ReadAsString(jsonBuffer); |
| 160 | } |
| 161 | catch (RootException const & e) |
| 162 | { |
| 163 | LOG(LCRITICAL, ("Can't open", transitJsonPath, e.what())); |
| 164 | } |
| 165 | |
| 166 | base::Json root(jsonBuffer.c_str()); |
| 167 | CHECK(root.get() != nullptr, ("Cannot parse the json file:", transitJsonPath)); |
| 168 | |
| 169 | data.Clear(); |
| 170 | try |
| 171 | { |
| 172 | data.DeserializeFromJson(root, mapping); |
| 173 | } |
| 174 | catch (RootException const & e) |
| 175 | { |
| 176 | LOG(LCRITICAL, ("Exception while parsing transit graph json. Json file path:", transitJsonPath, e.what())); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | void ProcessGraph(std::string const & mwmPath, CountryId const & countryId, |
| 181 | OsmIdToFeatureIdsMap const & osmIdToFeatureIdsMap, GraphData & data) |
no test coverage detected