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

feat(autoware_overlay_rviz_plugin): add plugin to show string stamped #9683

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
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.8)
project(autoware_string_stamped_rviz_plugin)

# find dependencies
find_package(autoware_cmake REQUIRED)
autoware_package()

find_package(Qt5 REQUIRED Core Widgets)
set(QT_LIBRARIES Qt5::Widgets)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_definitions(-DQT_NO_KEYWORDS)

ament_auto_add_library(${PROJECT_NAME} SHARED
DIRECTORY src
)

target_link_libraries(${PROJECT_NAME}
${QT_LIBRARIES}
)

# Export the plugin to be imported by rviz2
pluginlib_export_plugin_description_file(rviz_common plugins/plugins_description.xml)

ament_auto_package(
INSTALL_TO_SHARE
plugins
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# autoware_string_stamped_rviz_plugin

Plugin for displaying 2D overlays over the RViz2 3D scene.

## Purpose

This plugin displays the ROS message whose topic type is `autoware_internal_debug_msgs::msg::StringStamped` in rviz.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>autoware_string_stamped_rviz_plugin</name>
<version>0.39.0</version>
<description>
RViz2 plugin for 2D overlays in the 3D view. Mainly a port of the JSK overlay plugin
(https://github.com/jsk-ros-pkg/jsk_visualization).
</description>
<maintainer email="[email protected]">Takayuki Murooka</maintainer>
<maintainer email="[email protected]">Satoshi Ota</maintainer>

<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_cmake</buildtool_depend>

<depend>ament_index_cpp</depend>
<depend>autoware_internal_debug_msgs</depend>
<depend>rviz_common</depend>
<depend>rviz_ogre_vendor</depend>
<depend>rviz_rendering</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<library path="autoware_string_stamped_rviz_plugin">
<class name="autoware_string_stamped_rviz_plugin/StringStampedOverlayDisplay" type="autoware::string_stamped_rviz_plugin::StringStampedOverlayDisplay" base_class_type="rviz_common::Display">
<description>String stamped overlay plugin for the 3D view.</description>
</class>
</library>
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
// Copyright 2024 TIER IV, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Copyright (c) 2014, JSK Lab
// All rights reserved.
//
// Software License Agreement (BSD License)
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of {copyright_holder} nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.S SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#include "jsk_overlay_utils.hpp"

#include <string>

namespace jsk_rviz_plugins
{
ScopedPixelBuffer::ScopedPixelBuffer(Ogre::HardwarePixelBufferSharedPtr pixel_buffer)
: pixel_buffer_(pixel_buffer)

Check warning on line 55 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L54-L55

Added lines #L54 - L55 were not covered by tests
{
pixel_buffer_->lock(Ogre::HardwareBuffer::HBL_NORMAL);
}

Check warning on line 58 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L57-L58

Added lines #L57 - L58 were not covered by tests

ScopedPixelBuffer::~ScopedPixelBuffer()

Check warning on line 60 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L60

Added line #L60 was not covered by tests
{
pixel_buffer_->unlock();
}

Check warning on line 63 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L62-L63

Added lines #L62 - L63 were not covered by tests

Ogre::HardwarePixelBufferSharedPtr ScopedPixelBuffer::getPixelBuffer()

Check warning on line 65 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L65

Added line #L65 was not covered by tests
{
return pixel_buffer_;

Check warning on line 67 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L67

Added line #L67 was not covered by tests
}

QImage ScopedPixelBuffer::getQImage(unsigned int width, unsigned int height)

Check warning on line 70 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L70

Added line #L70 was not covered by tests
{
const Ogre::PixelBox & pixelBox = pixel_buffer_->getCurrentLock();
Ogre::uint8 * pDest = static_cast<Ogre::uint8 *>(pixelBox.data);
memset(pDest, 0, width * height);
return QImage(pDest, width, height, QImage::Format_ARGB32);

Check warning on line 75 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L72-L75

Added lines #L72 - L75 were not covered by tests
}

QImage ScopedPixelBuffer::getQImage(unsigned int width, unsigned int height, QColor & bg_color)

Check warning on line 78 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L78

Added line #L78 was not covered by tests
{
QImage Hud = getQImage(width, height);

Check warning on line 80 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L80

Added line #L80 was not covered by tests
for (unsigned int i = 0; i < width; i++) {
for (unsigned int j = 0; j < height; j++) {
Hud.setPixel(i, j, bg_color.rgba());

Check warning on line 83 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L83

Added line #L83 was not covered by tests
}
}
return Hud;
}

Check warning on line 87 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L86-L87

Added lines #L86 - L87 were not covered by tests

QImage ScopedPixelBuffer::getQImage(OverlayObject & overlay)

Check warning on line 89 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L89

Added line #L89 was not covered by tests
{
return getQImage(overlay.getTextureWidth(), overlay.getTextureHeight());

Check warning on line 91 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L91

Added line #L91 was not covered by tests
}

QImage ScopedPixelBuffer::getQImage(OverlayObject & overlay, QColor & bg_color)

Check warning on line 94 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L94

Added line #L94 was not covered by tests
{
return getQImage(overlay.getTextureWidth(), overlay.getTextureHeight(), bg_color);

Check warning on line 96 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L96

Added line #L96 was not covered by tests
}

OverlayObject::OverlayObject(
Ogre::SceneManager * manager, rclcpp::Logger logger, const std::string & name)
: name_(name), logger_(logger)

Check warning on line 101 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L99-L101

Added lines #L99 - L101 were not covered by tests
{
rviz_rendering::RenderSystem::get()->prepareOverlays(manager);
std::string material_name = name_ + "Material";
Ogre::OverlayManager * mOverlayMgr = Ogre::OverlayManager::getSingletonPtr();
overlay_ = mOverlayMgr->create(name_);
panel_ = static_cast<Ogre::PanelOverlayElement *>(
mOverlayMgr->createOverlayElement("Panel", name_ + "Panel"));
panel_->setMetricsMode(Ogre::GMM_PIXELS);

Check warning on line 109 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L103-L109

Added lines #L103 - L109 were not covered by tests

panel_material_ = Ogre::MaterialManager::getSingleton().create(

Check warning on line 111 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L111

Added line #L111 was not covered by tests
material_name, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
panel_->setMaterialName(panel_material_->getName());
overlay_->add2D(panel_);
}

Check warning on line 115 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L113-L115

Added lines #L113 - L115 were not covered by tests

OverlayObject::~OverlayObject()

Check warning on line 117 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L117

Added line #L117 was not covered by tests
{
hide();
panel_material_->unload();
Ogre::MaterialManager::getSingleton().remove(panel_material_->getName());

Check warning on line 121 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L119-L121

Added lines #L119 - L121 were not covered by tests
// Ogre::OverlayManager* mOverlayMgr = Ogre::OverlayManager::getSingletonPtr();
// mOverlayMgr->destroyOverlayElement(panel_);
// delete panel_;
// delete overlay_;
}

Check warning on line 126 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L126

Added line #L126 was not covered by tests

std::string OverlayObject::getName()

Check warning on line 128 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L128

Added line #L128 was not covered by tests
{
return name_;

Check warning on line 130 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L130

Added line #L130 was not covered by tests
}

void OverlayObject::hide()

Check warning on line 133 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L133

Added line #L133 was not covered by tests
{
if (overlay_->isVisible()) {
overlay_->hide();

Check warning on line 136 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L136

Added line #L136 was not covered by tests
}
}

Check warning on line 138 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L138

Added line #L138 was not covered by tests

void OverlayObject::show()

Check warning on line 140 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L140

Added line #L140 was not covered by tests
{
if (!overlay_->isVisible()) {
overlay_->show();

Check warning on line 143 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L143

Added line #L143 was not covered by tests
}
}

Check warning on line 145 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L145

Added line #L145 was not covered by tests

bool OverlayObject::isTextureReady()

Check warning on line 147 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L147

Added line #L147 was not covered by tests
{
return static_cast<bool>(texture_);

Check warning on line 149 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L149

Added line #L149 was not covered by tests
}

void OverlayObject::updateTextureSize(unsigned int width, unsigned int height)

Check warning on line 152 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L152

Added line #L152 was not covered by tests
{
const std::string texture_name = name_ + "Texture";

Check warning on line 154 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L154

Added line #L154 was not covered by tests
if (width == 0) {
RCLCPP_WARN(logger_, "width=0 is specified as texture size");

Check warning on line 156 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L156

Added line #L156 was not covered by tests
width = 1;
}
if (height == 0) {
RCLCPP_WARN(logger_, "height=0 is specified as texture size");

Check warning on line 160 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L160

Added line #L160 was not covered by tests
height = 1;
}
if (!isTextureReady() || ((width != texture_->getWidth()) || (height != texture_->getHeight()))) {

Check warning on line 163 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Complex Conditional

OverlayObject::updateTextureSize has 1 complex conditionals with 2 branches, threshold = 2. A complex conditional is an expression inside a branch (e.g. if, for, while) which consists of multiple, logical operators such as AND/OR. The more logical operators in an expression, the more severe the code smell.
if (isTextureReady()) {
Ogre::TextureManager::getSingleton().remove(texture_name);
panel_material_->getTechnique(0)->getPass(0)->removeAllTextureUnitStates();

Check warning on line 166 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L165-L166

Added lines #L165 - L166 were not covered by tests
}
texture_ = Ogre::TextureManager::getSingleton().createManual(

Check warning on line 168 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L168

Added line #L168 was not covered by tests
texture_name, // name
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D, // type
width, height, // width & height of the render window
0, // number of mipmaps
Ogre::PF_A8R8G8B8, // pixel format chosen to match a format Qt can use
Ogre::TU_DEFAULT // usage
);
panel_material_->getTechnique(0)->getPass(0)->createTextureUnitState(texture_name);

Check warning on line 177 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L177

Added line #L177 was not covered by tests

panel_material_->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);

Check warning on line 179 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L179

Added line #L179 was not covered by tests
}
}

Check warning on line 181 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L181

Added line #L181 was not covered by tests

ScopedPixelBuffer OverlayObject::getBuffer()

Check warning on line 183 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L183

Added line #L183 was not covered by tests
{
if (isTextureReady()) {
return ScopedPixelBuffer(texture_->getBuffer());

Check warning on line 186 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L186

Added line #L186 was not covered by tests
} else {
return ScopedPixelBuffer(Ogre::HardwarePixelBufferSharedPtr());

Check warning on line 188 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L188

Added line #L188 was not covered by tests
}
}

void OverlayObject::setPosition(double left, double top)

Check warning on line 192 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L192

Added line #L192 was not covered by tests
{
panel_->setPosition(left, top);
}

Check warning on line 195 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L194-L195

Added lines #L194 - L195 were not covered by tests

void OverlayObject::setDimensions(double width, double height)

Check warning on line 197 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L197

Added line #L197 was not covered by tests
{
panel_->setDimensions(width, height);
}

Check warning on line 200 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L199-L200

Added lines #L199 - L200 were not covered by tests

bool OverlayObject::isVisible()

Check warning on line 202 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L202

Added line #L202 was not covered by tests
{
return overlay_->isVisible();

Check warning on line 204 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L204

Added line #L204 was not covered by tests
}

unsigned int OverlayObject::getTextureWidth()

Check warning on line 207 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L207

Added line #L207 was not covered by tests
{
if (isTextureReady()) {
return texture_->getWidth();

Check warning on line 210 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L210

Added line #L210 was not covered by tests
} else {
return 0;
}
}

unsigned int OverlayObject::getTextureHeight()

Check warning on line 216 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L216

Added line #L216 was not covered by tests
{
if (isTextureReady()) {
return texture_->getHeight();

Check warning on line 219 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp

View check run for this annotation

Codecov / codecov/patch

visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/jsk_overlay_utils.cpp#L219

Added line #L219 was not covered by tests
} else {
return 0;
}
}

} // namespace jsk_rviz_plugins
Loading
Loading