mirror of
https://github.com/opencv/opencv.git
synced 2024-11-25 19:50:38 +08:00
cv::viz::get(window_name) implementation
This commit is contained in:
parent
c37f091cc5
commit
6bc393676d
@ -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)
|
||||
interactor_->DestroyTimer (timer_id_);
|
||||
|
||||
if (renderer_) renderer_->Clear();
|
||||
if (interactor_)
|
||||
interactor_->DestroyTimer(timer_id_);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user