Skip to content

Commit

Permalink
external: Update untwine
Browse files Browse the repository at this point in the history
Closes: qgis#59887
  • Loading branch information
ptitjano committed Feb 14, 2025
1 parent 06502da commit 426a2a2
Show file tree
Hide file tree
Showing 18 changed files with 750 additions and 583 deletions.
2 changes: 1 addition & 1 deletion external/untwine/api/QgisUntwine_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ bool QgisUntwine::start(Options& options)
cmdline += "--" + op.first + " \"" + op.second + "\" ";

PROCESS_INFORMATION processInfo;
STARTUPINFOA startupInfo;
STARTUPINFO startupInfo;

ZeroMemory(&processInfo, sizeof(PROCESS_INFORMATION));
ZeroMemory(&startupInfo, sizeof(STARTUPINFO));
Expand Down
12 changes: 6 additions & 6 deletions external/untwine/bu/CopcSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ CopcSupport::CopcSupport(const BaseInfo& b) : m_b(b),
m_header.point_format_id = m_b.pointFormatId;
m_header.point_format_id |= (1 << 7); // Bit for laszip
m_header.point_record_length = lazperf::baseCount(m_b.pointFormatId) + extraByteSize();
m_header.scale.x = b.scale[0];
m_header.scale.y = b.scale[1];
m_header.scale.z = b.scale[2];
m_header.offset.x = b.offset[0];
m_header.offset.y = b.offset[1];
m_header.offset.z = b.offset[2];
m_header.scale.x = b.xform.scale.x;
m_header.scale.y = b.xform.scale.y;
m_header.scale.z = b.xform.scale.z;
m_header.offset.x = b.xform.offset.x;
m_header.offset.y = b.xform.offset.y;
m_header.offset.z = b.xform.offset.z;
m_header.vlr_count = 3;

//IMPORTANT: We have to calculate the point offset here so that we can start writing
Expand Down
15 changes: 8 additions & 7 deletions external/untwine/bu/Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,13 +524,14 @@ void Processor::fillPointBuf(pdal::PointRef& point, std::vector<char>& buf,
return i;
};

int32_t x = converter((point.getFieldAs<double>(Id::X) - m_b.offset[0]) / m_b.scale[0], Id::X);
int32_t y = converter((point.getFieldAs<double>(Id::Y) - m_b.offset[1]) / m_b.scale[1], Id::Y);
int32_t z = converter((point.getFieldAs<double>(Id::Z) - m_b.offset[2]) / m_b.scale[2], Id::Z);

ostream << x;
ostream << y;
ostream << z;
double x = point.getFieldAs<double>(Id::X);
int32_t xi = converter((x - m_b.xform.offset.x) / m_b.xform.scale.x, Id::X);
double y = point.getFieldAs<double>(Id::Y);
int32_t yi = converter((y - m_b.xform.offset.y) / m_b.xform.scale.y, Id::Y);
double z = point.getFieldAs<double>(Id::Z);
int32_t zi = converter((z - m_b.xform.offset.z) / m_b.xform.scale.z, Id::Z);

ostream << xi << yi << zi;

ostream << point.getFieldAs<uint16_t>(Id::Intensity);
ostream << (uint8_t)(returnNumber | (numberOfReturns << 4));
Expand Down
Loading

0 comments on commit 426a2a2

Please # to comment.