1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

handle legacy VTK functions

This commit is contained in:
jasjuang
2017-12-21 01:33:25 -08:00
parent a5c04baec1
commit 235889ddbb
2 changed files with 24 additions and 1 deletions
+10 -1
View File
@@ -91,7 +91,9 @@ cv::viz::Widget cv::viz::Widget::fromPlyFile(const String &file_name)
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
mapper->SetInputConnection( reader->GetOutputPort() );
#if VTK_MAJOR_VERSION < 8
mapper->ImmediateModeRenderingOff();
#endif
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
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 OPACITY: actor->GetProperty()->SetOpacity(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;
#else
case IMMEDIATE_RENDERING: std::cerr << "this property has no effect" << std::endl; break;
#endif
case AMBIENT: actor->GetProperty()->SetAmbient(float(value)); break;
case LIGHTING:
{
@@ -191,8 +197,11 @@ double cv::viz::Widget::getRenderingProperty(int property) const
case POINT_SIZE: value = actor->GetProperty()->GetPointSize(); break;
case OPACITY: value = actor->GetProperty()->GetOpacity(); break;
case LINE_WIDTH: value = actor->GetProperty()->GetLineWidth(); break;
#if VTK_MAJOR_VERSION < 8
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:
{
vtkTextActor* text_actor = vtkTextActor::SafeDownCast(actor);