Changeset 5d401f2c50 in tspsg for src/tspsolver.cpp
- Timestamp:
- Apr 28, 2010, 1:38:10 AM (15 years ago)
- Branches:
- 0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- f2ff738751
- Parents:
- 20015b41e7
- git-author:
- Oleksii Serdiuk <contacts@…> (04/28/10 01:38:10)
- git-committer:
- Oleksii Serdiuk <contacts@…> (06/29/12 19:41:31)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tspsolver.cpp
r20015b41e7 r5d401f2c50 71 71 /*! 72 72 * \brief Returns the sorted optimal path, starting from City 1. 73 * \param city A string that represents city elements in the path. 74 * \param separator A string that represents separators between cities in the path. 73 75 * \return A string, containing sorted optimal path. 74 */ 75 QString CTSPSolver::getSortedPath() const 76 * 77 * The resulting path will be in the form \a city+\a separator+\a city+...+\a separator+\a city. 78 * \c \%1 in \a city will be replaced by the city number. 79 */ 80 QString CTSPSolver::getSortedPath(const QString &city, const QString &separator) const 76 81 { 77 82 if (!root || route.isEmpty() || (route.size() != nCities)) … … 79 84 80 85 int i = 0; // We start from City 1 81 QString path = tr("City %1").arg(1) + " -> "; 86 QStringList path; 87 path << city.arg(1); 82 88 while ((i = route[i]) != 0) { 83 path += tr("City %1").arg(i + 1) + " -> ";89 path << city.arg(i + 1); 84 90 } 85 91 // And finish in City 1, too 86 path += tr("City %1").arg(1);87 88 return path ;92 path << city.arg(1); 93 94 return path.join(separator); 89 95 } 90 96
Note: See TracChangeset
for help on using the changeset viewer.