[Liblas-commits] hg: hard-code byte positions of fixed-schema
dimensions.
liblas-commits at liblas.org
liblas-commits at liblas.org
Fri Dec 17 12:43:01 EST 2010
changeset d4128e8b5ece in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=d4128e8b5ece
summary: hard-code byte positions of fixed-schema dimensions.
diffstat:
src/laspoint.cpp | 142 ++++++++++++++++++++++++++++++++++--------------------
1 files changed, 88 insertions(+), 54 deletions(-)
diffs (truncated from 401 to 300 lines):
diff -r bc1a553d5a88 -r d4128e8b5ece src/laspoint.cpp
--- a/src/laspoint.cpp Fri Dec 17 11:14:33 2010 -0600
+++ b/src/laspoint.cpp Fri Dec 17 11:42:54 2010 -0600
@@ -462,7 +462,8 @@
boost::int32_t Point::GetRawX() const
{
// std::vector<boost::uint8_t>::size_type pos = GetDimensionPosition("X");
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(0);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(0);
+ std::vector<boost::uint8_t>::size_type pos = 0;
boost::int32_t output = liblas::detail::bitsToInt<boost::int32_t>(output, m_data, pos);
return output;
@@ -471,7 +472,8 @@
boost::int32_t Point::GetRawY() const
{
// std::vector<boost::uint8_t>::size_type pos = GetDimensionPosition("Y");
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(1);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(1);
+ std::vector<boost::uint8_t>::size_type pos = 4;
boost::int32_t output = liblas::detail::bitsToInt<boost::int32_t>(output, m_data, pos);
return output;
@@ -481,7 +483,8 @@
{
boost::int32_t output;
// std::vector<boost::uint8_t>::size_type pos = GetDimensionPosition("Z");
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(2);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(2);
+ std::vector<boost::uint8_t>::size_type pos = 8;
output = liblas::detail::bitsToInt<boost::int32_t>(output, m_data, pos);
return output;
@@ -490,28 +493,32 @@
void Point::SetRawX( boost::int32_t const& value)
{
// std::vector<boost::uint8_t>::size_type pos = GetDimensionPosition("X");
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(0);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(0);
+ std::vector<boost::uint8_t>::size_type pos = 0;
liblas::detail::intToBits<boost::int32_t>(value, m_data, pos);
}
void Point::SetRawY( boost::int32_t const& value)
{
// std::vector<boost::uint8_t>::size_type pos = GetDimensionPosition("Y");
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(1);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(1);
+ std::vector<boost::uint8_t>::size_type pos = 4;
liblas::detail::intToBits<boost::int32_t>(value, m_data, pos);
}
void Point::SetRawZ( boost::int32_t const& value)
{
// std::vector<boost::uint8_t>::size_type pos = GetDimensionPosition("Z");
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(2);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(2);
+ std::vector<boost::uint8_t>::size_type pos = 8;
liblas::detail::intToBits<boost::int32_t>(value, m_data, pos);
}
boost::uint16_t Point::GetIntensity() const
{
// Intensity's position is always the 4th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(3);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(3);
+ std::vector<boost::uint8_t>::size_type pos = 12;
boost::uint16_t output =
liblas::detail::bitsToInt<boost::uint16_t>(
output, m_data, pos);
@@ -523,7 +530,8 @@
void Point::SetIntensity(boost::uint16_t const& intensity)
{
// Intensity's position is always the 4th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(3);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(3);
+ std::vector<boost::uint8_t>::size_type pos = 12;
liblas::detail::intToBits<boost::uint16_t>(intensity,
m_data,
pos);
@@ -534,7 +542,8 @@
// Scan Flag's position is always the 5th dimension
// (the entire byte composed of "Return Number", "Number of Returns",
// "Scan Direction", and "Flightline Edge")
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(4);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(4);
+ std::vector<boost::uint8_t>::size_type pos = 14;
return m_data[pos];
}
@@ -543,14 +552,17 @@
// Scan Flag's position is always the 5th dimension
// (the entire byte composed of "Return Number", "Number of Returns",
// "Scan Direction", and "Flightline Edge")
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(4);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(4);
+ std::vector<boost::uint8_t>::size_type pos = 14;
m_data[pos] = flags;
}
boost::uint16_t Point::GetReturnNumber() const
{
// "Return Number" is always the 5th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(4);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(4);
+ std::vector<boost::uint8_t>::size_type pos = 14;
+
boost::uint8_t flags = m_data[pos];
// Read bits 1,2,3 (first 3 bits)
@@ -560,8 +572,8 @@
void Point::SetReturnNumber(uint16_t const& num)
{
// "Return Number" is always the 5th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(4);
-
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(4);
+ std::vector<boost::uint8_t>::size_type pos = 14;
boost::uint8_t flags = m_data[pos];
// Store value in bits 0,1,2
@@ -576,7 +588,8 @@
boost::uint8_t flags;
// "Number of Returns" is always the 6th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(5);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(5);
+ std::vector<boost::uint8_t>::size_type pos = 14;
flags = m_data[pos];
@@ -587,7 +600,8 @@
void Point::SetNumberOfReturns(uint16_t const& num)
{
// "Number of Returns" is always the 6th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(5);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(5);
+ std::vector<boost::uint8_t>::size_type pos = 14;
boost::uint8_t flags = m_data[pos];
@@ -597,17 +611,13 @@
flags |= mask & (static_cast<uint8_t>(num) << 3);
m_data[pos] = flags;
-// // Store value in bits 3,4,5
-// uint8_t mask = 0x7 << 3; // 0b00111000
-// m_flags &= ~mask;
-// m_flags |= mask & (static_cast<uint8_t>(num) << 3);
-
}
void Point::SetScanDirection(uint16_t const& dir)
{
// "Scan Direction" is always the 7th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(6);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(6);
+ std::vector<boost::uint8_t>::size_type pos = 14;
boost::uint8_t flags = m_data[pos];
@@ -621,8 +631,8 @@
boost::uint16_t Point::GetScanDirection() const
{
// "Scan Direction" is always the 7th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(6);
-
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(6);
+ std::vector<boost::uint8_t>::size_type pos = 14;
boost::uint8_t flags = m_data[pos];
// Read 6th bit
@@ -632,7 +642,8 @@
void Point::SetFlightLineEdge(uint16_t const& edge)
{
// "Flightline Edge" is always the 8th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(7);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(7);
+ std::vector<boost::uint8_t>::size_type pos = 14;
boost::uint8_t flags = m_data[pos];
@@ -642,17 +653,13 @@
flags |= mask & (static_cast<uint8_t>(edge) << 7);
m_data[pos] = flags;
-// // Store value in bit 7
-// uint8_t mask = 0x1 << 7; // 0b10000000
-// m_flags &= ~mask;
-// m_flags |= mask & (static_cast<uint8_t>(edge) << 7);}
-
}
boost::uint16_t Point::GetFlightLineEdge() const
{
// "Flightline Edge" is always the 8th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(7);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(7);
+ std::vector<boost::uint8_t>::size_type pos = 14;
boost::uint8_t flags = m_data[pos];
@@ -664,7 +671,9 @@
Classification Point::GetClassification() const
{
// "Classification" is always the 9th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(8);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(8);
+ std::vector<boost::uint8_t>::size_type pos = 15;
+
boost::uint8_t kls = m_data[pos];
return Classification(kls);
}
@@ -672,28 +681,32 @@
void Point::SetClassification(Classification const& cls)
{
// "Classification" is always the 9th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(8);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(8);
+ std::vector<boost::uint8_t>::size_type pos = 15;
m_data[pos] = cls.GetClass();
}
void Point::SetClassification(Classification::bitset_type const& flags)
{
// "Classification" is always the 9th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(8);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(8);
+ std::vector<boost::uint8_t>::size_type pos = 15;
m_data[pos] = Classification(flags).GetClass();
}
void Point::SetClassification(boost::uint8_t const& flags)
{
// "Classification" is always the 9th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(8);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(8);
+ std::vector<boost::uint8_t>::size_type pos = 15;
m_data[pos] = Classification(flags).GetClass();
}
void Point::SetScanAngleRank(int8_t const& rank)
{
// "Scan Angle Rank" is always the 10th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(9);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(9);
+ std::vector<boost::uint8_t>::size_type pos = 16;
m_data[pos] = rank;
@@ -701,7 +714,8 @@
boost::int8_t Point::GetScanAngleRank() const
{
// "Scan Angle Rank" is always the 10th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(9);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(9);
+ std::vector<boost::uint8_t>::size_type pos = 16;
return m_data[pos];
}
@@ -709,15 +723,16 @@
boost::uint8_t Point::GetUserData() const
{
// "User Data" is always the 11th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(10);
-
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(10);
+ std::vector<boost::uint8_t>::size_type pos = 17;
return m_data[pos];
}
void Point::SetUserData(boost::uint8_t const& flags)
{
// "User Data" is always the 11th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(10);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(10);
+ std::vector<boost::uint8_t>::size_type pos = 17;
m_data[pos] = flags;
}
@@ -726,7 +741,9 @@
boost::uint16_t output;
// "Point Source ID" is always the 12th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(11);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(11);
+ std::vector<boost::uint8_t>::size_type pos = 18;
+
output = liblas::detail::bitsToInt<boost::uint16_t>(output,
m_data,
pos);
@@ -737,7 +754,8 @@
void Point::SetPointSourceID(boost::uint16_t const& id)
{
// "Point Source ID" is always the 12th dimension
- std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(11);
+ // std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(11);
+ std::vector<boost::uint8_t>::size_type pos = 18;
liblas::detail::intToBits<boost::uint16_t>(id, m_data, pos);
}
More information about the Liblas-commits
mailing list