Sketcher: Initialize constraint members in class declaration

This commit is contained in:
Benjamin Nauck
2025-06-20 10:59:06 +02:00
committed by Kacper Donat
parent f389ba5214
commit 7e8a65b82b
2 changed files with 16 additions and 30 deletions

View File

@@ -44,21 +44,6 @@ using namespace Base;
TYPESYSTEM_SOURCE(Sketcher::Constraint, Base::Persistence)
Constraint::Constraint()
: Value(0.0)
, Type(None)
, AlignmentType(Undef)
, First(GeoEnum::GeoUndef)
, FirstPos(PointPos::none)
, Second(GeoEnum::GeoUndef)
, SecondPos(PointPos::none)
, Third(GeoEnum::GeoUndef)
, ThirdPos(PointPos::none)
, LabelDistance(10.f)
, LabelPosition(0.f)
, isDriving(true)
, InternalAlignmentIndex(-1)
, isInVirtualSpace(false)
, isActive(true)
{
// Initialize a random number generator, to avoid Valgrind false positives.
// The random number generator is not threadsafe so we guard it. See

View File

@@ -166,7 +166,7 @@ private:
Constraint(const Constraint&) = default; // only for internal use
private:
double Value;
double Value {0.0};
// clang-format off
constexpr static std::array<const char*, ConstraintType::NumConstraintTypes> type2str {
@@ -207,24 +207,25 @@ private:
"ParabolaFocalAxis"}};
public:
ConstraintType Type;
InternalAlignmentType AlignmentType;
ConstraintType Type {None};
InternalAlignmentType AlignmentType {Undef};
std::string Name;
int First;
PointPos FirstPos;
int Second;
PointPos SecondPos;
int Third;
PointPos ThirdPos;
float LabelDistance;
float LabelPosition;
bool isDriving;
int First {GeoEnum::GeoUndef};
PointPos FirstPos {PointPos::none};
int Second {GeoEnum::GeoUndef};
PointPos SecondPos {PointPos::none};
int Third {GeoEnum::GeoUndef};
PointPos ThirdPos {PointPos::none};
float LabelDistance {10.F};
float LabelPosition {0.F};
bool isDriving {true};
// Note: for InternalAlignment Type this index indexes equal internal geometry elements (e.g.
// index of pole in a bspline). It is not a GeoId!!
int InternalAlignmentIndex;
bool isInVirtualSpace;
int InternalAlignmentIndex {-1};
bool isInVirtualSpace {false};
bool isActive {true};
bool isActive;
protected:
boost::uuids::uuid tag;