/** * @brief ShortPathWriter::savePaths - Write in file paths. Create if not exist. * @param fileName - file name for save paths * @param nodes - deque of nodes id for generate and save path into file * @param pathLimit - path weight limit * @param options - set some options for function (PRINT_INDENTS, PRINT_INFO) * @return true if save successful */ bool ShortPathWriter::savePaths(const char* fileName, const NodeIdDeque* nodes, float pathLimit, cuint options) { if (!nodes) { GraphBase* graph = &shortPath->getGraph(); NodeMap* map = graph->getNodeMap(); NodeIdDeque list; for (const auto &pair : *map) { list.push_back(pair.first); shortPath->generateShortPath(pair.first, pathLimit); } return writeExistPaths(fileName, &list, options); } else { for (const auto &i : *nodes) { shortPath->generateShortPath(i, pathLimit); } return writeExistPaths(fileName, nodes, options); } }