| 77 | |
| 78 | |
| 79 | int RandomKernel::execute() |
| 80 | { |
| 81 | Options readerOptions; |
| 82 | |
| 83 | if (!m_bounds.empty()) |
| 84 | readerOptions.add("bounds", m_bounds); |
| 85 | |
| 86 | std::string distribution(Utils::tolower(m_distribution)); |
| 87 | if (distribution == "uniform") |
| 88 | readerOptions.add("mode", "uniform"); |
| 89 | else if (distribution == "normal") |
| 90 | readerOptions.add("mode", "normal"); |
| 91 | else if (distribution == "random") |
| 92 | readerOptions.add("mode", "random"); |
| 93 | else |
| 94 | throw pdal_error("invalid distribution: " + m_distribution); |
| 95 | readerOptions.add("count", m_numPointsToWrite); |
| 96 | Stage& reader = makeReader("", "readers.faux", readerOptions); |
| 97 | |
| 98 | Options writerOptions; |
| 99 | if (m_bCompress) |
| 100 | writerOptions.add("compression", true); |
| 101 | Stage& writer = makeWriter(m_outputFile, reader, "", writerOptions); |
| 102 | |
| 103 | ColumnPointTable table; |
| 104 | writer.prepare(table); |
| 105 | writer.execute(table); |
| 106 | |
| 107 | return 0; |
| 108 | } |
| 109 | |
| 110 | } // pdal |