/*private*/
void 
MCIndexSegmentSetMutualIntersector::addToMonoChains(SegmentString* segStr)
{
    MonoChains segChains;
    MonotoneChainBuilder::getChains(segStr->getCoordinates(),
                                    segStr, segChains);

    MonoChains::size_type n = segChains.size(); 
    monoChains.reserve(monoChains.size() + n);
    for (MonoChains::size_type i = 0; i < n; i++)
    {
        MonotoneChain* mc = segChains[i];
        mc->setId( processCounter++ );
        monoChains.push_back(mc);
    }
}
/*private*/
void 
MCIndexSegmentSetMutualIntersector::addToIndex(SegmentString* segStr)
{
    MonoChains segChains;
    MonotoneChainBuilder::getChains(segStr->getCoordinates(),
      segStr, segChains);

    MonoChains::size_type n = segChains.size();
    chainStore.reserve(chainStore.size() + n);
    for (MonoChains::size_type i = 0; i < n; i++)
    {
        MonotoneChain * mc = segChains[i];
        mc->setId(indexCounter++);
        index->insert(&(mc->getEnvelope()), mc);
        chainStore.push_back(mc);
    }
}
示例#3
0
/*private*/
void
MCIndexNoder::add(SegmentString* segStr)
{
	vector<MonotoneChain*> segChains;

	// segChains will contain nelwy allocated MonotoneChain objects
	MonotoneChainBuilder::getChains(segStr->getCoordinates(),
			segStr, segChains);

	for(vector<MonotoneChain*>::iterator
			it=segChains.begin(), iEnd=segChains.end();
			it!=iEnd; ++it)
	{
		MonotoneChain* mc = *it;
		assert(mc);

		mc->setId(idCounter++);
		index.insert(&(mc->getEnvelope()), mc);

		// MonotoneChain objects deletion delegated to destructor
		monoChains.push_back(mc);
	}
}