| 823 | } |
| 824 | |
| 825 | void |
| 826 | TreeCanvas::reset(void) { |
| 827 | QMutexLocker locker(&mutex); |
| 828 | Space* rootSpace = |
| 829 | root->getStatus() == FAILED ? nullptr : |
| 830 | root->getSpace(*na,curBest,c_d,a_d); |
| 831 | if (curBest != nullptr) { |
| 832 | delete curBest; |
| 833 | curBest = new BestNode(nullptr); |
| 834 | } |
| 835 | if (root) { |
| 836 | DisposeCursor dc(root,*na); |
| 837 | PreorderNodeVisitor<DisposeCursor>(dc).run(); |
| 838 | } |
| 839 | delete na; |
| 840 | na = new Node::NodeAllocator(curBest != nullptr); |
| 841 | int rootIdx = na->allocate(rootSpace); |
| 842 | assert(rootIdx == 0); (void) rootIdx; |
| 843 | root = (*na)[0]; |
| 844 | root->setMarked(true); |
| 845 | currentNode = root; |
| 846 | pathHead = root; |
| 847 | scale = 1.0; |
| 848 | stats = Statistics(); |
| 849 | for (int i=bookmarks.size(); i--;) |
| 850 | emit removedBookmark(i); |
| 851 | bookmarks.clear(); |
| 852 | root->layout(*na); |
| 853 | |
| 854 | emit statusChanged(currentNode, stats, true); |
| 855 | update(); |
| 856 | } |
| 857 | |
| 858 | void |
| 859 | TreeCanvas::bookmarkNode(void) { |