Example #1
0
void process_input(struct partition_op &partop) {
	BinarySplitNode *tree = new BinarySplitNode(partop.low[0], 
		partop.low[1], partop.high[0], partop.high[1], 0);
	leafNodeList.push_back(tree);
	for (vector<SpatialObject*>::iterator it = listAllObjects.begin(); it != listAllObjects.end(); it++) {
		tree->addObject(*it);
	}

	int tid = 0; //bucket id
	//int countLeaf = 0;
	for(vector<BinarySplitNode*>::iterator it = leafNodeList.begin(); it != leafNodeList.end(); it++ ) {
		BinarySplitNode *tmp = *it;
		if (tmp->isLeaf) {
			/* Composite key */
			cout << partop.prefix_tile_id << tid 
				<< TAB << tmp->low[0] << TAB << tmp->low[1] << TAB
				<< tmp->high[0] << TAB << tmp->high[1] 
				#ifdef DEBUG
				<< TAB << tmp->size 
				#endif
				<< endl;
			tid++;
		}
	}

	// Memory cleanup here. 

	for (vector<SpatialObject*>::iterator it = listAllObjects.begin(); it != listAllObjects.end(); it++) { 
		delete *it;
	}

	for(vector<BinarySplitNode*>::iterator it = leafNodeList.begin(); it != leafNodeList.end(); it++ ) {
	//	(*it)->objectList.clear();
		delete *it;

	}
	listAllObjects.clear(); 
	leafNodeList.clear();
	//delete tree;
}
Example #2
0
void processInput() {
  BinarySplitNode *tree = new BinarySplitNode(0.0, 1.0, 1.0, 0.0, 0);
  leafNodeList.push_back(tree);
  for (vector<SpatialObject*>::iterator it = listAllObjects.begin(); it != listAllObjects.end(); it++) { 
    tree->addObject(*it);
  }

  id_type tid=1; //bucket id
  double low[2], high[2];
  //int countLeaf = 0;
  for(vector<BinarySplitNode*>::iterator it = leafNodeList.begin(); it != leafNodeList.end(); it++ ) {
    BinarySplitNode *tmp = *it;
    if (tmp->isLeaf) {
      // cout << ++countLeaf << SPACE << tmp->left << SPACE  << tmp->bottom 
      //    << SPACE << tmp->right << SPACE << tmp->top << SPACE << tmp->size << endl ;
      low[0] = tmp->left ;
      low[1] = tmp->bottom;
      high[0] = tmp->right;
      high[1] = tmp->top;
      Region r(low, high, 2);
      tiles.push_back(new RTree::Data(0, 0 , r, tid++));
    }
  }
}