From c7d55f1dd628b533d3698431530cb43aead60684 Mon Sep 17 00:00:00 2001 From: Amael Marquez Date: Tue, 12 Dec 2023 14:36:35 +0100 Subject: [PATCH] [SpatialPartitioning] Improve kdtree to_string --- Ponca/src/SpatialPartitioning/KdTree/kdTree.h | 2 +- .../src/SpatialPartitioning/KdTree/kdTree.hpp | 47 ++++++++++++++----- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/Ponca/src/SpatialPartitioning/KdTree/kdTree.h b/Ponca/src/SpatialPartitioning/KdTree/kdTree.h index 57cdecca..572cebd8 100644 --- a/Ponca/src/SpatialPartitioning/KdTree/kdTree.h +++ b/Ponca/src/SpatialPartitioning/KdTree/kdTree.h @@ -186,7 +186,7 @@ class KdTreeBase Converter c); inline bool valid() const; - inline std::string to_string() const; + inline std::string to_string(bool verbose = false) const; // Accessors --------------------------------------------------------------- public: diff --git a/Ponca/src/SpatialPartitioning/KdTree/kdTree.hpp b/Ponca/src/SpatialPartitioning/KdTree/kdTree.hpp index 0ace85f2..e0f746f4 100644 --- a/Ponca/src/SpatialPartitioning/KdTree/kdTree.hpp +++ b/Ponca/src/SpatialPartitioning/KdTree/kdTree.hpp @@ -95,30 +95,51 @@ bool KdTreeBase::valid() const } template -std::string KdTreeBase::to_string() const +std::string KdTreeBase::to_string(bool verbose) const { - if (m_indices.empty()) return ""; - std::stringstream str; - str << "indices (" << index_count() << ") :\n"; - for(IndexType i=0; i