/** * \brief Replace the node in the m_nodes vector and recompute the box */ void replace_node(node_pointer const& leaf, node_pointer& new_leaf) { unsigned int index = 0; for(typename node_map::iterator it = m_nodes.begin(); it != m_nodes.end(); ++it, index++) { if (it->second.get() == leaf.get()) { m_nodes[index] = std::make_pair(new_leaf->compute_box(), new_leaf); new_leaf->update_parent(new_leaf); return; } } // TODO: mloskot - define & use GGL exception throw std::logic_error("Node not found."); }
/** * \brief Add a child to this node */ virtual void add_node(Box const& box, node_pointer const& node) { m_nodes.push_back(std::make_pair(box, node)); node->update_parent(node); }