@@ -611,12 +611,11 @@ Base::Unit FemPostPipeline::getFrameUnit()
|
||||
|
||||
vtkAbstractArray* TimeInfo = multiblock->GetFieldData()->GetAbstractArray("TimeInfo");
|
||||
if (!TimeInfo->IsA("vtkStringArray") || TimeInfo->GetNumberOfTuples() < 2) {
|
||||
|
||||
// units cannot be undefined, so use time
|
||||
return Base::Unit::TimeSpan;
|
||||
}
|
||||
|
||||
return Base::Unit(vtkStringArray::SafeDownCast(TimeInfo)->GetValue(1));
|
||||
auto qty = Base::Quantity(0, vtkStringArray::SafeDownCast(TimeInfo)->GetValue(1));
|
||||
return qty.getUnit();
|
||||
}
|
||||
|
||||
std::vector<double> FemPostPipeline::getFrameValues()
|
||||
|
||||
@@ -201,8 +201,8 @@ int EditDatumDialog::exec(bool atCursor)
|
||||
void EditDatumDialog::accepted()
|
||||
{
|
||||
Base::Quantity newQuant = ui_ins_datum->labelEdit->value();
|
||||
if (newQuant.isQuantity() || (Constr->Type == Sketcher::SnellsLaw && newQuant.isDimensionless())
|
||||
|| (Constr->Type == Sketcher::Weight && newQuant.isDimensionless())) {
|
||||
if (Constr->Type == Sketcher::SnellsLaw || Constr->Type == Sketcher::Weight
|
||||
|| !newQuant.isDimensionless()) {
|
||||
|
||||
// save the value for the history
|
||||
ui_ins_datum->labelEdit->pushToHistory();
|
||||
|
||||
@@ -607,7 +607,7 @@ void Cell::setComputedUnit(const Base::Unit& unit)
|
||||
PropertySheet::AtomicPropertyChange signaller(*owner);
|
||||
|
||||
computedUnit = unit;
|
||||
setUsed(COMPUTED_UNIT_SET, !computedUnit.isEmpty());
|
||||
setUsed(COMPUTED_UNIT_SET, computedUnit != Unit::One);
|
||||
setDirty();
|
||||
|
||||
signaller.tryInvoke();
|
||||
@@ -1110,7 +1110,7 @@ std::string Cell::getFormattedQuantity()
|
||||
const Base::Unit& computedUnit = floatProp->getUnit();
|
||||
qFormatted = QLocale().toString(rawVal, 'f', Base::UnitsApi::getDecimals());
|
||||
if (hasDisplayUnit) {
|
||||
if (computedUnit.isEmpty() || computedUnit == du.unit) {
|
||||
if (computedUnit == Unit::One || computedUnit == du.unit) {
|
||||
QString number =
|
||||
QLocale().toString(rawVal / duScale, 'f', Base::UnitsApi::getDecimals());
|
||||
qFormatted = number + QString::fromStdString(" " + displayUnit.stringRep);
|
||||
|
||||
@@ -802,7 +802,7 @@ void Sheet::updateProperty(CellAddress key)
|
||||
Base::PyGILStateLocker lock;
|
||||
setObjectProperty(key, constant->getPyValue());
|
||||
}
|
||||
else if (!number->getUnit().isEmpty()) {
|
||||
else if (number->getUnit() != Unit::One) {
|
||||
setQuantityProperty(key, number->getValue(), number->getUnit());
|
||||
}
|
||||
else if (number->isInteger(&l)) {
|
||||
|
||||
@@ -384,7 +384,7 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const
|
||||
|
||||
// Display locale specific decimal separator (#0003875,#0003876)
|
||||
if (cell->getDisplayUnit(displayUnit)) {
|
||||
if (computedUnit.isEmpty() || computedUnit == displayUnit.unit) {
|
||||
if (computedUnit == Base::Unit::One || computedUnit == displayUnit.unit) {
|
||||
QString number =
|
||||
QLocale().toString(floatProp->getValue() / displayUnit.scaler,
|
||||
'f',
|
||||
|
||||
Reference in New Issue
Block a user