2 #include "view_btree.h"
3 #include "view_btree_data.h"
5 ViewBTree::ViewBTree (Canvas::Group *parent, std::string filename):Canvas::Group (*parent, 0, 0),
8 /* TODO : hace que el arbol se abra de un archivo ya creado o que se
11 for (int i=0; i<=64; i++) {
18 uchar *node = ReadBlock (0);
19 BTreeNodeHeader node_h;
20 ReadNodoHeader (node, &node_h);
21 std::list<BTreeData *> keys = ReadKeys (node, node_h);
23 Canvas::Rect *rect = new Canvas::Rect (*this, 0, 0, NODE_WIDTH, NODE_HEIGHT);
24 rect->property_fill_color() = "gray";
26 int byte_to_pixels = NODE_WIDTH/64; // TODO : 64 == BlockSize
28 /* Ahora pongo el lugar que opcupa el header */
29 double header_w = byte_to_pixels * sizeof (BTreeNodeHeader);
32 Canvas::Rect *view_header = new Canvas::Rect (*this, x, 0, x+header_w, NODE_HEIGHT);
35 std::list<BTreeData *>::iterator it = keys.begin ();
36 while (it != keys.end ()) {
37 BTreeData *data = (*it);
38 double w = byte_to_pixels * data->Size ();
40 ViewBTreeData::Create (data, this, x, 0, w+x, NODE_HEIGHT);