/*private*/ void MCIndexNoder::intersectChains() { assert(segInt); SegmentOverlapAction overlapAction(*segInt); for (vector<MonotoneChain*>::iterator i=monoChains.begin(), iEnd=monoChains.end(); i != iEnd; ++i) { GEOS_CHECK_FOR_INTERRUPTS(); MonotoneChain* queryChain = *i; assert(queryChain); vector<void*> overlapChains; index.query(&(queryChain->getEnvelope()), overlapChains); for (vector<void*>::iterator j=overlapChains.begin(), jEnd=overlapChains.end(); j != jEnd; ++j) { MonotoneChain* testChain = static_cast<MonotoneChain*>(*j); assert(testChain); /** * following test makes sure we only compare each * pair of chains once and that we don't compare a * chain to itself */ if (testChain->getId() > queryChain->getId()) { queryChain->computeOverlaps(testChain, &overlapAction); nOverlaps++; } // short-circuit if possible if (segInt->isDone()) return; } } }
/*private*/ void MCIndexSegmentSetMutualIntersector::intersectChains() { MCIndexSegmentSetMutualIntersector::SegmentOverlapAction overlapAction( *segInt); for (MonoChains::size_type i = 0, ni = monoChains.size(); i < ni; ++i) { MonotoneChain * queryChain = (MonotoneChain *)monoChains[i]; std::vector<void*> overlapChains; index->query( &(queryChain->getEnvelope()), overlapChains); for (std::size_t j = 0, nj = overlapChains.size(); j < nj; j++) { MonotoneChain * testChain = (MonotoneChain *)(overlapChains[j]); queryChain->computeOverlaps( testChain, &overlapAction); nOverlaps++; if (segInt->isDone()) return; } } }