| 170 | } |
| 171 | |
| 172 | std::vector<LinearSegment> LoadSegments(pugi::xml_document & document) |
| 173 | { |
| 174 | std::vector<LinearSegment> segments; |
| 175 | if (!ParseOpenlr(document, segments)) |
| 176 | { |
| 177 | LOG(LERROR, ("Can't parse data.")); |
| 178 | exit(-1); |
| 179 | } |
| 180 | |
| 181 | OpenLRDecoder::SegmentsFilter filter(FLAGS_ids_path, FLAGS_multipoints_only); |
| 182 | if (FLAGS_limit != kHandleAllSegments && FLAGS_limit >= 0 && static_cast<size_t>(FLAGS_limit) < segments.size()) |
| 183 | segments.resize(FLAGS_limit); |
| 184 | |
| 185 | base::EraseIf(segments, [&filter](LinearSegment const & segment) { return !filter.Matches(segment); }); |
| 186 | |
| 187 | std::sort(segments.begin(), segments.end(), base::LessBy(&LinearSegment::m_segmentId)); |
| 188 | |
| 189 | return segments; |
| 190 | } |
| 191 | |
| 192 | void WriteAssessmentFile(std::string const fileName, pugi::xml_document const & doc, |
| 193 | std::vector<DecodedPath> const & paths) |