Рефакторинг, добавление моделей примитивов
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
public enum PrimitiveType
|
public enum PrimitiveType
|
||||||
{
|
{
|
||||||
Ellipse,
|
Point,
|
||||||
Rectangle
|
Rectangle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Media;
|
|
||||||
using StructureHelper.Infrastructure.Enums;
|
using StructureHelper.Infrastructure.Enums;
|
||||||
using StructureHelper.Models.Materials;
|
|
||||||
using StructureHelper.Windows.MainWindow;
|
using StructureHelper.Windows.MainWindow;
|
||||||
using StructureHelperLogics.Data.Shapes;
|
using StructureHelperLogics.Data.Shapes;
|
||||||
using StructureHelperLogics.NdmCalculations.Entities;
|
using StructureHelperLogics.NdmCalculations.Entities;
|
||||||
@@ -9,7 +7,7 @@ using StructureHelperLogics.NdmCalculations.Materials;
|
|||||||
|
|
||||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||||
{
|
{
|
||||||
public class Ellipse : PrimitiveBase<Point>
|
public class Point : PrimitiveBase
|
||||||
{
|
{
|
||||||
private double square;
|
private double square;
|
||||||
public double Square
|
public double Square
|
||||||
@@ -24,7 +22,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ellipse(double square, double ellipseX, double ellipseY, MainViewModel mainViewModel) : base(PrimitiveType.Ellipse, ellipseX, ellipseY, mainViewModel)
|
public Point(double square, double x, double y, MainViewModel mainViewModel) : base(PrimitiveType.Point, x, y, mainViewModel)
|
||||||
{
|
{
|
||||||
Square = square;
|
Square = square;
|
||||||
ShowedX = 0;
|
ShowedX = 0;
|
||||||
@@ -39,13 +37,10 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
double area = 0;
|
double area = 0;
|
||||||
string materialName = "s400";
|
string materialName = "s400";
|
||||||
ICenter center = new Center() { X = centerX, Y = centerY };
|
ICenter center = new Center() { X = centerX, Y = centerY };
|
||||||
IShape shape = new Point() { Area = area };
|
IShape shape = new StructureHelperLogics.Data.Shapes.Point() { Area = area };
|
||||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
|
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
|
||||||
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<T> : ViewModelBase where T : StructureHelperLogics.Data.Shapes.IShape
|
public abstract class PrimitiveBase: ViewModelBase
|
||||||
{
|
{
|
||||||
#region Поля
|
#region Поля
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
public ICommand PrimitiveLeftButtonDown { get; }
|
public ICommand PrimitiveLeftButtonDown { get; }
|
||||||
public ICommand PrimitiveLeftButtonUp { get; }
|
public ICommand PrimitiveLeftButtonUp { get; }
|
||||||
public ICommand RectanglePreviewMouseMove { get; }
|
public ICommand RectanglePreviewMouseMove { get; }
|
||||||
public ICommand EllipsePreviewMouseMove { get; }
|
public ICommand PointPreviewMouseMove { get; }
|
||||||
public ICommand PrimitiveDoubleClick { get; }
|
public ICommand PrimitiveDoubleClick { get; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -208,30 +208,30 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
//ElementLock = rect.ElementLock;
|
//ElementLock = rect.ElementLock;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
EllipsePreviewMouseMove = new RelayCommand(o =>
|
PointPreviewMouseMove = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
if (!(o is Ellipse ellipse)) return;
|
if (!(o is Point point)) return;
|
||||||
if (ellipse.Captured && !ellipse.ElementLock)
|
if (point.Captured && !point.ElementLock)
|
||||||
{
|
{
|
||||||
var ellipseDelta = ellipse.PrimitiveWidth / 2;
|
var pointDelta = point.PrimitiveWidth / 2;
|
||||||
|
|
||||||
if (ellipse.ShowedX % 10 <= ellipseDelta || ellipse.ShowedX % 10 >= 10 - ellipseDelta)
|
if (point.ShowedX % 10 <= pointDelta || point.ShowedX % 10 >= 10 - pointDelta)
|
||||||
ellipse.ShowedX = Math.Round((mainViewModel.PanelX - Yx1) / 10) * 10;
|
point.ShowedX = Math.Round((mainViewModel.PanelX - Yx1) / 10) * 10;
|
||||||
else
|
else
|
||||||
ellipse.ShowedX = mainViewModel.PanelX - ellipseDelta - Yx1;
|
point.ShowedX = mainViewModel.PanelX - pointDelta - Yx1;
|
||||||
|
|
||||||
if (ellipse.ShowedY % 10 <= ellipseDelta || ellipse.ShowedY % 10 >= 10 - ellipseDelta)
|
if (point.ShowedY % 10 <= pointDelta || point.ShowedY % 10 >= 10 - pointDelta)
|
||||||
ellipse.ShowedY = -(Math.Round((mainViewModel.PanelY - Xy1) / 10) * 10);
|
point.ShowedY = -(Math.Round((mainViewModel.PanelY - Xy1) / 10) * 10);
|
||||||
else
|
else
|
||||||
ellipse.ShowedY = -(mainViewModel.PanelY - ellipseDelta - Xy1);
|
point.ShowedY = -(mainViewModel.PanelY - pointDelta - Xy1);
|
||||||
}
|
}
|
||||||
if (ParameterCaptured)
|
if (ParameterCaptured)
|
||||||
{
|
{
|
||||||
//EllipseParameterX = ellipse.ShowedX;
|
//EllipseParameterX = point.ShowedX;
|
||||||
//EllipseParameterY = ellipse.ShowedY;
|
//EllipseParameterY = point.ShowedY;
|
||||||
//EllipseParameterSquare = ellipse.Square;
|
//EllipseParameterSquare = point.Square;
|
||||||
//ParameterOpacity = ellipse.ShowedOpacity;
|
//ParameterOpacity = point.ShowedOpacity;
|
||||||
//ElementLock = ellipse.ElementLock;
|
//ElementLock = point.ElementLock;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
PrimitiveDoubleClick = new RelayCommand(o =>
|
PrimitiveDoubleClick = new RelayCommand(o =>
|
||||||
@@ -249,12 +249,12 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
private void UpdateCoordinatesX(double showedX)
|
private void UpdateCoordinatesX(double showedX)
|
||||||
{
|
{
|
||||||
if (Type == PrimitiveType.Rectangle) X = showedX + Yx1;
|
if (Type == PrimitiveType.Rectangle) X = showedX + Yx1;
|
||||||
if (Type == PrimitiveType.Ellipse) X = showedX + Yx1 - PrimitiveWidth / 2;
|
if (Type == PrimitiveType.Point) X = showedX + Yx1 - PrimitiveWidth / 2;
|
||||||
}
|
}
|
||||||
private void UpdateCoordinatesY(double showedY)
|
private void UpdateCoordinatesY(double showedY)
|
||||||
{
|
{
|
||||||
if (Type == PrimitiveType.Rectangle) Y = -showedY + Xy1 - PrimitiveHeight;
|
if (Type == PrimitiveType.Rectangle) Y = -showedY + Xy1 - PrimitiveHeight;
|
||||||
if (Type == PrimitiveType.Ellipse) Y = -showedY + Xy1 - PrimitiveWidth / 2;
|
if (Type == PrimitiveType.Point) Y = -showedY + Xy1 - PrimitiveWidth / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract INdmPrimitive GetNdmPrimitive();
|
public abstract INdmPrimitive GetNdmPrimitive();
|
||||||
@@ -266,7 +266,5 @@ 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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
using System;
|
using StructureHelper.Infrastructure.Enums;
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using StructureHelper.Infrastructure.Enums;
|
|
||||||
using StructureHelper.Windows.MainWindow;
|
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<RectangleShape>
|
public class Rectangle : PrimitiveBase
|
||||||
{
|
{
|
||||||
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)
|
||||||
{
|
{
|
||||||
@@ -34,8 +30,5 @@ 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,5 +1,4 @@
|
|||||||
using System.Windows;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Controls;
|
|
||||||
|
|
||||||
namespace StructureHelper.Infrastructure.UI.DataTemplates
|
namespace StructureHelper.Infrastructure.UI.DataTemplates
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Windows;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Controls;
|
|
||||||
|
|
||||||
namespace StructureHelper.Infrastructure.UI.DataTemplates
|
namespace StructureHelper.Infrastructure.UI.DataTemplates
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</local:PrimitivePopup>
|
</local:PrimitivePopup>
|
||||||
<!--Ellipse-->
|
<!--Ellipse-->
|
||||||
<local:PrimitivePopup IsOpen="{Binding ParamsPanelVisibilty}" d:DataContext="{d:DesignInstance dataContexts:Ellipse}" Type="Ellipse">
|
<local:PrimitivePopup IsOpen="{Binding ParamsPanelVisibilty}" d:DataContext="{d:DesignInstance dataContexts:Point}" Type="Ellipse">
|
||||||
<i:Interaction.Triggers>
|
<i:Interaction.Triggers>
|
||||||
<i:EventTrigger EventName="MouseLeave">
|
<i:EventTrigger EventName="MouseLeave">
|
||||||
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetPopupCanBeClosedTrue}" CommandParameter="{Binding}"/>
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetPopupCanBeClosedTrue}" CommandParameter="{Binding}"/>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System.Windows;
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
using System.Windows;
|
||||||
|
|
||||||
namespace StructureHelper.MaterialCatalogWindow
|
namespace StructureHelper.MaterialCatalogWindow
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -89,7 +89,7 @@
|
|||||||
<Compile Include="Models\Materials\ConcreteDefinition.cs" />
|
<Compile Include="Models\Materials\ConcreteDefinition.cs" />
|
||||||
<Compile Include="Infrastructure\NamedList.cs" />
|
<Compile Include="Infrastructure\NamedList.cs" />
|
||||||
<Compile Include="Models\Materials\MaterialDefinitionBase.cs" />
|
<Compile Include="Models\Materials\MaterialDefinitionBase.cs" />
|
||||||
<Compile Include="Infrastructure\UI\DataContexts\Ellipse.cs" />
|
<Compile Include="Infrastructure\UI\DataContexts\Point.cs" />
|
||||||
<Compile Include="Infrastructure\UI\DataContexts\PrimitiveBase.cs" />
|
<Compile Include="Infrastructure\UI\DataContexts\PrimitiveBase.cs" />
|
||||||
<Compile Include="Properties\Annotations.cs" />
|
<Compile Include="Properties\Annotations.cs" />
|
||||||
<Compile Include="Models\Materials\RebarDefinition.cs" />
|
<Compile Include="Models\Materials\RebarDefinition.cs" />
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.Data.Shapes
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Data.Shapes
|
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public class Center : ICenter
|
public class Center : ICenter
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.Data.Shapes
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Data.Shapes
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface for point of center of some shape
|
/// Interface for point of center of some shape
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.Data.Shapes
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Data.Shapes
|
|
||||||
{
|
{
|
||||||
public interface ICenterShape
|
public interface ICenterShape
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.Data.Shapes
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Data.Shapes
|
|
||||||
{
|
{
|
||||||
public interface ICircle : IShape
|
public interface ICircle : IShape
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.Data.Shapes
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Data.Shapes
|
|
||||||
{
|
{
|
||||||
public interface IPoint : IShape
|
public interface IPoint : IShape
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.Data.Shapes
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Data.Shapes
|
|
||||||
{
|
{
|
||||||
public interface IRectangle : IShape
|
public interface IRectangle : IShape
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.Data.Shapes
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Data.Shapes
|
|
||||||
{
|
{
|
||||||
public interface IShape
|
public interface IShape
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.Data.Shapes
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Data.Shapes
|
|
||||||
{
|
{
|
||||||
public class Point : IPoint
|
public class Point : IPoint
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.Data.Shapes
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Data.Shapes
|
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public class Rectangle : IRectangle
|
public class Rectangle : IRectangle
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.Infrastructures.CommonEnums
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Infrastructures.CommonEnums
|
|
||||||
{
|
{
|
||||||
public enum CalcTerms
|
public enum CalcTerms
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.Infrastructures.CommonEnums
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Infrastructures.CommonEnums
|
|
||||||
{
|
{
|
||||||
public enum LimitStates
|
public enum LimitStates
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
using StructureHelperLogics.Data.Shapes;
|
using StructureHelperLogics.Data.Shapes;
|
||||||
using StructureHelperLogics.NdmCalculations.Entities;
|
using StructureHelperLogics.NdmCalculations.Entities;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.NdmPrimitives
|
namespace StructureHelperLogics.Models.NdmPrimitives
|
||||||
{
|
{
|
||||||
public interface IPrimitive
|
public interface IPrimitive : ICenterShape
|
||||||
{
|
{
|
||||||
ICenter Center { get;}
|
|
||||||
IShape Shape { get;}
|
|
||||||
INdmPrimitive GetNdmPrimitive();
|
INdmPrimitive GetNdmPrimitive();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +1,19 @@
|
|||||||
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 System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.NdmPrimitives
|
namespace StructureHelperLogics.Models.NdmPrimitives
|
||||||
{
|
{
|
||||||
public class PointPrimitive : IPrimitive
|
public class PointPrimitive : PrimitiveBase<IPoint>, IPoint
|
||||||
{
|
{
|
||||||
ICenter _center;
|
|
||||||
IShape _shape;
|
|
||||||
|
|
||||||
public ICenter Center => _center;
|
|
||||||
public IShape Shape => _shape;
|
|
||||||
public double Area
|
public double Area
|
||||||
{
|
{
|
||||||
get
|
get => _shape.Area;
|
||||||
{
|
set => _shape.Area = value;
|
||||||
IPoint point = _shape as IPoint;
|
|
||||||
return point.Area;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
IPoint point = _shape as IPoint;
|
|
||||||
point.Area = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PointPrimitive(ICenter center, IShape shape)
|
public PointPrimitive(ICenter center, IPoint shape) : base(center, shape) { }
|
||||||
{
|
public override INdmPrimitive GetNdmPrimitive()
|
||||||
_center = center;
|
|
||||||
_shape = shape;
|
|
||||||
}
|
|
||||||
public INdmPrimitive GetNdmPrimitive()
|
|
||||||
{
|
{
|
||||||
double strength = 400;
|
double strength = 400;
|
||||||
string materialName = "s400";
|
string materialName = "s400";
|
||||||
|
|||||||
22
StructureHelperLogics/Models/NdmPrimitives/PrimitiveBase.cs
Normal file
22
StructureHelperLogics/Models/NdmPrimitives/PrimitiveBase.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using StructureHelperLogics.Data.Shapes;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Entities;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.NdmPrimitives
|
||||||
|
{
|
||||||
|
public abstract class PrimitiveBase<T> : IPrimitive where T : IShape
|
||||||
|
{
|
||||||
|
protected ICenter _center;
|
||||||
|
protected T _shape;
|
||||||
|
|
||||||
|
public ICenter Center => _center;
|
||||||
|
public IShape Shape => _shape;
|
||||||
|
|
||||||
|
public PrimitiveBase(ICenter center, T shape)
|
||||||
|
{
|
||||||
|
_center = center;
|
||||||
|
_shape = shape;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract INdmPrimitive GetNdmPrimitive();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using StructureHelperLogics.Data.Shapes;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Entities;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Materials;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.NdmPrimitives
|
||||||
|
{
|
||||||
|
public class RectanglePrimitive : PrimitiveBase<IRectangle>, IRectangle
|
||||||
|
{
|
||||||
|
public RectanglePrimitive(ICenter center, IRectangle shape) : base(center, shape) { }
|
||||||
|
|
||||||
|
public double Width => _shape.Width;
|
||||||
|
|
||||||
|
public double Height => _shape.Height;
|
||||||
|
|
||||||
|
public double Angle => _shape.Angle;
|
||||||
|
|
||||||
|
public override INdmPrimitive GetNdmPrimitive()
|
||||||
|
{
|
||||||
|
double strength = 400;
|
||||||
|
string materialName = "s400";
|
||||||
|
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
|
||||||
|
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = _center, Shape = _shape, PrimitiveMaterial = primitiveMaterial };
|
||||||
|
return ndmPrimitive;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MaterialTypes GetMaterialTypes()
|
||||||
|
{
|
||||||
|
return MaterialTypes.Reinforcement;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
using StructureHelperLogics.Data.Shapes;
|
using StructureHelperLogics.Data.Shapes;
|
||||||
using StructureHelperLogics.NdmCalculations.Materials;
|
using StructureHelperLogics.NdmCalculations.Materials;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Entities
|
namespace StructureHelperLogics.NdmCalculations.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
using StructureHelperLogics.Data.Shapes;
|
using StructureHelperLogics.Data.Shapes;
|
||||||
using StructureHelperLogics.NdmCalculations.Materials;
|
using StructureHelperLogics.NdmCalculations.Materials;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Entities
|
namespace StructureHelperLogics.NdmCalculations.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.NdmCalculations.Materials
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Materials
|
|
||||||
{
|
{
|
||||||
public interface IPrimitiveMaterial
|
public interface IPrimitiveMaterial
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.NdmCalculations.Materials
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Materials
|
|
||||||
{
|
{
|
||||||
public enum MaterialTypes
|
public enum MaterialTypes
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Materials
|
namespace StructureHelperLogics.NdmCalculations.Materials
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|
||||||
{
|
{
|
||||||
interface IPointTriangulationLogic : ITriangulationLogic
|
interface IPointTriangulationLogic : ITriangulationLogic
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
using StructureHelperLogics.Data.Shapes;
|
using StructureHelperLogics.Data.Shapes;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|
||||||
{
|
{
|
||||||
public interface IRectangleTriangulationLogic : ITriangulationLogic
|
public interface IRectangleTriangulationLogic : ITriangulationLogic
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
using StructureHelperLogics.Data.Shapes;
|
using StructureHelperLogics.Data.Shapes;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Data.Materials;
|
using LoaderCalculator.Data.Materials;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|
||||||
{
|
{
|
||||||
public interface ITriangulationLogicOptions
|
public interface ITriangulationLogicOptions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
using StructureHelperLogics.Infrastructures.CommonEnums;
|
using StructureHelperLogics.Infrastructures.CommonEnums;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using LoaderCalculator.Data.Ndms;
|
|||||||
using StructureHelperLogics.Data.Shapes;
|
using StructureHelperLogics.Data.Shapes;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
using StructureHelperLogics.Data.Shapes;
|
using StructureHelperLogics.Data.Shapes;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
|
||||||
using LoaderCalculator.Data.Ndms.Transformations;
|
using LoaderCalculator.Data.Ndms.Transformations;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using StructureHelperLogics.Data.Shapes;
|
using StructureHelperLogics.Data.Shapes;
|
||||||
using StructureHelperLogics.NdmCalculations.Entities;
|
using StructureHelperLogics.NdmCalculations.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
|
||||||
using LoaderCalculator.Data.Materials;
|
using LoaderCalculator.Data.Materials;
|
||||||
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
using StructureHelperLogics.Infrastructures.CommonEnums;
|
using StructureHelperLogics.Infrastructures.CommonEnums;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System.Windows;
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
using System.Windows;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.ColorPickerWindow
|
namespace StructureHelper.Windows.ColorPickerWindow
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<DataTemplate DataType="{x:Type dataContexts:Rectangle}">
|
<DataTemplate DataType="{x:Type dataContexts:Rectangle}">
|
||||||
<dataTemplates:RectangleTemplate/>
|
<dataTemplates:RectangleTemplate/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate DataType="{x:Type dataContexts:Ellipse}">
|
<DataTemplate DataType="{x:Type dataContexts:Point}">
|
||||||
<dataTemplates:EllipseTemplate/>
|
<dataTemplates:EllipseTemplate/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
|
|||||||
@@ -75,23 +75,23 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private double ellipseParameterX, ellipseParameterY, ellipseParameterSquare;
|
private double pointParameterX, pointParameterY, pointParameterSquare;
|
||||||
public double EllipseParameterX
|
public double EllipseParameterX
|
||||||
{
|
{
|
||||||
get => ellipseParameterX;
|
get => pointParameterX;
|
||||||
set => OnPropertyChanged(value, ref ellipseParameterX);
|
set => OnPropertyChanged(value, ref pointParameterX);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double EllipseParameterY
|
public double EllipseParameterY
|
||||||
{
|
{
|
||||||
get => ellipseParameterY;
|
get => pointParameterY;
|
||||||
set => OnPropertyChanged(value, ref ellipseParameterY);
|
set => OnPropertyChanged(value, ref pointParameterY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double EllipseParameterSquare
|
public double EllipseParameterSquare
|
||||||
{
|
{
|
||||||
get => ellipseParameterSquare;
|
get => pointParameterSquare;
|
||||||
set => OnPropertyChanged(value, ref ellipseParameterSquare);
|
set => OnPropertyChanged(value, ref pointParameterSquare);
|
||||||
}
|
}
|
||||||
private bool elementLock;
|
private bool elementLock;
|
||||||
public bool ElementLock
|
public bool ElementLock
|
||||||
@@ -237,10 +237,10 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
rectangle.PrimitiveWidth = RectParameterWidth;
|
rectangle.PrimitiveWidth = RectParameterWidth;
|
||||||
rectangle.PrimitiveHeight = RectParameterHeight;
|
rectangle.PrimitiveHeight = RectParameterHeight;
|
||||||
break;
|
break;
|
||||||
case Ellipse ellipse:
|
case Point point:
|
||||||
ellipse.Square = EllipseParameterSquare;
|
point.Square = EllipseParameterSquare;
|
||||||
ellipse.ShowedX = EllipseParameterX;
|
point.ShowedX = EllipseParameterX;
|
||||||
ellipse.ShowedY = EllipseParameterY;
|
point.ShowedY = EllipseParameterY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -312,8 +312,8 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
});
|
});
|
||||||
AddEllipse = new RelayCommand(o =>
|
AddEllipse = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
var ellipse = new Ellipse(2000, YX1, XY1, this);
|
var point = new Point(2000, YX1, XY1, this);
|
||||||
Primitives.Add(ellipse);
|
Primitives.Add(point);
|
||||||
PrimitivesCount = Primitives.Count;
|
PrimitivesCount = Primitives.Count;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user