Skip to content

Commit 7abaec1

Browse files
committed
Merge branch 'develop'
2 parents d1e06fa + 65e2964 commit 7abaec1

18 files changed

+412
-46
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# version format
2-
version: 2.15.1-{branch}-build{build}
2+
version: 2.15.2-{branch}-build{build}
33

44
os: Visual Studio 2019
55

doc/source/doxygen-docs/changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
\page changelog Change Log
22

3+
# Version 2.15.2: Released Nov 19th, 2025
4+
- Changes in libraries:
5+
- \ref mrpt_maps_grp
6+
- mrpt::maps::CGenericPointsMap now supports fields of type `double` too.
7+
- Others:
8+
- Fix appstreamcli warnings for metainfo files
9+
310
# Version 2.15.1: Released Oct 29th, 2025
411
- Bug fixes:
512
- FIX: Avoid throw when viewing and describing as text a PCD with an empty field.

libs/maps/include/mrpt/maps/CGenericPointsMap.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class CGenericPointsMap : public CPointsMap
5252
// see docs in parent class
5353
bool registerField_float(const std::string_view& fieldName) override;
5454

55+
// see docs in parent class
56+
bool registerField_double(const std::string_view& fieldName) override;
57+
5558
// see docs in parent class
5659
bool registerField_uint16(const std::string_view& fieldName) override;
5760

@@ -108,12 +111,15 @@ class CGenericPointsMap : public CPointsMap
108111
@{ */
109112
bool hasPointField(const std::string_view& fieldName) const override;
110113
std::vector<std::string_view> getPointFieldNames_float() const override;
114+
std::vector<std::string_view> getPointFieldNames_double() const override;
111115
std::vector<std::string_view> getPointFieldNames_uint16() const override;
112116

113117
float getPointField_float(size_t index, const std::string_view& fieldName) const override;
118+
double getPointField_double(size_t index, const std::string_view& fieldName) const override;
114119
uint16_t getPointField_uint16(size_t index, const std::string_view& fieldName) const override;
115120

116121
void setPointField_float(size_t index, const std::string_view& fieldName, float value) override;
122+
void setPointField_double(size_t index, const std::string_view& fieldName, double value) override;
117123
void setPointField_uint16(
118124
size_t index, const std::string_view& fieldName, uint16_t value) override;
119125

@@ -123,6 +129,12 @@ class CGenericPointsMap : public CPointsMap
123129
* (i.e. you just called `insertPointFast()`).
124130
*/
125131
void insertPointField_float(const std::string_view& fieldName, float value) override;
132+
/** Appends a value to the given field.
133+
* The field must be registered.
134+
* Asserts that the field vector's size is exactly `this->size() - 1`
135+
* (i.e. you just called `insertPointFast()`).
136+
*/
137+
void insertPointField_double(const std::string_view& fieldName, double value) override;
126138
/** Appends a value to the given field.
127139
* The field must be registered.
128140
* Asserts that the field vector's size is exactly `this->size() - 1`
@@ -131,8 +143,11 @@ class CGenericPointsMap : public CPointsMap
131143
void insertPointField_uint16(const std::string_view& fieldName, uint16_t value) override;
132144

133145
void reserveField_float(const std::string_view& fieldName, size_t n) override;
146+
void reserveField_double(const std::string_view& fieldName, size_t n) override;
134147
void reserveField_uint16(const std::string_view& fieldName, size_t n) override;
148+
135149
void resizeField_float(const std::string_view& fieldName, size_t n) override;
150+
void resizeField_double(const std::string_view& fieldName, size_t n) override;
136151
void resizeField_uint16(const std::string_view& fieldName, size_t n) override;
137152

138153
auto getPointsBufferRef_float_field(const std::string_view& fieldName) const
@@ -148,6 +163,15 @@ class CGenericPointsMap : public CPointsMap
148163
}
149164
return nullptr;
150165
}
166+
auto getPointsBufferRef_double_field(const std::string_view& fieldName) const
167+
-> const mrpt::aligned_std_vector<double>* override
168+
{
169+
if (auto it = m_double_fields.find(fieldName); it != m_double_fields.end())
170+
{
171+
return &it->second;
172+
}
173+
return nullptr;
174+
}
151175
auto getPointsBufferRef_uint_field(const std::string_view& fieldName) const
152176
-> const mrpt::aligned_std_vector<uint16_t>* override
153177
{
@@ -171,6 +195,15 @@ class CGenericPointsMap : public CPointsMap
171195
}
172196
return nullptr;
173197
}
198+
auto getPointsBufferRef_double_field(const std::string_view& fieldName)
199+
-> mrpt::aligned_std_vector<double>* override
200+
{
201+
if (auto it = m_double_fields.find(fieldName); it != m_double_fields.end())
202+
{
203+
return &it->second;
204+
}
205+
return nullptr;
206+
}
174207
auto getPointsBufferRef_uint_field(const std::string_view& fieldName)
175208
-> mrpt::aligned_std_vector<uint16_t>* override
176209
{
@@ -187,6 +220,8 @@ class CGenericPointsMap : public CPointsMap
187220
/** Map from field name to data vector */
188221
std::unordered_map<std::string_view, mrpt::aligned_std_vector<float>> m_float_fields;
189222
/** Map from field name to data vector */
223+
std::unordered_map<std::string_view, mrpt::aligned_std_vector<double>> m_double_fields;
224+
/** Map from field name to data vector */
190225
std::unordered_map<std::string_view, mrpt::aligned_std_vector<uint16_t>> m_uint16_fields;
191226

192227
/** Clear the map, erasing all the points and all fields */

libs/maps/include/mrpt/maps/CPointsMap.h

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)