[Liblas-commits] r1196 - trunk/src/detail
liblas-commits at liblas.org
liblas-commits at liblas.org
Thu Apr 9 14:51:45 EDT 2009
Author: hobu
Date: Thu Apr 9 14:51:42 2009
New Revision: 1196
URL: http://liblas.org/changeset/1196
Log:
rearrange a bit
Modified:
trunk/src/detail/reader.cpp
Modified: trunk/src/detail/reader.cpp
==============================================================================
--- trunk/src/detail/reader.cpp (original)
+++ trunk/src/detail/reader.cpp Thu Apr 9 14:51:42 2009
@@ -183,6 +183,36 @@
m_recordlength = header.GetDataRecordLength();
}
+void Reader::SkipPointDataSignature()
+{
+ uint8_t const sgn1 = 0xCC;
+ uint8_t const sgn2 = 0xDD;
+ uint8_t pad1 = 0x0;
+ uint8_t pad2 = 0x0;
+
+ detail::read_n(pad1, m_ifs, sizeof(uint8_t));
+ detail::read_n(pad2, m_ifs, sizeof(uint8_t));
+
+ LIBLAS_SWAP_BYTES(pad1);
+ LIBLAS_SWAP_BYTES(pad2);
+
+ // FIXME: we have to worry about swapping issues
+ // but some people write the pad bytes backwards
+ // anyway. Let's check both ways.
+ bool found = false;
+ if (sgn1 == pad2 && sgn2 == pad1) found = true;
+ if (sgn1 == pad1 && sgn2 == pad2) found = true;
+ if (!found)
+ {
+ // If the two bytes we read weren't signature bytes
+ // we'll throw an exception. Depending on the version
+ // we may want ot throw an error to the user or
+ // silently continue on.
+ throw std::domain_error("point data signature (1.0's 0xCC and 0xDD padding) not found");
+
+ }
+}
+
void Reader::SetSRS(const LASSpatialReference& srs)
{
m_out_srs = srs;
@@ -275,34 +305,6 @@
throw std::runtime_error("LAS file of unknown version");
}
-void Reader::SkipPointDataSignature()
-{
- uint8_t const sgn1 = 0xCC;
- uint8_t const sgn2 = 0xDD;
- uint8_t pad1 = 0x0;
- uint8_t pad2 = 0x0;
- detail::read_n(pad1, m_ifs, sizeof(uint8_t));
- detail::read_n(pad2, m_ifs, sizeof(uint8_t));
-
- LIBLAS_SWAP_BYTES(pad1);
- LIBLAS_SWAP_BYTES(pad2);
-
- // FIXME: we have to worry about swapping issues
- // but some people write the pad bytes backwards
- // anyway. Let's check both ways.
- bool found = false;
- if (sgn1 == pad2 && sgn2 == pad1) found = true;
- if (sgn1 == pad1 && sgn2 == pad2) found = true;
- if (!found)
- {
- // If the two bytes we read weren't signature bytes
- // we'll throw an exception. Depending on the version
- // we may want ot throw an error to the user or
- // silently continue on.
- throw std::domain_error("point data signature (1.0's 0xCC and 0xDD padding) not found");
-
- }
-}
void ReaderFactory::Destroy(Reader* p)
{
More information about the Liblas-commits
mailing list