MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / Window

Method Window

visualization/src/window.cpp:52–109  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

50
51/////////////////////////////////////////////////////////////////////////////////////////////
52pcl::visualization::Window::Window (const std::string& window_name)
53 :
54 mouse_command_ (vtkCallbackCommand::New ())
55 , keyboard_command_ (vtkCallbackCommand::New ())
56 , style_ (vtkSmartPointer<pcl::visualization::PCLVisualizerInteractorStyle>::New ())
57 , rens_ (vtkSmartPointer<vtkRendererCollection>::New ())
58{
59 mouse_command_->SetClientData (this);
60 mouse_command_->SetCallback (Window::MouseCallback);
61
62 keyboard_command_->SetClientData (this);
63 keyboard_command_->SetCallback (Window::KeyboardCallback);
64
65 // Create a RendererWindow
66 win_ = vtkSmartPointer<vtkRenderWindow>::New ();
67 win_->SetWindowName (window_name.c_str ());
68 win_->AlphaBitPlanesOff ();
69 win_->PointSmoothingOff ();
70 win_->LineSmoothingOff ();
71 win_->PolygonSmoothingOff ();
72 win_->SwapBuffersOn ();
73 win_->SetStereoTypeToAnaglyph ();
74
75 // Get screen size
76 int *scr_size = win_->GetScreenSize ();
77 // Set the window size as 1/2 of the screen size
78 win_->SetSize (scr_size[0] / 2, scr_size[1] / 2);
79
80 // Create the interactor style
81 style_->Initialize ();
82 style_->setRendererCollection (rens_);
83 style_->UseTimersOn ();
84
85 // Create the interactor
86 interactor_ = vtkSmartPointer<vtkRenderWindowInteractor>::New ();
87 //interactor_ = vtkSmartPointer<PCLVisualizerInteractor>::New ();
88
89 interactor_->SetRenderWindow (win_);
90 interactor_->SetInteractorStyle (style_);
91 interactor_->SetDesiredUpdateRate (30.0);
92 // Initialize and create timer
93 interactor_->Initialize ();
94 //interactor_->CreateRepeatingTimer (5000L);
95 timer_id_ = interactor_->CreateRepeatingTimer (5000L);
96 // interactor_->timer_id_ = interactor_->CreateRepeatingTimer (5000L);
97 //interactor_->timer_id_ = interactor_->CreateRepeatingTimer (30L);
98
99 exit_main_loop_timer_callback_ = vtkSmartPointer<ExitMainLoopTimerCallback>::New ();
100 exit_main_loop_timer_callback_->window = this;
101 exit_main_loop_timer_callback_->right_timer_id = -1;
102 interactor_->AddObserver (vtkCommand::TimerEvent, exit_main_loop_timer_callback_);
103
104 exit_callback_ = vtkSmartPointer<ExitCallback>::New ();
105 exit_callback_->window = this;
106 interactor_->AddObserver (vtkCommand::ExitEvent, exit_callback_);
107
108 resetStoppedFlag ();
109}

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
resetStoppedFlagFunction · 0.85
SetCallbackMethod · 0.45
InitializeMethod · 0.45
setRendererCollectionMethod · 0.45

Tested by

no test coverage detected