MCPcopy Create free account
hub / github.com/CloudCompare/CloudCompare / exportEntity

Method exportEntity

qCC/ccCommandLineParser.cpp:299–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299QString ccCommandLineParser::exportEntity( CLEntityDesc& entityDesc,
300 const QString& suffix/*=QString()*/,
301 QString* baseOutputFilename/*=nullptr*/,
302 ccCommandLineInterface::ExportOptions options/*ExportOptiopn::NoOption*/)
303{
304 print("[SAVING]");
305
306 //fetch the real entity
307 ccHObject* entity = entityDesc.getEntity();
308 if (!entity)
309 {
310 assert(false);
311 return "[ExportEntity] Internal error: invalid input entity!";
312 }
313
314 bool anyForced = options.testFlag(ExportOption::ForceCloud) | options.testFlag(ExportOption::ForceHierarchy) | options.testFlag(ExportOption::ForceMesh);
315 //specific case: clouds
316 bool isCloud = entity->isA(CC_TYPES::POINT_CLOUD) || entityDesc.getCLEntityType() == CL_ENTITY_TYPE::CLOUD;
317
318 //specific case: mesh
319 bool isMesh = entity->isKindOf(CC_TYPES::MESH) || entityDesc.getCLEntityType() == CL_ENTITY_TYPE::MESH;
320
321 QString extension = isCloud ? m_cloudExportExt : isMesh ? m_meshExportExt : m_hierarchyExportExt;
322 QString format = isCloud ? m_cloudExportFormat : isMesh ? m_meshExportFormat : m_hierarchyExportFormat;
323 if (anyForced)
324 {
325 if (options.testFlag(ExportOption::ForceCloud))
326 {
327 extension = m_cloudExportExt;
328 format = m_cloudExportFormat;
329 }
330 if (options.testFlag(ExportOption::ForceMesh))
331 {
332 extension = m_meshExportExt;
333 format = m_meshExportFormat;
334 }
335 if (options.testFlag(ExportOption::ForceHierarchy))
336 {
337 extension = m_hierarchyExportExt;
338 format = m_hierarchyExportFormat;
339 }
340 }
341
342 QString outputFilename = getExportFilename( entityDesc,
343 extension,
344 suffix,
345 baseOutputFilename,
346 options.testFlag(ExportOption::ForceNoTimestamp) );
347 if (outputFilename.isEmpty())
348 {
349 return QString();
350 }
351
352 //update the entity name as well
353 {
354 QString entName = entity->getName();
355 if (entName.isEmpty())
356 {

Callers 8

processMethod · 0.80
processMethod · 0.80
processMethod · 0.80
processMethod · 0.80
processMethod · 0.80
processMethod · 0.80
processMethod · 0.80
processMethod · 0.80

Calls 12

getEntityMethod · 0.80
getCLEntityTypeMethod · 0.80
isAncestorOfMethod · 0.80
parentWidgetMethod · 0.80
detachChildMethod · 0.80
QStringClass · 0.70
GetFileFilterFunction · 0.50
isEmptyMethod · 0.45
getNameMethod · 0.45
setNameMethod · 0.45
getAssociatedCloudMethod · 0.45
addChildMethod · 0.45

Tested by

no test coverage detected