From 05292fedb05cf672b407b0e35a8fb8326bdd4064 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Tue, 19 Dec 2023 23:36:25 +0100 Subject: [PATCH] Add override methods --- .../include/mrpt/maps/CColouredPointsMap.h | 16 +++++- libs/maps/include/mrpt/maps/CPointsMapXYZI.h | 19 +++---- .../maps/include/mrpt/maps/CPointsMapXYZIRT.h | 50 ++++++------------- 3 files changed, 35 insertions(+), 50 deletions(-) diff --git a/libs/maps/include/mrpt/maps/CColouredPointsMap.h b/libs/maps/include/mrpt/maps/CColouredPointsMap.h index 063bcbe01f..35edb0e3d9 100644 --- a/libs/maps/include/mrpt/maps/CColouredPointsMap.h +++ b/libs/maps/include/mrpt/maps/CColouredPointsMap.h @@ -37,7 +37,7 @@ class CColouredPointsMap : public CPointsMap CColouredPointsMap(const CPointsMap& o) { CPointsMap::operator=(o); } CColouredPointsMap(const CColouredPointsMap& o) : CPointsMap() { - impl_copyFrom(o); + CColouredPointsMap::impl_copyFrom(o); } CColouredPointsMap& operator=(const CPointsMap& o) { @@ -227,6 +227,20 @@ class CColouredPointsMap : public CPointsMap * predefined value */ void resetPointsMinDist(float defValue = 2000.0f); + // clang-format off + auto getPointsBufferRef_color_R() const -> const mrpt::aligned_std_vector* override { return &m_color_R;} + auto getPointsBufferRef_color_G() const -> const mrpt::aligned_std_vector* override { return &m_color_G; } + auto getPointsBufferRef_color_B() const -> const mrpt::aligned_std_vector* override { return &m_color_B; } + + auto getPointsBufferRef_color_R() -> mrpt::aligned_std_vector* override { return &m_color_R; } + auto getPointsBufferRef_color_G() -> mrpt::aligned_std_vector* override { return &m_color_G; } + auto getPointsBufferRef_color_B() -> mrpt::aligned_std_vector* override { return &m_color_B; } + + void insertPointField_color_R(float v) override { m_color_R.push_back(v); } + void insertPointField_color_G(float v) override { m_color_G.push_back(v); } + void insertPointField_color_B(float v) override { m_color_B.push_back(v); } + /// clang-format on + /** @name PCL library support @{ */ diff --git a/libs/maps/include/mrpt/maps/CPointsMapXYZI.h b/libs/maps/include/mrpt/maps/CPointsMapXYZI.h index 35ad7811e4..7a28c06952 100644 --- a/libs/maps/include/mrpt/maps/CPointsMapXYZI.h +++ b/libs/maps/include/mrpt/maps/CPointsMapXYZI.h @@ -167,19 +167,6 @@ class CPointsMapXYZI : public CPointsMap return m_intensity[index]; } - /** Provides a direct access to a read-only reference of the internal - * intensity point buffer. \sa getPointsBufferRef_x() */ - auto getPointsBufferRef_intensity() const - -> const mrpt::aligned_std_vector* override - { - return &m_intensity; - } - auto getPointsBufferRef_intensity() - -> mrpt::aligned_std_vector* override - { - return &m_intensity; - } - /** Returns true if the point map has a color field for each point */ bool hasColorPoints() const override { return true; } @@ -189,6 +176,12 @@ class CPointsMapXYZI : public CPointsMap void getVisualizationInto( mrpt::opengl::CSetOfObjects& outObj) const override; + // clang-format off + auto getPointsBufferRef_intensity() const -> const mrpt::aligned_std_vector* override { return &m_intensity; } + auto getPointsBufferRef_intensity() -> mrpt::aligned_std_vector* override { return &m_intensity; } + void insertPointField_Intensity(float i) override { m_intensity.push_back(i); } + /// clang-format on + /** @name PCL library support @{ */ diff --git a/libs/maps/include/mrpt/maps/CPointsMapXYZIRT.h b/libs/maps/include/mrpt/maps/CPointsMapXYZIRT.h index 556af68a3d..3f9d0ab04f 100644 --- a/libs/maps/include/mrpt/maps/CPointsMapXYZIRT.h +++ b/libs/maps/include/mrpt/maps/CPointsMapXYZIRT.h @@ -229,42 +229,6 @@ class CPointsMapXYZIRT : public CPointsMap return m_intensity[index]; } - auto getPointsBufferRef_intensity() const - -> const mrpt::aligned_std_vector* override - { - return &m_intensity; - } - - auto getPointsBufferRef_ring() const - -> const mrpt::aligned_std_vector* override - { - return &m_ring; - } - - auto getPointsBufferRef_timestamp() const - -> const mrpt::aligned_std_vector* override - { - return &m_time; - } - - auto getPointsBufferRef_intensity() - -> mrpt::aligned_std_vector* override - { - return &m_intensity; - } - - auto getPointsBufferRef_ring() - -> mrpt::aligned_std_vector* override - { - return &m_ring; - } - - auto getPointsBufferRef_timestamp() - -> mrpt::aligned_std_vector* override - { - return &m_time; - } - /** Returns true if the point map has a color field for each point */ bool hasColorPoints() const override { return true; } @@ -274,6 +238,20 @@ class CPointsMapXYZIRT : public CPointsMap void getVisualizationInto( mrpt::opengl::CSetOfObjects& outObj) const override; + // clang-format off + auto getPointsBufferRef_intensity() const -> const mrpt::aligned_std_vector* override { return &m_intensity; } + auto getPointsBufferRef_ring() const -> const mrpt::aligned_std_vector* override { return &m_ring; } + auto getPointsBufferRef_timestamp() const -> const mrpt::aligned_std_vector* override { return &m_time; } + + auto getPointsBufferRef_intensity() -> mrpt::aligned_std_vector* override { return &m_intensity; } + auto getPointsBufferRef_ring() -> mrpt::aligned_std_vector* override { return &m_ring; } + auto getPointsBufferRef_timestamp() -> mrpt::aligned_std_vector* override { return &m_time; } + + void insertPointField_Intensity(float i) override { m_intensity.push_back(i); } + void insertPointField_Ring(uint16_t r) override { m_ring.push_back(r); } + void insertPointField_Timestamp(float t) override { m_time.push_back(t); } + /// clang-format on + protected: /** The intensity/reflectance data */ mrpt::aligned_std_vector m_intensity;