@@ -386,6 +386,14 @@ class CPointsMap :
386386 */
387387 virtual bool registerField_uint16 (const std::string_view& fieldName) { return false ; }
388388
389+ /* * Registers a new data channel of type `double`.
390+ * If the map is not empty, the new channel is filled with default values (0)
391+ * to match the current point count.
392+ * \return true if the field could effectively be added to the underlying point map class.
393+ * \sa hasPointField(), getPointFieldNames_double()
394+ */
395+ virtual bool registerField_double (const std::string_view& fieldName) { return false ; }
396+
389397 /* * @} */
390398
391399 // --------------------------------------------------
@@ -586,7 +594,7 @@ class CPointsMap :
586594 * @{ */
587595
588596 /* * Returns true if the map has a data channel with the given name.
589- * \sa getPointField_float, getPointField_uint16
597+ * \sa getPointField_float, getPointField_double, getPointField_uint16
590598 */
591599 virtual bool hasPointField (const std::string_view& fieldName) const
592600 {
@@ -595,6 +603,8 @@ class CPointsMap :
595603
596604 /* * Get list of all float channel names */
597605 virtual std::vector<std::string_view> getPointFieldNames_float () const { return {" x" , " y" , " z" }; }
606+ /* * Get list of all double channel names */
607+ virtual std::vector<std::string_view> getPointFieldNames_double () const { return {}; }
598608 /* * Get list of all uint16_t channel names */
599609 virtual std::vector<std::string_view> getPointFieldNames_uint16 () const { return {}; }
600610
@@ -614,6 +624,16 @@ class CPointsMap :
614624 return 0 ;
615625 }
616626
627+ /* * Read the value of a double channel for a given point.
628+ * Returns 0 if field does not exist.
629+ * \exception std::exception on index out of bounds or if field exists but
630+ * is not double.
631+ */
632+ virtual double getPointField_double (size_t index, const std::string_view& fieldName) const
633+ {
634+ return 0 ;
635+ }
636+
617637 /* * Read the value of a uint16_t channel for a given point.
618638 * Returns 0 if field does not exist.
619639 * \exception std::exception on index out of bounds or if field exists but
@@ -637,6 +657,14 @@ class CPointsMap :
637657 else if (fieldName == " z" )
638658 m_z.at (index) = value;
639659 }
660+ /* * Sets the value of a double channel for a given point.
661+ * \exception std::exception on index out of bounds or if field does not
662+ * exist or is not double.
663+ */
664+ virtual void setPointField_double (size_t index, const std::string_view& fieldName, double value)
665+ {
666+ }
667+
640668 /* * Sets the value of a uint16_t channel for a given point.
641669 * \exception std::exception on index out of bounds or if field does not
642670 * exist or is not uint16_t.
@@ -647,12 +675,16 @@ class CPointsMap :
647675
648676 /* * Appends a value to a float channel (for use after insertPointFast()) */
649677 virtual void insertPointField_float (const std::string_view& fieldName, float value) {}
678+ /* * Appends a value to a double channel (for use after insertPointFast()) */
679+ virtual void insertPointField_double (const std::string_view& fieldName, double value) {}
650680 /* * Appends a value to a uint16_t channel (for use after insertPointFast()) */
651681 virtual void insertPointField_uint16 (const std::string_view& fieldName, uint16_t value) {}
652682
653683 virtual void reserveField_float (const std::string_view& fieldName, size_t n) {}
684+ virtual void reserveField_double (const std::string_view& fieldName, size_t n) {}
654685 virtual void reserveField_uint16 (const std::string_view& fieldName, size_t n) {}
655686 virtual void resizeField_float (const std::string_view& fieldName, size_t n) {}
687+ virtual void resizeField_double (const std::string_view& fieldName, size_t n) {}
656688 virtual void resizeField_uint16 (const std::string_view& fieldName, size_t n) {}
657689
658690 virtual auto getPointsBufferRef_float_field (const std::string_view& fieldName) const
@@ -663,6 +695,11 @@ class CPointsMap :
663695 if (fieldName == " z" ) return &m_z;
664696 return nullptr ;
665697 }
698+ virtual auto getPointsBufferRef_double_field ([[maybe_unused]] const std::string_view& fieldName)
699+ const -> const mrpt::aligned_std_vector<double>*
700+ {
701+ return nullptr ;
702+ }
666703 virtual auto getPointsBufferRef_uint_field ([[maybe_unused]] const std::string_view& fieldName)
667704 const -> const mrpt::aligned_std_vector<uint16_t>*
668705 {
@@ -677,6 +714,11 @@ class CPointsMap :
677714 if (fieldName == " z" ) return &m_z;
678715 return nullptr ;
679716 }
717+ virtual auto getPointsBufferRef_double_field ([[maybe_unused]] const std::string_view& fieldName)
718+ -> mrpt::aligned_std_vector<double>*
719+ {
720+ return nullptr ;
721+ }
680722 virtual auto getPointsBufferRef_uint_field ([[maybe_unused]] const std::string_view& fieldName)
681723 -> mrpt::aligned_std_vector<uint16_t>*
682724 {
@@ -824,6 +866,13 @@ class CPointsMap :
824866 };
825867 std::vector<FloatFieldMapping> float_fields;
826868
869+ struct DoubleFieldMapping
870+ {
871+ const mrpt::aligned_std_vector<double >* src_buf = nullptr ;
872+ mrpt::aligned_std_vector<double >* dst_buf = nullptr ;
873+ };
874+ std::vector<DoubleFieldMapping> double_fields;
875+
827876 struct UInt16FieldMapping
828877 {
829878 const mrpt::aligned_std_vector<uint16_t >* src_buf = nullptr ;
@@ -850,7 +899,10 @@ class CPointsMap :
850899 {
851900 f.dst_buf ->push_back ((*f.src_buf )[i]);
852901 }
853-
902+ for (auto & f : ctx.double_fields )
903+ {
904+ f.dst_buf ->push_back ((*f.src_buf )[i]);
905+ }
854906 for (auto & f : ctx.uint16_fields )
855907 {
856908 f.dst_buf ->push_back ((*f.src_buf )[i]);
0 commit comments