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

Function exportNormalToSF

qCC/ccEntityAction.cpp:1670–1731  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1668 }
1669
1670 bool exportNormalToSF(const ccHObject::Container& selectedEntities, QWidget* parent/*=nullptr*/, bool* exportDimensions/*=nullptr*/)
1671 {
1672 bool exportDims[3] { false, false, false };
1673
1674 if (exportDimensions)
1675 {
1676 exportDims[0] = exportDimensions[0];
1677 exportDims[1] = exportDimensions[1];
1678 exportDims[2] = exportDimensions[2];
1679 }
1680 else
1681 {
1682 //ask the user
1683 ccExportCoordToSFDlg ectsDlg(parent);
1684 ectsDlg.setWindowTitle(QObject::tr("Export normals to SF(s)"));
1685
1686 if (!ectsDlg.exec())
1687 {
1688 return false;
1689 }
1690
1691 exportDims[0] = ectsDlg.exportX();
1692 exportDims[1] = ectsDlg.exportY();
1693 exportDims[2] = ectsDlg.exportZ();
1694 }
1695
1696 if (!exportDims[0] && !exportDims[1] && !exportDims[2]) //nothing to do?!
1697 {
1698 return false;
1699 }
1700
1701 //for each selected cloud (or vertices set)
1702 for (ccHObject* entity : selectedEntities)
1703 {
1704 ccPointCloud* pc = ccHObjectCaster::ToPointCloud(entity);
1705 if (pc == nullptr)
1706 {
1707 // TODO do something with error?
1708 continue;
1709 }
1710
1711 if (!pc->hasNormals())
1712 {
1713 ccLog::Warning(QObject::tr("Cloud '%1' has no normals").arg(pc->getName()));
1714 continue;
1715 }
1716
1717 if (!pc->exportNormalToSF(exportDims))
1718 {
1719 ccLog::Error(QObject::tr("The process failed!"));
1720 return true; //true because we want the UI to be updated anyway
1721 }
1722
1723 if (entity != pc)
1724 {
1725 entity->showSF(true); //for meshes
1726 }
1727 entity->prepareDisplayForRefresh_recursive();

Callers 2

processMethod · 0.85

Calls 8

execMethod · 0.80
exportXMethod · 0.80
exportYMethod · 0.80
exportZMethod · 0.80
exportNormalToSFMethod · 0.80
showSFMethod · 0.80
hasNormalsMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected