| 597 | } |
| 598 | |
| 599 | bool BuildRoutingIndex(string const & filename, string const & country, |
| 600 | CountryParentNameGetterFn const & countryParentNameGetterFn) |
| 601 | { |
| 602 | LOG(LINFO, ("Building routing index for", filename)); |
| 603 | try |
| 604 | { |
| 605 | Processor processor(country, countryParentNameGetterFn); |
| 606 | processor.ProcessAllFeatures(filename); |
| 607 | |
| 608 | IndexGraph graph; |
| 609 | processor.BuildGraph(graph); |
| 610 | |
| 611 | FilesContainerW cont(filename, FileWriter::OP_WRITE_EXISTING); |
| 612 | auto writer = cont.GetWriter(ROUTING_FILE_TAG); |
| 613 | |
| 614 | auto const startPos = writer->Pos(); |
| 615 | IndexGraphSerializer::Serialize(graph, processor.GetMasks(), *writer); |
| 616 | auto const sectionSize = writer->Pos() - startPos; |
| 617 | |
| 618 | LOG(LINFO, ("Routing section created:", sectionSize, "bytes,", graph.GetNumRoads(), "roads,", graph.GetNumJoints(), |
| 619 | "joints,", graph.GetNumPoints(), "points")); |
| 620 | return true; |
| 621 | } |
| 622 | catch (RootException const & e) |
| 623 | { |
| 624 | LOG(LERROR, ("An exception happened while creating", ROUTING_FILE_TAG, "section:", e.what())); |
| 625 | return false; |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | /// \brief Serializes all the cross mwm information to |sectionName| of |mwmFile| including: |
| 630 | /// * header |