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

Method execute

kernels/TranslateKernel.cpp:197–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195
196
197int TranslateKernel::execute()
198{
199 std::ostream *metaOut(nullptr);
200
201 if (m_filterJSON.size() && m_filterType.size())
202 throw pdal_error("Cannot set both --filter options and --json options");
203
204 if (m_metadataFile.size())
205 {
206 if (m_pipelineOutputFile.size())
207 m_log->get(LogLevel::Info) << "Metadata will not be written. "
208 "'pipeline' option prevents execution.";
209 else
210 {
211 metaOut = FileUtils::createFile(m_metadataFile);
212 if (! metaOut)
213 throw pdal_error("Couldn't output metadata output file '" +
214 m_metadataFile + "'.");
215 }
216 }
217
218 if (!m_filterJSON.empty())
219 makeJSONPipeline();
220 else
221 makeArgPipeline();
222
223 // If we write pipeline output, we don't run, and therefore don't write
224 if (m_pipelineOutputFile.size() > 0)
225 {
226 PipelineWriter::writePipeline(m_manager.getStage(),
227 m_pipelineOutputFile);
228 return 0;
229 }
230
231 m_manager.pointTable().layout()->setAllowedDims(m_dimNames);
232 if (m_manager.execute(m_mode).m_mode == ExecMode::None)
233 throw pdal_error("Couldn't run translation pipeline in requested "
234 "execution mode.");
235
236 if (metaOut)
237 {
238 MetadataNode m = m_manager.getMetadata();
239 *metaOut << Utils::toJSON(m);
240 FileUtils::closeFile(metaOut);
241 }
242
243 return 0;
244}
245
246} // namespace pdal

Callers

nothing calls this directly

Calls 9

writePipelineFunction · 0.85
toJSONFunction · 0.85
createFileFunction · 0.50
closeFileFunction · 0.50
sizeMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45
setAllowedDimsMethod · 0.45
getMetadataMethod · 0.45

Tested by

no test coverage detected