From f6f01af5fa2c5d067239d1d65fd0379ee845c7a6 Mon Sep 17 00:00:00 2001 From: kylemann16 Date: Mon, 1 Feb 2021 15:13:03 -0600 Subject: [PATCH] tests are satisfied --- plugins/draco/io/DracoWriter.cpp | 22 +++++---------------- plugins/draco/test/DracoWriterTest.cpp | 27 +++++++++++++------------- 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/plugins/draco/io/DracoWriter.cpp b/plugins/draco/io/DracoWriter.cpp index 89f47f909f..655d4a5fd3 100644 --- a/plugins/draco/io/DracoWriter.cpp +++ b/plugins/draco/io/DracoWriter.cpp @@ -160,7 +160,7 @@ DracoWriter::DimensionInfo *DracoWriter::findDimInfo(Dimension::Id pt) { void DracoWriter::parseDimensions() { if(!m_userDimJson.is_object()) { - if (std::string(m_userQuant.type_name()) == "null") return; + if (std::string(m_userDimJson.type_name()) == "null") return; throw pdal_error("Option 'dimensions' must be a JSON object, not a " + std::string(m_userDimJson.type_name())); } @@ -282,16 +282,8 @@ void DracoWriter::addGeneric(Dimension::Id pt) m_pc->AddAttributeMetadata(attId, std::move(metaPtr)); //update attribute id - for (auto &dimInfo: m_dims) { - if (dimInfo.dracoAtt == draco::GeometryAttribute::GENERIC) { - for (auto &dimType: dimInfo.pdalDims) { - if (dimType.m_id == pt) { - dimInfo.attId = attId; - return; - } - } - } - } + DimensionInfo *dimInfo = findDimInfo(pt); + dimInfo->attId = attId; } void DracoWriter::addAttribute(draco::GeometryAttribute::Type t, int n) @@ -319,12 +311,8 @@ void DracoWriter::addAttribute(draco::GeometryAttribute::Type t, int n) int attId = m_pc->AddAttribute(ga, true, m_pc->num_points()); //update attribute id - for (auto &dimInfo: m_dims) { - if (dimInfo.dracoAtt == t) { - dimInfo.attId = attId; - return; - } - } + DimensionInfo *dimInfo = findDimInfo(t); + dimInfo->attId = attId; } void DracoWriter::initPointCloud(point_count_t size) diff --git a/plugins/draco/test/DracoWriterTest.cpp b/plugins/draco/test/DracoWriterTest.cpp index c7beea5f24..b09231ed55 100644 --- a/plugins/draco/test/DracoWriterTest.cpp +++ b/plugins/draco/test/DracoWriterTest.cpp @@ -198,7 +198,7 @@ namespace pdal Options readerOptions; readerOptions.add("filename", inFile); readerOptions.add("count", 1065); - FauxReader reader; + LasReader reader; reader.setOptions(readerOptions); Options options; @@ -220,29 +220,22 @@ namespace pdal { NL::json dims; //test position - dims = { {"X", "uint16"}, {"Y", "uint16"}, {"Z", "float"} }; + dims = { {"X", "float"}, {"Y", "float"}, {"Z", "double"} }; testDimensions(dims, false); - dims = { {"X", "uint16"} }; + dims = { {"X", "float"} }; testDimensions(dims, false); - dims = { {"X", "uint16"}, {"Y", "uint16"}, {"Z", "uint16"} }; + dims = { {"X", "float"}, {"Y", "float"}, {"Z", "float"} }; testDimensions(dims, true); //test RGB + dims = { {"Red", "double"}, {"Green", "double"}, {"Blue", "double"} }; + testDimensions(dims, true); dims = { {"Red", "double"}, {"Green", "double"}, {"Blue", "uint16"} }; testDimensions(dims, false); dims = { {"Red", "double"} }; testDimensions(dims, false); - dims = { {"Red", "double"}, {"Green", "double"}, {"Blue", "double"} }; - testDimensions(dims, true); - // test textures - dims = { {"TextureU", "double"}, {"TextureV", "double"}, {"TextureW", "float"} }; - testDimensions(dims, false); - dims = { {"TextureU", "double"} }; - testDimensions(dims, false); - dims = { {"TextureU", "double"}, {"TextureV", "double"}, {"TextureW", "double"} }; - testDimensions(dims, true); //test file doesn't currently use these types //test normals @@ -253,6 +246,14 @@ namespace pdal // dims = { {"NormalX", "double"}, {"NormalY", "double"}, {"NormalZ", "double"} }; // testDimensions(dims, true); + // // test textures + // dims = { {"TextureU", "double"}, {"TextureV", "double"}, {"TextureW", "float"} }; + // testDimensions(dims, false); + // dims = { {"TextureU", "double"} }; + // testDimensions(dims, false); + // dims = { {"TextureU", "double"}, {"TextureV", "double"}, {"TextureW", "double"} }; + // testDimensions(dims, true); + }