From 4aa61dee5046b185cbbe1a43093c4e4f2e0c7ddd Mon Sep 17 00:00:00 2001 From: ozantonkal Date: Sat, 31 Aug 2013 11:54:49 +0200 Subject: [PATCH] minor refactoring interactor_style --- modules/viz/src/interactor_style.cpp | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/modules/viz/src/interactor_style.cpp b/modules/viz/src/interactor_style.cpp index 06e7af4c20..ace60c860f 100644 --- a/modules/viz/src/interactor_style.cpp +++ b/modules/viz/src/interactor_style.cpp @@ -1,9 +1,6 @@ #include "precomp.hpp" - #include "interactor_style.h" -//#include - using namespace cv; ////////////////////////////////////////////////////////////////////////////////////////////// @@ -227,7 +224,7 @@ cv::viz::InteractorStyle::OnKeyDown () { for (actor->InitPathTraversal (); vtkAssemblyPath* path = actor->GetNextPath (); ) { - vtkSmartPointer apart = reinterpret_cast (path->GetLastNode ()->GetViewProp ()); + vtkActor* apart = reinterpret_cast (path->GetLastNode ()->GetViewProp ()); apart->GetProperty ()->SetRepresentationToPoints (); } } @@ -250,15 +247,12 @@ cv::viz::InteractorStyle::OnKeyDown () cam->GetFocalPoint (focal); cam->GetPosition (pos); cam->GetViewUp (view); -#ifndef M_PI - # define M_PI 3.14159265358979323846 // pi -#endif int *win_pos = Interactor->GetRenderWindow ()->GetPosition (); int *win_size = Interactor->GetRenderWindow ()->GetSize (); ofs_cam << clip[0] << "," << clip[1] << "/" << focal[0] << "," << focal[1] << "," << focal[2] << "/" << pos[0] << "," << pos[1] << "," << pos[2] << "/" << view[0] << "," << view[1] << "," << view[2] << "/" << - cam->GetViewAngle () / 180.0 * M_PI << "/" << win_size[0] << "," << win_size[1] << "/" << win_pos[0] << "," << win_pos[1] + cam->GetViewAngle () / 180.0 * CV_PI << "/" << win_size[0] << "," << win_size[1] << "/" << win_pos[0] << "," << win_pos[1] << endl; ofs_cam.close (); @@ -302,7 +296,7 @@ cv::viz::InteractorStyle::OnKeyDown () { for (actor->InitPathTraversal (); vtkAssemblyPath* path = actor->GetNextPath (); ) { - vtkSmartPointer apart = reinterpret_cast (path->GetLastNode ()->GetViewProp ()); + vtkActor* apart = reinterpret_cast (path->GetLastNode ()->GetViewProp ()); float psize = apart->GetProperty ()->GetPointSize (); if (psize < 63.0f) apart->GetProperty ()->SetPointSize (psize + 1.0f); @@ -323,7 +317,7 @@ cv::viz::InteractorStyle::OnKeyDown () { for (actor->InitPathTraversal (); vtkAssemblyPath* path = actor->GetNextPath (); ) { - vtkSmartPointer apart = static_cast (path->GetLastNode ()->GetViewProp ()); + vtkActor* apart = static_cast (path->GetLastNode ()->GetViewProp ()); float psize = apart->GetProperty ()->GetPointSize (); if (psize > 1.0f) apart->GetProperty ()->SetPointSize (psize - 1.0f); @@ -651,17 +645,8 @@ void cv::viz::InteractorStyle::OnMouseWheelBackward () ////////////////////////////////////////////////////////////////////////////////////////////// void cv::viz::InteractorStyle::OnTimer () { - if (!init_) - { - std::cout << "[PCLVisualizerInteractorStyle] Interactor style not initialized. Please call Initialize () before continuing.\n" << std::endl; - return; - } - - if (!renderer_) - { - std::cout << "[PCLVisualizerInteractorStyle] No renderer collection given! Use SetRendererCollection () before continuing." << std::endl; - return; - } + CV_Assert("Interactor style not initialized." && init_); + CV_Assert("Renderer has not been set." && renderer_); renderer_->Render (); Interactor->Render (); }