Fixed ref counting bug, minor formatting
This commit is contained in:
parent
45cdc41763
commit
9d684a39da
@ -1,6 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <opencv2/core.hpp>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <list>
|
#include <list>
|
||||||
@ -153,5 +152,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <q/viz3d_impl.hpp>
|
||||||
|
#include <opencv2/core.hpp>
|
||||||
#include "opencv2/viz/widget_accessor.hpp"
|
#include "opencv2/viz/widget_accessor.hpp"
|
||||||
#include <opencv2/viz/widgets.hpp>
|
#include <opencv2/viz/widgets.hpp>
|
||||||
|
#include <opencv2/calib3d.hpp>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
#include <opencv2/calib3d.hpp>
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// line widget implementation
|
/// line widget implementation
|
||||||
@ -135,15 +134,13 @@ temp_viz::ArrowWidget::ArrowWidget(const Point3f& pt1, const Point3f& pt2, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply the transforms
|
// Apply the transforms
|
||||||
vtkSmartPointer<vtkTransform> transform =
|
vtkSmartPointer<vtkTransform> transform = vtkSmartPointer<vtkTransform>::New();
|
||||||
vtkSmartPointer<vtkTransform>::New();
|
|
||||||
transform->Translate(startPoint);
|
transform->Translate(startPoint);
|
||||||
transform->Concatenate(matrix);
|
transform->Concatenate(matrix);
|
||||||
transform->Scale(length, length, length);
|
transform->Scale(length, length, length);
|
||||||
|
|
||||||
// Transform the polydata
|
// Transform the polydata
|
||||||
vtkSmartPointer<vtkTransformPolyDataFilter> transformPD =
|
vtkSmartPointer<vtkTransformPolyDataFilter> transformPD = vtkSmartPointer<vtkTransformPolyDataFilter>::New();
|
||||||
vtkSmartPointer<vtkTransformPolyDataFilter>::New();
|
|
||||||
transformPD->SetTransform(transform);
|
transformPD->SetTransform(transform);
|
||||||
transformPD->SetInputConnection(arrowSource->GetOutputPort());
|
transformPD->SetInputConnection(arrowSource->GetOutputPort());
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
#include <q/viz3d_impl.hpp>
|
|
||||||
|
|
||||||
namespace temp_viz
|
namespace temp_viz
|
||||||
{
|
{
|
||||||
@ -865,12 +864,10 @@ bool temp_viz::Viz3d::VizImpl::addPolygon (const cv::Mat& cloud, const Color& co
|
|||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "opencv2/viz/widget_accessor.hpp"
|
|
||||||
|
|
||||||
void temp_viz::Viz3d::VizImpl::showWidget(const String &id, const Widget &widget)
|
void temp_viz::Viz3d::VizImpl::showWidget(const String &id, const Widget &widget)
|
||||||
{
|
{
|
||||||
WidgetActorMap::iterator wam_itr = widget_actor_map_->find(id);
|
WidgetActorMap::iterator wam_itr = widget_actor_map_->find(id);
|
||||||
bool exists = !(wam_itr == widget_actor_map_->end());
|
bool exists = wam_itr != widget_actor_map_->end();
|
||||||
if (exists)
|
if (exists)
|
||||||
{
|
{
|
||||||
// Remove it if it exists and add it again
|
// Remove it if it exists and add it again
|
||||||
@ -883,14 +880,11 @@ void temp_viz::Viz3d::VizImpl::showWidget(const String &id, const Widget &widget
|
|||||||
bool temp_viz::Viz3d::VizImpl::removeWidget(const String &id)
|
bool temp_viz::Viz3d::VizImpl::removeWidget(const String &id)
|
||||||
{
|
{
|
||||||
WidgetActorMap::iterator wam_itr = widget_actor_map_->find(id);
|
WidgetActorMap::iterator wam_itr = widget_actor_map_->find(id);
|
||||||
bool exists = !(wam_itr == widget_actor_map_->end());
|
bool exists = wam_itr != widget_actor_map_->end();
|
||||||
|
|
||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
return std::cout << "[removeWidget] A widget with id <" << id << "> does not exist!" << std::endl, false;
|
||||||
std::cout << "[removeWidget] A widget with id <" << id << "> does not exist!" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!removeActorFromRenderer (wam_itr->second.actor))
|
if (!removeActorFromRenderer (wam_itr->second.actor))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -136,6 +136,7 @@ void temp_viz::Widget::release()
|
|||||||
if (impl_ && CV_XADD(&impl_->ref_counter, -1) == 1)
|
if (impl_ && CV_XADD(&impl_->ref_counter, -1) == 1)
|
||||||
{
|
{
|
||||||
delete impl_;
|
delete impl_;
|
||||||
|
impl_ = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user