Measurements of units were added
This commit is contained in:
17
StructureHelperCommon/Infrastructures/Enums/UnitTypes.cs
Normal file
17
StructureHelperCommon/Infrastructures/Enums/UnitTypes.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Enums
|
||||
{
|
||||
public enum UnitTypes
|
||||
{
|
||||
Length,
|
||||
Area,
|
||||
Stress,
|
||||
Force,
|
||||
Moment
|
||||
}
|
||||
}
|
||||
@@ -15,5 +15,6 @@ namespace StructureHelperCommon.Infrastructures.Strings
|
||||
public static string ShapeIsNotCorrect => "#0004: Shape is not valid";
|
||||
public static string LimitStatesIsNotValid => "#0005: Type of limite state is not valid";
|
||||
public static string LoadTermIsNotValid => "#0006: Load term is not valid";
|
||||
public static string IncorrectValue => "#0007: value is not valid";
|
||||
}
|
||||
}
|
||||
|
||||
20
StructureHelperCommon/Services/Units/IUnit.cs
Normal file
20
StructureHelperCommon/Services/Units/IUnit.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Services.Units
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for measurements Unit
|
||||
/// </summary>
|
||||
public interface IUnit
|
||||
{
|
||||
|
||||
UnitTypes UnitType { get; }
|
||||
string Name { get; }
|
||||
double Multiplyer { get; }
|
||||
}
|
||||
}
|
||||
16
StructureHelperCommon/Services/Units/Unit.cs
Normal file
16
StructureHelperCommon/Services/Units/Unit.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Services.Units
|
||||
{
|
||||
public class Unit : IUnit
|
||||
{
|
||||
public UnitTypes UnitType { get; set; }
|
||||
public string Name { get; set; }
|
||||
public double Multiplyer { get; set; }
|
||||
}
|
||||
}
|
||||
27
StructureHelperCommon/Services/Units/UnitsFactory.cs
Normal file
27
StructureHelperCommon/Services/Units/UnitsFactory.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Services.Units
|
||||
{
|
||||
public static class UnitsFactory
|
||||
{
|
||||
public static List<IUnit> GetUnitCollection()
|
||||
{
|
||||
List<IUnit> units = new List<IUnit>();
|
||||
UnitTypes type = UnitTypes.Length;
|
||||
units.Add(new Unit() { UnitType = type, Name = "m", Multiplyer = 1d });
|
||||
units.Add(new Unit() { UnitType = type, Name = "mm", Multiplyer = 1e3d });
|
||||
units.Add(new Unit() { UnitType = type, Name = "cm", Multiplyer = 1e2d });
|
||||
units.Add(new Unit() { UnitType = type, Name = "km", Multiplyer = 1e-3d });
|
||||
type = UnitTypes.Stress;
|
||||
units.Add(new Unit() { UnitType = type, Name = "Pa", Multiplyer = 1d });
|
||||
units.Add(new Unit() { UnitType = type, Name = "kPa", Multiplyer = 1e-3d });
|
||||
units.Add(new Unit() { UnitType = type, Name = "MPa", Multiplyer = 1e-6d });
|
||||
return units;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,7 @@
|
||||
<Compile Include="Infrastructures\Enums\CalcTerms.cs" />
|
||||
<Compile Include="Infrastructures\Enums\CodeTypes.cs" />
|
||||
<Compile Include="Infrastructures\Enums\LimitStates.cs" />
|
||||
<Compile Include="Infrastructures\Enums\UnitTypes.cs" />
|
||||
<Compile Include="Infrastructures\Exceptions\StructureHelperException.cs" />
|
||||
<Compile Include="Infrastructures\Interfaces\IHasParent.cs" />
|
||||
<Compile Include="Infrastructures\Interfaces\ISaveable.cs" />
|
||||
@@ -68,6 +69,9 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\ColorServices\ColorProcessor.cs" />
|
||||
<Compile Include="Services\ShapeServices\ShapeService.cs" />
|
||||
<Compile Include="Services\Units\IUnit.cs" />
|
||||
<Compile Include="Services\Units\Unit.cs" />
|
||||
<Compile Include="Services\Units\UnitsFactory.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user