Changeset 43c29c04ba in tspsg for src/tspsolver.cpp
- Timestamp:
- Jul 4, 2010, 3:03:13 AM (14 years ago)
- Branches:
- 0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- 7aaa0b0ec7
- Parents:
- d2820c3a1f
- git-author:
- Oleksii Serdiuk <contacts@…> (07/04/10 03:03:13)
- git-committer:
- Oleksii Serdiuk <contacts@…> (06/29/12 19:45:57)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tspsolver.cpp
rd2820c3a1f r43c29c04ba 43 43 */ 44 44 CTSPSolver::CTSPSolver(QObject *parent) 45 : QObject(parent), nCities(0), total(0), root(NULL) {}45 : QObject(parent), cc(true), nCities(0), total(0), root(NULL) {} 46 46 47 47 /*! … … 51 51 * \note It is not required to call this function manually. This function is always called by solve() at the beginning of the solution process. 52 52 * 53 * \sa solve() 53 * \sa solve(), setCleanupOnCancel() 54 54 */ 55 55 void CTSPSolver::cleanup(bool processEvents) 56 56 { 57 #ifdef QAPPLICATION_H58 if (!processEvents)59 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));60 #endif61 57 route.clear(); 62 58 mayNotBeOptimal = false; 63 59 if (root != NULL) 64 60 deleteTree(root, processEvents); 65 #ifdef QAPPLICATION_H66 if (!processEvents)67 QApplication::restoreOverrideCursor();68 #endif69 61 } 70 62 … … 115 107 { 116 108 return !mayNotBeOptimal; 109 } 110 111 /*! 112 * \brief Sets whether or not to call cleanup() on solution cancel. 113 * \param enable Set to \c true to enable clenup (default). 114 * 115 * This may be useful if you want to make cleanup yourself or provide indication of clenup to user. 116 * 117 * \note Please, note that cleanup() is explicitly called at the start of each solution. 118 * Disabling cleanup and forgetting to do it manually may considerably increase the solution time for large tasks (with more than 15 cities). 119 * \sa cleanup() 120 */ 121 void CTSPSolver::setCleanupOnCancel(bool enable) 122 { 123 cc = enable; 117 124 } 118 125 … … 174 181 locker.relock(); 175 182 if ((nRow == -1) || (nCol == -1) || canceled) { 176 cleanup(); 183 if (canceled && cc) 184 cleanup(); 177 185 return NULL; 178 186 }
Note: See TracChangeset
for help on using the changeset viewer.