MCPcopy Create free account
hub / github.com/PDAL/PDAL / passesSpatialFilter

Method passesSpatialFilter

io/EptReader.cpp:686–724  ·  view source on GitHub ↗

Determine if an EPT tile overlaps our query boundary

Source from the content-addressed store, hash-verified

684
685// Determine if an EPT tile overlaps our query boundary
686bool EptReader::Private::passesSpatialFilter(const BOX3D& tileBounds) const
687{
688 auto boxOverlaps = [this, &tileBounds]() -> bool
689 {
690 if (!bounds.box.valid())
691 return true;
692
693 if (llToBcbfTransform.valid())
694 {
695 return reprojectBoundsBcbfToLonLat(bounds.box, llToBcbfTransform).overlaps(tileBounds);
696 }
697
698 // If the reprojected source bounds doesn't overlap our query bounds, we're done.
699 return reprojectBoundsViaCorner(tileBounds, bounds.xform).overlaps(bounds.box);
700 };
701
702 // Check the box of the key against our query polygon(s). If it doesn't overlap,
703 // we can skip
704 auto polysOverlap = [this, &tileBounds]() -> bool
705 {
706 if (polys.empty())
707 return true;
708
709 for (auto& ps : polys)
710 if (!ps.poly.disjoint(reprojectBoundsViaCorner(tileBounds, ps.xform)))
711 return true;
712 return false;
713 };
714
715 // If there's no spatial filter, we always overlap.
716 if (!hasSpatialFilter())
717 return true;
718
719 // This lock is here because if a bunch of threads are using the transform
720 // at the same time, it seems to get corrupted. There may be other instances
721 // that need to be locked.
722 std::lock_guard<std::mutex> lock(mutex);
723 return boxOverlaps() && polysOverlap();
724}
725
726
727void EptReader::Private::overlaps(ept::Hierarchy& target, const NL::json& hier, const ept::Key& key)

Callers

nothing calls this directly

Calls 6

disjointMethod · 0.80
reprojectBoundsViaCornerFunction · 0.70
validMethod · 0.45
overlapsMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected