| 62 | } |
| 63 | |
| 64 | void vtkTreeDFSIterator::Initialize() |
| 65 | { |
| 66 | if (this->Tree == nullptr) |
| 67 | { |
| 68 | return; |
| 69 | } |
| 70 | // Set all colors to white |
| 71 | this->Color->SetNumberOfValues(this->Tree->GetNumberOfVertices()); |
| 72 | for (vtkIdType i = 0; i < this->Tree->GetNumberOfVertices(); i++) |
| 73 | { |
| 74 | this->Color->SetValue(i, this->WHITE); |
| 75 | } |
| 76 | if (this->StartVertex < 0) |
| 77 | { |
| 78 | this->StartVertex = this->Tree->GetRoot(); |
| 79 | } |
| 80 | this->CurRoot = this->StartVertex; |
| 81 | while (!this->Internals->Stack.empty()) |
| 82 | { |
| 83 | this->Internals->Stack.pop(); |
| 84 | } |
| 85 | |
| 86 | // Find the first item |
| 87 | if (this->Tree->GetNumberOfVertices() > 0) |
| 88 | { |
| 89 | this->NextId = this->NextInternal(); |
| 90 | } |
| 91 | else |
| 92 | { |
| 93 | this->NextId = -1; |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | void vtkTreeDFSIterator::SetMode(int mode) |
| 98 | { |
no test coverage detected