int mapQuadTreeAbstraction::getQuadrant(node *which)
{ // int sectorSize;
	// 1. get any child
	node *child = which;
	while (child->getLabelL(kAbstractionLevel) != 0)
		child = getNthChild(child, 0);
	
	int xloc = child->getLabelL(kFirstData); // x loc in map
	int yloc = child->getLabelL(kFirstData+1); // y loc in map

	int level = which->getLabelL(kAbstractionLevel);
	int absSectorSize = (int)pow((double)sectorSize, (double)level+1);
	
	int sectorNum = (getMap()->getMapWidth()/absSectorSize)*(yloc/absSectorSize)+(xloc/absSectorSize);
	
	return sectorNum;
}
示例#2
0
文件: element.cpp 项目: Aricg/mongo
 Element Element::operator[](size_t n) const {
     return getNthChild(*this, n);
 }