Shapes Mapping has been added to DataContext's primitives
This commit is contained in:
@@ -9,7 +9,7 @@ using StructureHelperLogics.NdmCalculations.Materials;
|
|||||||
|
|
||||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||||
{
|
{
|
||||||
public class Ellipse : PrimitiveBase
|
public class Ellipse : PrimitiveBase<Point>
|
||||||
{
|
{
|
||||||
private double square;
|
private double square;
|
||||||
public double Square
|
public double Square
|
||||||
@@ -44,5 +44,8 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
|
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
|
||||||
return ndmPrimitive;
|
return ndmPrimitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Point MapToShape()
|
||||||
|
=> new Point {Area = Square};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using StructureHelperLogics.NdmCalculations.Materials;
|
|||||||
|
|
||||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||||
{
|
{
|
||||||
public abstract class PrimitiveBase : ViewModelBase
|
public abstract class PrimitiveBase<T> : ViewModelBase where T : StructureHelperLogics.Data.Shapes.IShape
|
||||||
{
|
{
|
||||||
#region Поля
|
#region Поля
|
||||||
|
|
||||||
@@ -266,5 +266,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
else { throw new Exception("MaterialType is unknown"); }
|
else { throw new Exception("MaterialType is unknown"); }
|
||||||
return materialTypes;
|
return materialTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract T MapToShape();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,11 @@ using StructureHelper.Windows.MainWindow;
|
|||||||
using StructureHelperLogics.Data.Shapes;
|
using StructureHelperLogics.Data.Shapes;
|
||||||
using StructureHelperLogics.NdmCalculations.Entities;
|
using StructureHelperLogics.NdmCalculations.Entities;
|
||||||
using StructureHelperLogics.NdmCalculations.Materials;
|
using StructureHelperLogics.NdmCalculations.Materials;
|
||||||
|
using RectangleShape = StructureHelperLogics.Data.Shapes.Rectangle;
|
||||||
|
|
||||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||||
{
|
{
|
||||||
public class Rectangle : PrimitiveBase
|
public class Rectangle : PrimitiveBase<RectangleShape>
|
||||||
{
|
{
|
||||||
public Rectangle(double primitiveWidth, double primitiveHeight, double rectX, double rectY, MainViewModel mainViewModel) : base(PrimitiveType.Rectangle, rectX, rectY, mainViewModel)
|
public Rectangle(double primitiveWidth, double primitiveHeight, double rectX, double rectY, MainViewModel mainViewModel) : base(PrimitiveType.Rectangle, rectX, rectY, mainViewModel)
|
||||||
{
|
{
|
||||||
@@ -33,5 +34,8 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
|
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
|
||||||
return ndmPrimitive;
|
return ndmPrimitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override RectangleShape MapToShape()
|
||||||
|
=> new RectangleShape {Height = PrimitiveHeight, Width = PrimitiveWidth};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MaterialResistanceCalc
|
|
||||||
{
|
|
||||||
public class ConcreteDefinition : MaterialDefinition
|
|
||||||
{
|
|
||||||
public ConcreteDefinition(string materialClass, double youngModulus, double compressiveStrengthCoef, double tensileStrengthCoef, double materialCoefInCompress, double materialCoefInTension)
|
|
||||||
: base(materialClass, youngModulus, compressiveStrengthCoef, tensileStrengthCoef, materialCoefInCompress, materialCoefInTension)
|
|
||||||
{
|
|
||||||
CompressiveStrength = compressiveStrengthCoef * Math.Pow(10, 6);
|
|
||||||
TensileStrength = tensileStrengthCoef * Math.Sqrt(CompressiveStrength);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MaterialResistanceCalc
|
|
||||||
{
|
|
||||||
public class MaterialDefinition
|
|
||||||
{
|
|
||||||
public string MaterialClass { get; set; }
|
|
||||||
public double YoungModulus { get; set; }
|
|
||||||
public double CompressiveStrength { get; set; }
|
|
||||||
public double TensileStrength { get; set; }
|
|
||||||
public double MaterialCoefInCompress { get; set; }
|
|
||||||
public double MaterialCoefInTension { get; set; }
|
|
||||||
|
|
||||||
public MaterialDefinition(string materialClass, double youngModulus, double compressiveStrengthCoef, double tensileStrengthCoef, double materialCoefInCompress, double materialCoefInTension)
|
|
||||||
{
|
|
||||||
MaterialClass = materialClass;
|
|
||||||
YoungModulus = youngModulus;
|
|
||||||
CompressiveStrength = compressiveStrengthCoef;
|
|
||||||
TensileStrength = tensileStrengthCoef;
|
|
||||||
MaterialCoefInCompress = materialCoefInCompress;
|
|
||||||
MaterialCoefInTension = materialCoefInTension;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MaterialResistanceCalc
|
|
||||||
{
|
|
||||||
public class RebarDefinition : MaterialDefinition
|
|
||||||
{
|
|
||||||
public RebarDefinition(string materialClass, double youngModulus, double compressiveStrengthCoef, double tensileStrengthCoef, double materialCoefInCompress, double materialCoefInTension) : base(materialClass, youngModulus, compressiveStrengthCoef, tensileStrengthCoef, materialCoefInCompress, materialCoefInTension)
|
|
||||||
{
|
|
||||||
YoungModulus = youngModulus * Math.Pow(10, 11);
|
|
||||||
CompressiveStrength = compressiveStrengthCoef * Math.Pow(10, 6);
|
|
||||||
TensileStrength = tensileStrengthCoef * Math.Pow(10, 6);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user