cv::viz::get(window_name) implementation
This commit is contained in:
@@ -112,7 +112,11 @@ cv::viz::VizAccessor * cv::viz::VizAccessor::getInstance()
|
|||||||
|
|
||||||
cv::viz::Viz3d cv::viz::VizAccessor::get(const String & window_name)
|
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();
|
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 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_ = new VizImpl(window_name);
|
||||||
impl_->ref_counter = 1;
|
impl_->ref_counter = 1;
|
||||||
// Register the window
|
// Register the window
|
||||||
// cv::viz::VizAccessor::getInstance()->add(*this);
|
cv::viz::VizAccessor::getInstance()->add(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::viz::Viz3d::release()
|
void cv::viz::Viz3d::release()
|
||||||
{
|
{
|
||||||
if (impl_ && CV_XADD(&impl_->ref_counter, -1) == 1)
|
if (impl_ && CV_XADD(&impl_->ref_counter, -1) == 1)
|
||||||
{
|
{
|
||||||
|
// Erase the window
|
||||||
cv::viz::VizAccessor::getInstance()->remove(getWindowName());
|
cv::viz::VizAccessor::getInstance()->remove(getWindowName());
|
||||||
delete impl_;
|
delete impl_;
|
||||||
impl_ = 0;
|
impl_ = 0;
|
||||||
|
@@ -83,10 +83,8 @@ cv::viz::Viz3d::VizImpl::VizImpl (const std::string &name)
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
cv::viz::Viz3d::VizImpl::~VizImpl ()
|
cv::viz::Viz3d::VizImpl::~VizImpl ()
|
||||||
{
|
{
|
||||||
if (interactor_ != NULL)
|
if (interactor_)
|
||||||
interactor_->DestroyTimer (timer_id_);
|
interactor_->DestroyTimer(timer_id_);
|
||||||
|
|
||||||
if (renderer_) renderer_->Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Reference in New Issue
Block a user