Point Cloud Library (PCL)  1.7.0
viewport.h
1 #ifndef PCL_OUTOFCORE_VIEWPORT_H_
2 #define PCL_OUTOFCORE_VIEWPORT_H_
3 
4 // C++
5 #include <iostream>
6 #include <string>
7 
8 // PCL
9 #include "camera.h"
10 
11 // VTK
12 #include <vtkActor.h>
13 #include <vtkCallbackCommand.h>
14 #include <vtkObject.h>
15 #include <vtkTextActor.h>
16 #include <vtkRenderer.h>
17 #include <vtkRenderWindow.h>
18 #include <vtkSmartPointer.h>
19 
20 class Viewport
21 {
22 public:
23 
24  // Operators
25  // -----------------------------------------------------------------------------
26  Viewport (vtkSmartPointer<vtkRenderWindow> window, double xmin = 0.0, double ymin = 0.0, double xmax = 1.0,
27  double ymax = 1.0);
28 
29  // Accessors
30  // -----------------------------------------------------------------------------
32  getRenderer () const
33  {
34  return renderer_;
35  }
36 
37  void
38  setCamera (Camera* camera)
39  {
40  renderer_->SetActiveCamera (vtkCamera::SafeDownCast (camera->getCamera ()));
41  camera_hud_actor_->SetInput (camera->getName ().c_str ());
42  renderer_->ResetCamera ();
43  }
44 
45 private:
46 
47  // Callbacks
48  // -----------------------------------------------------------------------------
49  static void
50  viewportModifiedCallback (vtkObject* caller, unsigned long int vtkNotUsed(eventId), void* vtkNotUsed(clientData),
51  void* vtkNotUsed(callData));
52 
53  void
54  viewportModified ();
55 
56  static void
57  viewportActorUpdateCallback (vtkObject* caller, unsigned long int vtkNotUsed(eventId), void* vtkNotUsed(clientData),
58  void* vtkNotUsed(callData));
59 
60  void
61  viewportActorUpdate ();
62 
63  static void
64  viewportHudUpdateCallback (vtkObject* caller, unsigned long int vtkNotUsed(eventId), void* vtkNotUsed(clientData),
65  void* vtkNotUsed(callData));
66 
67  void
68  viewportHudUpdate ();
69 
70  // Members
71  // -----------------------------------------------------------------------------
73  vtkSmartPointer<vtkCallbackCommand> viewport_modified_callback_;
74  vtkSmartPointer<vtkCallbackCommand> viewport_actor_update_callback_;
75  vtkSmartPointer<vtkCallbackCommand> viewport_hud_callback_;
76 
77  vtkSmartPointer<vtkTextActor> camera_hud_actor_;
78  vtkSmartPointer<vtkTextActor> fps_hud_actor_;
79  vtkSmartPointer<vtkTextActor> points_hud_actor_;
80 };
81 
82 #endif