Build the assembly paths if necessary. UpdatePaths() is only called when the assembly is at the root of the hierarchy; otherwise UpdatePaths() is called.
| 274 | // is only called when the assembly is at the root |
| 275 | // of the hierarchy; otherwise UpdatePaths() is called. |
| 276 | void vtkAssembly::UpdatePaths() |
| 277 | { |
| 278 | if (this->GetMTime() > this->PathTime || |
| 279 | (this->Paths != nullptr && this->Paths->GetMTime() > this->PathTime)) |
| 280 | { |
| 281 | if (this->Paths) |
| 282 | { |
| 283 | this->Paths->Delete(); |
| 284 | this->Paths = nullptr; |
| 285 | } |
| 286 | |
| 287 | // Create the list to hold all the paths |
| 288 | this->Paths = vtkAssemblyPaths::New(); |
| 289 | vtkAssemblyPath* path = vtkAssemblyPath::New(); |
| 290 | |
| 291 | // add ourselves to the path to start things off |
| 292 | path->AddNode(this, this->GetMatrix()); |
| 293 | |
| 294 | // Add nodes as we proceed down the hierarchy |
| 295 | vtkProp3D* prop3D; |
| 296 | vtkCollectionSimpleIterator pit; |
| 297 | for (this->Parts->InitTraversal(pit); (prop3D = this->Parts->GetNextProp3D(pit));) |
| 298 | { |
| 299 | path->AddNode(prop3D, prop3D->GetMatrix()); |
| 300 | |
| 301 | // dive into the hierarchy |
| 302 | prop3D->BuildPaths(this->Paths, path); |
| 303 | |
| 304 | // when returned, pop the last node off of the |
| 305 | // current path |
| 306 | path->DeleteLastNode(); |
| 307 | } |
| 308 | |
| 309 | path->Delete(); |
| 310 | this->PathTime.Modified(); |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | // Build assembly paths from this current assembly. A path consists of |
| 315 | // an ordered sequence of props, with transformations properly concatenated. |
no test coverage detected