Exemple #1
0
void TileNode::aggregateTile(const SpatialDimension* hashing, const Query& query, Response& response, ulong level) const {
	const ulong d = level % hashing->key().size();

	if (query.evalTile(d) && (last() || _pivot.value().z >= query.zoom + query.resolution)) {
		response.addElement(&_pivot);

	} else {
		if (_container[0] != nullptr) _container[0]->aggregateTile(hashing, query, response, level + 1);
		if (_container[1] != nullptr) _container[1]->aggregateTile(hashing, query, response, level + 1);
		if (_container[2] != nullptr) _container[2]->aggregateTile(hashing, query, response, level + 1);
		if (_container[3] != nullptr) _container[3]->aggregateTile(hashing, query, response, level + 1);
	}
}
Exemple #2
0
void TileNode::queryTile(const SpatialDimension* hashing, const Query& query, Response& response, ulong level) const {
	const ulong d = level % hashing->key().size();

	if (query.evalTile(d)) {
		if (query.getTile(d) == _pivot.value() || (last() && util::intersects(_pivot.value(), query.getTile(d)))) {
			aggregateTile(hashing, query, response, level);

		} else if (_pivot.value().z < query.zoom) {
			if (_container[0] != nullptr) _container[0]->queryTile(hashing, query, response, level + 1);
			if (_container[1] != nullptr) _container[1]->queryTile(hashing, query, response, level + 1);
			if (_container[2] != nullptr) _container[2]->queryTile(hashing, query, response, level + 1);
			if (_container[3] != nullptr) _container[3]->queryTile(hashing, query, response, level + 1);
		} 		
	} else {
		if (_container[0] != nullptr) _container[0]->queryTile(hashing, query, response, level + 1);
		if (_container[1] != nullptr) _container[1]->queryTile(hashing, query, response, level + 1);
		if (_container[2] != nullptr) _container[2]->queryTile(hashing, query, response, level + 1);
		if (_container[3] != nullptr) _container[3]->queryTile(hashing, query, response, level + 1);
	}
}