From daa2a205a41fa44c4d8895d9e3f77c02d7aa9f14 Mon Sep 17 00:00:00 2001 From: ozantonkal Date: Wed, 3 Jul 2013 22:27:09 +0300 Subject: [PATCH] remove redundant methods, implement assignment operator for widget --- modules/viz/include/opencv2/viz/types.hpp | 5 ++++- modules/viz/src/types.cpp | 23 ++++++++++++----------- modules/viz/test/test_viz3d.cpp | 4 +++- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/modules/viz/include/opencv2/viz/types.hpp b/modules/viz/include/opencv2/viz/types.hpp index 27fc074..39432e2 100644 --- a/modules/viz/include/opencv2/viz/types.hpp +++ b/modules/viz/include/opencv2/viz/types.hpp @@ -119,6 +119,9 @@ namespace temp_viz public: Widget(); Widget(const Widget &other); + Widget& operator =(const Widget &other); + + void copyTo(Widget &dst); void setColor(const Color &color); void setPose(const Affine3f &pose); @@ -134,6 +137,6 @@ namespace temp_viz class LineWidget : public Widget { public: - LineWidget(const Point3f &pt1, const Point3f &pt2, const Color &color); + LineWidget(const Point3f &pt1, const Point3f &pt2, const Color &color = Color(255,255,255)); }; } diff --git a/modules/viz/src/types.cpp b/modules/viz/src/types.cpp index 5670f75..8500d2a 100644 --- a/modules/viz/src/types.cpp +++ b/modules/viz/src/types.cpp @@ -75,17 +75,6 @@ public: return Affine3f(matrix_cv); } - void setActorMapperInput(const vtkSmartPointer &data) - { - vtkSmartPointer mapper = reinterpret_cast(actor->GetMapper ()); - if (mapper == 0) - { - mapper = vtkSmartPointer::New (); - actor->SetMapper(mapper); - } - mapper->SetInput (data); - } - protected: vtkSmartPointer convertToVtkMatrix (const cv::Matx44f &m) const @@ -115,6 +104,18 @@ temp_viz::Widget::Widget(const Widget &other) impl_ = other.impl_; } +temp_viz::Widget& temp_viz::Widget::operator =(const Widget &other) +{ + if (this != &other) + impl_ = other.impl_; + return *this; +} + +void temp_viz::Widget::copyTo(Widget &dst) +{ + // TODO Deep copy the data if there is any +} + void temp_viz::Widget::setColor(const Color &color) { impl_->setColor(color); diff --git a/modules/viz/test/test_viz3d.cpp b/modules/viz/test/test_viz3d.cpp index 31b85f9..1bce1a3 100644 --- a/modules/viz/test/test_viz3d.cpp +++ b/modules/viz/test/test_viz3d.cpp @@ -97,6 +97,8 @@ TEST(Viz_viz3d, accuracy) temp_viz::LineWidget lw(cv::Point3f(0.0,0.0,0.0), cv::Point3f(1.0,1.0,1.0), temp_viz::Color(0,255,0)); v.showWidget("line", lw); + temp_viz::LineWidget lw2 = lw; + while(!v.wasStopped()) { // Creating new point cloud with id cloud1 @@ -112,7 +114,7 @@ TEST(Viz_viz3d, accuracy) v.setShapePose("circle1", cloudPosition); v.setShapePose("sphere1", cloudPosition); v.setShapePose("arrow1", cloudPosition); - lw.setColor(temp_viz::Color(col_blue, col_green, col_red)); + lw2.setColor(temp_viz::Color(col_blue, col_green, col_red)); angle_x += 0.1f; angle_y -= 0.1f; -- 2.7.4