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
|
||||
{
|
||||
public class Ellipse : PrimitiveBase
|
||||
public class Ellipse : PrimitiveBase<Point>
|
||||
{
|
||||
private double square;
|
||||
public double Square
|
||||
@@ -44,5 +44,8 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
|
||||
return ndmPrimitive;
|
||||
}
|
||||
|
||||
public override Point MapToShape()
|
||||
=> new Point {Area = Square};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ using StructureHelperLogics.NdmCalculations.Materials;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
public abstract class PrimitiveBase : ViewModelBase
|
||||
public abstract class PrimitiveBase<T> : ViewModelBase where T : StructureHelperLogics.Data.Shapes.IShape
|
||||
{
|
||||
#region Поля
|
||||
|
||||
@@ -266,5 +266,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
else { throw new Exception("MaterialType is unknown"); }
|
||||
return materialTypes;
|
||||
}
|
||||
|
||||
public abstract T MapToShape();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,11 @@ using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelperLogics.Data.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Entities;
|
||||
using StructureHelperLogics.NdmCalculations.Materials;
|
||||
using RectangleShape = StructureHelperLogics.Data.Shapes.Rectangle;
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -33,5 +34,8 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
|
||||
return ndmPrimitive;
|
||||
}
|
||||
|
||||
public override RectangleShape MapToShape()
|
||||
=> new RectangleShape {Height = PrimitiveHeight, Width = PrimitiveWidth};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user