|
|
|
@ -85,3 +85,58 @@ namespace cv |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
/// Viz accessor implementation
|
|
|
|
|
|
|
|
|
|
cv::viz::VizAccessor * cv::viz::VizAccessor::instance_ = 0; |
|
|
|
|
bool cv::viz::VizAccessor::is_instantiated_ = false; |
|
|
|
|
cv::viz::VizMap cv::viz::VizAccessor::viz_map_; |
|
|
|
|
|
|
|
|
|
cv::viz::VizAccessor::VizAccessor() {} |
|
|
|
|
|
|
|
|
|
cv::viz::VizAccessor::~VizAccessor() |
|
|
|
|
{ |
|
|
|
|
is_instantiated_ = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cv::viz::VizAccessor * cv::viz::VizAccessor::getInstance() |
|
|
|
|
{ |
|
|
|
|
if (is_instantiated_) |
|
|
|
|
{ |
|
|
|
|
std::cout << "HERE" << std::endl; |
|
|
|
|
instance_ = new VizAccessor(); |
|
|
|
|
is_instantiated_ = true; |
|
|
|
|
} |
|
|
|
|
return instance_; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cv::viz::Viz3d cv::viz::VizAccessor::get(const String & window_name) |
|
|
|
|
{ |
|
|
|
|
VizMap::iterator vm_itr = viz_map_.find(window_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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::viz::VizAccessor::add(Viz3d window) |
|
|
|
|
{ |
|
|
|
|
String window_name = window.getWindowName(); |
|
|
|
|
VizMap::iterator vm_itr = viz_map_.find(window_name); |
|
|
|
|
bool exists = vm_itr != viz_map_.end(); |
|
|
|
|
if (exists) return ; |
|
|
|
|
viz_map_.insert(std::pair<String,Viz3d>(window_name, window)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::viz::VizAccessor::remove(const String &window_name) |
|
|
|
|
{ |
|
|
|
|
VizMap::iterator vm_itr = viz_map_.find(window_name); |
|
|
|
|
bool exists = vm_itr != viz_map_.end(); |
|
|
|
|
if (!exists) return ; |
|
|
|
|
viz_map_.erase(vm_itr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cv::viz::Viz3d cv::viz::get(const String &window_name) |
|
|
|
|
{ |
|
|
|
|
return cv::viz::VizAccessor::getInstance()->get(window_name); |
|
|
|
|
} |