mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 16:57:46 +08:00
fixed RVIZ crash when changing map cloud style
git-svn-id: http://rtabmap.googlecode.com/svn/trunk/ros-pkg@1457 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -27,9 +27,9 @@ namespace rtabmap
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
MapCloudDisplay::CloudInfo::CloudInfo()
|
MapCloudDisplay::CloudInfo::CloudInfo() :
|
||||||
: manager_(0)
|
manager_(0),
|
||||||
, scene_node_(0)
|
scene_node_(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
MapCloudDisplay::CloudInfo::~CloudInfo()
|
MapCloudDisplay::CloudInfo::~CloudInfo()
|
||||||
@@ -324,7 +324,8 @@ void MapCloudDisplay::updateTransformers( const sensor_msgs::PointCloud2ConstPtr
|
|||||||
if (has_rgb_transformer)
|
if (has_rgb_transformer)
|
||||||
{
|
{
|
||||||
color_transformer_property_->setStringStd( "RGB8" );
|
color_transformer_property_->setStringStd( "RGB8" );
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
color_transformer_property_->setStringStd( valid_color.rbegin()->second );
|
color_transformer_property_->setStringStd( valid_color.rbegin()->second );
|
||||||
}
|
}
|
||||||
@@ -334,9 +335,9 @@ void MapCloudDisplay::updateTransformers( const sensor_msgs::PointCloud2ConstPtr
|
|||||||
|
|
||||||
void MapCloudDisplay::updateAlpha()
|
void MapCloudDisplay::updateAlpha()
|
||||||
{
|
{
|
||||||
for ( unsigned i=0; i<cloud_infos_.size(); i++ )
|
for( std::map<int, CloudInfoPtr>::iterator it = cloud_infos_.begin(); it != cloud_infos_.end(); ++it )
|
||||||
{
|
{
|
||||||
cloud_infos_[i]->cloud_->setAlpha( alpha_property_->getFloat() );
|
it->second->cloud_->setAlpha( alpha_property_->getFloat() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,9 +354,9 @@ void MapCloudDisplay::updateStyle()
|
|||||||
point_world_size_property_->show();
|
point_world_size_property_->show();
|
||||||
point_pixel_size_property_->hide();
|
point_pixel_size_property_->hide();
|
||||||
}
|
}
|
||||||
for( unsigned int i = 0; i < cloud_infos_.size(); i++ )
|
for( std::map<int, CloudInfoPtr>::iterator it = cloud_infos_.begin(); it != cloud_infos_.end(); ++it )
|
||||||
{
|
{
|
||||||
cloud_infos_[i]->cloud_->setRenderMode( mode );
|
it->second->cloud_->setRenderMode( mode );
|
||||||
}
|
}
|
||||||
updateBillboardSize();
|
updateBillboardSize();
|
||||||
}
|
}
|
||||||
@@ -364,14 +365,17 @@ void MapCloudDisplay::updateBillboardSize()
|
|||||||
{
|
{
|
||||||
rviz::PointCloud::RenderMode mode = (rviz::PointCloud::RenderMode) style_property_->getOptionInt();
|
rviz::PointCloud::RenderMode mode = (rviz::PointCloud::RenderMode) style_property_->getOptionInt();
|
||||||
float size;
|
float size;
|
||||||
if( mode == rviz::PointCloud::RM_POINTS ) {
|
if( mode == rviz::PointCloud::RM_POINTS )
|
||||||
|
{
|
||||||
size = point_pixel_size_property_->getFloat();
|
size = point_pixel_size_property_->getFloat();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
size = point_world_size_property_->getFloat();
|
size = point_world_size_property_->getFloat();
|
||||||
}
|
}
|
||||||
for ( unsigned i=0; i<cloud_infos_.size(); i++ )
|
for( std::map<int, CloudInfoPtr>::iterator it = cloud_infos_.begin(); it != cloud_infos_.end(); ++it )
|
||||||
{
|
{
|
||||||
cloud_infos_[i]->cloud_->setDimensions( size, size, size );
|
it->second->cloud_->setDimensions( size, size, size );
|
||||||
}
|
}
|
||||||
context_->queueRender();
|
context_->queueRender();
|
||||||
}
|
}
|
||||||
@@ -612,9 +616,7 @@ void MapCloudDisplay::retransform()
|
|||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock lock(transformers_mutex_);
|
boost::recursive_mutex::scoped_lock lock(transformers_mutex_);
|
||||||
|
|
||||||
std::map<int, CloudInfoPtr>::iterator it = cloud_infos_.begin();
|
for( std::map<int, CloudInfoPtr>::iterator it = cloud_infos_.begin(); it != cloud_infos_.end(); ++it )
|
||||||
std::map<int, CloudInfoPtr>::iterator end = cloud_infos_.end();
|
|
||||||
for (; it != end; ++it)
|
|
||||||
{
|
{
|
||||||
const CloudInfoPtr& cloud_info = it->second;
|
const CloudInfoPtr& cloud_info = it->second;
|
||||||
transformCloud(cloud_info, false);
|
transformCloud(cloud_info, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user