Sketcher: never ever hide constraint value sign, anymore
This commit is contained in:
parent
b25ef6235d
commit
e624a1d00d
|
@ -137,11 +137,11 @@ double Constraint::getPresentationValue() const
|
|||
switch (Type) {
|
||||
case Distance:
|
||||
case Radius:
|
||||
return std::abs(Value);
|
||||
return Value;
|
||||
case DistanceX:
|
||||
case DistanceY:
|
||||
if (FirstPos == Sketcher::none || Second != Sketcher::Constraint::GeoUndef)
|
||||
return std::abs(Value);
|
||||
return Value;
|
||||
else
|
||||
return Value;
|
||||
case Angle:
|
||||
|
|
|
@ -128,7 +128,7 @@ void openEditDatumDialog(Sketcher::SketchObject* sketch, int ConstrNbr)
|
|||
((Constr->Type == Sketcher::DistanceX || Constr->Type == Sketcher::DistanceY) &&
|
||||
(Constr->FirstPos == Sketcher::none || Constr->Second != Sketcher::Constraint::GeoUndef)))
|
||||
// hide negative sign
|
||||
init_val.setValue(std::abs(datum));
|
||||
init_val.setValue(datum);
|
||||
|
||||
else // show negative sign
|
||||
init_val.setValue(datum);
|
||||
|
@ -145,15 +145,6 @@ void openEditDatumDialog(Sketcher::SketchObject* sketch, int ConstrNbr)
|
|||
ui_ins_datum.labelEdit->pushToHistory();
|
||||
|
||||
double newDatum = newQuant.getValue();
|
||||
if (Constr->Type == Sketcher::Angle ||
|
||||
((Constr->Type == Sketcher::DistanceX || Constr->Type == Sketcher::DistanceY) &&
|
||||
(Constr->FirstPos == Sketcher::none || Constr->Second != Sketcher::Constraint::GeoUndef))) {
|
||||
// Permit negative values to flip the sign of the constraint
|
||||
if (newDatum >= 0) // keep the old sign
|
||||
newDatum = ((datum >= 0) ? 1 : -1) * std::abs(newDatum);
|
||||
else // flip sign
|
||||
newDatum = ((datum >= 0) ? -1 : 1) * std::abs(newDatum);
|
||||
}
|
||||
|
||||
try {
|
||||
if (ui_ins_datum.labelEdit->hasExpression())
|
||||
|
|
|
@ -122,15 +122,7 @@ void EditDatumDialog::exec(bool atCursor)
|
|||
|
||||
//ui_ins_datum.lineEdit->setParamGrpPath("User parameter:History/Sketcher/SetDatum");
|
||||
|
||||
// e.g. an angle or a distance X or Y applied on a line or two vertexes
|
||||
if (Constr->Type == Sketcher::Angle ||
|
||||
((Constr->Type == Sketcher::DistanceX || Constr->Type == Sketcher::DistanceY) &&
|
||||
(Constr->FirstPos == Sketcher::none || Constr->Second != Sketcher::Constraint::GeoUndef)))
|
||||
// hide negative sign
|
||||
init_val.setValue(std::abs(datum));
|
||||
|
||||
else // show negative sign
|
||||
init_val.setValue(datum);
|
||||
init_val.setValue(datum);
|
||||
|
||||
// Enable label if we are modifying a driving constraint
|
||||
ui_ins_datum.labelEdit->setEnabled(Constr->isDriving);
|
||||
|
@ -150,15 +142,6 @@ void EditDatumDialog::exec(bool atCursor)
|
|||
ui_ins_datum.labelEdit->pushToHistory();
|
||||
|
||||
double newDatum = newQuant.getValue();
|
||||
if (Constr->Type == Sketcher::Angle ||
|
||||
((Constr->Type == Sketcher::DistanceX || Constr->Type == Sketcher::DistanceY) &&
|
||||
(Constr->FirstPos == Sketcher::none || Constr->Second != Sketcher::Constraint::GeoUndef))) {
|
||||
// Permit negative values to flip the sign of the constraint
|
||||
if (newDatum >= 0) // keep the old sign
|
||||
newDatum = ((datum >= 0) ? 1 : -1) * std::abs(newDatum);
|
||||
else // flip sign
|
||||
newDatum = ((datum >= 0) ? -1 : 1) * std::abs(newDatum);
|
||||
}
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Modify sketch constraints");
|
||||
|
|
|
@ -126,16 +126,16 @@ public:
|
|||
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->getPresentationValue()),Base::Unit::Length).getUserString());
|
||||
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(constraint->getPresentationValue(),Base::Unit::Length).getUserString());
|
||||
break;
|
||||
case Sketcher::DistanceY:
|
||||
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(std::abs(constraint->getPresentationValue()),Base::Unit::Length).getUserString());
|
||||
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(constraint->getPresentationValue(),Base::Unit::Length).getUserString());
|
||||
break;
|
||||
case Sketcher::Radius:
|
||||
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->getPresentationValue())),Base::Unit::Angle).getUserString());
|
||||
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(Base::toDegrees<double>(constraint->getPresentationValue()),Base::Unit::Angle).getUserString());
|
||||
break;
|
||||
case Sketcher::SnellsLaw: {
|
||||
double v = constraint->getPresentationValue();
|
||||
|
|
|
@ -3525,12 +3525,7 @@ Restart:
|
|||
break;
|
||||
|
||||
SoDatumLabel *asciiText = dynamic_cast<SoDatumLabel *>(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_MATERIAL_OR_DATUMLABEL));
|
||||
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->getPresentationValue(),Base::Unit::Length).getUserString().toUtf8().constData());
|
||||
else // hide negative sign
|
||||
asciiText->string = SbString(Base::Quantity(std::abs(Constr->getPresentationValue()),Base::Unit::Length).getUserString().toUtf8().constData());
|
||||
asciiText->string = SbString(Base::Quantity(Constr->getPresentationValue(),Base::Unit::Length).getUserString().toUtf8().constData());
|
||||
|
||||
if (Constr->Type == Distance)
|
||||
asciiText->datumtype = SoDatumLabel::DISTANCE;
|
||||
|
@ -3829,7 +3824,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->getPresentationValue())),Base::Unit::Angle).getUserString().toUtf8().constData());
|
||||
asciiText->string = SbString(Base::Quantity(Base::toDegrees<double>(Constr->getPresentationValue()),Base::Unit::Angle).getUserString().toUtf8().constData());
|
||||
asciiText->datumtype = SoDatumLabel::ANGLE;
|
||||
asciiText->param1 = Constr->LabelDistance;
|
||||
asciiText->param2 = startangle;
|
||||
|
|
Loading…
Reference in New Issue
Block a user