Skip to content

Commit

Permalink
Fix some small issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed Jul 26, 2019
1 parent 9620401 commit ef1f21b
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions plugins/e57/io/E57Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,11 @@ E57Writer::ChunkWriter::ChunkWriter
if (!e57dim.empty())
m_doubleBuffers[e57dim].resize(m_defaultChunkSize);

//ABELL - Result seems unused.
auto prototype = static_cast<e57::StructureNode>(vectorNode.prototype());
for (auto& keyValue : m_doubleBuffers)
m_e57buffers.emplace_back(vectorNode.destImageFile(), keyValue.first,
keyValue.second.data(), m_defaultChunkSize, true, true );

// Setup the writer
//ABELL - Result seems unused.
auto f = vectorNode.destImageFile();
m_dataWriter.reset(
new e57::CompressedVectorWriter(vectorNode.writer(m_e57buffers)));

Expand All @@ -78,10 +74,7 @@ void E57Writer::ChunkWriter::write(pdal::PointRef& pt)
{
// If buffer full, write to disk and reinitialise buffer

//ABELL - This seems like it's off by one.
// We increment after setting the entry in the map, so I would think we'd
// want to use up to m_defaultChunkSize entries.
if (m_currentIndex == m_defaultChunkSize - 1)
if (m_currentIndex == m_defaultChunkSize)
{
m_dataWriter->write(m_defaultChunkSize);
m_currentIndex = 0;
Expand Down Expand Up @@ -174,10 +167,6 @@ bool E57Writer::processOne(PointRef& point)
point.getFieldAs<double>(Dimension::Id::Y),
point.getFieldAs<double>(Dimension::Id::Z));

//ABELL - Do we need to check this for every point?
if (!m_chunkWriter)
throwError("e57 writer has not been initialised correctly.");

// Write point
m_chunkWriter->write(point);
return true;
Expand All @@ -194,14 +183,18 @@ void E57Writer::done(PointTableRef table)
if (Utils::contains(m_dimensionsToWrite, "colorRed"))
{
// found color info
using namespace Dimension;

e57::StructureNode colorbox = e57::StructureNode(*m_imageFile);
for (const std::string& color: {"Red", "Green","Blue"})
std::vector<Id> colors { Id::Red, Id::Green, Id::Blue };

for (auto id : colors)
{
//ABELL - this seems wrong. Why would we always use red?
auto minmax = e57plugin::getPdalBounds(Dimension::Id::Red);
colorbox.set("color" + color + "Minimum",
std::string name = Dimension::name(id);
auto minmax = e57plugin::getPdalBounds(id);
colorbox.set("color" + name + "Minimum",
e57::IntegerNode(*m_imageFile,minmax.first));
colorbox.set("color" + color + "Maximum",
colorbox.set("color" + name + "Maximum",
e57::IntegerNode(*m_imageFile, minmax.second));
}
m_scanNode->set("colorLimits", colorbox);
Expand Down Expand Up @@ -274,8 +267,7 @@ void E57Writer::setupFileHeader()

//ABELL - This description seems too specific.
m_rootNode->set("description",
e57::StringNode(*m_imageFile,"E57 file generated by Helix's "
"Point Cloud Processor"));
e57::StringNode(*m_imageFile,"E57 file generated by PDAL"));
}

void E57Writer::setupWriter()
Expand Down

0 comments on commit ef1f21b

Please sign in to comment.