| 543 | }; |
| 544 | |
| 545 | QuadIndex::QImpl::QImpl(const PointView& view, std::size_t topLevel) |
| 546 | : m_topLevel(topLevel) |
| 547 | , m_pointRefVec() |
| 548 | , m_tree() |
| 549 | , m_depth(0) |
| 550 | , m_fills() |
| 551 | { |
| 552 | m_pointRefVec.resize(view.size()); |
| 553 | |
| 554 | double xMin((std::numeric_limits<double>::max)()); |
| 555 | double yMin((std::numeric_limits<double>::max)()); |
| 556 | double xMax((std::numeric_limits<double>::min)()); |
| 557 | double yMax((std::numeric_limits<double>::min)()); |
| 558 | |
| 559 | for (PointId i(0); i < view.size(); ++i) |
| 560 | { |
| 561 | m_pointRefVec[i].reset( |
| 562 | new QuadPointRef( |
| 563 | Point( |
| 564 | view.getFieldAs<double>(Dimension::Id::X, i), |
| 565 | view.getFieldAs<double>(Dimension::Id::Y, i)), |
| 566 | i)); |
| 567 | |
| 568 | const QuadPointRef* pointRef(m_pointRefVec[i].get()); |
| 569 | if (pointRef->point.x < xMin) xMin = pointRef->point.x; |
| 570 | if (pointRef->point.x > xMax) xMax = pointRef->point.x; |
| 571 | if (pointRef->point.y < yMin) yMin = pointRef->point.y; |
| 572 | if (pointRef->point.y > yMax) yMax = pointRef->point.y; |
| 573 | } |
| 574 | |
| 575 | m_tree.reset(new Tree(BBox(Point(xMin, yMin), Point(xMax, yMax)))); |
| 576 | |
| 577 | for (std::size_t i = 0; i < m_pointRefVec.size(); ++i) |
| 578 | { |
| 579 | m_depth = (std::max)(m_tree->addPoint(m_pointRefVec[i].get()), m_depth); |
| 580 | } |
| 581 | } |
| 582 | |
| 583 | QuadIndex::QImpl::QImpl( |
| 584 | const PointView& view, |