6 #include "glog/logging.h" 13 void WriteXyzPoint(
const Eigen::Vector3f& point,
14 FileWriter*
const file_writer) {
15 std::ostringstream stream;
16 stream << std::setprecision(6);
17 stream << point.x() <<
" " << point.y() <<
" " << point.z() <<
"\n";
18 const std::string out = stream.str();
19 CHECK(file_writer->Write(out.data(), out.size()));
26 : next_(next), file_writer_(std::move(file_writer)) {}
28 std::unique_ptr<XyzWriterPointsProcessor>
33 return common::make_unique<XyzWriterPointsProcessor>(
34 file_writer_factory(dictionary->
GetString(
"filename")), next);
38 CHECK(
file_writer_->Close()) <<
"Closing XYZ file failed.";
44 LOG(FATAL) <<
"XYZ generation must be configured to occur after any " 45 "stages that require multiple passes.";
51 for (
const Eigen::Vector3f& point : batch->points) {
PointsProcessor *const next_
virtual void Process(std::unique_ptr< PointsBatch > points_batch)=0
std::function< std::unique_ptr< FileWriter >(const std::string &filename)> FileWriterFactory
std::string GetString(const std::string &key)
void Process(std::unique_ptr< PointsBatch > batch) override
std::unique_ptr< FileWriter > file_writer_
XyzWriterPointsProcessor(std::unique_ptr< FileWriter >, PointsProcessor *next)
virtual FlushResult Flush()=0
static std::unique_ptr< XyzWriterPointsProcessor > FromDictionary(const FileWriterFactory &file_writer_factory, common::LuaParameterDictionary *dictionary, PointsProcessor *next)
FlushResult Flush() override