Exemple #1
0
/*private*/
void
Root::insertContained(Node *tree, const Envelope *itemEnv, void *item)
{
	assert(tree->getEnvelope()->contains(itemEnv));

	/**
	 * Do NOT create a new quad for zero-area envelopes - this would lead
	 * to infinite recursion. Instead, use a heuristic of simply returning
	 * the smallest existing quad containing the query
	 */
	bool isZeroX = IntervalSize::isZeroWidth(itemEnv->getMinX(),
	                                         itemEnv->getMaxX());
	bool isZeroY = IntervalSize::isZeroWidth(itemEnv->getMinY(),
	                                         itemEnv->getMaxY());

	NodeBase *node;

	if (isZeroX || isZeroY)
	{
		node = tree->find(itemEnv);
	}
	else
	{
		node = tree->getNode(itemEnv);
	}

	node->add(item);
}
Exemple #2
0
void
Root::insertContained(Node *tree, Interval *itemInterval, void* item)
{
	using geos::index::quadtree::IntervalSize;  

	assert(tree->getInterval()->contains(itemInterval));

	/**
	 * Do NOT create a new node for zero-area intervals - this would lead
	 * to infinite recursion. Instead, use a heuristic of simply returning
	 * the smallest existing node containing the query
	 */
	bool isZeroArea=IntervalSize::isZeroWidth(itemInterval->getMin(),
			itemInterval->getMax());
	NodeBase *node;
	if (isZeroArea)
		node=tree->find(itemInterval);
	else
		node=tree->getNode(itemInterval);
	node->add(item);
}