diff --git a/common/math/geometry/include/geometry/bounding_box.hpp b/common/math/geometry/include/geometry/bounding_box.hpp index 2839301ac85..0dfa05e0d7c 100644 --- a/common/math/geometry/include/geometry/bounding_box.hpp +++ b/common/math/geometry/include/geometry/bounding_box.hpp @@ -63,11 +63,11 @@ auto toPolygon2D(const traffic_simulator_msgs::msg::BoundingBox & bounding_box) -> std::vector; auto toPolygon2D( const geometry_msgs::msg::Pose & pose, - const traffic_simulator_msgs::msg::BoundingBox & bounding_box) -> const boost_polygon; + const traffic_simulator_msgs::msg::BoundingBox & bounding_box) -> boost_polygon; std::vector getPointsFromBbox( - traffic_simulator_msgs::msg::BoundingBox bounding_box, double width_extension_right = 0.0, - double width_extension_left = 0.0, double length_extension_front = 0.0, - double length_extension_rear = 0.0); + const traffic_simulator_msgs::msg::BoundingBox & bounding_box, + const double width_extension_right = 0.0, const double width_extension_left = 0.0, + const double length_extension_front = 0.0, const double length_extension_rear = 0.0); DistancesFromCenterToEdge getDistancesFromCenterToEdge( const traffic_simulator_msgs::msg::BoundingBox & bounding_box); diff --git a/common/math/geometry/src/bounding_box.cpp b/common/math/geometry/src/bounding_box.cpp index e1e9cad6533..d5fc3277d79 100644 --- a/common/math/geometry/src/bounding_box.cpp +++ b/common/math/geometry/src/bounding_box.cpp @@ -121,14 +121,15 @@ boost_point pointToSegmentProjection( auto toPolygon2D( const geometry_msgs::msg::Pose & pose, - const traffic_simulator_msgs::msg::BoundingBox & bounding_box) -> const boost_polygon + const traffic_simulator_msgs::msg::BoundingBox & bounding_box) -> boost_polygon { return toBoostPolygon(transformPoints(pose, getPointsFromBbox(bounding_box))); } std::vector getPointsFromBbox( - traffic_simulator_msgs::msg::BoundingBox bounding_box, double width_extension_right, - double width_extension_left, double length_extension_front, double length_extension_rear) + const traffic_simulator_msgs::msg::BoundingBox & bounding_box, const double width_extension_right, + const double width_extension_left, const double length_extension_front, + const double length_extension_rear) { std::vector points; auto distances_from_center_to_edge = getDistancesFromCenterToEdge(bounding_box); @@ -159,7 +160,14 @@ auto toPolygon2D(const traffic_simulator_msgs::msg::BoundingBox & bounding_box) -> std::vector { std::vector points_bounding_box; - geometry_msgs::msg::Point p0, p1, p2, p3, p4, p5, p6, p7; + geometry_msgs::msg::Point p0; + geometry_msgs::msg::Point p1; + geometry_msgs::msg::Point p2; + geometry_msgs::msg::Point p3; + geometry_msgs::msg::Point p4; + geometry_msgs::msg::Point p5; + geometry_msgs::msg::Point p6; + geometry_msgs::msg::Point p7; p0.x = bounding_box.center.x + bounding_box.dimensions.x * 0.5; p0.y = bounding_box.center.y + bounding_box.dimensions.y * 0.5; diff --git a/rviz_plugins/openscenario_visualization/include/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.hpp b/rviz_plugins/openscenario_visualization/include/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.hpp index 0f020511a10..0e773c95e6f 100644 --- a/rviz_plugins/openscenario_visualization/include/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.hpp +++ b/rviz_plugins/openscenario_visualization/include/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.hpp @@ -88,13 +88,13 @@ private Q_SLOTS: protected: void processMessage(const Context::ConstSharedPtr msg_ptr); jsk_rviz_plugins::OverlayObject::Ptr overlay_; - rviz_common::properties::ColorProperty * property_text_color_; - rviz_common::properties::IntProperty * property_left_; - rviz_common::properties::IntProperty * property_top_; - rviz_common::properties::IntProperty * property_length_; - rviz_common::properties::IntProperty * property_width_; - rviz_common::properties::StringProperty * property_topic_name_; - rviz_common::properties::FloatProperty * property_value_scale_; + std::unique_ptr property_text_color_; + std::unique_ptr property_left_; + std::unique_ptr property_top_; + std::unique_ptr property_length_; + std::unique_ptr property_width_; + std::unique_ptr property_topic_name_; + std::unique_ptr property_value_scale_; private: void loadConditionGroups(const Context::ConstSharedPtr msg_ptr); diff --git a/rviz_plugins/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/jsk_overlay_utils.cpp b/rviz_plugins/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/jsk_overlay_utils.cpp index ce544b634dd..b3b4ded3849 100644 --- a/rviz_plugins/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/jsk_overlay_utils.cpp +++ b/rviz_plugins/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/jsk_overlay_utils.cpp @@ -110,7 +110,7 @@ OverlayObject::OverlayObject( OverlayObject::~OverlayObject() { - hide(); + this->hide(); panel_material_->unload(); Ogre::MaterialManager::getSingleton().remove(panel_material_->getName()); } diff --git a/rviz_plugins/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.cpp b/rviz_plugins/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.cpp index b702b772f68..0d1c54a46f5 100644 --- a/rviz_plugins/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.cpp +++ b/rviz_plugins/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -31,7 +32,7 @@ VisualizationConditionGroupsDisplay::VisualizationConditionGroupsDisplay() : condition_groups_collection_ptr_(std::make_shared>()) { /// @note Get screen info of default display - const Screen * screen_info = DefaultScreenOfDisplay(XOpenDisplay(NULL)); + const Screen * screen_info = DefaultScreenOfDisplay(XOpenDisplay(nullptr)); /// @note Fixed height for a 4k resolution screen /// @sa https://github.com/tier4/scenario_simulator_v2/pull/1033#discussion_r1412781103 @@ -75,25 +76,25 @@ VisualizationConditionGroupsDisplay::VisualizationConditionGroupsDisplay() */ const int width = static_cast(std::round(2000 * scale)); - property_topic_name_ = new rviz_common::properties::StringProperty( + property_topic_name_ = std::make_unique( "Topic", "/simulation/context", "The topic on which to publish simulation context.", this, SLOT(updateTopic()), this); - property_text_color_ = new rviz_common::properties::ColorProperty( + property_text_color_ = std::make_unique( "Text Color", QColor(255, 255, 255), "text color", this, SLOT(updateVisualization()), this); - property_left_ = new rviz_common::properties::IntProperty( + property_left_ = std::make_unique( "Left", left, "Left of the plotter window", this, SLOT(updateVisualization()), this); property_left_->setMin(0); - property_top_ = new rviz_common::properties::IntProperty( + property_top_ = std::make_unique( "Top", top, "Top of the plotter window", this, SLOT(updateVisualization())); property_top_->setMin(0); - property_length_ = new rviz_common::properties::IntProperty( + property_length_ = std::make_unique( "Length", length, "Length of the plotter window", this, SLOT(updateVisualization()), this); property_length_->setMin(10); - property_width_ = new rviz_common::properties::IntProperty( + property_width_ = std::make_unique( "Width", width, "Width of the plotter window", this, SLOT(updateVisualization()), this); property_width_->setMin(10); - property_value_scale_ = new rviz_common::properties::FloatProperty( + property_value_scale_ = std::make_unique( "Value Scale", text_size, "This property controls the scaling factor for the text size on the panel. Setting a higher " "value results in larger text, making the displayed information easier to read.",