UnitSystem inplementation started, Calculation started

This commit is contained in:
NickAppLab
2022-08-26 01:49:22 +05:00
parent e73702d133
commit 51748407e8
29 changed files with 252 additions and 290 deletions

View File

@@ -1,5 +1,6 @@
using System;
using StructureHelper.Infrastructure.Enums;
using StructureHelper.UnitSystem.Systems;
using StructureHelper.Windows.MainWindow;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Materials;
@@ -9,36 +10,21 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
{
public class Point : PrimitiveBase
{
private double square;
public double Square
public Point(double d, double x, double y, MainViewModel mainViewModel) : base(PrimitiveType.Point, x, y, mainViewModel)
{
get => square;
set
{
square = value;
PrimitiveWidth = Math.Round(Math.Sqrt(4 * value / Math.PI), 2);
OnPropertyChanged(nameof(PrimitiveWidth));
OnPropertyChanged();
}
}
public Point(double square, double x, double y, MainViewModel mainViewModel) : base(PrimitiveType.Point, x, y, mainViewModel)
{
Square = square;
PrimitiveWidth = d;
ShowedX = 0;
ShowedY = 0;
}
public override INdmPrimitive GetNdmPrimitive()
public override INdmPrimitive GetNdmPrimitive(IUnitSystem unitSystem)
{
double strength = 0;
double centerX = 0;
double centerY = 0;
double area = 0;
string materialName = "s400";
ICenter center = new Center { X = centerX, Y = centerY };
var width = unitSystem.ConvertLength(PrimitiveWidth);
double area = Math.Round(width * width * Math.PI / 4, 2);
string materialName = MaterialName;
ICenter center = new Center { X = unitSystem.ConvertLength(ShowedX), Y = unitSystem.ConvertLength(ShowedY) };
IShape shape = new StructureHelperCommon.Models.Shapes.Point { Area = area };
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = Material.DesingTensileStrength }; ;
INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
return ndmPrimitive;
}