This code runs in a single thread, so doesn't need locking.
| 806 | |
| 807 | // This code runs in a single thread, so doesn't need locking. |
| 808 | bool EptReader::processPoint(PointRef& dst, const ept::TileContents& tile) |
| 809 | { |
| 810 | using namespace Dimension; |
| 811 | |
| 812 | BasePointTable& t = tile.table(); |
| 813 | |
| 814 | // Save current point ID and increment so that we can return without |
| 815 | // worrying about m_pointId being correct on exit. |
| 816 | PointId pointId = m_pointId++; |
| 817 | |
| 818 | PointRef p(t, pointId); |
| 819 | if (m_queryOriginId != -1 && |
| 820 | p.getFieldAs<int64_t>(Id::OriginId)!= m_queryOriginId) |
| 821 | { |
| 822 | return false; |
| 823 | } |
| 824 | |
| 825 | auto passesBoundsFilter = [this](double x, double y, double z) |
| 826 | { |
| 827 | if (!m_p->bounds.box.valid()) |
| 828 | return true; |
| 829 | m_p->bounds.xform.transform(x, y, z); |
| 830 | return m_p->bounds.box.contains(x, y, z); |
| 831 | }; |
| 832 | |
| 833 | auto passesPolyFilter = [this](double xo, double yo, double zo) |
| 834 | { |
| 835 | if (m_p->polys.empty()) |
| 836 | return true; |
| 837 | |
| 838 | for (PolyXform& ps : m_p->polys) |
| 839 | { |
| 840 | double x = xo; |
| 841 | double y = yo; |
| 842 | double z = zo; |
| 843 | |
| 844 | ps.xform.transform(x, y, z); |
| 845 | if (ps.poly.contains(x, y)) |
| 846 | return true; |
| 847 | } |
| 848 | return false; |
| 849 | }; |
| 850 | |
| 851 | double x = p.getFieldAs<double>(Id::X); |
| 852 | double y = p.getFieldAs<double>(Id::Y); |
| 853 | double z = p.getFieldAs<double>(Id::Z); |
| 854 | |
| 855 | // If there is a spatial filter, make sure it passes. |
| 856 | if (m_p->hasSpatialFilter()) |
| 857 | if (!passesBoundsFilter(x, y, z) || !passesPolyFilter(x, y, z)) |
| 858 | return false; |
| 859 | |
| 860 | for (auto& el : m_p->info->dims()) |
| 861 | { |
| 862 | DimType& dt = el.second; |
| 863 | if (dt.m_id != Dimension::Id::X && |
| 864 | dt.m_id != Dimension::Id::Y && |
| 865 | dt.m_id != Dimension::Id::Z) |
nothing calls this directly
no test coverage detected