From 769eba7535d35b384ba5f45fbb006894a3036895 Mon Sep 17 00:00:00 2001 From: ozantonkal Date: Mon, 15 Jul 2013 16:47:19 +0200 Subject: [PATCH] cube wire_frame fix using vtkOutlineSource --- modules/viz/src/precomp.hpp | 1 + modules/viz/src/shape_widgets.cpp | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/modules/viz/src/precomp.hpp b/modules/viz/src/precomp.hpp index df3a970404..73a1a85f5b 100644 --- a/modules/viz/src/precomp.hpp +++ b/modules/viz/src/precomp.hpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include diff --git a/modules/viz/src/shape_widgets.cpp b/modules/viz/src/shape_widgets.cpp index 2272e17f8a..89818062e5 100644 --- a/modules/viz/src/shape_widgets.cpp +++ b/modules/viz/src/shape_widgets.cpp @@ -269,19 +269,24 @@ template<> cv::viz::CylinderWidget cv::viz::Widget::cast cube = vtkSmartPointer::New (); - cube->SetBounds (pt_min.x, pt_max.x, pt_min.y, pt_max.y, pt_min.z, pt_max.z); +{ + vtkSmartPointer mapper = vtkSmartPointer::New (); + if (wire_frame) + { + vtkSmartPointer cube = vtkSmartPointer::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 ()); + } + else + { + vtkSmartPointer cube = vtkSmartPointer::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 ()); + } - vtkSmartPointer mapper = vtkSmartPointer::New (); - mapper->SetInput(cube->GetOutput ()); - vtkSmartPointer actor = vtkSmartPointer::New(); actor->SetMapper(mapper); - if (wire_frame) - actor->GetProperty ()->SetRepresentationToWireframe (); - WidgetAccessor::setProp(*this, actor); setColor(color); }