MCPcopy Create free account
hub / github.com/Kitware/VTK / StartLayoutAnimation

Method StartLayoutAnimation

Views/Infovis/vtkGraphItem.cxx:298–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298void 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
326void vtkGraphItem::StopLayoutAnimation()
327{

Callers 1

MouseButtonPressEventMethod · 0.95

Calls 7

SetClientDataMethod · 0.80
CreateRepeatingTimerMethod · 0.80
GetSceneWidthMethod · 0.80
GetSceneHeightMethod · 0.80
MapFromSceneMethod · 0.80
AddObserverMethod · 0.45
SetAlphaMethod · 0.45

Tested by

no test coverage detected