- Timestamp:
- Apr 28, 2010, 1:38:10 AM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mainwindow.cpp
r109 r110 666 666 667 667 cur.insertBlock(fmt_paragraph); 668 cur.insertText(" " + solver.getSortedPath( ));668 cur.insertText(" " + solver.getSortedPath(tr("City %1"))); 669 669 670 670 cur.insertBlock(fmt_paragraph); … … 861 861 pic.drawLine(QPointF(x, y - r), QPointF(r * 2.25, y - 2 * r)); 862 862 } else if (nstep > 1) { 863 pic.drawLine(QPointF(x, y - r), QPointF((step->pNode-> next == SStep::RightBranch) ? r * 3.5 : r, y - 2 * r));863 pic.drawLine(QPointF(x, y - r), QPointF((step->pNode->pNode->next == SStep::RightBranch) ? r * 3.5 : r, y - 2 * r)); 864 864 } 865 865 -
trunk/src/tspsolver.cpp
r107 r110 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 -
trunk/src/tspsolver.h
r107 r110 113 113 CTSPSolver(QObject *parent = NULL); 114 114 void cleanup(bool processEvents = false); 115 QString getSortedPath( ) const;115 QString getSortedPath(const QString &city, const QString &separator = " -> ") const; 116 116 int getTotalSteps() const; 117 117 bool isOptimal() const; -
trunk/src/version.h
r100 r110 11 11 * 12 12 * This file is part of TSPSG. 13 *14 * TSPSG is free software: you can redistribute it and/or modify15 * it under the terms of the GNU General Public License as published by16 * the Free Software Foundation, either version 3 of the License, or17 * (at your option) any later version.18 *19 * TSPSG is distributed in the hope that it will be useful,20 * but WITHOUT ANY WARRANTY; without even the implied warranty of21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the22 * GNU General Public License for more details.23 *24 * You should have received a copy of the GNU General Public License25 * along with TSPSG. If not, see <http://www.gnu.org/licenses/>.26 */27 /*!28 * \mainpage29 * \image html tspsg.png30 * <b>TSPSG: TSP Solver and Generator</b>31 * \author Copyright © 2007-2010 Lёppa <contacts[at]oleksii[dot]name>32 *33 * \b Homepage: <a href="http://tspsg.sourceforge.net/">tspsg.sourceforge.net</a>34 13 * 35 14 * TSPSG is free software: you can redistribute it and/or modify
Note: See TracChangeset
for help on using the changeset viewer.