Skip to content

Commit d55e194

Browse files
authored
move readers.copc thread pool init to initialize (PDAL#4716)
1 parent 6fbc4e6 commit d55e194

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

io/CopcReader.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,10 @@ void CopcReader::initialize(PointTableRef table)
385385

386386
if (m_args->resolution)
387387
log()->get(LogLevel::Debug) << "Maximum depth: " << m_p->depthEnd << std::endl;
388+
389+
// Initialize our threadpool
390+
m_p->pool.reset(new ThreadPool(m_args->threads));
391+
388392
}
389393

390394

@@ -641,7 +645,6 @@ void CopcReader::addDimensions(PointLayoutPtr layout)
641645

642646
void CopcReader::ready(PointTableRef table)
643647
{
644-
m_p->pool.reset(new ThreadPool(m_args->threads));
645648
// Determine all overlapping data files we'll need to fetch.
646649
try
647650
{

test/unit/io/CopcReaderTest.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,4 +677,25 @@ TEST(CopcReaderTest, ogrCrop)
677677
EXPECT_LE(v->size(), 90u);
678678
}
679679

680+
681+
TEST(CopcReaderTest, boundedpreview)
682+
{
683+
684+
685+
BOX2D bounds(515380, 4918350, 515400, 4918370);
686+
687+
CopcReader reader;
688+
{
689+
Options options;
690+
options.add("filename", copcPath);
691+
options.add("bounds", bounds);
692+
reader.setOptions(options);
693+
}
694+
695+
pdal::QuickInfo qi(reader.preview());
696+
pdal::BOX3D bounds3d = qi.m_bounds;
697+
698+
EXPECT_EQ(pdal::Bounds(bounds).to2d(), pdal::Bounds(bounds3d).to2d());
699+
}
700+
680701
} // namespace pdal

0 commit comments

Comments
 (0)