Merge pull request #10329 from jasjuang:master

pull/10600/head^2
Alexander Alekhin 7 years ago
commit fc1d85bf59
  1. 14
      modules/viz/src/clouds.cpp
  2. 11
      modules/viz/src/widget.cpp

@ -77,7 +77,9 @@ cv::viz::WCloud::WCloud(cv::InputArray cloud, cv::InputArray colors, cv::InputAr
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
VtkUtils::SetInputData(mapper, cloud_source->GetOutput()); VtkUtils::SetInputData(mapper, cloud_source->GetOutput());
mapper->SetScalarModeToUsePointData(); mapper->SetScalarModeToUsePointData();
#if VTK_MAJOR_VERSION < 8
mapper->ImmediateModeRenderingOff(); mapper->ImmediateModeRenderingOff();
#endif
mapper->SetScalarRange(0, 255); mapper->SetScalarRange(0, 255);
mapper->ScalarVisibilityOn(); mapper->ScalarVisibilityOn();
@ -117,7 +119,9 @@ cv::viz::WPaintedCloud::WPaintedCloud(InputArray cloud)
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
VtkUtils::SetInputData(mapper, vtkPolyData::SafeDownCast(elevation->GetOutput())); VtkUtils::SetInputData(mapper, vtkPolyData::SafeDownCast(elevation->GetOutput()));
#if VTK_MAJOR_VERSION < 8
mapper->ImmediateModeRenderingOff(); mapper->ImmediateModeRenderingOff();
#endif
mapper->ScalarVisibilityOn(); mapper->ScalarVisibilityOn();
mapper->SetColorModeToMapScalars(); mapper->SetColorModeToMapScalars();
@ -143,7 +147,9 @@ cv::viz::WPaintedCloud::WPaintedCloud(InputArray cloud, const Point3d& p1, const
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
VtkUtils::SetInputData(mapper, vtkPolyData::SafeDownCast(elevation->GetOutput())); VtkUtils::SetInputData(mapper, vtkPolyData::SafeDownCast(elevation->GetOutput()));
#if VTK_MAJOR_VERSION < 8
mapper->ImmediateModeRenderingOff(); mapper->ImmediateModeRenderingOff();
#endif
mapper->ScalarVisibilityOn(); mapper->ScalarVisibilityOn();
mapper->SetColorModeToMapScalars(); mapper->SetColorModeToMapScalars();
@ -182,7 +188,9 @@ cv::viz::WPaintedCloud::WPaintedCloud(InputArray cloud, const Point3d& p1, const
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
VtkUtils::SetInputData(mapper, vtkPolyData::SafeDownCast(elevation->GetOutput())); VtkUtils::SetInputData(mapper, vtkPolyData::SafeDownCast(elevation->GetOutput()));
#if VTK_MAJOR_VERSION < 8
mapper->ImmediateModeRenderingOff(); mapper->ImmediateModeRenderingOff();
#endif
mapper->ScalarVisibilityOn(); mapper->ScalarVisibilityOn();
mapper->SetColorModeToMapScalars(); mapper->SetColorModeToMapScalars();
mapper->SetLookupTable(color_transfer); mapper->SetLookupTable(color_transfer);
@ -211,7 +219,9 @@ cv::viz::WCloudCollection::WCloudCollection()
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(append_filter->GetOutputPort()); mapper->SetInputConnection(append_filter->GetOutputPort());
mapper->SetScalarModeToUsePointData(); mapper->SetScalarModeToUsePointData();
#if VTK_MAJOR_VERSION < 8
mapper->ImmediateModeRenderingOff(); mapper->ImmediateModeRenderingOff();
#endif
mapper->SetScalarRange(0, 255); mapper->SetScalarRange(0, 255);
mapper->ScalarVisibilityOn(); mapper->ScalarVisibilityOn();
@ -416,7 +426,9 @@ cv::viz::WMesh::WMesh(const Mesh &mesh)
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetScalarModeToUsePointData(); mapper->SetScalarModeToUsePointData();
#if VTK_MAJOR_VERSION < 8
mapper->ImmediateModeRenderingOff(); mapper->ImmediateModeRenderingOff();
#endif
VtkUtils::SetInputData(mapper, polydata); VtkUtils::SetInputData(mapper, polydata);
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New(); vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
@ -468,7 +480,9 @@ cv::viz::WWidgetMerger::WWidgetMerger()
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(append_filter->GetOutputPort()); mapper->SetInputConnection(append_filter->GetOutputPort());
mapper->SetScalarModeToUsePointData(); mapper->SetScalarModeToUsePointData();
#if VTK_MAJOR_VERSION < 8
mapper->ImmediateModeRenderingOff(); mapper->ImmediateModeRenderingOff();
#endif
mapper->SetScalarRange(0, 255); mapper->SetScalarRange(0, 255);
mapper->ScalarVisibilityOn(); mapper->ScalarVisibilityOn();

@ -91,7 +91,9 @@ cv::viz::Widget cv::viz::Widget::fromPlyFile(const String &file_name)
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New(); vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
mapper->SetInputConnection( reader->GetOutputPort() ); mapper->SetInputConnection( reader->GetOutputPort() );
#if VTK_MAJOR_VERSION < 8
mapper->ImmediateModeRenderingOff(); mapper->ImmediateModeRenderingOff();
#endif
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New(); vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->GetProperty()->SetInterpolationToFlat(); actor->GetProperty()->SetInterpolationToFlat();
@ -113,7 +115,11 @@ void cv::viz::Widget::setRenderingProperty(int property, double value)
case POINT_SIZE: actor->GetProperty()->SetPointSize(float(value)); break; case POINT_SIZE: actor->GetProperty()->SetPointSize(float(value)); break;
case OPACITY: actor->GetProperty()->SetOpacity(value); break; case OPACITY: actor->GetProperty()->SetOpacity(value); break;
case LINE_WIDTH: actor->GetProperty()->SetLineWidth(float(value)); break; case LINE_WIDTH: actor->GetProperty()->SetLineWidth(float(value)); break;
#if VTK_MAJOR_VERSION < 8
case IMMEDIATE_RENDERING: actor->GetMapper()->SetImmediateModeRendering(int(value)); break; case IMMEDIATE_RENDERING: actor->GetMapper()->SetImmediateModeRendering(int(value)); break;
#else
case IMMEDIATE_RENDERING: std::cerr << "this property has no effect" << std::endl; break;
#endif
case AMBIENT: actor->GetProperty()->SetAmbient(float(value)); break; case AMBIENT: actor->GetProperty()->SetAmbient(float(value)); break;
case LIGHTING: case LIGHTING:
{ {
@ -191,8 +197,11 @@ double cv::viz::Widget::getRenderingProperty(int property) const
case POINT_SIZE: value = actor->GetProperty()->GetPointSize(); break; case POINT_SIZE: value = actor->GetProperty()->GetPointSize(); break;
case OPACITY: value = actor->GetProperty()->GetOpacity(); break; case OPACITY: value = actor->GetProperty()->GetOpacity(); break;
case LINE_WIDTH: value = actor->GetProperty()->GetLineWidth(); break; case LINE_WIDTH: value = actor->GetProperty()->GetLineWidth(); break;
#if VTK_MAJOR_VERSION < 8
case IMMEDIATE_RENDERING: value = actor->GetMapper()->GetImmediateModeRendering(); break; case IMMEDIATE_RENDERING: value = actor->GetMapper()->GetImmediateModeRendering(); break;
#else
case IMMEDIATE_RENDERING: std::cerr << "this property has no effect" << std::endl; break;
#endif
case FONT_SIZE: case FONT_SIZE:
{ {
vtkTextActor* text_actor = vtkTextActor::SafeDownCast(actor); vtkTextActor* text_actor = vtkTextActor::SafeDownCast(actor);

Loading…
Cancel
Save