cv::viz::get(window_name) implementation

pull/1453/head
ozantonkal 11 years ago
parent c37f091cc5
commit 6bc393676d
  1. 6
      modules/viz/src/viz.cpp
  2. 3
      modules/viz/src/viz3d.cpp
  3. 4
      modules/viz/src/viz3d_impl.cpp

@ -112,7 +112,11 @@ cv::viz::VizAccessor * cv::viz::VizAccessor::getInstance()
cv::viz::Viz3d cv::viz::VizAccessor::get(const String & window_name)
{
VizMap::iterator vm_itr = viz_map_.find(window_name);
// Add the prefix Viz
String name("Viz");
name = window_name.empty() ? name : name + " - " + window_name;
VizMap::iterator vm_itr = viz_map_.find(name);
bool exists = vm_itr != viz_map_.end();
if (exists) return vm_itr->second;
else return viz_map_.insert(VizPair(window_name, Viz3d(window_name))).first->second;

@ -28,13 +28,14 @@ void cv::viz::Viz3d::create(const String &window_name)
impl_ = new VizImpl(window_name);
impl_->ref_counter = 1;
// Register the window
// cv::viz::VizAccessor::getInstance()->add(*this);
cv::viz::VizAccessor::getInstance()->add(*this);
}
void cv::viz::Viz3d::release()
{
if (impl_ && CV_XADD(&impl_->ref_counter, -1) == 1)
{
// Erase the window
cv::viz::VizAccessor::getInstance()->remove(getWindowName());
delete impl_;
impl_ = 0;

@ -83,10 +83,8 @@ cv::viz::Viz3d::VizImpl::VizImpl (const std::string &name)
/////////////////////////////////////////////////////////////////////////////////////////////
cv::viz::Viz3d::VizImpl::~VizImpl ()
{
if (interactor_ != NULL)
if (interactor_)
interactor_->DestroyTimer(timer_id_);
if (renderer_) renderer_->Clear();
}
/////////////////////////////////////////////////////////////////////////////////////////////

Loading…
Cancel
Save