Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cean Code #975

Merged
merged 3 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions rviz_common/src/rviz_common/add_display_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,11 +455,7 @@ TopicDisplayWidget::TopicDisplayWidget(
tree_->setColumnCount(2);

tree_->header()->setStretchLastSection(false);
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
tree_->header()->setResizeMode(0, QHeaderView::Stretch);
#else
tree_->header()->setSectionResizeMode(0, QHeaderView::Stretch);
#endif

enable_hidden_box_ = new QCheckBox("Show unvisualizable topics");
enable_hidden_box_->setCheckState(Qt::Unchecked);
Expand Down
15 changes: 2 additions & 13 deletions rviz_common/src/rviz_common/visualization_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
#include <QTimer> // NOLINT: cpplint cannot handle include order here
#include <QWindow> // NOLINT: cpplint cannot handle include order here

// #include "tf/transform_listener.h"
#include "rclcpp/clock.hpp"
#include "rclcpp/time.hpp"
#include "rviz_rendering/material_manager.hpp"
Expand All @@ -66,9 +65,6 @@
#include "./displays_panel.hpp"
#include "frame_manager.hpp"
#include "rviz_common/load_resource.hpp"
// #include "./ogre_helpers/ogre_render_queue_clearer.hpp"
// #include "./ogre_helpers/qt_ogre_render_window.hpp"
// #include "./ogre_helpers/render_system.hpp"
#include "rviz_common/properties/color_property.hpp"
#include "rviz_common/properties/int_property.hpp"
#include "rviz_common/properties/parse_color.hpp"
Expand All @@ -85,11 +81,8 @@
#include "rviz_common/interaction/view_picker_iface.hpp"
#include "rviz_common/tool.hpp"
#include "rviz_common/tool_manager.hpp"
// #include "rviz_common/view_controller.hpp"
#include "rviz_common/view_manager.hpp"
// #include "./viewport_mouse_event.hpp"

// #include "rviz/window_manager_interface.h"

namespace rviz_common
{
Expand Down Expand Up @@ -131,10 +124,6 @@ class IconizedProperty : public rviz_common::properties::Property
class VisualizationManagerPrivate
{
public:
// ros::CallbackQueue threaded_queue_;
// boost::thread_group threaded_queue_threads_;
// ros::NodeHandle update_nh_;
// ros::NodeHandle threaded_nh_;
std::mutex render_mutex_;
};

Expand Down Expand Up @@ -662,7 +651,7 @@ void VisualizationManager::handleMouseEvent(const ViewportMouseEvent & vme)
int flags = 0;
if (current_tool) {
ViewportMouseEvent _vme = vme;
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)

QWindow * window = vme.panel->windowHandle();
if (window) {
double pixel_ratio = window->devicePixelRatio();
Expand All @@ -671,7 +660,7 @@ void VisualizationManager::handleMouseEvent(const ViewportMouseEvent & vme)
_vme.last_x = static_cast<int>(pixel_ratio * _vme.last_x);
_vme.last_y = static_cast<int>(pixel_ratio * _vme.last_y);
}
#endif

flags = current_tool->processMouseEvent(_vme);
vme.panel->setCursor(current_tool->getCursor());
vme.panel->getRenderWindow()->setCursor(current_tool->getCursor());
Expand Down
1 change: 0 additions & 1 deletion rviz_rendering/include/rviz_rendering/render_system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#ifndef RVIZ_RENDERING__RENDER_SYSTEM_HPP_
#define RVIZ_RENDERING__RENDER_SYSTEM_HPP_

#define OGRE_VERSION_HIGHER_OR_EQUAL_1_9_0 (OGRE_VERSION >= ((1 << 16) | (9 << 8) | 0))

#include <cstdint>
#include <string>
Expand Down
6 changes: 0 additions & 6 deletions rviz_rendering/src/rviz_rendering/objects/shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ Shape::Shape(Type type, Ogre::SceneManager * scene_manager, Ogre::SceneNode * pa
if (entity_) {
entity_->setMaterialName(material_name_);
}

#if (OGRE_VERSION_MAJOR <= 1 && OGRE_VERSION_MINOR <= 4)
if (entity_) {
entity_->setNormaliseNormals(true);
}
#endif
}

Shape::~Shape()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,12 +551,8 @@ void RenderWindowImpl::paintEvent(QPaintEvent * e)
}

if (ogre_root_->_fireFrameStarted()) {
#if (OGRE_VERSION_MAJOR >= 1 && OGRE_VERSION_MINOR >= 6)
ogre_root_->_fireFrameRenderingQueued();
#endif

render_window_->update();

ogre_root_->_fireFrameEnded();
}

Expand Down
33 changes: 0 additions & 33 deletions rviz_rendering/src/rviz_rendering/ogre_render_window_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,6 @@ class RenderWindowImpl
void
setupSceneAfterInit(setupSceneCallback setup_scene_callback);

#if 0
/**
* Set a callback which is called before each render
* @param func The callback functor
*/
virtual void setPreRenderCallback(boost::function<void()> func);
/**
* Set a callback which is called after each render
* @param func The callback functor
*/
virtual void setPostRenderCallback(boost::function<void()> func);
#endif

/// Get the associated Ogre viewport.
/**
Expand Down Expand Up @@ -138,28 +126,7 @@ class RenderWindowImpl

void addListener(Ogre::RenderTargetListener * listener);
void removeListener(Ogre::RenderTargetListener * listener);
#if 0
/**
* \brief Set the scale of the orthographic window. Only valid for an orthographic camera.
* @param scale The scale
*/
void setOrthoScale(float scale);

/** \brief Enable or disable stereo rendering
* If stereo is not supported this is ignored.
* @return the old setting (whether stereo was enabled before)
*/
bool enableStereo(bool enable);

/** \brief Prepare to render in stereo if enabled and supported. */
void setupStereo();

void setAutoRender(bool auto_render) {auto_render_ = auto_render;}

////// Functions mimicked from Ogre::Viewport to satisfy timing of
////// after-constructor creation of Ogre::RenderWindow.
void setOverlaysEnabled(bool overlays_enabled);
#endif
void setBackgroundColor(Ogre::ColourValue color);

void setVisibilityMask(uint32_t mask);
Expand Down
12 changes: 0 additions & 12 deletions rviz_rendering/src/rviz_rendering/render_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,8 @@ RenderSystem::getOgreRoot()

void RenderSystem::Destroy()
{
#if OGRE_VERSION_HIGHER_OR_EQUAL_1_9_0
OGRE_DELETE this->ogre_overlay_system_;
this->ogre_overlay_system_ = nullptr;
#endif
if (this->ogre_root_) {
try {
// TODO(anyone): do we need to catch segfault on delete?
Expand Down Expand Up @@ -165,9 +163,7 @@ RenderSystem::RenderSystem()
setPluginDirectory();
setupDummyWindowId();
ogre_root_ = new Ogre::Root(get_resource_directory() + "/ogre_media/plugins.cfg");
#if ((OGRE_VERSION_MAJOR == 1 && OGRE_VERSION_MINOR >= 9) || OGRE_VERSION_MAJOR >= 2)
ogre_overlay_system_ = new Ogre::OverlaySystem();
#endif
loadOgrePlugins();
setupRenderSystem();
ogre_root_->initialise(false);
Expand All @@ -180,11 +176,9 @@ RenderSystem::RenderSystem()
void
RenderSystem::prepareOverlays(Ogre::SceneManager * scene_manager)
{
#if ((OGRE_VERSION_MAJOR == 1 && OGRE_VERSION_MINOR >= 9) || OGRE_VERSION_MAJOR >= 2)
if (ogre_overlay_system_) {
scene_manager->addRenderQueueListener(ogre_overlay_system_);
}
#endif
}

void
Expand Down Expand Up @@ -234,12 +228,6 @@ RenderSystem::loadOgrePlugins()
ogre_root_->loadPlugin(plugin_prefix + "RenderSystem_GL");
#endif
ogre_root_->loadPlugin(plugin_prefix + "Codec_STBI");
// #if __APPLE__
// #else
// ogre_root_->loadPlugin(plugin_prefix + "RenderSystem_GL3Plus");
// #endif
// ogre_root_->loadPlugin(plugin_prefix + "Plugin_OctreeSceneManager");
// ogre_root_->loadPlugin(plugin_prefix + "Plugin_ParticleFX");
}

void
Expand Down
29 changes: 0 additions & 29 deletions rviz_rendering/src/rviz_rendering/render_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ ToString(const EnumType & enumValue)
bool
RenderWindow::event(QEvent * event)
{
// qDebug() <<
// "[" << QTime::currentTime().toString("HH:mm:ss:zzz") << "]:" <<
// "event->type() ==" << ToString(event->type());
switch (event->type()) {
case QEvent::Resize:
if (this->isExposed()) {
Expand All @@ -170,7 +167,6 @@ RenderWindow::event(QEvent * event)
case QEvent::Type::MouseMove:
case QEvent::Type::MouseButtonPress:
case QEvent::Type::MouseButtonRelease:
// case QEvent::Type::MouseButtonRelease:
if (on_mouse_events_callback_) {
on_mouse_events_callback_(static_cast<QMouseEvent *>(event));
}
Expand All @@ -184,7 +180,6 @@ RenderWindow::event(QEvent * event)
QWindow::event(event);
return false;
}
// return QWindow::event(event);
}

void
Expand All @@ -198,30 +193,6 @@ RenderWindow::exposeEvent(QExposeEvent * expose_event)
}
}

// bool
// RenderWindow::eventFilter(QObject * target, QEvent * event)
// {
// // if (target == this) {
// // qDebug() <<
// // "[" << QTime::currentTime().toString("HH:mm:ss:zzz") << "]:" <<
// // "event->type() ==" << ToString(event->type()) <<
// // "target ==" << target;
// // switch (event->type()) {
// // case QEvent::Resize:
// // if (this->isExposed()) {
// // impl_->resize(this->width(), this->height());
// // }
// // return false;
// // case QEvent::UpdateRequest:
// // this->renderNow();
// // return true;
// // default:
// // return QWindow::event(event);
// // }
// // }
// QWindow::eventFilter(target, event);
// return false;
// }

void
RenderWindowOgreAdapter::setOgreCamera(RenderWindow * render_window, Ogre::Camera * ogre_camera)
Expand Down