All: Reformat according to new standard

This commit is contained in:
pre-commit-ci[bot]
2025-11-11 13:49:01 +01:00
committed by Kacper Donat
parent eafd18dac0
commit 25c3ba7338
2390 changed files with 154630 additions and 115818 deletions

View File

@@ -21,18 +21,17 @@
***************************************************************************/
# include <sstream>
# include <QCoreApplication>
# include <Inventor/fields/SoMFString.h>
# include <Inventor/nodes/SoBaseColor.h>
# include <Inventor/nodes/SoCoordinate3.h>
# include <Inventor/nodes/SoFont.h>
# include <Inventor/nodes/SoIndexedFaceSet.h>
# include <Inventor/nodes/SoMaterial.h>
# include <Inventor/nodes/SoText2.h>
# include <Inventor/nodes/SoTransform.h>
# include <Inventor/nodes/SoTransparencyType.h>
#include <sstream>
#include <QCoreApplication>
#include <Inventor/fields/SoMFString.h>
#include <Inventor/nodes/SoBaseColor.h>
#include <Inventor/nodes/SoCoordinate3.h>
#include <Inventor/nodes/SoFont.h>
#include <Inventor/nodes/SoIndexedFaceSet.h>
#include <Inventor/nodes/SoMaterial.h>
#include <Inventor/nodes/SoText2.h>
#include <Inventor/nodes/SoTransform.h>
#include <Inventor/nodes/SoTransparencyType.h>
#include <Base/Parameter.h>
@@ -81,7 +80,7 @@ SoFCColorGradient::SoFCColorGradient()
*/
SoFCColorGradient::~SoFCColorGradient()
{
//delete THIS;
// delete THIS;
coords->unref();
labels->unref();
}
@@ -179,9 +178,8 @@ void SoFCColorGradient::setViewportSize(const SbVec2s& size)
auto transform = static_cast<SoTransform*>(labels->getChild(j)); // NOLINT
if (first) {
first = false;
transform->translation.setValue(fMaxX + spaceX - boxWidth,
fMaxY - spaceY + fStep,
0.0F);
transform->translation
.setValue(fMaxX + spaceX - boxWidth, fMaxY - spaceY + fStep, 0.0F);
}
else {
transform->translation.setValue(0, -fStep, 0.0F);
@@ -197,42 +195,43 @@ void SoFCColorGradient::setViewportSize(const SbVec2s& size)
namespace
{
bool isScientific(float fMin, float fMax, int prec, int numColors)
{
const float base10 = 10.0F;
float eps = std::pow(base10, static_cast<float>(-prec));
float value_min = std::min<float>(fabs(fMin), fabs(fMax));
float value_max = std::max<float>(fabs(fMin), fabs(fMax));
bool isScientific(float fMin, float fMax, int prec, int numColors)
{
const float base10 = 10.0F;
float eps = std::pow(base10, static_cast<float>(-prec));
float value_min = std::min<float>(fabs(fMin), fabs(fMax));
float value_max = std::max<float>(fabs(fMin), fabs(fMax));
if (value_min < eps && value_min > 0.0F) {
return true;
}
if ((value_max - value_min) < eps * static_cast<float>(numColors -1)) {
return true;
}
return value_max > upperLimit;
if (value_min < eps && value_min > 0.0F) {
return true;
}
std::ios::fmtflags getFormatFlags(float fMin, float fMax, int prec, int numColors)
{
bool scientific = isScientific(fMin, fMax, prec, numColors);
std::ios::fmtflags flags = scientific ? (std::ios::scientific | std::ios::showpoint | std::ios::showpos)
: (std::ios::fixed | std::ios::showpoint | std::ios::showpos);
return flags;
if ((value_max - value_min) < eps * static_cast<float>(numColors - 1)) {
return true;
}
std::string getLabelText(float value, int prec, std::ios::fmtflags flags)
{
std::stringstream str;
str.precision(prec);
str.setf(flags);
str << value;
return str.str();
}
return value_max > upperLimit;
}
std::ios::fmtflags getFormatFlags(float fMin, float fMax, int prec, int numColors)
{
bool scientific = isScientific(fMin, fMax, prec, numColors);
std::ios::fmtflags flags = scientific
? (std::ios::scientific | std::ios::showpoint | std::ios::showpos)
: (std::ios::fixed | std::ios::showpoint | std::ios::showpos);
return flags;
}
std::string getLabelText(float value, int prec, std::ios::fmtflags flags)
{
std::stringstream str;
str.precision(prec);
str.setf(flags);
str << value;
return str.str();
}
} // namespace
void SoFCColorGradient::setRange(float fMin, float fMax, int prec)
{
_cColGrad.setRange(fMin, fMax);
@@ -278,7 +277,7 @@ std::vector<float> SoFCColorGradient::getMarkerValues(float fMin, float fMax, in
labels.push_back(fValue);
}
}
else { // either not zero based or 0 is not in between [fMin,fMax]
else { // either not zero based or 0 is not in between [fMin,fMax]
for (int j = 0; j < count; j++) {
float w = (float)j / ((float)count - 1.0F);
float fValue = (1.0F - w) * fMax + w * fMin;
@@ -301,7 +300,7 @@ void SoFCColorGradient::modifyPoints(const SbBox2f& box)
for (int i = 0; i < intFields; i++) {
float w = static_cast<float>(i) / static_cast<float>(intFields - 1);
float fPosY = (1.0F - w) * fMaxY + w * fMinY;
coords->point.set1Value(2 * i, fMinX, fPosY, 0.0F);
coords->point.set1Value(2 * i, fMinX, fPosY, 0.0F);
coords->point.set1Value(2 * i + 1, fMaxX, fPosY, 0.0F);
}
}
@@ -433,8 +432,7 @@ void SoFCColorGradient::customize(SoFCColorBarBase* parentNode)
triggerChange(parentNode);
};
QObject::connect(&dlg, &Gui::Dialog::DlgSettingsColorGradientImp::colorModelChanged,
[&] {
QObject::connect(&dlg, &Gui::Dialog::DlgSettingsColorGradientImp::colorModelChanged, [&] {
try {
applyProfile(dlg.getProfile(), dlg.numberOfDecimals());
}