| 583 | |
| 584 | |
| 585 | void EptReader::ready(PointTableRef table) |
| 586 | { |
| 587 | // These may not exist, in general they are only needed to track point |
| 588 | // origins and ordering for an EPT writer. |
| 589 | m_nodeIdDim = table.layout()->findDim("EptNodeId"); |
| 590 | m_pointIdDim = table.layout()->findDim("EptPointId"); |
| 591 | |
| 592 | // We may be running multiple times without re-initializing. reset the |
| 593 | // connector & threadpool if so. |
| 594 | if (m_p->done) |
| 595 | { |
| 596 | m_p->connector.reset(new connector::Connector(m_filespec)); |
| 597 | m_p->pool.reset(new ThreadPool(m_args->m_threads)); |
| 598 | } |
| 599 | |
| 600 | if ( |
| 601 | m_queryOriginId != -1 && |
| 602 | !table.layout()->hasDim(Dimension::Id::OriginId)) |
| 603 | { |
| 604 | // In this case we can't compare the OriginId for each point since the |
| 605 | // EPT data does not have that attribute saved. We will keep the |
| 606 | // spatial query to limit the data to the extents of the requested |
| 607 | // origin, but if other origins overlap these extents, then their points |
| 608 | // will also be included. |
| 609 | m_queryOriginId = -1; |
| 610 | |
| 611 | log()->get(LogLevel::Warning) << |
| 612 | "An origin query was given but no OriginId dimension exists - " << |
| 613 | "points from other origins may be included" << std::endl; |
| 614 | } |
| 615 | |
| 616 | m_p->hierarchy.reset(new ept::Hierarchy); |
| 617 | |
| 618 | // Determine all overlapping data files we'll need to fetch. |
| 619 | try |
| 620 | { |
| 621 | overlaps(); |
| 622 | } |
| 623 | catch (std::exception& e) |
| 624 | { |
| 625 | throwError(e.what()); |
| 626 | } |
| 627 | |
| 628 | point_count_t overlapPoints(0); |
| 629 | for (const ept::Overlap& overlap : *m_p->hierarchy) |
| 630 | overlapPoints += overlap.m_count; |
| 631 | |
| 632 | if (overlapPoints > 1e8) |
| 633 | { |
| 634 | log()->get(LogLevel::Warning) << overlapPoints << |
| 635 | " points will be downloaded" << std::endl; |
| 636 | } |
| 637 | |
| 638 | m_pointId = 0; |
| 639 | m_tileCount = m_p->hierarchy->size(); |
| 640 | |
| 641 | // If we're running in standard mode, queue up all the requests for data. |
| 642 | // In streaming mode, queue up at most 4 to avoid having a ton of data |