use QuantityFormat to restore old behaviour for dimensionsal constraints of sketches

This commit is contained in:
wmayer 2016-08-06 19:08:27 +02:00
parent f39b89a54d
commit 4062a15018

View File

@ -135,23 +135,33 @@ double Constraint::getValue() const
Quantity Constraint::getPresentationValue() const Quantity Constraint::getPresentationValue() const
{ {
Quantity quantity;
switch (Type) { switch (Type) {
case Distance: case Distance:
case Radius: case Radius:
return Quantity(Value, Unit::Length);
case DistanceX: case DistanceX:
case DistanceY: case DistanceY:
if (FirstPos == Sketcher::none || Second != Sketcher::Constraint::GeoUndef) quantity.setValue(Value);
return Quantity(Value, Unit::Length); quantity.setUnit(Unit::Length);
else break;
return Quantity(Value, Unit::Length);
case Angle: case Angle:
return Quantity(toDegrees<double>(Value), Unit::Angle); quantity.setValue(toDegrees<double>(Value));
quantity.setUnit(Unit::Angle);
break;
case SnellsLaw: case SnellsLaw:
return Value; quantity.setValue(Value);
break;
default: default:
return Value; quantity.setValue(Value);
break;
} }
QuantityFormat format = quantity.getFormat();
format.option = QuantityFormat::None;
format.format = QuantityFormat::Default;
format.precision = 6; // QString's default
quantity.setFormat(format);
return quantity;
} }
unsigned int Constraint::getMemSize (void) const unsigned int Constraint::getMemSize (void) const