[Liblas-commits] r1331 - in branches/1.2: include/liblas/detail
src/detail
liblas-commits at liblas.org
liblas-commits at liblas.org
Sun Aug 2 00:42:38 EDT 2009
Author: hobu
Date: Sun Aug 2 00:42:38 2009
New Revision: 1331
URL: http://liblas.org/changeset/1331
Log:
attempt a fix for #134
Modified:
branches/1.2/include/liblas/detail/writer.hpp
branches/1.2/src/detail/writer.cpp
Modified: branches/1.2/include/liblas/detail/writer.hpp
==============================================================================
--- branches/1.2/include/liblas/detail/writer.hpp (original)
+++ branches/1.2/include/liblas/detail/writer.hpp Sun Aug 2 00:42:38 2009
@@ -77,7 +77,7 @@
void FillPointRecord(PointRecord& record, const LASPoint& point, const LASHeader& header);
- void Project(PointRecord& point);
+ void Project(LASPoint& point);
LASSpatialReference m_out_srs;
LASSpatialReference m_in_srs;
Modified: branches/1.2/src/detail/writer.cpp
==============================================================================
--- branches/1.2/src/detail/writer.cpp (original)
+++ branches/1.2/src/detail/writer.cpp Sun Aug 2 00:42:38 2009
@@ -87,11 +87,18 @@
void Writer::FillPointRecord(PointRecord& record, const LASPoint& point, const LASHeader& header)
{
- record.x = static_cast<int32_t>((point.GetX() - header.GetOffsetX()) / header.GetScaleX());
- record.y = static_cast<int32_t>((point.GetY() - header.GetOffsetY()) / header.GetScaleY());
- record.z = static_cast<int32_t>((point.GetZ() - header.GetOffsetZ()) / header.GetScaleZ());
-
- if (m_transform) Project(record);
+ if (m_transform) {
+ // let's just copy the point for now.
+ LASPoint p = LASPoint(point);
+ Project(p);
+ record.x = static_cast<int32_t>((p.GetX() - header.GetOffsetX()) / header.GetScaleX());
+ record.y = static_cast<int32_t>((p.GetY() - header.GetOffsetY()) / header.GetScaleY());
+ record.z = static_cast<int32_t>((p.GetZ() - header.GetOffsetZ()) / header.GetScaleZ());
+ } else {
+ record.x = static_cast<int32_t>((point.GetX() - header.GetOffsetX()) / header.GetScaleX());
+ record.y = static_cast<int32_t>((point.GetY() - header.GetOffsetY()) / header.GetScaleY());
+ record.z = static_cast<int32_t>((point.GetZ() - header.GetOffsetZ()) / header.GetScaleZ());
+ }
record.intensity = point.GetIntensity();
record.flags = point.GetScanFlags();
@@ -120,7 +127,7 @@
}
int32_t difference = header.GetDataOffset() - (vlr_total_size + header.GetHeaderSize());
-
+
if (difference < 0)
{
return difference;
@@ -150,7 +157,7 @@
}
-void Writer::SetSRS(const LASSpatialReference& srs)
+void Writer::SetSRS(const LASSpatialReference& srs )
{
m_out_srs = srs;
#ifdef HAVE_GDAL
@@ -161,7 +168,7 @@
if (result != OGRERR_NONE)
{
std::ostringstream msg;
- msg << "Could not import input spatial reference for Reader::" << CPLGetLastErrorMsg() << result;
+ msg << "Could not import input spatial reference for Writer::" << CPLGetLastErrorMsg() << result;
std::string message(msg.str());
throw std::runtime_error(message);
}
@@ -170,7 +177,7 @@
if (result != OGRERR_NONE)
{
std::ostringstream msg;
- msg << "Could not import output spatial reference for Reader::" << CPLGetLastErrorMsg() << result;
+ msg << "Could not import output spatial reference for Writer::" << CPLGetLastErrorMsg() << result;
std::string message(msg.str());
throw std::runtime_error(message);
}
@@ -180,14 +187,14 @@
#endif
}
-void Writer::Project(PointRecord& point)
+void Writer::Project(LASPoint& p)
{
#ifdef HAVE_GDAL
int ret = 0;
- double x = point.x;
- double y = point.y;
- double z = point.z;
+ double x = p.GetX();
+ double y = p.GetY();
+ double z = p.GetZ();
ret = OCTTransform(m_transform, 1, &x, &y, &z);
@@ -198,10 +205,9 @@
throw std::runtime_error(message);
}
- // FIXME: PointRecords need to be descaled
- point.x = x;
- point.y = y;
- point.z = z;
+ p.SetX(x);
+ p.SetY(y);
+ p.SetZ(z);
#else
UNREFERENCED_PARAMETER(point);
#endif
More information about the Liblas-commits
mailing list