Exemplo n.º 1
0
        internal override ScalingData <double> ScaleMeasure(MeasurementSystem targetSystem, int?targetScale = null)
        {
            switch (targetSystem)
            {
            case MeasurementSystem.InternationalSystemOfUnits:
                var _metricValue = ConvertToPrimitive(MeasurementSystem.InternationalSystemOfUnits);
                var _scale       = (targetScale ?? InternationalSystemOfUnits.GetScalePower(_metricValue)) + 3;
                return(new ScalingData <double> {
                    ScaleLevel = _scale - 3,
                    ScaledValue = _metricValue / Math.Pow(10, _scale - 3),
                    Quantifier = (_scale == 6) ? ISOUQuantifiers.F_Mass_Ton : string.Format("{0}{1}", InternationalSystemOfUnits.GetScalePrefix(_scale),
                                                                                            this [targetSystem, false]),
                    Abbreviation = (_scale == 6) ? ISOUQuantifiers.A_Mass_Ton : string.Format("{0}{1}", InternationalSystemOfUnits.GetScaleAbbreviation(_scale),
                                                                                              this [targetSystem, true])
                });

            default:
                throw new MeasureSystemException(Exceptions.NotSupported_MeasurementSystem);
            }
        }