[Liblas-commits] hg: cache time and color indicators from the
schema so we don't ...
liblas-commits at liblas.org
liblas-commits at liblas.org
Wed Sep 22 13:42:26 EDT 2010
changeset 4e85994594ad in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=4e85994594ad
summary: cache time and color indicators from the schema so we don't have to search so much
diffstat:
include/liblas/detail/writer/point.hpp | 5 ++++-
src/detail/writer/point.cpp | 14 ++++++++------
2 files changed, 12 insertions(+), 7 deletions(-)
diffs (68 lines):
diff -r f9317af500d4 -r 4e85994594ad include/liblas/detail/writer/point.hpp
--- a/include/liblas/detail/writer/point.hpp Wed Sep 22 12:28:42 2010 -0500
+++ b/include/liblas/detail/writer/point.hpp Wed Sep 22 12:42:17 2010 -0500
@@ -87,7 +87,10 @@
Schema m_format;
boost::uint8_t* m_blanks; // TODO: shared_ptr --mlosko
-
+
+ bool bTime;
+ bool bColor;
+
void setup();
void fill();
};
diff -r f9317af500d4 -r 4e85994594ad src/detail/writer/point.cpp
--- a/src/detail/writer/point.cpp Wed Sep 22 12:28:42 2010 -0500
+++ b/src/detail/writer/point.cpp Wed Sep 22 12:42:17 2010 -0500
@@ -62,6 +62,8 @@
, m_point(liblas::Point())
, m_format(header.GetSchema())
, m_blanks(0)
+ , bTime(header.GetSchema().HasTime())
+ , bColor(header.GetSchema().HasColor())
{
setup();
}
@@ -100,7 +102,7 @@
uint16_t red = 0;
uint16_t blue = 0;
uint16_t green = 0;
- liblas::Color color;
+
std::size_t byteswritten(0);
@@ -110,16 +112,16 @@
detail::write_n(m_ofs, m_record, sizeof(m_record));
byteswritten += sizeof(PointRecord);
- if (m_format.HasTime())
+ if (bTime)
{
t = point.GetTime();
detail::write_n(m_ofs, t, sizeof(double));
byteswritten += sizeof(double);
- if (m_format.HasColor())
+ if (bColor)
{
- color = point.GetColor();
+ liblas::Color const& color = point.GetColor();
red = color.GetRed();
green = color.GetGreen();
blue = color.GetBlue();
@@ -130,9 +132,9 @@
}
} else {
- if (m_format.HasColor())
+ if (bColor)
{
- color = point.GetColor();
+ liblas::Color const& color = point.GetColor();
red = color.GetRed();
green = color.GetGreen();
blue = color.GetBlue();
More information about the Liblas-commits
mailing list