| 964 | |
| 965 | |
| 966 | bool EptReader::processOne(PointRef& point) |
| 967 | { |
| 968 | top: |
| 969 | if (m_tileCount == 0) |
| 970 | return false; |
| 971 | |
| 972 | // If there is no active tile, grab one off the queue and ask for |
| 973 | // another if there are more. If none are available, wait. |
| 974 | if (!m_p->currentTile) |
| 975 | { |
| 976 | do |
| 977 | { |
| 978 | std::unique_lock<std::mutex> l(m_p->mutex); |
| 979 | if (m_p->contents.size()) |
| 980 | { |
| 981 | m_p->currentTile.reset(new ept::TileContents(std::move(m_p->contents.front()))); |
| 982 | m_p->contents.pop(); |
| 983 | break; |
| 984 | } |
| 985 | else if (!m_tileCount) |
| 986 | return false; |
| 987 | else |
| 988 | m_p->contentsCv.wait(l); |
| 989 | } while (true); |
| 990 | checkTile(*m_p->currentTile); |
| 991 | } |
| 992 | |
| 993 | bool ok = processPoint(point, *m_p->currentTile); |
| 994 | |
| 995 | // If we've processed all the points in the current tile, pop it. |
| 996 | // If we've processed all the tiles, return false to indicate that |
| 997 | // we're done. |
| 998 | if (m_pointId == m_p->currentTile->size()) |
| 999 | { |
| 1000 | m_pointId = 0; |
| 1001 | m_p->currentTile.reset(); |
| 1002 | --m_tileCount; |
| 1003 | } |
| 1004 | |
| 1005 | // If we didn't pass a point, try again. |
| 1006 | if (!ok) |
| 1007 | goto top; |
| 1008 | |
| 1009 | return true; |
| 1010 | } |
| 1011 | |
| 1012 | } // namespace pdal |