| 296 | } |
| 297 | |
| 298 | void vtkGraphItem::StartLayoutAnimation(vtkRenderWindowInteractor* interactor) |
| 299 | { |
| 300 | // Start a simple repeating timer |
| 301 | if (!this->Internal->Animating && interactor) |
| 302 | { |
| 303 | if (!this->Internal->AnimationCallbackInitialized) |
| 304 | { |
| 305 | this->Internal->AnimationCallback->SetClientData(this); |
| 306 | this->Internal->AnimationCallback->SetCallback(vtkGraphItem::ProcessEvents); |
| 307 | interactor->AddObserver(vtkCommand::TimerEvent, this->Internal->AnimationCallback, 0); |
| 308 | this->Internal->Interactor = interactor; |
| 309 | this->Internal->AnimationCallbackInitialized = true; |
| 310 | } |
| 311 | this->Internal->Animating = true; |
| 312 | // This defines the interval at which the animation will proceed. 60Hz? |
| 313 | this->Internal->TimerId = interactor->CreateRepeatingTimer(1000 / 60); |
| 314 | if (!this->Internal->GravityPointSet) |
| 315 | { |
| 316 | vtkVector2f screenPos( |
| 317 | this->Scene->GetSceneWidth() / 2.0f, this->Scene->GetSceneHeight() / 2.0f); |
| 318 | vtkVector2f pos = this->MapFromScene(screenPos); |
| 319 | this->Layout->SetGravityPoint(pos); |
| 320 | this->Internal->GravityPointSet = true; |
| 321 | } |
| 322 | this->Layout->SetAlpha(this->Internal->LayoutAlphaStart); |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | void vtkGraphItem::StopLayoutAnimation() |
| 327 | { |
no test coverage detected