Sketcher: Fixed keeping sign of constraints.
This commit is contained in:
parent
f53a691bba
commit
b68ae65f56
|
@ -108,6 +108,11 @@ void Constraint::setValue(double newValue)
|
|||
}
|
||||
|
||||
double Constraint::getValue() const
|
||||
{
|
||||
return Value;
|
||||
}
|
||||
|
||||
double Constraint::getPresentationValue() const
|
||||
{
|
||||
switch (Type) {
|
||||
case Distance:
|
||||
|
|
|
@ -83,6 +83,7 @@ public:
|
|||
virtual PyObject *getPyObject(void);
|
||||
|
||||
void setValue(double newValue);
|
||||
double getPresentationValue() const;
|
||||
double getValue() const;
|
||||
|
||||
friend class Sketch;
|
||||
|
@ -103,6 +104,7 @@ public:
|
|||
float LabelDistance;
|
||||
float LabelPosition;
|
||||
bool isDriving;
|
||||
|
||||
protected:
|
||||
boost::uuids::uuid tag;
|
||||
};
|
||||
|
|
|
@ -466,7 +466,7 @@ const Constraint * PropertyConstraintList::getConstraint(const ObjectIdentifier
|
|||
|
||||
const boost::any PropertyConstraintList::getPathValue(const ObjectIdentifier &path) const
|
||||
{
|
||||
return boost::any(getConstraint(path)->getValue());
|
||||
return boost::any(getConstraint(path)->getPresentationValue());
|
||||
}
|
||||
|
||||
const ObjectIdentifier PropertyConstraintList::canonicalPath(const ObjectIdentifier &p) const
|
||||
|
|
|
@ -123,22 +123,22 @@ public:
|
|||
case Sketcher::Symmetric:
|
||||
break;
|
||||
case Sketcher::Distance:
|
||||
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(constraint->getValue(),Base::Unit::Length).getUserString());
|
||||
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(constraint->getPresentationValue(),Base::Unit::Length).getUserString());
|
||||
break;
|
||||
case Sketcher::DistanceX:
|
||||
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(std::abs(constraint->getValue()),Base::Unit::Length).getUserString());
|
||||
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(std::abs(constraint->getPresentationValue()),Base::Unit::Length).getUserString());
|
||||
break;
|
||||
case Sketcher::DistanceY:
|
||||
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(std::abs(constraint->getValue()),Base::Unit::Length).getUserString());
|
||||
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(std::abs(constraint->getPresentationValue()),Base::Unit::Length).getUserString());
|
||||
break;
|
||||
case Sketcher::Radius:
|
||||
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(constraint->getValue(),Base::Unit::Length).getUserString());
|
||||
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(constraint->getPresentationValue(),Base::Unit::Length).getUserString());
|
||||
break;
|
||||
case Sketcher::Angle:
|
||||
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(Base::toDegrees<double>(std::abs(constraint->getValue())),Base::Unit::Angle).getUserString());
|
||||
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(Base::toDegrees<double>(std::abs(constraint->getPresentationValue())),Base::Unit::Angle).getUserString());
|
||||
break;
|
||||
case Sketcher::SnellsLaw: {
|
||||
double v = constraint->getValue();
|
||||
double v = constraint->getPresentationValue();
|
||||
double n1 = 1.0;
|
||||
double n2 = 1.0;
|
||||
if (fabs(v) >= 1) {
|
||||
|
|
|
@ -3524,9 +3524,9 @@ Restart:
|
|||
if ((Constr->Type == DistanceX || Constr->Type == DistanceY) &&
|
||||
Constr->FirstPos != Sketcher::none && Constr->Second == Constraint::GeoUndef)
|
||||
// display negative sign for absolute coordinates
|
||||
asciiText->string = SbString(Base::Quantity(Constr->getValue(),Base::Unit::Length).getUserString().toUtf8().constData());
|
||||
asciiText->string = SbString(Base::Quantity(Constr->getPresentationValue(),Base::Unit::Length).getUserString().toUtf8().constData());
|
||||
else // hide negative sign
|
||||
asciiText->string = SbString(Base::Quantity(std::abs(Constr->getValue()),Base::Unit::Length).getUserString().toUtf8().constData());
|
||||
asciiText->string = SbString(Base::Quantity(std::abs(Constr->getPresentationValue()),Base::Unit::Length).getUserString().toUtf8().constData());
|
||||
|
||||
if (Constr->Type == Distance)
|
||||
asciiText->datumtype = SoDatumLabel::DISTANCE;
|
||||
|
@ -3825,7 +3825,7 @@ Restart:
|
|||
break;
|
||||
|
||||
SoDatumLabel *asciiText = dynamic_cast<SoDatumLabel *>(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_MATERIAL_OR_DATUMLABEL));
|
||||
asciiText->string = SbString(Base::Quantity(Base::toDegrees<double>(std::abs(Constr->getValue())),Base::Unit::Angle).getUserString().toUtf8().constData());
|
||||
asciiText->string = SbString(Base::Quantity(Base::toDegrees<double>(std::abs(Constr->getPresentationValue())),Base::Unit::Angle).getUserString().toUtf8().constData());
|
||||
asciiText->datumtype = SoDatumLabel::ANGLE;
|
||||
asciiText->param1 = Constr->LabelDistance;
|
||||
asciiText->param2 = startangle;
|
||||
|
@ -3879,7 +3879,7 @@ Restart:
|
|||
SbVec3f p2(pnt2.x,pnt2.y,zConstr);
|
||||
|
||||
SoDatumLabel *asciiText = dynamic_cast<SoDatumLabel *>(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_MATERIAL_OR_DATUMLABEL));
|
||||
asciiText->string = SbString(Base::Quantity(Constr->getValue(),Base::Unit::Length).getUserString().toUtf8().constData());
|
||||
asciiText->string = SbString(Base::Quantity(Constr->getPresentationValue(),Base::Unit::Length).getUserString().toUtf8().constData());
|
||||
|
||||
asciiText->datumtype = SoDatumLabel::RADIUS;
|
||||
asciiText->param1 = Constr->LabelDistance;
|
||||
|
|
Loading…
Reference in New Issue
Block a user