diff --git a/Orthtree/include/CGAL/Orthtree.h b/Orthtree/include/CGAL/Orthtree.h index e67caf2fa06..8751c15e97e 100644 --- a/Orthtree/include/CGAL/Orthtree.h +++ b/Orthtree/include/CGAL/Orthtree.h @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -110,6 +111,8 @@ public: */ typedef std::size_t Node_index; + typedef Properties::Property_container Node_property_container; + /*! * \brief Optional index of a node in the tree. */ @@ -161,6 +164,13 @@ private: // data members : std::vector m_nodes; /* nodes of the tree; root is always at index 0 */ + Node_property_container m_node_properties; + Node_property_container::Array> &m_node_points; + Node_property_container::Array &m_node_depths; + Node_property_container::Array> &m_node_coordinates; + Node_property_container::Array &m_node_parents; + Node_property_container::Array &m_node_children; + Point m_bbox_min; /* input bounding box min value */ std::vector m_side_per_depth; /* side length per node's depth */ @@ -202,10 +212,13 @@ public: Orthtree(PointRange& point_range, PointMap point_map = PointMap(), const FT enlarge_ratio = 1.2, - Traits traits = Traits()) - : m_traits(traits) - , m_range(point_range) - , m_point_map(point_map) { + Traits traits = Traits()) : + m_traits(traits), m_range(point_range), m_point_map(point_map), + m_node_points(m_node_properties.add_property>("points")), + m_node_depths(m_node_properties.add_property("depths", 0)), + m_node_coordinates(m_node_properties.add_property>("coordinates")), + m_node_parents(m_node_properties.add_property("parents")), + m_node_children(m_node_properties.add_property("children")) { m_nodes.emplace_back(); @@ -260,22 +273,26 @@ public: /// \cond SKIP_IN_MANUAL // copy constructor - Orthtree(const Orthtree& other) - : m_traits(other.m_traits) - , m_range(other.m_range) - , m_point_map(other.m_point_map) - , m_nodes(other.m_nodes) // todo: copying will require some extra management - , m_bbox_min(other.m_bbox_min) - , m_side_per_depth(other.m_side_per_depth) {} + Orthtree(const Orthtree& other) : + m_traits(other.m_traits), m_range(other.m_range), m_point_map(other.m_point_map), m_nodes(other.m_nodes), + m_bbox_min(other.m_bbox_min), m_side_per_depth(other.m_side_per_depth), + m_node_properties(other.m_node_properties), + m_node_points(m_node_properties.get_property>("points")), + m_node_depths(m_node_properties.get_property("depths")), + m_node_coordinates(m_node_properties.get_property>("coordinates")), + m_node_parents(m_node_properties.get_property("parents")), + m_node_children(m_node_properties.get_property("children")) {} // move constructor - Orthtree(Orthtree&& other) - : m_traits(other.m_traits) - , m_range(other.m_range) - , m_point_map(other.m_point_map) - , m_nodes(std::move(other.m_nodes)) - , m_bbox_min(other.m_bbox_min) - , m_side_per_depth(other.m_side_per_depth) { + Orthtree(Orthtree&& other): + m_traits(other.m_traits), m_range(other.m_range), m_point_map(other.m_point_map), m_nodes(std::move(other.m_nodes)), + m_bbox_min(other.m_bbox_min), m_side_per_depth(other.m_side_per_depth), + m_node_properties(other.m_node_properties), + m_node_points(m_node_properties.get_property>("points")), + m_node_depths(m_node_properties.get_property("depths")), + m_node_coordinates(m_node_properties.get_property>("coordinates")), + m_node_parents(m_node_properties.get_property("parents")), + m_node_children(m_node_properties.get_property("children")) { // todo: makes sure moved-from is still valid. Maybe this shouldn't be necessary. other.m_nodes.emplace_back();