MCPcopy Create free account
hub / github.com/PDAL/PDAL / initialize

Method initialize

plugins/draco/io/DracoReader.cpp:98–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98void DracoReader::initialize()
99{
100 if (!FileUtils::fileExists(m_filename))
101 throwError("File '" + m_filename + "' does not exist");
102
103 m_istreamPtr = Utils::openFile(m_filename, true);
104 if (!m_istreamPtr)
105 throwError("Unable to open file '" + m_filename + "' ");
106 std::vector<char> data;
107 data.assign(std::istreambuf_iterator<char>(*m_istreamPtr),
108 std::istreambuf_iterator<char>());
109 Utils::closeFile(m_istreamPtr);
110
111 draco::DecoderBuffer draco_buffer;
112 draco_buffer.Init(data.data(), data.size());
113
114 draco::Decoder decoder;
115
116 auto geom_status = draco::Decoder::GetEncodedGeometryType(&draco_buffer);
117 if (!geom_status.ok())
118 {
119 return throwError(geom_status.status().error_msg());
120 }
121 const draco::EncodedGeometryType geom_type = geom_status.value();
122 draco::StatusOr<std::unique_ptr<draco::PointCloud>> pc_status = decoder.DecodePointCloudFromBuffer(&draco_buffer);
123
124 if (!pc_status.ok())
125 {
126 return throwError(pc_status.status().error_msg());
127 }
128
129 m_pc = std::move(pc_status).value();
130}
131
132void DracoReader::addOneDimension(Dimension::Id id, const draco::PointAttribute* attr, PointLayoutPtr layout, int index, int attNum)
133{

Callers

nothing calls this directly

Calls 6

fileExistsFunction · 0.50
openFileFunction · 0.50
closeFileFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected