[Liblas-commits] hg: zipped reader must put the header back if a
filter has chang...
liblas-commits at liblas.org
liblas-commits at liblas.org
Mon Jan 10 10:55:36 EST 2011
details: http://hg.liblas.orghg/rev/20eb298ee542
changeset: 2714:20eb298ee542
user: Howard Butler <hobu.inc at gmail.com>
date: Mon Jan 10 09:55:30 2011 -0600
description:
zipped reader must put the header back if a filter has changed it (needed for ReprojectionTransform and ilk that are allowed to move the HeaderPtr
diffstat:
include/liblas/detail/reader/zipreader.hpp | 8 +++++---
src/detail/reader/zipreader.cpp | 20 +++++++++++++++++++-
2 files changed, 24 insertions(+), 4 deletions(-)
diffs (70 lines):
diff -r 3882cfa78410 -r 20eb298ee542 include/liblas/detail/reader/zipreader.hpp
--- a/include/liblas/detail/reader/zipreader.hpp Sun Jan 09 13:19:11 2011 -0600
+++ b/include/liblas/detail/reader/zipreader.hpp Mon Jan 10 09:55:30 2011 -0600
@@ -105,10 +105,12 @@
std::vector<liblas::FilterPtr> m_filters;
std::vector<liblas::TransformPtr> m_transforms;
+ bool bNeedHeaderCheck;
+
private:
- void ReadIdiom(bool recordPoint);
- void ResetUnzipper();
-
+ void ReadIdiom(bool recordPoint);
+ void ResetUnzipper();
+
LASunzipper* m_unzipper;
ZipPoint* m_zipPoint;
diff -r 3882cfa78410 -r 20eb298ee542 src/detail/reader/zipreader.cpp
--- a/src/detail/reader/zipreader.cpp Sun Jan 09 13:19:11 2011 -0600
+++ b/src/detail/reader/zipreader.cpp Mon Jan 10 09:55:30 2011 -0600
@@ -238,6 +238,12 @@
throw std::out_of_range("ReadNextPoint: file has no more points to read, end of file reached");
}
+ if (bNeedHeaderCheck)
+ {
+ if (m_point->GetHeaderPtr().get() != m_header.get())
+ m_point->SetHeaderPtr(m_header);
+ }
+
ReadIdiom(true);
// Filter the points and continue reading until we either find
@@ -311,6 +317,12 @@
m_ifs.clear();
m_ifs.seekg(pos, std::ios::beg);
+ if (bNeedHeaderCheck)
+ {
+ if (m_point->GetHeaderPtr().get() != m_header.get())
+ m_point->SetHeaderPtr(m_header);
+ }
+
ResetUnzipper();
// skip over a whole bunch
@@ -350,7 +362,7 @@
m_ifs.clear();
m_ifs.seekg(pos, std::ios::beg);
-
+
ResetUnzipper();
// skip over a whole bunch
@@ -373,6 +385,12 @@
void ZipReaderImpl::SetTransforms(std::vector<liblas::TransformPtr> const& transforms)
{
m_transforms = transforms;
+
+ // Transforms are allowed to change the point, including moving the
+ // point's HeaderPtr. We need to check if we need to set that
+ // back on any subsequent reads.
+ if (m_transforms.size() > 0)
+ bNeedHeaderCheck = true;
}
}} // namespace liblas::detail
More information about the Liblas-commits
mailing list