From 434fc92c09ef82882bbb64cc271ec6f51f36c3fb Mon Sep 17 00:00:00 2001 From: Dirk Schuermans Date: Wed, 5 Feb 2020 16:07:03 +0100 Subject: [PATCH 1/2] Added KilopoundsForcePerFoot (kipf/ft) imperial variant --- Common/UnitDefinitions/ForcePerLength.json | 14 +++- .../CustomCode/ForcePerLengthTests.cs | 1 + .../TestsBase/ForcePerLengthTestsBase.g.cs | 69 +++++++++++-------- .../Quantities/ForcePerLength.g.cs | 17 +++++ .../GeneratedCode/UnitAbbreviationsCache.g.cs | 1 + .../Units/ForcePerLengthUnit.g.cs | 1 + .../Quantities/ForcePerLength.g.cs | 17 +++++ .../GeneratedCode/UnitAbbreviationsCache.g.cs | 1 + UnitsNet/GeneratedCode/UnitConverter.g.cs | 2 + .../Units/ForcePerLengthUnit.g.cs | 1 + 10 files changed, 96 insertions(+), 28 deletions(-) diff --git a/Common/UnitDefinitions/ForcePerLength.json b/Common/UnitDefinitions/ForcePerLength.json index dda68b67a0..ef0c67672a 100644 --- a/Common/UnitDefinitions/ForcePerLength.json +++ b/Common/UnitDefinitions/ForcePerLength.json @@ -20,7 +20,7 @@ } ] }, - { + { "SingularName": "NewtonPerMillimeter", "PluralName": "NewtonsPerMillimeter", "FromUnitToBaseFunc": "x*1e3", @@ -83,6 +83,18 @@ "Abbreviations": [ "lbf/yd" ] } ] + }, + { + "SingularName": "KilopoundForcePerFoot", + "PluralName": "KilopoundsForcePerFoot", + "FromUnitToBaseFunc": "x*14593.90292", + "FromBaseToUnitFunc": "x/14593.90292", + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "kipf/ft" ] + } + ] } ] } diff --git a/UnitsNet.Tests/CustomCode/ForcePerLengthTests.cs b/UnitsNet.Tests/CustomCode/ForcePerLengthTests.cs index a6b47c12c4..d33ba3aa21 100644 --- a/UnitsNet.Tests/CustomCode/ForcePerLengthTests.cs +++ b/UnitsNet.Tests/CustomCode/ForcePerLengthTests.cs @@ -27,6 +27,7 @@ public class ForcePerLengthTests : ForcePerLengthTestsBase protected override double DecinewtonsPerMeterInOneNewtonPerMeter => 1E1; protected override double KilogramsForcePerMeterInOneNewtonPerMeter => 0.101972; protected override double KilonewtonsPerMeterInOneNewtonPerMeter => 1E-3; + protected override double KilopoundsForcePerFootInOneNewtonPerMeter => 6.8521766E-5; protected override double MicronewtonsPerMeterInOneNewtonPerMeter => 1E6; protected override double MillinewtonsPerMeterInOneNewtonPerMeter => 1E3; protected override double NanonewtonsPerMeterInOneNewtonPerMeter => 1E9; diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs index e3426b05f8..076f34e67b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs @@ -40,6 +40,7 @@ public abstract partial class ForcePerLengthTestsBase protected abstract double DecinewtonsPerMeterInOneNewtonPerMeter { get; } protected abstract double KilogramsForcePerMeterInOneNewtonPerMeter { get; } protected abstract double KilonewtonsPerMeterInOneNewtonPerMeter { get; } + protected abstract double KilopoundsForcePerFootInOneNewtonPerMeter { get; } protected abstract double MeganewtonsPerMeterInOneNewtonPerMeter { get; } protected abstract double MicronewtonsPerMeterInOneNewtonPerMeter { get; } protected abstract double MillinewtonsPerMeterInOneNewtonPerMeter { get; } @@ -55,6 +56,7 @@ public abstract partial class ForcePerLengthTestsBase protected virtual double DecinewtonsPerMeterTolerance { get { return 1e-5; } } protected virtual double KilogramsForcePerMeterTolerance { get { return 1e-5; } } protected virtual double KilonewtonsPerMeterTolerance { get { return 1e-5; } } + protected virtual double KilopoundsForcePerFootTolerance { get { return 1e-5; } } protected virtual double MeganewtonsPerMeterTolerance { get { return 1e-5; } } protected virtual double MicronewtonsPerMeterTolerance { get { return 1e-5; } } protected virtual double MillinewtonsPerMeterTolerance { get { return 1e-5; } } @@ -129,6 +131,7 @@ public void NewtonPerMeterToForcePerLengthUnits() AssertEx.EqualTolerance(DecinewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.DecinewtonsPerMeter, DecinewtonsPerMeterTolerance); AssertEx.EqualTolerance(KilogramsForcePerMeterInOneNewtonPerMeter, newtonpermeter.KilogramsForcePerMeter, KilogramsForcePerMeterTolerance); AssertEx.EqualTolerance(KilonewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.KilonewtonsPerMeter, KilonewtonsPerMeterTolerance); + AssertEx.EqualTolerance(KilopoundsForcePerFootInOneNewtonPerMeter, newtonpermeter.KilopoundsForcePerFoot, KilopoundsForcePerFootTolerance); AssertEx.EqualTolerance(MeganewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.MeganewtonsPerMeter, MeganewtonsPerMeterTolerance); AssertEx.EqualTolerance(MicronewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.MicronewtonsPerMeter, MicronewtonsPerMeterTolerance); AssertEx.EqualTolerance(MillinewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.MillinewtonsPerMeter, MillinewtonsPerMeterTolerance); @@ -159,41 +162,45 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() AssertEx.EqualTolerance(1, quantity03.KilonewtonsPerMeter, KilonewtonsPerMeterTolerance); Assert.Equal(ForcePerLengthUnit.KilonewtonPerMeter, quantity03.Unit); - var quantity04 = ForcePerLength.From(1, ForcePerLengthUnit.MeganewtonPerMeter); - AssertEx.EqualTolerance(1, quantity04.MeganewtonsPerMeter, MeganewtonsPerMeterTolerance); - Assert.Equal(ForcePerLengthUnit.MeganewtonPerMeter, quantity04.Unit); + var quantity04 = ForcePerLength.From(1, ForcePerLengthUnit.KilopoundForcePerFoot); + AssertEx.EqualTolerance(1, quantity04.KilopoundsForcePerFoot, KilopoundsForcePerFootTolerance); + Assert.Equal(ForcePerLengthUnit.KilopoundForcePerFoot, quantity04.Unit); - var quantity05 = ForcePerLength.From(1, ForcePerLengthUnit.MicronewtonPerMeter); - AssertEx.EqualTolerance(1, quantity05.MicronewtonsPerMeter, MicronewtonsPerMeterTolerance); - Assert.Equal(ForcePerLengthUnit.MicronewtonPerMeter, quantity05.Unit); + var quantity05 = ForcePerLength.From(1, ForcePerLengthUnit.MeganewtonPerMeter); + AssertEx.EqualTolerance(1, quantity05.MeganewtonsPerMeter, MeganewtonsPerMeterTolerance); + Assert.Equal(ForcePerLengthUnit.MeganewtonPerMeter, quantity05.Unit); - var quantity06 = ForcePerLength.From(1, ForcePerLengthUnit.MillinewtonPerMeter); - AssertEx.EqualTolerance(1, quantity06.MillinewtonsPerMeter, MillinewtonsPerMeterTolerance); - Assert.Equal(ForcePerLengthUnit.MillinewtonPerMeter, quantity06.Unit); + var quantity06 = ForcePerLength.From(1, ForcePerLengthUnit.MicronewtonPerMeter); + AssertEx.EqualTolerance(1, quantity06.MicronewtonsPerMeter, MicronewtonsPerMeterTolerance); + Assert.Equal(ForcePerLengthUnit.MicronewtonPerMeter, quantity06.Unit); - var quantity07 = ForcePerLength.From(1, ForcePerLengthUnit.NanonewtonPerMeter); - AssertEx.EqualTolerance(1, quantity07.NanonewtonsPerMeter, NanonewtonsPerMeterTolerance); - Assert.Equal(ForcePerLengthUnit.NanonewtonPerMeter, quantity07.Unit); + var quantity07 = ForcePerLength.From(1, ForcePerLengthUnit.MillinewtonPerMeter); + AssertEx.EqualTolerance(1, quantity07.MillinewtonsPerMeter, MillinewtonsPerMeterTolerance); + Assert.Equal(ForcePerLengthUnit.MillinewtonPerMeter, quantity07.Unit); - var quantity08 = ForcePerLength.From(1, ForcePerLengthUnit.NewtonPerMeter); - AssertEx.EqualTolerance(1, quantity08.NewtonsPerMeter, NewtonsPerMeterTolerance); - Assert.Equal(ForcePerLengthUnit.NewtonPerMeter, quantity08.Unit); + var quantity08 = ForcePerLength.From(1, ForcePerLengthUnit.NanonewtonPerMeter); + AssertEx.EqualTolerance(1, quantity08.NanonewtonsPerMeter, NanonewtonsPerMeterTolerance); + Assert.Equal(ForcePerLengthUnit.NanonewtonPerMeter, quantity08.Unit); - var quantity09 = ForcePerLength.From(1, ForcePerLengthUnit.NewtonPerMillimeter); - AssertEx.EqualTolerance(1, quantity09.NewtonsPerMillimeter, NewtonsPerMillimeterTolerance); - Assert.Equal(ForcePerLengthUnit.NewtonPerMillimeter, quantity09.Unit); + var quantity09 = ForcePerLength.From(1, ForcePerLengthUnit.NewtonPerMeter); + AssertEx.EqualTolerance(1, quantity09.NewtonsPerMeter, NewtonsPerMeterTolerance); + Assert.Equal(ForcePerLengthUnit.NewtonPerMeter, quantity09.Unit); - var quantity10 = ForcePerLength.From(1, ForcePerLengthUnit.PoundForcePerFoot); - AssertEx.EqualTolerance(1, quantity10.PoundsForcePerFoot, PoundsForcePerFootTolerance); - Assert.Equal(ForcePerLengthUnit.PoundForcePerFoot, quantity10.Unit); + var quantity10 = ForcePerLength.From(1, ForcePerLengthUnit.NewtonPerMillimeter); + AssertEx.EqualTolerance(1, quantity10.NewtonsPerMillimeter, NewtonsPerMillimeterTolerance); + Assert.Equal(ForcePerLengthUnit.NewtonPerMillimeter, quantity10.Unit); - var quantity11 = ForcePerLength.From(1, ForcePerLengthUnit.PoundForcePerInch); - AssertEx.EqualTolerance(1, quantity11.PoundsForcePerInch, PoundsForcePerInchTolerance); - Assert.Equal(ForcePerLengthUnit.PoundForcePerInch, quantity11.Unit); + var quantity11 = ForcePerLength.From(1, ForcePerLengthUnit.PoundForcePerFoot); + AssertEx.EqualTolerance(1, quantity11.PoundsForcePerFoot, PoundsForcePerFootTolerance); + Assert.Equal(ForcePerLengthUnit.PoundForcePerFoot, quantity11.Unit); - var quantity12 = ForcePerLength.From(1, ForcePerLengthUnit.PoundForcePerYard); - AssertEx.EqualTolerance(1, quantity12.PoundsForcePerYard, PoundsForcePerYardTolerance); - Assert.Equal(ForcePerLengthUnit.PoundForcePerYard, quantity12.Unit); + var quantity12 = ForcePerLength.From(1, ForcePerLengthUnit.PoundForcePerInch); + AssertEx.EqualTolerance(1, quantity12.PoundsForcePerInch, PoundsForcePerInchTolerance); + Assert.Equal(ForcePerLengthUnit.PoundForcePerInch, quantity12.Unit); + + var quantity13 = ForcePerLength.From(1, ForcePerLengthUnit.PoundForcePerYard); + AssertEx.EqualTolerance(1, quantity13.PoundsForcePerYard, PoundsForcePerYardTolerance); + Assert.Equal(ForcePerLengthUnit.PoundForcePerYard, quantity13.Unit); } @@ -218,6 +225,7 @@ public void As() AssertEx.EqualTolerance(DecinewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.DecinewtonPerMeter), DecinewtonsPerMeterTolerance); AssertEx.EqualTolerance(KilogramsForcePerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.KilogramForcePerMeter), KilogramsForcePerMeterTolerance); AssertEx.EqualTolerance(KilonewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.KilonewtonPerMeter), KilonewtonsPerMeterTolerance); + AssertEx.EqualTolerance(KilopoundsForcePerFootInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.KilopoundForcePerFoot), KilopoundsForcePerFootTolerance); AssertEx.EqualTolerance(MeganewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.MeganewtonPerMeter), MeganewtonsPerMeterTolerance); AssertEx.EqualTolerance(MicronewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.MicronewtonPerMeter), MicronewtonsPerMeterTolerance); AssertEx.EqualTolerance(MillinewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.MillinewtonPerMeter), MillinewtonsPerMeterTolerance); @@ -250,6 +258,10 @@ public void ToUnit() AssertEx.EqualTolerance(KilonewtonsPerMeterInOneNewtonPerMeter, (double)kilonewtonpermeterQuantity.Value, KilonewtonsPerMeterTolerance); Assert.Equal(ForcePerLengthUnit.KilonewtonPerMeter, kilonewtonpermeterQuantity.Unit); + var kilopoundforceperfootQuantity = newtonpermeter.ToUnit(ForcePerLengthUnit.KilopoundForcePerFoot); + AssertEx.EqualTolerance(KilopoundsForcePerFootInOneNewtonPerMeter, (double)kilopoundforceperfootQuantity.Value, KilopoundsForcePerFootTolerance); + Assert.Equal(ForcePerLengthUnit.KilopoundForcePerFoot, kilopoundforceperfootQuantity.Unit); + var meganewtonpermeterQuantity = newtonpermeter.ToUnit(ForcePerLengthUnit.MeganewtonPerMeter); AssertEx.EqualTolerance(MeganewtonsPerMeterInOneNewtonPerMeter, (double)meganewtonpermeterQuantity.Value, MeganewtonsPerMeterTolerance); Assert.Equal(ForcePerLengthUnit.MeganewtonPerMeter, meganewtonpermeterQuantity.Unit); @@ -295,6 +307,7 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, ForcePerLength.FromDecinewtonsPerMeter(newtonpermeter.DecinewtonsPerMeter).NewtonsPerMeter, DecinewtonsPerMeterTolerance); AssertEx.EqualTolerance(1, ForcePerLength.FromKilogramsForcePerMeter(newtonpermeter.KilogramsForcePerMeter).NewtonsPerMeter, KilogramsForcePerMeterTolerance); AssertEx.EqualTolerance(1, ForcePerLength.FromKilonewtonsPerMeter(newtonpermeter.KilonewtonsPerMeter).NewtonsPerMeter, KilonewtonsPerMeterTolerance); + AssertEx.EqualTolerance(1, ForcePerLength.FromKilopoundsForcePerFoot(newtonpermeter.KilopoundsForcePerFoot).NewtonsPerMeter, KilopoundsForcePerFootTolerance); AssertEx.EqualTolerance(1, ForcePerLength.FromMeganewtonsPerMeter(newtonpermeter.MeganewtonsPerMeter).NewtonsPerMeter, MeganewtonsPerMeterTolerance); AssertEx.EqualTolerance(1, ForcePerLength.FromMicronewtonsPerMeter(newtonpermeter.MicronewtonsPerMeter).NewtonsPerMeter, MicronewtonsPerMeterTolerance); AssertEx.EqualTolerance(1, ForcePerLength.FromMillinewtonsPerMeter(newtonpermeter.MillinewtonsPerMeter).NewtonsPerMeter, MillinewtonsPerMeterTolerance); @@ -447,6 +460,7 @@ public void ToString_ReturnsValueAndUnitAbbreviationInCurrentCulture() Assert.Equal("1 dN/m", new ForcePerLength(1, ForcePerLengthUnit.DecinewtonPerMeter).ToString()); Assert.Equal("1 kgf/m", new ForcePerLength(1, ForcePerLengthUnit.KilogramForcePerMeter).ToString()); Assert.Equal("1 kN/m", new ForcePerLength(1, ForcePerLengthUnit.KilonewtonPerMeter).ToString()); + Assert.Equal("1 kipf/ft", new ForcePerLength(1, ForcePerLengthUnit.KilopoundForcePerFoot).ToString()); Assert.Equal("1 MN/m", new ForcePerLength(1, ForcePerLengthUnit.MeganewtonPerMeter).ToString()); Assert.Equal("1 µN/m", new ForcePerLength(1, ForcePerLengthUnit.MicronewtonPerMeter).ToString()); Assert.Equal("1 mN/m", new ForcePerLength(1, ForcePerLengthUnit.MillinewtonPerMeter).ToString()); @@ -473,6 +487,7 @@ public void ToString_WithSwedishCulture_ReturnsUnitAbbreviationForEnglishCulture Assert.Equal("1 dN/m", new ForcePerLength(1, ForcePerLengthUnit.DecinewtonPerMeter).ToString(swedishCulture)); Assert.Equal("1 kgf/m", new ForcePerLength(1, ForcePerLengthUnit.KilogramForcePerMeter).ToString(swedishCulture)); Assert.Equal("1 kN/m", new ForcePerLength(1, ForcePerLengthUnit.KilonewtonPerMeter).ToString(swedishCulture)); + Assert.Equal("1 kipf/ft", new ForcePerLength(1, ForcePerLengthUnit.KilopoundForcePerFoot).ToString(swedishCulture)); Assert.Equal("1 MN/m", new ForcePerLength(1, ForcePerLengthUnit.MeganewtonPerMeter).ToString(swedishCulture)); Assert.Equal("1 µN/m", new ForcePerLength(1, ForcePerLengthUnit.MicronewtonPerMeter).ToString(swedishCulture)); Assert.Equal("1 mN/m", new ForcePerLength(1, ForcePerLengthUnit.MillinewtonPerMeter).ToString(swedishCulture)); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.g.cs index f4bab3a94c..dc6c68bceb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -175,6 +175,11 @@ private ForcePerLength(double value, ForcePerLengthUnit unit) /// public double KilonewtonsPerMeter => As(ForcePerLengthUnit.KilonewtonPerMeter); + /// + /// Get ForcePerLength in KilopoundsForcePerFoot. + /// + public double KilopoundsForcePerFoot => As(ForcePerLengthUnit.KilopoundForcePerFoot); + /// /// Get ForcePerLength in MeganewtonsPerMeter. /// @@ -291,6 +296,16 @@ public static ForcePerLength FromKilonewtonsPerMeter(double kilonewtonspermeter) return new ForcePerLength(value, ForcePerLengthUnit.KilonewtonPerMeter); } /// + /// Get ForcePerLength from KilopoundsForcePerFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForcePerLength FromKilopoundsForcePerFoot(double kilopoundsforceperfoot) + { + double value = (double) kilopoundsforceperfoot; + return new ForcePerLength(value, ForcePerLengthUnit.KilopoundForcePerFoot); + } + /// /// Get ForcePerLength from MeganewtonsPerMeter. /// /// If value is NaN or Infinity. @@ -675,6 +690,7 @@ private double AsBaseUnit() case ForcePerLengthUnit.DecinewtonPerMeter: return (_value) * 1e-1d; case ForcePerLengthUnit.KilogramForcePerMeter: return _value*9.80665002864; case ForcePerLengthUnit.KilonewtonPerMeter: return (_value) * 1e3d; + case ForcePerLengthUnit.KilopoundForcePerFoot: return _value*14593.90292; case ForcePerLengthUnit.MeganewtonPerMeter: return (_value) * 1e6d; case ForcePerLengthUnit.MicronewtonPerMeter: return (_value) * 1e-6d; case ForcePerLengthUnit.MillinewtonPerMeter: return (_value) * 1e-3d; @@ -702,6 +718,7 @@ private double AsBaseNumericType(ForcePerLengthUnit unit) case ForcePerLengthUnit.DecinewtonPerMeter: return (baseUnitValue) / 1e-1d; case ForcePerLengthUnit.KilogramForcePerMeter: return baseUnitValue/9.80665002864; case ForcePerLengthUnit.KilonewtonPerMeter: return (baseUnitValue) / 1e3d; + case ForcePerLengthUnit.KilopoundForcePerFoot: return baseUnitValue/14593.90292; case ForcePerLengthUnit.MeganewtonPerMeter: return (baseUnitValue) / 1e6d; case ForcePerLengthUnit.MicronewtonPerMeter: return (baseUnitValue) / 1e-6d; case ForcePerLengthUnit.MillinewtonPerMeter: return (baseUnitValue) / 1e-3d; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs index c69a6aad28..f49a2a4a90 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -397,6 +397,7 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilogramForcePerMeter, new string[]{"kgf/m"}), ("ru-RU", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilogramForcePerMeter, new string[]{"кгс/м"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilonewtonPerMeter, new string[]{"kN/m"}), + ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilopoundForcePerFoot, new string[]{"kipf/ft"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MeganewtonPerMeter, new string[]{"MN/m"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MicronewtonPerMeter, new string[]{"µN/m"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MillinewtonPerMeter, new string[]{"mN/m"}), diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/ForcePerLengthUnit.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/ForcePerLengthUnit.g.cs index b26e00b071..077145dd93 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/ForcePerLengthUnit.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/ForcePerLengthUnit.g.cs @@ -30,6 +30,7 @@ public enum ForcePerLengthUnit DecinewtonPerMeter, KilogramForcePerMeter, KilonewtonPerMeter, + KilopoundForcePerFoot, MeganewtonPerMeter, MicronewtonPerMeter, MillinewtonPerMeter, diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs index 693c7aac3f..595ec6026b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -54,6 +54,7 @@ static ForcePerLength() new UnitInfo(ForcePerLengthUnit.DecinewtonPerMeter, BaseUnits.Undefined), new UnitInfo(ForcePerLengthUnit.KilogramForcePerMeter, BaseUnits.Undefined), new UnitInfo(ForcePerLengthUnit.KilonewtonPerMeter, BaseUnits.Undefined), + new UnitInfo(ForcePerLengthUnit.KilopoundForcePerFoot, BaseUnits.Undefined), new UnitInfo(ForcePerLengthUnit.MeganewtonPerMeter, BaseUnits.Undefined), new UnitInfo(ForcePerLengthUnit.MicronewtonPerMeter, BaseUnits.Undefined), new UnitInfo(ForcePerLengthUnit.MillinewtonPerMeter, BaseUnits.Undefined), @@ -195,6 +196,11 @@ public ForcePerLength(double value, UnitSystem unitSystem) /// public double KilonewtonsPerMeter => As(ForcePerLengthUnit.KilonewtonPerMeter); + /// + /// Get ForcePerLength in KilopoundsForcePerFoot. + /// + public double KilopoundsForcePerFoot => As(ForcePerLengthUnit.KilopoundForcePerFoot); + /// /// Get ForcePerLength in MeganewtonsPerMeter. /// @@ -306,6 +312,15 @@ public static ForcePerLength FromKilonewtonsPerMeter(QuantityValue kilonewtonspe return new ForcePerLength(value, ForcePerLengthUnit.KilonewtonPerMeter); } /// + /// Get ForcePerLength from KilopoundsForcePerFoot. + /// + /// If value is NaN or Infinity. + public static ForcePerLength FromKilopoundsForcePerFoot(QuantityValue kilopoundsforceperfoot) + { + double value = (double) kilopoundsforceperfoot; + return new ForcePerLength(value, ForcePerLengthUnit.KilopoundForcePerFoot); + } + /// /// Get ForcePerLength from MeganewtonsPerMeter. /// /// If value is NaN or Infinity. @@ -819,6 +834,7 @@ private double GetValueInBaseUnit() case ForcePerLengthUnit.DecinewtonPerMeter: return (_value) * 1e-1d; case ForcePerLengthUnit.KilogramForcePerMeter: return _value*9.80665002864; case ForcePerLengthUnit.KilonewtonPerMeter: return (_value) * 1e3d; + case ForcePerLengthUnit.KilopoundForcePerFoot: return _value*14593.90292; case ForcePerLengthUnit.MeganewtonPerMeter: return (_value) * 1e6d; case ForcePerLengthUnit.MicronewtonPerMeter: return (_value) * 1e-6d; case ForcePerLengthUnit.MillinewtonPerMeter: return (_value) * 1e-3d; @@ -857,6 +873,7 @@ private double GetValueAs(ForcePerLengthUnit unit) case ForcePerLengthUnit.DecinewtonPerMeter: return (baseUnitValue) / 1e-1d; case ForcePerLengthUnit.KilogramForcePerMeter: return baseUnitValue/9.80665002864; case ForcePerLengthUnit.KilonewtonPerMeter: return (baseUnitValue) / 1e3d; + case ForcePerLengthUnit.KilopoundForcePerFoot: return baseUnitValue/14593.90292; case ForcePerLengthUnit.MeganewtonPerMeter: return (baseUnitValue) / 1e6d; case ForcePerLengthUnit.MicronewtonPerMeter: return (baseUnitValue) / 1e-6d; case ForcePerLengthUnit.MillinewtonPerMeter: return (baseUnitValue) / 1e-3d; diff --git a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs index efb2b4eba8..57c4a385a4 100644 --- a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -397,6 +397,7 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilogramForcePerMeter, new string[]{"kgf/m"}), ("ru-RU", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilogramForcePerMeter, new string[]{"кгс/м"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilonewtonPerMeter, new string[]{"kN/m"}), + ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilopoundForcePerFoot, new string[]{"kipf/ft"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MeganewtonPerMeter, new string[]{"MN/m"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MicronewtonPerMeter, new string[]{"µN/m"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MillinewtonPerMeter, new string[]{"mN/m"}), diff --git a/UnitsNet/GeneratedCode/UnitConverter.g.cs b/UnitsNet/GeneratedCode/UnitConverter.g.cs index 217f59c0f4..3eb4fbc8f4 100644 --- a/UnitsNet/GeneratedCode/UnitConverter.g.cs +++ b/UnitsNet/GeneratedCode/UnitConverter.g.cs @@ -602,6 +602,8 @@ public static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ForcePerLengthUnit.KilogramForcePerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLengthUnit.KilonewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.KilonewtonPerMeter)); unitConverter.SetConversionFunction(ForcePerLengthUnit.KilonewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLengthUnit.KilopoundForcePerFoot, q => q.ToUnit(ForcePerLengthUnit.KilopoundForcePerFoot)); + unitConverter.SetConversionFunction(ForcePerLengthUnit.KilopoundForcePerFoot, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLengthUnit.MeganewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.MeganewtonPerMeter)); unitConverter.SetConversionFunction(ForcePerLengthUnit.MeganewtonPerMeter, ForcePerLength.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(ForcePerLength.BaseUnit, ForcePerLengthUnit.MicronewtonPerMeter, q => q.ToUnit(ForcePerLengthUnit.MicronewtonPerMeter)); diff --git a/UnitsNet/GeneratedCode/Units/ForcePerLengthUnit.g.cs b/UnitsNet/GeneratedCode/Units/ForcePerLengthUnit.g.cs index b26e00b071..077145dd93 100644 --- a/UnitsNet/GeneratedCode/Units/ForcePerLengthUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ForcePerLengthUnit.g.cs @@ -30,6 +30,7 @@ public enum ForcePerLengthUnit DecinewtonPerMeter, KilogramForcePerMeter, KilonewtonPerMeter, + KilopoundForcePerFoot, MeganewtonPerMeter, MicronewtonPerMeter, MillinewtonPerMeter, From cdeebb313c258e048d5f16ceb61991061d39fbee Mon Sep 17 00:00:00 2001 From: Dirk Schuermans Date: Fri, 7 Feb 2020 10:27:45 +0100 Subject: [PATCH 2/2] Updated abbreviations according to PR remarks --- Common/UnitDefinitions/ForcePerLength.json | 2 +- .../GeneratedCode/UnitAbbreviationsCache.g.cs | 2 +- UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Common/UnitDefinitions/ForcePerLength.json b/Common/UnitDefinitions/ForcePerLength.json index ef0c67672a..96ce8214aa 100644 --- a/Common/UnitDefinitions/ForcePerLength.json +++ b/Common/UnitDefinitions/ForcePerLength.json @@ -92,7 +92,7 @@ "Localization": [ { "Culture": "en-US", - "Abbreviations": [ "kipf/ft" ] + "Abbreviations": [ "kipf/ft", "kip/ft", "k/ft" ] } ] } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs index f49a2a4a90..329f6b5efa 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -397,7 +397,7 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilogramForcePerMeter, new string[]{"kgf/m"}), ("ru-RU", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilogramForcePerMeter, new string[]{"кгс/м"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilonewtonPerMeter, new string[]{"kN/m"}), - ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilopoundForcePerFoot, new string[]{"kipf/ft"}), + ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilopoundForcePerFoot, new string[]{"kipf/ft", "kip/ft", "k/ft"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MeganewtonPerMeter, new string[]{"MN/m"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MicronewtonPerMeter, new string[]{"µN/m"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MillinewtonPerMeter, new string[]{"mN/m"}), diff --git a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs index 57c4a385a4..6e8ecb5e22 100644 --- a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -397,7 +397,7 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilogramForcePerMeter, new string[]{"kgf/m"}), ("ru-RU", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilogramForcePerMeter, new string[]{"кгс/м"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilonewtonPerMeter, new string[]{"kN/m"}), - ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilopoundForcePerFoot, new string[]{"kipf/ft"}), + ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilopoundForcePerFoot, new string[]{"kipf/ft", "kip/ft", "k/ft"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MeganewtonPerMeter, new string[]{"MN/m"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MicronewtonPerMeter, new string[]{"µN/m"}), ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MillinewtonPerMeter, new string[]{"mN/m"}),