Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include <pcl/apps/modeler/surface_actor_item.h>
00038
00039 #include <pcl/apps/modeler/cloud_mesh.h>
00040
00041 #include <vtkLODActor.h>
00042 #include <vtkPolyData.h>
00043 #include <vtkCellArray.h>
00044 #include <vtkDataSetMapper.h>
00045 #include <vtkPointData.h>
00046 #include <vtkProperty.h>
00047
00049 pcl::modeler::SurfaceActorItem::SurfaceActorItem(QTreeWidgetItem* parent,
00050 const boost::shared_ptr<CloudMesh>& cloud_mesh,
00051 const vtkSmartPointer<vtkRenderWindow>& render_window)
00052 :ChannelActorItem(parent, cloud_mesh, render_window, vtkSmartPointer<vtkLODActor>::New(), "Surface")
00053 {
00054 }
00055
00057 pcl::modeler::SurfaceActorItem::~SurfaceActorItem ()
00058 {
00059
00060 }
00061
00063 void
00064 pcl::modeler::SurfaceActorItem::initImpl()
00065 {
00066 poly_data_->SetPoints(cloud_mesh_->getVtkPoints());
00067 poly_data_->SetStrips(cloud_mesh_->getVtkPolygons());
00068
00069 vtkSmartPointer<vtkDataArray> scalars;
00070 cloud_mesh_->getColorScalarsFromField(scalars, color_scheme_);
00071 poly_data_->GetPointData ()->SetScalars (scalars);
00072 poly_data_->Update();
00073
00074 vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
00075 mapper->SetInput(poly_data_);
00076
00077 double minmax[2];
00078 scalars->GetRange(minmax);
00079 mapper->SetScalarRange(minmax);
00080
00081 mapper->SetScalarModeToUsePointData ();
00082 mapper->InterpolateScalarsBeforeMappingOn ();
00083 mapper->ScalarVisibilityOn ();
00084 mapper->ImmediateModeRenderingOff ();
00085
00086 vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>(dynamic_cast<vtkLODActor*>(actor_.GetPointer()));
00087 actor->SetMapper(mapper);
00088
00089 actor->SetNumberOfCloudPoints(int(std::max<vtkIdType> (1, poly_data_->GetNumberOfPoints () / 10)));
00090 actor->GetProperty ()->SetInterpolationToFlat ();
00091
00092 actor->GetProperty ()->SetRepresentationToSurface ();
00093 actor->GetProperty ()->BackfaceCullingOn ();
00094 actor->GetProperty ()->EdgeVisibilityOff ();
00095 actor->GetProperty ()->ShadingOff ();
00096
00097 return;
00098 }
00099
00101 void
00102 pcl::modeler::SurfaceActorItem::updateImpl()
00103 {
00104 vtkSmartPointer<vtkDataArray> scalars;
00105 cloud_mesh_->getColorScalarsFromField(scalars, "random");
00106 poly_data_->GetPointData ()->SetScalars (scalars);
00107 double minmax[2];
00108 scalars->GetRange(minmax);
00109 actor_->GetMapper()->SetScalarRange(minmax);
00110
00111 poly_data_->Update();
00112
00113 return;
00114 }
00115
00117 void
00118 pcl::modeler::SurfaceActorItem::prepareContextMenu(QMenu *) const
00119 {
00120
00121 }
00122
00124 void
00125 pcl::modeler::SurfaceActorItem::prepareProperties(ParameterDialog *)
00126 {
00127
00128 }
00129
00131 void
00132 pcl::modeler::SurfaceActorItem::setProperties()
00133 {
00134
00135 }