| 45 | |
| 46 | template <class Box, class Tree> |
| 47 | void print_tree_node (const Tree *tree, const Box &bbox, size_t pos, db::box_tree_node<Tree> *node, const std::string &in) |
| 48 | { |
| 49 | std::cout << in << "x [\n"; |
| 50 | if (! node) { |
| 51 | for (size_t i = pos; i < pos + tree->size (); ++i) { |
| 52 | std::cout << in << " " << tree->elements ()[i]->to_string () << "\n"; |
| 53 | } |
| 54 | } else { |
| 55 | for (size_t i = pos; i < pos + node->lenq (-1); ++i) { |
| 56 | std::cout << in << " " << tree->elements ()[i]->to_string () << "\n"; |
| 57 | } |
| 58 | } |
| 59 | std::cout << in << "]\n"; |
| 60 | if (node) { |
| 61 | pos += node->lenq (-1); |
| 62 | for (int q = 0; q < 4; ++q) { |
| 63 | Box qb (qbox (q, bbox)); |
| 64 | if (node->child (q)) { |
| 65 | std::cout << in << q << " (" << qb.to_string () << ") [\n"; |
| 66 | print_tree_node (tree, qb, pos, node->child (q), in + " "); |
| 67 | std::cout << in << "]\n"; |
| 68 | } else { |
| 69 | std::cout << in << q << " (" << qb.to_string () << ") [\n"; |
| 70 | for (size_t i = pos; i < pos + node->lenq (q); ++i) { |
| 71 | std::cout << in << " " << tree->elements ()[i]->to_string () << " #" << i << "\n"; |
| 72 | } |
| 73 | std::cout << in << "]\n"; |
| 74 | } |
| 75 | pos += node->lenq (q); |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | template <class Tree> |
| 81 | void print_tree (const Tree &t, db::Box bbox) |