Point Cloud Library (PCL)  1.7.0
axes.h
1 #ifndef PCL_OUTOFCORE_AXES_H_
2 #define PCL_OUTOFCORE_AXES_H_
3 
4 // C++
5 #include <iostream>
6 #include <string>
7 
8 // PCL
9 #include "object.h"
10 
11 // VTK
12 #include <vtkActor.h>
13 #include <vtkTubeFilter.h>
14 #include <vtkAxes.h>
15 //#include <vtkDataSetMapper.h>
16 #include <vtkFloatArray.h>
17 #include <vtkProperty.h>
18 #include <vtkPolyData.h>
19 #include <vtkPolyDataMapper.h>
20 #include <vtkSmartPointer.h>
21 
22 class Axes : public Object
23 {
24 public:
25 
26  // Operators
27  // -----------------------------------------------------------------------------
28  Axes (std::string name, float size = 1.0) :
29  Object (name)
30  {
32  axes_->SetOrigin (0, 0, 0);
33  axes_->SetScaleFactor (size);
34 
36  axes_colors->Allocate (6);
37  axes_colors->InsertNextValue (0.0);
38  axes_colors->InsertNextValue (0.0);
39  axes_colors->InsertNextValue (0.5);
40  axes_colors->InsertNextValue (0.5);
41  axes_colors->InsertNextValue (1.0);
42  axes_colors->InsertNextValue (1.0);
43 
44  vtkSmartPointer<vtkPolyData> axes_data = axes_->GetOutput ();
45  axes_data->Update ();
46  axes_data->GetPointData ()->SetScalars (axes_colors);
47 
49  axes_tubes->SetInput (axes_data);
50  axes_tubes->SetRadius (axes_->GetScaleFactor () / 100.0);
51  axes_tubes->SetNumberOfSides (6);
52 
54  axes_mapper->SetScalarModeToUsePointData ();
55  axes_mapper->SetInput (axes_tubes->GetOutput ());
56 
57  axes_actor_ = vtkSmartPointer<vtkActor>::New ();
58  axes_actor_->GetProperty ()->SetLighting (false);
59  axes_actor_->SetMapper (axes_mapper);
60 
61  addActor (axes_actor_);
62  }
63  //~Axes () { }
64 
65  // Accessors
66  // -----------------------------------------------------------------------------
68  getAxes () const
69  {
70  return axes_;
71  }
72 
74  getAxesActor () const
75  {
76  return axes_actor_;
77  }
78 
79 private:
80 
81  // Members
82  // -----------------------------------------------------------------------------
84  vtkSmartPointer<vtkActor> axes_actor_;
85 
86 };
87 
88 #endif
89