polydata->GetPointData()->SetScalars(scalars);
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
+#if VTK_MAJOR_VERSION <= 5
mapper->SetInput(polydata);
+#else
+ mapper->SetInputData(polydata);
+#endif
Vec3d minmax(scalars->GetRange());
mapper->SetScalarRange(minmax.val);
vtkSmartPointer<vtkPolyData> polydata = CreateCloudWidget::create(cloud, nr_points);
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
+#if VTK_MAJOR_VERSION <= 5
mapper->SetInput(polydata);
+#else
+ mapper->SetInputData(polydata);
+#endif
bool interpolation = (polydata && polydata->GetNumberOfCells() != polydata->GetNumberOfVerts());
{
// This is the first cloud
vtkSmartPointer<vtkDataSetMapper> mapper_new = vtkSmartPointer<vtkDataSetMapper>::New();
+#if VTK_MAJOR_VERSION <= 5
mapper_new->SetInputConnection(poly_data->GetProducerPort());
+#else
+ mapper_new->SetInputData(poly_data);
+#endif
mapper_new->SetScalarRange(minmax.val);
mapper_new->SetScalarModeToUsePointData();
CV_Assert("Cloud Widget without data" && data);
vtkSmartPointer<vtkAppendPolyData> appendFilter = vtkSmartPointer<vtkAppendPolyData>::New();
+#if VTK_MAJOR_VERSION <= 5
appendFilter->AddInputConnection(mapper->GetInput()->GetProducerPort());
appendFilter->AddInputConnection(poly_data->GetProducerPort());
+#else
+ appendFilter->AddInputData(data);
+ appendFilter->AddInputData(poly_data);
+#endif
mapper->SetInputConnection(appendFilter->GetOutputPort());
// Update the number of cloud points
vtkSmartPointer<vtkTransformPolyDataFilter> transform_filter = vtkSmartPointer<vtkTransformPolyDataFilter>::New();
transform_filter->SetTransform(transform);
+#if VTK_MAJOR_VERSION <= 5
transform_filter->SetInputConnection(polydata->GetProducerPort());
+#else
+ transform_filter->SetInputData(polydata);
+#endif
transform_filter->Update();
vtkLODActor *actor = vtkLODActor::SafeDownCast(WidgetAccessor::getProp(*this));
vtkSmartPointer<vtkTransformPolyDataFilter> transform_filter = vtkSmartPointer<vtkTransformPolyDataFilter>::New();
transform_filter->SetTransform(transform);
+#if VTK_MAJOR_VERSION <= 5
transform_filter->SetInputConnection(polydata->GetProducerPort());
+#else
+ transform_filter->SetInputData(polydata);
+#endif
transform_filter->Update();
vtkLODActor *actor = vtkLODActor::SafeDownCast(WidgetAccessor::getProp(*this));
polyData->SetLines(lines);
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
+#if VTK_MAJOR_VERSION <= 5
mapper->SetInput(polyData);
+#else
+ mapper->SetInputData(polyData);
+#endif
mapper->SetColorModeToMapScalars();
mapper->SetScalarModeToUsePointData();
poly_grid->Allocate(1, 1);
poly_grid->InsertNextCell(polygon->GetCellType(), polygon->GetPointIds());
poly_grid->SetPoints(points);
- poly_grid->Update();
if (scalars)
poly_grid->GetPointData()->SetScalars(scalars);
actor->GetProperty()->ShadingOff();
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
+#if VTK_MAJOR_VERSION <= 5
mapper->SetInput(data);
+#else
+ mapper->SetInputData(data);
+#endif
mapper->ImmediateModeRenderingOff();
vtkIdType numberOfCloudPoints = nr_points * 0.1;
line->Update();
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
- mapper->SetInput(line->GetOutput());
+ mapper->SetInputConnection(line->GetOutputPort());
vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New();
actor->SetMapper(mapper);
struct cv::viz::PlaneWidget::SetSizeImpl
{
template<typename _Tp>
- static vtkSmartPointer<vtkPolyData> setSize(const Vec<_Tp, 3> ¢er, vtkSmartPointer<vtkPolyData> poly_data, double size)
+ static vtkSmartPointer<vtkTransformPolyDataFilter> setSize(const Vec<_Tp, 3> ¢er, vtkSmartPointer<vtkAlgorithmOutput> poly_data_port, double size)
{
vtkSmartPointer<vtkTransform> transform = vtkSmartPointer<vtkTransform>::New();
transform->PreMultiply();
transform->Translate(-center[0], -center[1], -center[2]);
vtkSmartPointer<vtkTransformPolyDataFilter> transform_filter = vtkSmartPointer<vtkTransformPolyDataFilter>::New();
- transform_filter->SetInput(poly_data);
+ transform_filter->SetInputConnection(poly_data_port);
transform_filter->SetTransform(transform);
transform_filter->Update();
- return transform_filter->GetOutput();
+ return transform_filter;
}
};
plane->GetOrigin(p_center.val);
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
- mapper->SetInput(SetSizeImpl::setSize(p_center, plane->GetOutput(), size));
+ mapper->SetInputConnection(SetSizeImpl::setSize(p_center, plane->GetOutputPort(), size)->GetOutputPort());
vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New();
actor->SetMapper(mapper);
plane->SetCenter(p_center[0], p_center[1], p_center[2]);
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
- mapper->SetInput(SetSizeImpl::setSize(p_center, plane->GetOutput(), size));
+ mapper->SetInputConnection(SetSizeImpl::setSize(p_center, plane->GetOutputPort(), size)->GetOutputPort());
vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New();
actor->SetMapper(mapper);
sphere->Update();
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
- mapper->SetInput(sphere->GetOutput());
+ mapper->SetInputConnection(sphere->GetOutputPort());
vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New();
actor->SetMapper(mapper);
transformPD->SetInputConnection(arrowSource->GetOutputPort());
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
- mapper->SetInput(transformPD->GetOutput());
+ mapper->SetInputConnection(transformPD->GetOutputPort());
vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New();
actor->SetMapper(mapper);
tf->SetInputConnection(disk->GetOutputPort());
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
- mapper->SetInput(tf->GetOutput());
+ mapper->SetInputConnection(tf->GetOutputPort());
vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New();
actor->SetMapper(mapper);
tuber->SetNumberOfSides(numsides);
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
- mapper->SetInput(tuber->GetOutput());
+ mapper->SetInputConnection(tuber->GetOutputPort());
vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New();
actor->SetMapper(mapper);
{
vtkSmartPointer<vtkOutlineSource> cube = vtkSmartPointer<vtkOutlineSource>::New();
cube->SetBounds(pt_min.x, pt_max.x, pt_min.y, pt_max.y, pt_min.z, pt_max.z);
- mapper->SetInput(cube->GetOutput());
+ mapper->SetInputConnection(cube->GetOutputPort());
}
else
{
vtkSmartPointer<vtkCubeSource> cube = vtkSmartPointer<vtkCubeSource>::New();
cube->SetBounds(pt_min.x, pt_max.x, pt_min.y, pt_max.y, pt_min.z, pt_max.z);
- mapper->SetInput(cube->GetOutput());
+ mapper->SetInputConnection(cube->GetOutputPort());
}
vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New();
axes_colors->InsertNextValue(1.0);
vtkSmartPointer<vtkPolyData> axes_data = axes->GetOutput();
+#if VTK_MAJOR_VERSION <= 5
axes_data->Update();
+#else
+ axes->Update();
+#endif
axes_data->GetPointData()->SetScalars(axes_colors);
vtkSmartPointer<vtkTubeFilter> axes_tubes = vtkSmartPointer<vtkTubeFilter>::New();
+#if VTK_MAJOR_VERSION <= 5
axes_tubes->SetInput(axes_data);
+#else
+ axes_tubes->SetInputData(axes_data);
+#endif
axes_tubes->SetRadius(axes->GetScaleFactor() / 50.0);
axes_tubes->SetNumberOfSides(6);
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
mapper->SetScalarModeToUsePointData();
- mapper->SetInput(axes_tubes->GetOutput());
+ mapper->SetInputConnection(axes_tubes->GetOutputPort());
vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New();
actor->SetMapper(mapper);
polyData->SetLines(cells);
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
+#if VTK_MAJOR_VERSION <= 5
mapper->SetInput(polyData);
+#else
+ mapper->SetInputData(polyData);
+#endif
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
// Extract the edges so we have the grid
vtkSmartPointer<vtkExtractEdges> filter = vtkSmartPointer<vtkExtractEdges>::New();
+#if VTK_MAJOR_VERSION <= 5
filter->SetInputConnection(grid->GetProducerPort());
+#else
+ filter->SetInputData(grid);
+#endif
filter->Update();
return filter->GetOutput();
}
vtkSmartPointer<vtkPolyData> grid = GridImpl::createGrid(dimensions, spacing);
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
+#if VTK_MAJOR_VERSION <= 5
mapper->SetInputConnection(grid->GetProducerPort());
+#else
+ mapper->SetInputData(grid);
+#endif
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
vtkSmartPointer<vtkTransformPolyDataFilter> transform_filter = vtkSmartPointer<vtkTransformPolyDataFilter>::New();
transform_filter->SetTransform(transform);
+#if VTK_MAJOR_VERSION <= 5
transform_filter->SetInputConnection(grid->GetProducerPort());
+#else
+ transform_filter->SetInputData(grid);
+#endif
transform_filter->Update();
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
// Need to flip the image as the coordinates are different in OpenCV and VTK
vtkSmartPointer<vtkImageFlip> flipFilter = vtkSmartPointer<vtkImageFlip>::New();
flipFilter->SetFilteredAxis(1); // Vertical flip
+#if VTK_MAJOR_VERSION <= 5
flipFilter->SetInputConnection(vtk_image->GetProducerPort());
+#else
+ flipFilter->SetInputData(vtk_image);
+#endif
flipFilter->Update();
// Scale the image based on the Rect
// Need to flip the image as the coordinates are different in OpenCV and VTK
vtkSmartPointer<vtkImageFlip> flipFilter = vtkSmartPointer<vtkImageFlip>::New();
flipFilter->SetFilteredAxis(1); // Vertical flip
+#if VTK_MAJOR_VERSION <= 5
flipFilter->SetInputConnection(vtk_image->GetProducerPort());
+#else
+ flipFilter->SetInputData(vtk_image);
+#endif
flipFilter->Update();
mapper->SetInputConnection(flipFilter->GetOutputPort());
// Need to flip the image as the coordinates are different in OpenCV and VTK
vtkSmartPointer<vtkImageFlip> flipFilter = vtkSmartPointer<vtkImageFlip>::New();
flipFilter->SetFilteredAxis(1); // Vertical flip
+#if VTK_MAJOR_VERSION <= 5
flipFilter->SetInputConnection(vtk_image->GetProducerPort());
+#else
+ flipFilter->SetInputData(vtk_image);
+#endif
flipFilter->Update();
Vec3d plane_center(size.width * 0.5, size.height * 0.5, 0.0);
// Need to flip the image as the coordinates are different in OpenCV and VTK
vtkSmartPointer<vtkImageFlip> flipFilter = vtkSmartPointer<vtkImageFlip>::New();
flipFilter->SetFilteredAxis(1); // Vertical flip
+#if VTK_MAJOR_VERSION <= 5
flipFilter->SetInputConnection(vtk_image->GetProducerPort());
+#else
+ flipFilter->SetInputData(vtk_image);
+#endif
flipFilter->Update();
vtkSmartPointer<vtkPlaneSource> plane = vtkSmartPointer<vtkPlaneSource>::New();
// Need to flip the image as the coordinates are different in OpenCV and VTK
vtkSmartPointer<vtkImageFlip> flipFilter = vtkSmartPointer<vtkImageFlip>::New();
flipFilter->SetFilteredAxis(1); // Vertical flip
+#if VTK_MAJOR_VERSION <= 5
flipFilter->SetInputConnection(vtk_image->GetProducerPort());
+#else
+ flipFilter->SetInputData(vtk_image);
+#endif
flipFilter->Update();
// Apply the texture
// Need to flip the image as the coordinates are different in OpenCV and VTK
vtkSmartPointer<vtkImageFlip> flipFilter = vtkSmartPointer<vtkImageFlip>::New();
flipFilter->SetFilteredAxis(1); // Vertical flip
+#if VTK_MAJOR_VERSION <= 5
flipFilter->SetInputConnection(vtk_image->GetProducerPort());
+#else
+ flipFilter->SetInputData(vtk_image);
+#endif
flipFilter->Update();
Vec3d plane_center(0.0, 0.0, scale);
frustumSource->Update();
vtkSmartPointer<vtkExtractEdges> filter = vtkSmartPointer<vtkExtractEdges>::New();
- filter->SetInput(frustumSource->GetOutput());
+ filter->SetInputConnection(frustumSource->GetOutputPort());
filter->Update();
// Frustum needs to be textured or else it can't be combined with image
axes_colors->InsertNextValue(1.0);
vtkSmartPointer<vtkPolyData> axes_data = axes->GetOutput();
+#if VTK_MAJOR_VERSION <= 5
axes_data->Update();
+#else
+ axes->Update();
+#endif
axes_data->GetPointData()->SetScalars(axes_colors);
vtkSmartPointer<vtkTubeFilter> axes_tubes = vtkSmartPointer<vtkTubeFilter>::New();
+#if VTK_MAJOR_VERSION <= 5
axes_tubes->SetInput(axes_data);
+#else
+ axes_tubes->SetInputData(axes_data);
+#endif
axes_tubes->SetRadius(axes->GetScaleFactor() / 50.0);
axes_tubes->SetNumberOfSides(6);
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
mapper->SetScalarModeToUsePointData();
- mapper->SetInput(axes_tubes->GetOutput());
+ mapper->SetInputConnection(axes_tubes->GetOutputPort());
vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New();
actor->SetMapper(mapper);
frustumSource->Update();
vtkSmartPointer<vtkExtractEdges> filter = vtkSmartPointer<vtkExtractEdges>::New();
- filter->SetInput(frustumSource->GetOutput());
+ filter->SetInputConnection(frustumSource->GetOutputPort());
filter->Update();
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
- mapper->SetInput(filter->GetOutput());
+ mapper->SetInputConnection(filter->GetOutputPort());
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
// Extract the edges so we have the grid
vtkSmartPointer<vtkExtractEdges> filter = vtkSmartPointer<vtkExtractEdges>::New();
- filter->SetInput(frustumSource->GetOutput());
+ filter->SetInputConnection(frustumSource->GetOutputPort());
filter->Update();
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
- mapper->SetInput(filter->GetOutput());
+ mapper->SetInputConnection(filter->GetOutputPort());
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
transform->SetMatrix(mat_trans);
vtkSmartPointer<vtkTransformPolyDataFilter> filter = vtkSmartPointer<vtkTransformPolyDataFilter>::New();
+#if VTK_MAJOR_VERSION <= 5
filter->SetInput(new_data);
+#else
+ filter->SetInputData(new_data);
+#endif
filter->SetTransform(transform);
filter->Update();
colors->FillComponent(2, color[0]);
polyData->GetPointData()->SetScalars(colors);
+#if VTK_MAJOR_VERSION <= 5
appendFilter->AddInputConnection(polyData->GetProducerPort());
+#else
+ appendFilter->AddInputData(polyData);
+#endif
}
if ((~display_mode & 3) ^ TrajectoryWidget::DISPLAY_FRAMES)
axes_colors->InsertNextTuple3(0,0,255);
vtkSmartPointer<vtkPolyData> axes_data = axes->GetOutput();
+#if VTK_MAJOR_VERSION <= 5
axes_data->Update();
+#else
+ axes->Update();
+#endif
axes_data->GetPointData()->SetScalars(axes_colors);
vtkSmartPointer<vtkTubeFilter> axes_tubes = vtkSmartPointer<vtkTubeFilter>::New();
+#if VTK_MAJOR_VERSION <= 5
axes_tubes->SetInput(axes_data);
+#else
+ axes_tubes->SetInputData(axes_data);
+#endif
axes_tubes->SetRadius(axes->GetScaleFactor() / 50.0);
axes_tubes->SetNumberOfSides(6);
axes_tubes->Update();
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetScalarModeToUsePointData();
- mapper->SetInput(appendFilter->GetOutput());
+ mapper->SetInputConnection(appendFilter->GetOutputPort());
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
// Extract the edges
vtkSmartPointer<vtkExtractEdges> filter = vtkSmartPointer<vtkExtractEdges>::New();
- filter->SetInput(frustumSource->GetOutput());
+ filter->SetInputConnection(frustumSource->GetOutputPort());
filter->Update();
vtkSmartPointer<vtkAppendPolyData> appendFilter = vtkSmartPointer<vtkAppendPolyData>::New();
ApplyPath::applyPath(filter->GetOutput(), appendFilter, path);
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
- mapper->SetInput(appendFilter->GetOutput());
+ mapper->SetInputConnection(appendFilter->GetOutputPort());
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
// Extract the edges
vtkSmartPointer<vtkExtractEdges> filter = vtkSmartPointer<vtkExtractEdges>::New();
- filter->SetInput(frustumSource->GetOutput());
+ filter->SetInputConnection(frustumSource->GetOutputPort());
filter->Update();
vtkSmartPointer<vtkAppendPolyData> appendFilter = vtkSmartPointer<vtkAppendPolyData>::New();
ApplyPath::applyPath(filter->GetOutput(), appendFilter, path);
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
- mapper->SetInput(appendFilter->GetOutput());
+ mapper->SetInputConnection(appendFilter->GetOutputPort());
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetScalarModeToUseCellData();
- mapper->SetInput(appendFilter->GetOutput());
+ mapper->SetInputConnection(appendFilter->GetOutputPort());
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);