mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-01 17:10:26 +08:00
CloudViewer: using QWidget::update() call instead of render directly the window
This commit is contained in:
@@ -178,7 +178,6 @@ public:
|
||||
void setWorkingDirectory(const QString & path) {_workingDirectory = path;}
|
||||
|
||||
public slots:
|
||||
void render();
|
||||
void setBackgroundColor(const QColor & color);
|
||||
void setCloudVisibility(const std::string & id, bool isVisible);
|
||||
void setCloudOpacity(const std::string & id, double opacity = 1.0);
|
||||
|
||||
@@ -51,7 +51,7 @@ void CloudViewer::mouseEventOccurred (const pcl::visualization::MouseEvent &even
|
||||
if (event.getButton () == pcl::visualization::MouseEvent::LeftButton ||
|
||||
event.getButton () == pcl::visualization::MouseEvent::MiddleButton)
|
||||
{
|
||||
this->render(); // this will apply frustum
|
||||
this->update(); // this will apply frustum
|
||||
}
|
||||
}
|
||||
|
||||
@@ -517,7 +517,7 @@ void CloudViewer::clearTrajectory()
|
||||
{
|
||||
_trajectory->clear();
|
||||
_visualizer->removeShape("trajectory");
|
||||
this->render();
|
||||
this->update();
|
||||
}
|
||||
|
||||
void CloudViewer::removeAllClouds()
|
||||
@@ -671,9 +671,9 @@ void CloudViewer::updateCameraTargetPosition(const Transform & pose)
|
||||
cameras.front().focal[1] = Fp.y();
|
||||
cameras.front().focal[2] = Fp.z();
|
||||
//FIXME: the view up is not set properly...
|
||||
cameras.front().view[0] = Fp[8];
|
||||
cameras.front().view[1] = Fp[9];
|
||||
cameras.front().view[2] = Fp[10];
|
||||
cameras.front().view[0] = _aLockViewZ->isChecked()?0:Fp[8];
|
||||
cameras.front().view[1] = _aLockViewZ->isChecked()?0:Fp[9];
|
||||
cameras.front().view[2] = _aLockViewZ->isChecked()?1:Fp[10];
|
||||
}
|
||||
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 7, 2)
|
||||
@@ -693,28 +693,6 @@ void CloudViewer::updateCameraTargetPosition(const Transform & pose)
|
||||
_lastPose = pose;
|
||||
}
|
||||
|
||||
void CloudViewer::render()
|
||||
{
|
||||
// camera view up z locked?
|
||||
if(_aLockViewZ->isChecked())
|
||||
{
|
||||
std::vector<pcl::visualization::Camera> cameras;
|
||||
_visualizer->getCameras(cameras);
|
||||
|
||||
cameras.front().view[0] = 0;
|
||||
cameras.front().view[1] = 0;
|
||||
cameras.front().view[2] = 1;
|
||||
|
||||
_visualizer->setCameraPosition(
|
||||
cameras.front().pos[0], cameras.front().pos[1], cameras.front().pos[2],
|
||||
cameras.front().focal[0], cameras.front().focal[1], cameras.front().focal[2],
|
||||
cameras.front().view[0], cameras.front().view[1], cameras.front().view[2]);
|
||||
|
||||
}
|
||||
|
||||
this->GetRenderWindow()->Render();
|
||||
}
|
||||
|
||||
const QColor & CloudViewer::getBackgroundColor() const
|
||||
{
|
||||
return _backgroundColor;
|
||||
@@ -1045,7 +1023,7 @@ void CloudViewer::keyPressEvent(QKeyEvent * event)
|
||||
cameras.front().focal[0], cameras.front().focal[1], cameras.front().focal[2],
|
||||
cameras.front().view[0], cameras.front().view[1], cameras.front().view[2]);
|
||||
|
||||
render();
|
||||
update();
|
||||
|
||||
emit configChanged();
|
||||
}
|
||||
@@ -1141,7 +1119,7 @@ void CloudViewer::handleAction(QAction * a)
|
||||
0, 0, 0,
|
||||
0, 0, 1);
|
||||
}
|
||||
this->render();
|
||||
this->update();
|
||||
}
|
||||
else if(a == _aShowGrid)
|
||||
{
|
||||
@@ -1154,7 +1132,7 @@ void CloudViewer::handleAction(QAction * a)
|
||||
this->removeGrid();
|
||||
}
|
||||
|
||||
this->render();
|
||||
this->update();
|
||||
}
|
||||
else if(a == _aSetGridCellCount)
|
||||
{
|
||||
@@ -1184,7 +1162,7 @@ void CloudViewer::handleAction(QAction * a)
|
||||
{
|
||||
if(_aLockViewZ->isChecked())
|
||||
{
|
||||
this->render();
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1131,7 +1131,7 @@ void DatabaseViewer::update(int value,
|
||||
ui_->horizontalSlider_loops->setValue(0);
|
||||
ui_->horizontalSlider_neighbors->setValue(0);
|
||||
ui_->constraintsViewer->removeAllClouds();
|
||||
ui_->constraintsViewer->render();
|
||||
ui_->constraintsViewer->update();
|
||||
ui_->horizontalSlider_loops->blockSignals(false);
|
||||
ui_->horizontalSlider_neighbors->blockSignals(false);
|
||||
}
|
||||
@@ -1244,7 +1244,7 @@ void DatabaseViewer::updateStereo(const Signature * data)
|
||||
|
||||
ui_->stereoViewer->updateCameraTargetPosition(Transform::getIdentity());
|
||||
ui_->stereoViewer->addOrUpdateCloud("stereo", cloud);
|
||||
ui_->stereoViewer->render();
|
||||
ui_->stereoViewer->update();
|
||||
|
||||
std::vector<cv::KeyPoint> rightKpts;
|
||||
cv::KeyPoint::convert(rightCorners, rightKpts);
|
||||
@@ -1660,7 +1660,7 @@ void DatabaseViewer::updateConstraintView(const rtabmap::Link & linkIn,
|
||||
ui_->constraintsViewer->updateCameraTargetPosition(t);
|
||||
ui_->constraintsViewer->clearTrajectory();
|
||||
|
||||
ui_->constraintsViewer->render();
|
||||
ui_->constraintsViewer->update();
|
||||
}
|
||||
|
||||
// update buttons
|
||||
@@ -2490,7 +2490,7 @@ void DatabaseViewer::updateLoopClosuresSlider(int from, int to)
|
||||
{
|
||||
ui_->horizontalSlider_loops->setEnabled(false);
|
||||
ui_->constraintsViewer->removeAllClouds();
|
||||
ui_->constraintsViewer->render();
|
||||
ui_->constraintsViewer->update();
|
||||
updateConstraintButtons();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ void LoopClosureViewer::updateView(const Transform & transform)
|
||||
{
|
||||
UERROR("loop transform is null !?!?");
|
||||
ui_->cloudViewerTransform->removeAllClouds();
|
||||
}
|
||||
}
|
||||
ui_->cloudViewerTransform->update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -765,7 +765,7 @@ void MainWindow::processOdometry(const rtabmap::SensorData & data, const rtabmap
|
||||
_ui->widget_cloudViewer->updateCameraTargetPosition(_odometryCorrection*data.pose());
|
||||
}
|
||||
}
|
||||
_ui->widget_cloudViewer->render();
|
||||
_ui->widget_cloudViewer->update();
|
||||
}
|
||||
|
||||
if(_ui->dockWidget_odometry->isVisible() &&
|
||||
@@ -1451,7 +1451,7 @@ void MainWindow::updateMapCloud(
|
||||
_ui->widget_cloudViewer->updateCameraTargetPosition(currentPose);
|
||||
}
|
||||
|
||||
_ui->widget_cloudViewer->render();
|
||||
_ui->widget_cloudViewer->update();
|
||||
}
|
||||
|
||||
void MainWindow::createAndAddCloudToMap(int nodeId, const Transform & pose, int mapId)
|
||||
@@ -1648,7 +1648,7 @@ void MainWindow::updateNodeVisibility(int nodeId, bool visible)
|
||||
}
|
||||
}
|
||||
}
|
||||
_ui->widget_cloudViewer->render();
|
||||
_ui->widget_cloudViewer->update();
|
||||
}
|
||||
|
||||
void MainWindow::processRtabmapEventInit(int status, const QString & info)
|
||||
|
||||
@@ -164,7 +164,7 @@ void OdometryViewer::processData()
|
||||
this->setBackgroundColor(Qt::darkRed);
|
||||
}
|
||||
|
||||
this->render();
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user