| 120 | } |
| 121 | |
| 122 | void writerTest_testColorRanges(pdal::Reader* r, std::string infile, int min, int max) |
| 123 | { |
| 124 | std::string outfile(Support::datapath("e57/test.e57")); |
| 125 | remove(outfile.c_str()); |
| 126 | |
| 127 | Options ro; |
| 128 | |
| 129 | ro.add("filename", infile); |
| 130 | r->setOptions(ro); |
| 131 | |
| 132 | { |
| 133 | E57Writer w; |
| 134 | Options wo; |
| 135 | |
| 136 | wo.add("filename", outfile); |
| 137 | w.setOptions(wo); |
| 138 | w.setInput(*r); |
| 139 | |
| 140 | PointTable t; |
| 141 | |
| 142 | w.prepare(t); |
| 143 | w.execute(t); |
| 144 | } |
| 145 | e57::ImageFile imf(outfile, "r"); |
| 146 | |
| 147 | e57::VectorNode data3D(imf.root().get("/data3D")); |
| 148 | auto colorLimits = (e57::StructureNode)((e57::StructureNode)data3D.get(0)) |
| 149 | .get("colorLimits"); |
| 150 | std::vector<std::string> minDims{"colorRedMinimum", "colorGreenMinimum", |
| 151 | "colorBlueMinimum"}; |
| 152 | std::vector<std::string> maxDims{"colorRedMaximum", "colorGreenMaximum", |
| 153 | "colorBlueMaximum"}; |
| 154 | |
| 155 | for (auto& dim : minDims) |
| 156 | { |
| 157 | ASSERT_EQ(((e57::IntegerNode)colorLimits.get(dim)).value(), min); |
| 158 | } |
| 159 | |
| 160 | for (auto& dim : maxDims) |
| 161 | { |
| 162 | ASSERT_EQ(((e57::IntegerNode)colorLimits.get(dim)).value(), max); |
| 163 | } |
| 164 | |
| 165 | remove(outfile.c_str()); |
| 166 | } |
| 167 | |
| 168 | TEST(E57WriterTest, testWriteRanges) |
| 169 | { |