Ejemplo n.º 1
0
void
GiST::ShortenTree ()
{
	GiSTpath path;
	// Shorten the tree if necessary (This should only be done if root actually changed!)
	path.MakeRoot ();
	GiSTnode *root = ReadNode(path);

	if (!root->IsLeaf() && root->NumEntries()==1) {
		path.MakeChild ((*root)[0]->Ptr());
		GiSTnode *child = ReadNode (path);

		store->Deallocate(path.Page());
		child->SetSibling(0);
		child->Path().MakeRoot();
		WriteNode (child);
		delete child;
	}
	delete root;
}
Ejemplo n.º 2
0
double
RTentry::OverlapArea(const RTkey &k) const
{
  int i;
  GiSTnode *n = Node();
  RTkey *okey, *tmpkey;
  double retval;

  okey = new RTkey(k);

  for (i = 0; i < n->NumEntries(); i++)
    if (i != Position()) {
      tmpkey = okey;
      okey = tmpkey->intersect(((RTentry *)((*n)[i].Ptr()))->bbox());
      delete tmpkey;
      if (okey == NULL)
	return(0);
    }
  retval = okey->area();
  delete okey;
  return(retval);
}