Commit 286f81f3 authored by Ozan Tonkal's avatar Ozan Tonkal

fix crucial bug in get method, hide add and remove methods from user

parent 2969ec02
...@@ -101,8 +101,6 @@ namespace cv ...@@ -101,8 +101,6 @@ namespace cv
static void release(); static void release();
Viz3d get(const String &window_name); Viz3d get(const String &window_name);
void add(Viz3d window);
void remove(const String &window_name);
//! window names automatically have Viz - prefix even though not provided by the users //! window names automatically have Viz - prefix even though not provided by the users
static void generateWindowName(const String &window_name, String &output); static void generateWindowName(const String &window_name, String &output);
...@@ -111,9 +109,14 @@ namespace cv ...@@ -111,9 +109,14 @@ namespace cv
VizAccessor(); // Singleton VizAccessor(); // Singleton
~VizAccessor(); ~VizAccessor();
void add(Viz3d window);
void remove(const String &window_name);
static VizAccessor * instance_; static VizAccessor * instance_;
static bool is_instantiated_; static bool is_instantiated_;
static VizMap viz_map_; static VizMap viz_map_;
friend class Viz3d;
}; };
} /* namespace viz */ } /* namespace viz */
} /* namespace cv */ } /* namespace cv */
......
...@@ -126,7 +126,7 @@ cv::viz::Viz3d cv::viz::VizAccessor::get(const String & window_name) ...@@ -126,7 +126,7 @@ cv::viz::Viz3d cv::viz::VizAccessor::get(const String & window_name)
VizMap::iterator vm_itr = viz_map_.find(name); VizMap::iterator vm_itr = viz_map_.find(name);
bool exists = vm_itr != viz_map_.end(); bool exists = vm_itr != viz_map_.end();
if (exists) return vm_itr->second; if (exists) return vm_itr->second;
else return viz_map_.insert(VizPair(window_name, Viz3d(window_name))).first->second; else return Viz3d(window_name);
} }
void cv::viz::VizAccessor::add(Viz3d window) void cv::viz::VizAccessor::add(Viz3d window)
...@@ -135,7 +135,7 @@ void cv::viz::VizAccessor::add(Viz3d window) ...@@ -135,7 +135,7 @@ void cv::viz::VizAccessor::add(Viz3d window)
VizMap::iterator vm_itr = viz_map_.find(window_name); VizMap::iterator vm_itr = viz_map_.find(window_name);
bool exists = vm_itr != viz_map_.end(); bool exists = vm_itr != viz_map_.end();
if (exists) return ; if (exists) return ;
viz_map_.insert(std::pair<String,Viz3d>(window_name, window)); viz_map_.insert(VizPair(window_name, window));
} }
void cv::viz::VizAccessor::remove(const String &window_name) void cv::viz::VizAccessor::remove(const String &window_name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment