View primitives was fixed
This commit is contained in:
1
App.xaml
1
App.xaml
@@ -8,6 +8,7 @@
|
|||||||
<ResourceDictionary Source="Infrastructure/UI/Styles.xaml"/>
|
<ResourceDictionary Source="Infrastructure/UI/Styles.xaml"/>
|
||||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ShapeEditTemplates.xaml"/>
|
<ResourceDictionary Source="Infrastructure/UI/Resources/ShapeEditTemplates.xaml"/>
|
||||||
<ResourceDictionary Source="Infrastructure/UI/Resources/Converters.xaml"/>
|
<ResourceDictionary Source="Infrastructure/UI/Resources/Converters.xaml"/>
|
||||||
|
<ResourceDictionary Source="Infrastructure/UI/Resources/PrimitiveToolTips.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
|||||||
14
Infrastructure/UI/DataContexts/IHasCenter.cs
Normal file
14
Infrastructure/UI/DataContexts/IHasCenter.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||||
|
{
|
||||||
|
internal interface IHasCenter
|
||||||
|
{
|
||||||
|
double PrimitiveLeft { get; }
|
||||||
|
double PrimitiveTop { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Infrastructure/UI/DataContexts/IHasDivision.cs
Normal file
14
Infrastructure/UI/DataContexts/IHasDivision.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||||
|
{
|
||||||
|
internal interface IHasDivision
|
||||||
|
{
|
||||||
|
int NdmMinDivision { get; set; }
|
||||||
|
double NdmMaxSize { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ using StructureHelper.UnitSystem.Systems;
|
|||||||
using StructureHelper.Windows.MainWindow;
|
using StructureHelper.Windows.MainWindow;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -12,16 +13,15 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||||
{
|
{
|
||||||
internal class LinePrimitive : PrimitiveBase
|
internal class LineViewPrimitive : PrimitiveBase
|
||||||
{
|
{
|
||||||
private ILineShape lineShape;
|
public LineViewPrimitive(ILinePrimitive primitive) : base(primitive)
|
||||||
public LinePrimitive(PrimitiveType type, double x, double y, MainViewModel ownerVM) : base(type, x, y, ownerVM)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override INdmPrimitive GetNdmPrimitive(IUnitSystem unitSystem)
|
//public LineViewPrimitive(double x, double y, MainViewModel ownerVM) : base(x, y, ownerVM)
|
||||||
{
|
//{
|
||||||
throw new NotImplementedException();
|
//}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
using System;
|
|
||||||
using StructureHelper.Infrastructure.Enums;
|
|
||||||
using StructureHelper.UnitSystem.Systems;
|
|
||||||
using StructureHelper.Windows.MainWindow;
|
|
||||||
using StructureHelperLogics.Models.Primitives;
|
|
||||||
using StructureHelperLogics.Models.Materials;
|
|
||||||
using StructureHelperCommon.Models.Shapes;
|
|
||||||
|
|
||||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
|
||||||
{
|
|
||||||
public class Point : PrimitiveBase
|
|
||||||
{
|
|
||||||
private double area;
|
|
||||||
public double Area
|
|
||||||
{ get => area;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
area = value;
|
|
||||||
OnPropertyChanged(nameof(Area));
|
|
||||||
OnPropertyChanged(nameof(Diameter));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public Point(double area, double x, double y, MainViewModel ownerVm) : base(PrimitiveType.Point, x, y, ownerVm)
|
|
||||||
{
|
|
||||||
Name = "New point";
|
|
||||||
Area = area;
|
|
||||||
PreviewMouseMove = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
if (!(o is Point point)) return;
|
|
||||||
if (point.Captured && !point.ElementLock)
|
|
||||||
{
|
|
||||||
var pointDelta = point.PrimitiveWidth / 2;
|
|
||||||
|
|
||||||
if (point.ShowedX % 10 <= pointDelta || point.ShowedX % 10 >= 10 - pointDelta)
|
|
||||||
point.ShowedX = Math.Round((ownerVm.PanelX - OwnerVm.YX1) / 10) * 10;
|
|
||||||
else
|
|
||||||
point.ShowedX = ownerVm.PanelX - pointDelta - OwnerVm.YX1;
|
|
||||||
|
|
||||||
if (point.ShowedY % 10 <= pointDelta || point.ShowedY % 10 >= 10 - pointDelta)
|
|
||||||
point.ShowedY = -(Math.Round((ownerVm.PanelY - OwnerVm.XY1) / 10) * 10);
|
|
||||||
else
|
|
||||||
point.ShowedY = -(ownerVm.PanelY - pointDelta - OwnerVm.XY1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
CenterX = x;
|
|
||||||
CenterY = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double Diameter { get => Math.Sqrt(area / Math.PI) * 2; }
|
|
||||||
|
|
||||||
public override INdmPrimitive GetNdmPrimitive(IUnitSystem unitSystem)
|
|
||||||
{
|
|
||||||
string materialName = MaterialName;
|
|
||||||
ICenter center = new Center { X = CenterX, Y = CenterY };
|
|
||||||
IShape shape = new StructureHelperCommon.Models.Shapes.PointShape { Area = this.Area };
|
|
||||||
INdmPrimitive ndmPrimitive = new NdmPrimitive(HeadMaterial)
|
|
||||||
{ Center = center, Shape = shape,
|
|
||||||
PrestrainKx = PrestrainKx,
|
|
||||||
PrestrainKy = PrestrainKy,
|
|
||||||
PrestrainEpsZ = PrestrainEpsZ
|
|
||||||
};
|
|
||||||
return ndmPrimitive;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
49
Infrastructure/UI/DataContexts/PointViewPrimitive.cs
Normal file
49
Infrastructure/UI/DataContexts/PointViewPrimitive.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using System;
|
||||||
|
using StructureHelper.Infrastructure.Enums;
|
||||||
|
using StructureHelper.UnitSystem.Systems;
|
||||||
|
using StructureHelper.Windows.MainWindow;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
|
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||||
|
{
|
||||||
|
public class PointViewPrimitive : PrimitiveBase, IHasCenter
|
||||||
|
{
|
||||||
|
const double lengthUnit = 1000d;
|
||||||
|
|
||||||
|
IPointPrimitive primitive;
|
||||||
|
|
||||||
|
public double Area
|
||||||
|
{ get => primitive.Area;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
primitive.Area = value;
|
||||||
|
OnPropertyChanged(nameof(Area));
|
||||||
|
OnPropertyChanged(nameof(Diameter));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double PrimitiveLeft
|
||||||
|
{
|
||||||
|
get => DeltaX - Diameter / 2d * lengthUnit;
|
||||||
|
}
|
||||||
|
public double PrimitiveTop
|
||||||
|
{
|
||||||
|
get => DeltaY - Diameter / 2d * lengthUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PointViewPrimitive(IPointPrimitive _primitive) : base(_primitive)
|
||||||
|
{
|
||||||
|
primitive = _primitive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double Diameter { get => Math.Sqrt(primitive.Area / Math.PI) * 2; }
|
||||||
|
|
||||||
|
public override INdmPrimitive GetNdmPrimitive()
|
||||||
|
{
|
||||||
|
return primitive;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@ using StructureHelperCommon.Infrastructures.Strings;
|
|||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
using StructureHelperCommon.Services.ColorServices;
|
using StructureHelperCommon.Services.ColorServices;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||||
{
|
{
|
||||||
@@ -23,96 +24,84 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
{
|
{
|
||||||
#region Поля
|
#region Поля
|
||||||
private IPrimitiveRepository primitiveRepository;
|
private IPrimitiveRepository primitiveRepository;
|
||||||
private readonly PrimitiveType type;
|
private INdmPrimitive primitive;
|
||||||
private string name;
|
|
||||||
private double centerX, centerY;
|
|
||||||
private int minElementDivision;
|
|
||||||
private double maxElementSize;
|
|
||||||
private bool captured, parameterCaptured, elementLock, paramsPanelVisibilty, popupCanBeClosed = true, borderCaptured;
|
private bool captured, parameterCaptured, elementLock, paramsPanelVisibilty, popupCanBeClosed = true, borderCaptured;
|
||||||
private Brush brush;
|
|
||||||
private bool setMaterialColor;
|
private bool setMaterialColor;
|
||||||
private Color color;
|
private Color color;
|
||||||
private IHeadMaterial headMaterial;
|
private double opacity = 1, showedOpacity = 0, x, y, xY1, yX1, primitiveWidth, primitiveHeight;
|
||||||
private MaterialDefinitionBase material;
|
|
||||||
private double prestrainKx, prestrainKy, prestrainEpsZ;
|
|
||||||
private double opacity = 1, showedOpacity = 0, x, y, xY1, yX1, primitiveWidth, primitiveHeight, showedX, showedY;
|
|
||||||
protected double delta = 0.5;
|
protected double delta = 0.5;
|
||||||
private double stressValue;
|
|
||||||
private double strainValue;
|
|
||||||
private int showedZIndex = 1, zIndex;
|
private int showedZIndex = 1, zIndex;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Свойства
|
#region Свойства
|
||||||
|
public INdmPrimitive NdmPrimitive
|
||||||
public PrimitiveType Type
|
|
||||||
{
|
{
|
||||||
get => type;
|
get => primitive;
|
||||||
set
|
|
||||||
{
|
|
||||||
OnPropertyChanged(value, type);
|
|
||||||
OnPropertyChanged(nameof(RectangleFieldVisibility));
|
|
||||||
OnPropertyChanged(nameof(PrimitiveDimension));
|
|
||||||
OnPropertyChanged(nameof(HeightRowHeight));
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public IPrimitiveRepository PrimitiveRepository => primitiveRepository;
|
public IPrimitiveRepository PrimitiveRepository => primitiveRepository;
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get => name;
|
get => primitive.Name;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
OnPropertyChanged(value, ref name);
|
primitive.Name = value;
|
||||||
|
OnPropertyChanged(nameof(Name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public double CenterX
|
public double CenterX
|
||||||
{
|
{
|
||||||
get => centerX;
|
get => primitive.CenterX;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this is Rectangle)
|
primitive.CenterX = value;
|
||||||
{
|
OnPropertyChanged(nameof(CenterX));
|
||||||
ShowedX = value - primitiveWidth / 2d;
|
|
||||||
}
|
|
||||||
else if (this is Point)
|
|
||||||
{
|
|
||||||
Point point = this as Point;
|
|
||||||
ShowedX = value - point.Diameter / 2;
|
|
||||||
}
|
|
||||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); }
|
|
||||||
OnPropertyChanged(value, ref centerX);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public double CenterY
|
public double CenterY
|
||||||
{
|
{
|
||||||
get => centerY;
|
get => primitive.CenterY;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this is Rectangle)
|
primitive.CenterY = value;
|
||||||
|
OnPropertyChanged(nameof(CenterY));
|
||||||
|
OnPropertyChanged(nameof(InvertedCenterY));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double InvertedCenterY => - CenterY;
|
||||||
|
public double PrestrainKx
|
||||||
|
{ get => primitive.PrestrainKx;
|
||||||
|
set
|
||||||
{
|
{
|
||||||
ShowedY = value - primitiveHeight / 2d;
|
primitive.PrestrainKx = value;
|
||||||
|
OnPropertyChanged(nameof(PrestrainKx));
|
||||||
}
|
}
|
||||||
else if (this is Point)
|
}
|
||||||
|
public double PrestrainKy
|
||||||
|
{ get => primitive.PrestrainKy;
|
||||||
|
set
|
||||||
{
|
{
|
||||||
Point point = this as Point;
|
primitive.PrestrainKy = value;
|
||||||
ShowedY = value - point.Diameter / 2;
|
OnPropertyChanged(nameof(PrestrainKy));
|
||||||
}
|
}
|
||||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); }
|
}
|
||||||
OnPropertyChanged(value, ref centerY);
|
public double PrestrainEpsZ
|
||||||
|
{ get => primitive.PrestrainEpsZ;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
primitive.PrestrainEpsZ = value;
|
||||||
|
OnPropertyChanged(nameof(PrestrainEpsZ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public double PrestrainKx { get; set; }
|
|
||||||
public double PrestrainKy { get; set; }
|
|
||||||
public double PrestrainEpsZ { get; set; }
|
|
||||||
|
|
||||||
public IHeadMaterial HeadMaterial
|
public IHeadMaterial HeadMaterial
|
||||||
{
|
{
|
||||||
get => headMaterial;
|
get => primitive.HeadMaterial;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
OnPropertyChanged(value, ref headMaterial);
|
primitive.HeadMaterial = value;
|
||||||
|
OnPropertyChanged(nameof(HeadMaterial));
|
||||||
OnPropertyChanged(nameof(Color));
|
OnPropertyChanged(nameof(Color));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,27 +109,22 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
public bool SetMaterialColor
|
public bool SetMaterialColor
|
||||||
{
|
{
|
||||||
get => setMaterialColor;
|
get => setMaterialColor;
|
||||||
set { OnPropertyChanged(value, ref setMaterialColor);}
|
set
|
||||||
|
{
|
||||||
|
OnPropertyChanged(value, ref setMaterialColor);
|
||||||
|
OnPropertyChanged(nameof(Color));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public Color Color
|
public Color Color
|
||||||
{
|
{
|
||||||
get => ((setMaterialColor == true) & (headMaterial !=null))? headMaterial.Color :color;
|
get => ((setMaterialColor == true) & (primitive.HeadMaterial !=null))? primitive.HeadMaterial.Color : color;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetMaterialColor = false;
|
SetMaterialColor = false;
|
||||||
OnPropertyChanged(value, ref color);
|
OnPropertyChanged(value, ref color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int MinElementDivision
|
|
||||||
{
|
|
||||||
get => minElementDivision;
|
|
||||||
set { OnPropertyChanged(value, ref minElementDivision); }
|
|
||||||
}
|
|
||||||
public double MaxElementSize
|
|
||||||
{
|
|
||||||
get => maxElementSize;
|
|
||||||
set { OnPropertyChanged(value, ref maxElementSize); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Captured
|
public bool Captured
|
||||||
{
|
{
|
||||||
@@ -162,25 +146,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
get => new SolidColorBrush(Color);
|
get => new SolidColorBrush(Color);
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
public MaterialDefinitionBase Material
|
|
||||||
{
|
|
||||||
get => material;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value != null)
|
|
||||||
{
|
|
||||||
MaterialName = value.MaterialClass;
|
|
||||||
OnPropertyChanged(value, ref material);
|
|
||||||
OnPropertyChanged(nameof(MaterialName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private string materialName = string.Empty;
|
|
||||||
public string MaterialName
|
|
||||||
{
|
|
||||||
get => materialName;
|
|
||||||
set => OnPropertyChanged(value, ref materialName);
|
|
||||||
}
|
|
||||||
public bool ParamsPanelVisibilty
|
public bool ParamsPanelVisibilty
|
||||||
{
|
{
|
||||||
get => paramsPanelVisibilty;
|
get => paramsPanelVisibilty;
|
||||||
@@ -221,16 +187,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
get => zIndex;
|
get => zIndex;
|
||||||
set => OnPropertyChanged(value, ref zIndex);
|
set => OnPropertyChanged(value, ref zIndex);
|
||||||
}
|
}
|
||||||
public double X
|
|
||||||
{
|
|
||||||
get => x;
|
|
||||||
set => OnPropertyChanged(value, ref x);
|
|
||||||
}
|
|
||||||
public double Y
|
|
||||||
{
|
|
||||||
get => y;
|
|
||||||
set => OnPropertyChanged(value, ref y);
|
|
||||||
}
|
|
||||||
public double Xy1
|
public double Xy1
|
||||||
{
|
{
|
||||||
get => xY1;
|
get => xY1;
|
||||||
@@ -241,62 +198,13 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
get => yX1;
|
get => yX1;
|
||||||
set => OnPropertyChanged(value, ref yX1);
|
set => OnPropertyChanged(value, ref yX1);
|
||||||
}
|
}
|
||||||
public double PrimitiveWidth
|
public virtual double PrimitiveWidth { get; set; }
|
||||||
{
|
public virtual double PrimitiveHeight { get;set; }
|
||||||
get => primitiveWidth;
|
|
||||||
set => OnPropertyChanged(value, ref primitiveWidth);
|
|
||||||
}
|
|
||||||
public double PrimitiveHeight
|
|
||||||
{
|
|
||||||
get => primitiveHeight;
|
|
||||||
set => OnPropertyChanged(value, ref primitiveHeight);
|
|
||||||
}
|
|
||||||
public double StressValue
|
|
||||||
{
|
|
||||||
get { return stressValue; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
OnPropertyChanged(value, ref stressValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public double StrainValue
|
|
||||||
{
|
|
||||||
get { return strainValue; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
OnPropertyChanged(value, ref strainValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public double ShowedX
|
|
||||||
{
|
|
||||||
get => showedX;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
UpdateCoordinatesX(value);
|
|
||||||
OnPropertyChanged(value, ref showedX);
|
|
||||||
OnPropertyChanged(nameof(X));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public double ShowedY
|
|
||||||
{
|
|
||||||
get => showedY;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
UpdateCoordinatesY(value);
|
|
||||||
OnPropertyChanged(value, ref showedY);
|
|
||||||
OnPropertyChanged(nameof(Y));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public bool BorderCaptured
|
public bool BorderCaptured
|
||||||
{
|
{
|
||||||
get => borderCaptured;
|
get => borderCaptured;
|
||||||
set => OnPropertyChanged(value, ref borderCaptured);
|
set => OnPropertyChanged(value, ref borderCaptured);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Visibility RectangleFieldVisibility => Type == PrimitiveType.Rectangle ? Visibility.Visible : Visibility.Hidden;
|
|
||||||
public string PrimitiveDimension => Type == PrimitiveType.Rectangle ? "Ширина" : "Диаметр";
|
|
||||||
public double HeightRowHeight => Type == PrimitiveType.Rectangle ? 40 : 0;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Команды
|
#region Команды
|
||||||
@@ -307,67 +215,33 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
protected PrimitiveBase(PrimitiveType type, double x, double y, MainViewModel ownerVM)
|
public PrimitiveBase(INdmPrimitive primitive)
|
||||||
{
|
{
|
||||||
this.type = type;
|
|
||||||
X = ownerVM.YX1 + x;
|
|
||||||
Y = ownerVM.XY1 + y;
|
|
||||||
color = ColorProcessor.GetRandomColor();
|
color = ColorProcessor.GetRandomColor();
|
||||||
PrimitiveLeftButtonUp = new RelayCommand(o => Captured = false);
|
|
||||||
PrimitiveLeftButtonDown = new RelayCommand(o => Captured = true);
|
|
||||||
|
|
||||||
PrimitiveDoubleClick = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
//PopupCanBeClosed = false;
|
|
||||||
//Captured = false;
|
|
||||||
//ParamsPanelVisibilty = true;
|
|
||||||
//ParameterCaptured = true;
|
|
||||||
|
|
||||||
});
|
|
||||||
OwnerVm = ownerVM;
|
|
||||||
SetMaterialColor = true;
|
SetMaterialColor = true;
|
||||||
PrestrainKx = 0;
|
this.primitive = primitive;
|
||||||
PrestrainKy = 0;
|
|
||||||
PrestrainEpsZ = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readonly MainViewModel OwnerVm;
|
public void RegisterDeltas(double dx, double dy)
|
||||||
|
|
||||||
private void UpdateCoordinatesX(double showedX)
|
|
||||||
{
|
{
|
||||||
if (this is Rectangle)
|
DeltaX = dx;
|
||||||
{
|
DeltaY = dy;
|
||||||
X = showedX + OwnerVm.YX1 / UnitConstatnts.Length;
|
|
||||||
}
|
|
||||||
else if (this is Point)
|
|
||||||
{
|
|
||||||
Point point = this as Point;
|
|
||||||
X = showedX + OwnerVm.YX1 / UnitConstatnts.Length;
|
|
||||||
}
|
|
||||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); }
|
|
||||||
}
|
|
||||||
private void UpdateCoordinatesY(double showedY)
|
|
||||||
{
|
|
||||||
if (this is Rectangle)
|
|
||||||
{
|
|
||||||
Y = -showedY + OwnerVm.XY1 / UnitConstatnts.Length - PrimitiveHeight;
|
|
||||||
}
|
|
||||||
else if (this is Point)
|
|
||||||
{
|
|
||||||
Point point = this as Point;
|
|
||||||
Y = -showedY + OwnerVm.XY1 / UnitConstatnts.Length - point.Diameter;
|
|
||||||
}
|
|
||||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract INdmPrimitive GetNdmPrimitive(IUnitSystem unitSystem);
|
public MainViewModel OwnerVM { get; private set; }
|
||||||
public MaterialTypes GetMaterialTypes()
|
|
||||||
|
public double DeltaX { get; private set; }
|
||||||
|
public double DeltaY { get; private set; }
|
||||||
|
|
||||||
|
public virtual INdmPrimitive GetNdmPrimitive()
|
||||||
{
|
{
|
||||||
MaterialTypes materialTypes;
|
RefreshNdmPrimitive();
|
||||||
if (Material is ConcreteDefinition) { materialTypes = MaterialTypes.Concrete; }
|
return primitive;
|
||||||
else if (Material is RebarDefinition) { materialTypes = MaterialTypes.Reinforcement; }
|
}
|
||||||
else { throw new StructureHelperException(ErrorStrings.MaterialTypeIsUnknown); }
|
|
||||||
return materialTypes;
|
public virtual void RefreshNdmPrimitive()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
using StructureHelper.Infrastructure.Enums;
|
|
||||||
using StructureHelper.UnitSystem.Systems;
|
|
||||||
using StructureHelper.Windows.MainWindow;
|
|
||||||
using StructureHelperLogics.Models.Materials;
|
|
||||||
using StructureHelperCommon.Models.Shapes;
|
|
||||||
using System;
|
|
||||||
using StructureHelperLogics.Models.Primitives;
|
|
||||||
|
|
||||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
|
||||||
{
|
|
||||||
public class Rectangle : PrimitiveBase
|
|
||||||
{
|
|
||||||
public Rectangle(double primitiveWidth, double primitiveHeight, double x, double y, MainViewModel ownerVm) : base(PrimitiveType.Rectangle, x, y, ownerVm)
|
|
||||||
{
|
|
||||||
Type = PrimitiveType.Rectangle;
|
|
||||||
Name = "New rectangle";
|
|
||||||
PrimitiveWidth = primitiveWidth;
|
|
||||||
PrimitiveHeight = primitiveHeight;
|
|
||||||
PreviewMouseMove = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
if (!(o is Rectangle rect)) return;
|
|
||||||
if (Captured && !rect.BorderCaptured && !ElementLock)
|
|
||||||
{
|
|
||||||
var deltaX = PrimitiveWidth / 2;
|
|
||||||
var deltaY = PrimitiveHeight / 2;
|
|
||||||
|
|
||||||
if (rect.ShowedX % 10 <= delta || rect.ShowedX % 10 >= 10 - delta)
|
|
||||||
rect.ShowedX = Math.Round((OwnerVm.PanelX - deltaX - OwnerVm.YX1) / 10) * 10;
|
|
||||||
else
|
|
||||||
rect.ShowedX = OwnerVm.PanelX - deltaX - OwnerVm.YX1;
|
|
||||||
|
|
||||||
if (rect.ShowedY % 10 <= delta || rect.ShowedY % 10 >= 10 - delta)
|
|
||||||
rect.ShowedY = -(Math.Round((OwnerVm.PanelY - deltaY - OwnerVm.XY1 + rect.PrimitiveHeight) / 10) * 10);
|
|
||||||
else
|
|
||||||
rect.ShowedY = -(OwnerVm.PanelY - deltaY - OwnerVm.XY1 + rect.PrimitiveHeight);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
CenterX = x;
|
|
||||||
CenterY = y;
|
|
||||||
MinElementDivision = 10;
|
|
||||||
MaxElementSize = Math.Min(Math.Min(PrimitiveWidth, PrimitiveHeight) / MinElementDivision, 0.01);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override INdmPrimitive GetNdmPrimitive(IUnitSystem unitSystem)
|
|
||||||
{
|
|
||||||
var width = PrimitiveWidth;
|
|
||||||
var height = PrimitiveHeight;
|
|
||||||
double centerX = CenterX;
|
|
||||||
double centerY = CenterY;
|
|
||||||
ICenter center = new Center { X = centerX, Y = centerY };
|
|
||||||
IShape shape = new StructureHelperCommon.Models.Shapes.RectangleShape { Height = height, Width = width, Angle = 0 };
|
|
||||||
INdmPrimitive ndmPrimitive = new NdmPrimitive(HeadMaterial)
|
|
||||||
{ Center = center, Shape = shape,
|
|
||||||
NdmMaxSize = MaxElementSize, NdmMinDivision = MinElementDivision,
|
|
||||||
PrestrainKx = PrestrainKx,
|
|
||||||
PrestrainKy = PrestrainKy,
|
|
||||||
PrestrainEpsZ = PrestrainEpsZ };
|
|
||||||
return ndmPrimitive;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
76
Infrastructure/UI/DataContexts/RectangleViewPrimitive.cs
Normal file
76
Infrastructure/UI/DataContexts/RectangleViewPrimitive.cs
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
using StructureHelper.Infrastructure.Enums;
|
||||||
|
using StructureHelper.UnitSystem.Systems;
|
||||||
|
using StructureHelper.Windows.MainWindow;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
|
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||||
|
{
|
||||||
|
public class RectangleViewPrimitive : PrimitiveBase, IHasDivision, IHasCenter
|
||||||
|
{
|
||||||
|
const double lengthUnit = 1000d;
|
||||||
|
|
||||||
|
private IRectanglePrimitive primitive;
|
||||||
|
|
||||||
|
public override double PrimitiveWidth
|
||||||
|
{
|
||||||
|
get => primitive.Width;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
primitive.Width = value;
|
||||||
|
OnPropertyChanged(nameof(PrimitiveLeft));
|
||||||
|
OnPropertyChanged(nameof(PrimitiveWidth));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public override double PrimitiveHeight
|
||||||
|
{
|
||||||
|
get => primitive.Height;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
primitive.Height = value;
|
||||||
|
OnPropertyChanged(nameof(PrimitiveTop));
|
||||||
|
OnPropertyChanged(nameof(PrimitiveHeight));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double PrimitiveLeft
|
||||||
|
{
|
||||||
|
get => DeltaX - primitive.Width / 2 * lengthUnit;
|
||||||
|
}
|
||||||
|
public double PrimitiveTop
|
||||||
|
{
|
||||||
|
get => DeltaY - primitive.Height / 2 * lengthUnit;
|
||||||
|
}
|
||||||
|
public int NdmMinDivision
|
||||||
|
{
|
||||||
|
get => primitive.NdmMinDivision;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
primitive.NdmMinDivision = value;
|
||||||
|
OnPropertyChanged(nameof(NdmMinDivision));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double NdmMaxSize
|
||||||
|
{
|
||||||
|
get => primitive.NdmMaxSize;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
primitive.NdmMaxSize = value;
|
||||||
|
OnPropertyChanged(nameof(NdmMaxSize));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public RectangleViewPrimitive(IRectanglePrimitive _primitive) : base(_primitive)
|
||||||
|
{
|
||||||
|
primitive = _primitive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INdmPrimitive GetNdmPrimitive()
|
||||||
|
{
|
||||||
|
return primitive;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,21 +10,38 @@
|
|||||||
xmlns:userControls="clr-namespace:StructureHelper.Infrastructure.UI.UserControls"
|
xmlns:userControls="clr-namespace:StructureHelper.Infrastructure.UI.UserControls"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Ellipse Style="{StaticResource EllipseStyle}" d:DataContext="{d:DesignInstance dataContexts:Point}">
|
<Ellipse Style="{StaticResource EllipseStyle}" d:DataContext="{d:DesignInstance dataContexts:PointViewPrimitive}">
|
||||||
<i:Interaction.Triggers>
|
<Ellipse.ToolTip>
|
||||||
<!--<i:EventTrigger EventName="PreviewMouseDown">
|
<Grid>
|
||||||
<i:InvokeCommandAction Command="{Binding PrimitiveLeftButtonDown}" CommandParameter="{Binding}"/>
|
<Grid.ColumnDefinitions>
|
||||||
</i:EventTrigger>
|
<ColumnDefinition Width="Auto"/>
|
||||||
<i:EventTrigger EventName="PreviewMouseUp">
|
<ColumnDefinition Width="Auto"/>
|
||||||
<i:InvokeCommandAction Command="{Binding PrimitiveLeftButtonUp}" CommandParameter="{Binding}"/>
|
</Grid.ColumnDefinitions>
|
||||||
</i:EventTrigger>
|
<Grid.RowDefinitions>
|
||||||
<i:EventTrigger EventName="PreviewMouseMove">
|
<RowDefinition Height="Auto"/>
|
||||||
<i:InvokeCommandAction Command="{Binding PreviewMouseMove}" CommandParameter="{Binding}"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</i:EventTrigger>-->
|
<RowDefinition Height="Auto"/>
|
||||||
<!--<mouseEventTriggers:DoubleClickEventTrigger EventName="MouseDown">
|
<RowDefinition Height="Auto"/>
|
||||||
<i:InvokeCommandAction Command="{Binding PrimitiveDoubleClick}" CommandParameter="{Binding}"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</mouseEventTriggers:DoubleClickEventTrigger>-->
|
</Grid.RowDefinitions>
|
||||||
</i:Interaction.Triggers>
|
<TextBlock Text="Name: "/>
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Material Name: "/>
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding HeadMaterial.Name}"/>
|
||||||
|
<TextBlock Grid.Row="2" Text="Center X: "/>
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}}"/>
|
||||||
|
<TextBlock Grid.Row="3" Text="Center Y: "/>
|
||||||
|
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}}"/>
|
||||||
|
<TextBlock Grid.Row="4" Text="Diameter: "/>
|
||||||
|
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding Diameter, Converter={StaticResource LengthConverter}}"/>
|
||||||
|
</Grid>
|
||||||
|
</Ellipse.ToolTip>
|
||||||
|
<Ellipse.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<TranslateTransform X="{Binding CenterX, Converter={StaticResource LengthConverter}}" Y="{Binding InvertedCenterY, Converter={StaticResource LengthConverter}}"/>
|
||||||
|
<RotateTransform/>
|
||||||
|
</TransformGroup>
|
||||||
|
</Ellipse.RenderTransform>
|
||||||
</Ellipse>
|
</Ellipse>
|
||||||
<userControls:PrimitivePopup Type="Rectangle" IsOpen="{Binding ParamsPanelVisibilty}" d:DataContext="{d:DesignInstance dataContexts:PrimitiveBase}"/>
|
<userControls:PrimitivePopup Type="Rectangle" IsOpen="{Binding ParamsPanelVisibilty}" d:DataContext="{d:DesignInstance dataContexts:PrimitiveBase}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
@@ -10,40 +10,46 @@
|
|||||||
xmlns:userControls="clr-namespace:StructureHelper.Infrastructure.UI.UserControls"
|
xmlns:userControls="clr-namespace:StructureHelper.Infrastructure.UI.UserControls"
|
||||||
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
|
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance dataContexts:Rectangle}">
|
d:DataContext="{d:DesignInstance dataContexts:RectangleViewPrimitive}">
|
||||||
|
<UserControl.Resources>
|
||||||
|
</UserControl.Resources>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Rectangle Style="{StaticResource RectangleStyle}">
|
<Rectangle x:Name="Rect" Style="{StaticResource RectangleStyle}" Tag="{Binding}">
|
||||||
<i:Interaction.Triggers>
|
<Rectangle.ToolTip>
|
||||||
<!--<i:EventTrigger EventName="PreviewMouseDown">
|
<Grid>
|
||||||
<i:InvokeCommandAction Command="{Binding PrimitiveLeftButtonDown}" CommandParameter="{Binding}"/>
|
<Grid.ColumnDefinitions>
|
||||||
</i:EventTrigger>
|
<ColumnDefinition Width="Auto"/>
|
||||||
<i:EventTrigger EventName="PreviewMouseUp">
|
<ColumnDefinition Width="Auto"/>
|
||||||
<i:InvokeCommandAction Command="{Binding PrimitiveLeftButtonUp}" CommandParameter="{Binding}"/>
|
</Grid.ColumnDefinitions>
|
||||||
</i:EventTrigger>
|
<Grid.RowDefinitions>
|
||||||
<i:EventTrigger EventName="PreviewMouseMove">
|
<RowDefinition Height="Auto"/>
|
||||||
<i:InvokeCommandAction Command="{Binding PreviewMouseMove}" CommandParameter="{Binding}"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</i:EventTrigger>-->
|
<RowDefinition Height="Auto"/>
|
||||||
<!--<mouseEventTriggers:DoubleClickEventTrigger EventName="MouseDown">
|
<RowDefinition Height="Auto"/>
|
||||||
<i:InvokeCommandAction Command="{Binding PrimitiveDoubleClick}" CommandParameter="{Binding}"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</mouseEventTriggers:DoubleClickEventTrigger>-->
|
<RowDefinition Height="Auto"/>
|
||||||
</i:Interaction.Triggers>
|
</Grid.RowDefinitions>
|
||||||
</Rectangle>
|
<TextBlock Text="Name: "/>
|
||||||
<Rectangle Cursor="SizeNWSE" VerticalAlignment="Bottom" HorizontalAlignment="Right">
|
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||||
<i:Interaction.Triggers>
|
<TextBlock Grid.Row="1" Text="Material Name: "/>
|
||||||
<i:EventTrigger EventName="PreviewMouseDown">
|
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding HeadMaterial.Name}"/>
|
||||||
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.LeftButtonDown}" CommandParameter="{Binding}"/>
|
<TextBlock Grid.Row="2" Text="Center X: "/>
|
||||||
</i:EventTrigger>
|
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}}"/>
|
||||||
<i:EventTrigger EventName="PreviewMouseUp">
|
<TextBlock Grid.Row="3" Text="Center Y: "/>
|
||||||
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.LeftButtonUp}" CommandParameter="{Binding}"/>
|
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}}"/>
|
||||||
</i:EventTrigger>
|
<TextBlock Grid.Row="4" Text="Width: "/>
|
||||||
<i:EventTrigger EventName="PreviewMouseMove">
|
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding PrimitiveWidth, Converter={StaticResource LengthConverter}}"/>
|
||||||
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PreviewMouseMove}" CommandParameter="{Binding}"/>
|
<TextBlock Grid.Row="5" Text="Height: "/>
|
||||||
</i:EventTrigger>
|
<TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding PrimitiveHeight, Converter={StaticResource LengthConverter}}"/>
|
||||||
</i:Interaction.Triggers>
|
</Grid>
|
||||||
<!--<Rectangle.Fill>
|
</Rectangle.ToolTip>
|
||||||
<SolidColorBrush Color="{Binding Color}"/>
|
<Rectangle.RenderTransform>
|
||||||
</Rectangle.Fill>-->
|
<TransformGroup>
|
||||||
|
<TranslateTransform X="{Binding CenterX, Converter={StaticResource LengthConverter}}" Y="{Binding InvertedCenterY, Converter={StaticResource LengthConverter}}"/>
|
||||||
|
<RotateTransform/>
|
||||||
|
</TransformGroup>
|
||||||
|
</Rectangle.RenderTransform>
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
</Grid>
|
</Grid>
|
||||||
<userControls:PrimitivePopup IsOpen="{Binding ParamsPanelVisibilty}"/>
|
<userControls:PrimitivePopup IsOpen="{Binding ParamsPanelVisibilty}"/>
|
||||||
|
|||||||
27
Infrastructure/UI/Resources/PrimitiveToolTips.xaml
Normal file
27
Infrastructure/UI/Resources/PrimitiveToolTips.xaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
|
||||||
|
<DataTemplate x:Key="RectanglePrimitiveToolTip">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Text="Name: "/>
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Material Name: "/>
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding HeadMaterial.Name}"/>
|
||||||
|
<TextBlock Grid.Row="2" Text="Center X: "/>
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}}"/>
|
||||||
|
<TextBlock Grid.Row="3" Text="Center Y: "/>
|
||||||
|
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}}"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -26,35 +26,6 @@
|
|||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Setter Property="Opacity" Value="{Binding Opacity, Mode=TwoWay}"/>
|
<Setter Property="Opacity" Value="{Binding Opacity, Mode=TwoWay}"/>
|
||||||
<!--<Setter Property="ToolTip">
|
|
||||||
<Setter.Value>
|
|
||||||
<ToolTip Background="White" BorderBrush="Black" BorderThickness="1">
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="30"/>
|
|
||||||
<RowDefinition Height="30"/>
|
|
||||||
<RowDefinition Height="30"/>
|
|
||||||
<RowDefinition Height="30"/>
|
|
||||||
<RowDefinition Height="30"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="100"/>
|
|
||||||
<ColumnDefinition Width="50"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<TextBox Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Координата X:"/>
|
|
||||||
<TextBox Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding ShowedX}"/>
|
|
||||||
<TextBox Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Координата Y:"/>
|
|
||||||
<TextBox Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding ShowedY}"/>
|
|
||||||
<TextBox Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Ширина:"/>
|
|
||||||
<TextBox Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding PrimitiveWidth}"/>
|
|
||||||
<TextBox Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Высота:"/>
|
|
||||||
<TextBox Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding PrimitiveHeight}"/>
|
|
||||||
<TextBox Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Материал:"/>
|
|
||||||
<TextBox Grid.Row="4" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding MaterialName, Mode=TwoWay}"/>
|
|
||||||
</Grid>
|
|
||||||
</ToolTip>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>-->
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="EllipseStyle" TargetType="Ellipse" BasedOn="{StaticResource ShapeStyle}">
|
<Style x:Key="EllipseStyle" TargetType="Ellipse" BasedOn="{StaticResource ShapeStyle}">
|
||||||
@@ -68,4 +39,11 @@
|
|||||||
<Setter Property="Width" Value="{Binding PrimitiveWidth, Converter={StaticResource LengthConverter}}"/>
|
<Setter Property="Width" Value="{Binding PrimitiveWidth, Converter={StaticResource LengthConverter}}"/>
|
||||||
<Setter Property="Height" Value="{Binding PrimitiveHeight, Converter={StaticResource LengthConverter}}"/>
|
<Setter Property="Height" Value="{Binding PrimitiveHeight, Converter={StaticResource LengthConverter}}"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="LinePrimitiveStyle" TargetType="Line" BasedOn="{StaticResource ShapeStyle}">
|
||||||
|
<Setter Property="X1" Value="{Binding StartPoinX, Converter={StaticResource LengthConverter}}"/>
|
||||||
|
<Setter Property="Y1" Value="{Binding StartPoinY, Converter={StaticResource LengthConverter}}"/>
|
||||||
|
<Setter Property="X2" Value="{Binding EndPoinX, Converter={StaticResource LengthConverter}}"/>
|
||||||
|
<Setter Property="Y2" Value="{Binding EndPoinY, Converter={StaticResource LengthConverter}}"/>
|
||||||
|
</Style>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -103,11 +103,6 @@ namespace StructureHelper.MaterialCatalogWindow
|
|||||||
OnPropertyChanged(nameof(RebarDefinitions));
|
OnPropertyChanged(nameof(RebarDefinitions));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
SelectMaterial = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
if (primitive != null)
|
|
||||||
primitive.Material = SelectedMaterial;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|||||||
81
Models/Primitives/Factories/PrimitiveFactory.cs
Normal file
81
Models/Primitives/Factories/PrimitiveFactory.cs
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.Models.Templates.RCs;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Models.Primitives.Factories
|
||||||
|
{
|
||||||
|
internal static class PrimitiveFactory
|
||||||
|
{
|
||||||
|
public static IEnumerable<PrimitiveBase> GetRectangleRCElement(RectangleBeamTemplate template, IHeadMaterial concrete, IHeadMaterial reinforcement)
|
||||||
|
{
|
||||||
|
List<PrimitiveBase> primitives = new List<PrimitiveBase>();
|
||||||
|
var rect = template.Shape as StructureHelperCommon.Models.Shapes.RectangleShape;
|
||||||
|
var width = rect.Width;
|
||||||
|
var height = rect.Height;
|
||||||
|
var area1 = Math.PI * template.BottomDiameter * template.BottomDiameter / 4d;
|
||||||
|
var area2 = Math.PI * template.TopDiameter * template.TopDiameter / 4d;
|
||||||
|
var gap = template.CoverGap;
|
||||||
|
|
||||||
|
double[] xs = new double[] { -width / 2 + gap, width / 2 - gap };
|
||||||
|
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
||||||
|
|
||||||
|
var rectangle = new RectanglePrimitive() { Width = width, Height = height, Name = "Concrete block" };
|
||||||
|
primitives.Add(new RectangleViewPrimitive(rectangle) { HeadMaterial = concrete});
|
||||||
|
var point = new PointPrimitive() { CenterX = xs[0], CenterY = ys[0], Area = area1};
|
||||||
|
var viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Left bottom point" };
|
||||||
|
viewPoint.RegisterDeltas(xs[0], ys[0]);
|
||||||
|
primitives.Add(viewPoint);
|
||||||
|
point = new PointPrimitive() {CenterX = xs[1], CenterY = ys[0], Area = area1 };
|
||||||
|
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Right bottom point" };
|
||||||
|
primitives.Add(viewPoint);
|
||||||
|
point = new PointPrimitive() { CenterX = xs[0], CenterY = ys[1], Area = area2 };
|
||||||
|
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Left top point" };
|
||||||
|
primitives.Add(viewPoint);
|
||||||
|
point = new PointPrimitive() { CenterX = xs[1], CenterY = ys[1], Area = area2 };
|
||||||
|
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Right top point" };
|
||||||
|
viewPoint.RegisterDeltas(xs[1], ys[1]);
|
||||||
|
primitives.Add(viewPoint);
|
||||||
|
|
||||||
|
if (template.WidthCount > 2)
|
||||||
|
{
|
||||||
|
int count = template.WidthCount - 1;
|
||||||
|
double dist = (xs[1] - xs[0]) / count;
|
||||||
|
for (int i = 1; i < count; i++)
|
||||||
|
{
|
||||||
|
point = new PointPrimitive() {CenterX = xs[0] + dist * i, CenterY = ys[0], Area = area1 };
|
||||||
|
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Bottom point {i}" };
|
||||||
|
primitives.Add(viewPoint);
|
||||||
|
|
||||||
|
point = new PointPrimitive() { CenterX = xs[0] + dist * i, CenterY = ys[1], Area = area2 };
|
||||||
|
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Top point {i}" };
|
||||||
|
primitives.Add(viewPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (template.HeightCount > 2)
|
||||||
|
{
|
||||||
|
int count = template.HeightCount - 1;
|
||||||
|
double dist = (ys[1] - ys[0]) / count;
|
||||||
|
for (int i = 1; i < count; i++)
|
||||||
|
{
|
||||||
|
point = new PointPrimitive() {CenterX = xs[0], CenterY = ys[0] + dist * i, Area = area1 };
|
||||||
|
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Left point {i}" };
|
||||||
|
primitives.Add(viewPoint);
|
||||||
|
|
||||||
|
point = new PointPrimitive() { CenterX = xs[1], CenterY = ys[0] + dist * i, Area = area1 };
|
||||||
|
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Right point {i}" };
|
||||||
|
primitives.Add(viewPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return primitives;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,8 +5,8 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using Point = StructureHelper.Infrastructure.UI.DataContexts.Point;
|
using Point = StructureHelper.Infrastructure.UI.DataContexts.PointViewPrimitive;
|
||||||
using Rectangle = StructureHelper.Infrastructure.UI.DataContexts.Rectangle;
|
using Rectangle = StructureHelper.Infrastructure.UI.DataContexts.RectangleViewPrimitive;
|
||||||
|
|
||||||
namespace StructureHelper.Services.Primitives
|
namespace StructureHelper.Services.Primitives
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -140,11 +140,14 @@
|
|||||||
<Compile Include="Infrastructure\UI\Converters\Units\Length.cs" />
|
<Compile Include="Infrastructure\UI\Converters\Units\Length.cs" />
|
||||||
<Compile Include="Infrastructure\UI\Converters\Units\UnitBase.cs" />
|
<Compile Include="Infrastructure\UI\Converters\Units\UnitBase.cs" />
|
||||||
<Compile Include="Infrastructure\UI\Converters\Units\UnitConstatnts.cs" />
|
<Compile Include="Infrastructure\UI\Converters\Units\UnitConstatnts.cs" />
|
||||||
<Compile Include="Infrastructure\UI\DataContexts\LinePrimitive.cs" />
|
<Compile Include="Infrastructure\UI\DataContexts\IHasCenter.cs" />
|
||||||
|
<Compile Include="Infrastructure\UI\DataContexts\IHasDivision.cs" />
|
||||||
|
<Compile Include="Infrastructure\UI\DataContexts\LineViewPrimitive.cs" />
|
||||||
<Compile Include="Infrastructure\UI\PrimitiveTemplates\IRectangleBeamProperties.cs" />
|
<Compile Include="Infrastructure\UI\PrimitiveTemplates\IRectangleBeamProperties.cs" />
|
||||||
<Compile Include="Infrastructure\UI\UserControls\PrimitivePopup.xaml.cs">
|
<Compile Include="Infrastructure\UI\UserControls\PrimitivePopup.xaml.cs">
|
||||||
<DependentUpon>PrimitivePopup.xaml</DependentUpon>
|
<DependentUpon>PrimitivePopup.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Models\Primitives\Factories\PrimitiveFactory.cs" />
|
||||||
<Compile Include="Services\Primitives\PrimitiveRepository.cs" />
|
<Compile Include="Services\Primitives\PrimitiveRepository.cs" />
|
||||||
<Compile Include="Services\Primitives\IPrimitiveRepository.cs" />
|
<Compile Include="Services\Primitives\IPrimitiveRepository.cs" />
|
||||||
<Compile Include="Services\Reports\CalculationReports\IIsoFieldReport.cs" />
|
<Compile Include="Services\Reports\CalculationReports\IIsoFieldReport.cs" />
|
||||||
@@ -184,11 +187,11 @@
|
|||||||
<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\Point.cs" />
|
<Compile Include="Infrastructure\UI\DataContexts\PointViewPrimitive.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" />
|
||||||
<Compile Include="Infrastructure\UI\DataContexts\Rectangle.cs" />
|
<Compile Include="Infrastructure\UI\DataContexts\RectangleViewPrimitive.cs" />
|
||||||
<Compile Include="Infrastructure\UI\DataTemplates\EllipseTemplate.xaml.cs">
|
<Compile Include="Infrastructure\UI\DataTemplates\EllipseTemplate.xaml.cs">
|
||||||
<DependentUpon>EllipseTemplate.xaml</DependentUpon>
|
<DependentUpon>EllipseTemplate.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -202,7 +205,7 @@
|
|||||||
<Compile Include="Windows\MainWindow\Materials\HeadMaterialsView.xaml.cs">
|
<Compile Include="Windows\MainWindow\Materials\HeadMaterialsView.xaml.cs">
|
||||||
<DependentUpon>HeadMaterialsView.xaml</DependentUpon>
|
<DependentUpon>HeadMaterialsView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Windows\PrimitiveProperiesWindow\PrimitivePropertiesView.xaml.cs">
|
<Compile Include="Windows\PrimitivePropertiesWindow\PrimitivePropertiesView.xaml.cs">
|
||||||
<DependentUpon>PrimitivePropertiesView.xaml</DependentUpon>
|
<DependentUpon>PrimitivePropertiesView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Windows\PrimitiveTemplates\RCs\RectangleBeam\RectangleBeamView.xaml.cs">
|
<Compile Include="Windows\PrimitiveTemplates\RCs\RectangleBeam\RectangleBeamView.xaml.cs">
|
||||||
@@ -212,6 +215,7 @@
|
|||||||
<Compile Include="Windows\ViewModels\Calculations\CalculationResult\CalculationResultViewModel.cs" />
|
<Compile Include="Windows\ViewModels\Calculations\CalculationResult\CalculationResultViewModel.cs" />
|
||||||
<Compile Include="Windows\ViewModels\Materials\HeadMaterialsViewModel.cs" />
|
<Compile Include="Windows\ViewModels\Materials\HeadMaterialsViewModel.cs" />
|
||||||
<Compile Include="Windows\ViewModels\PrimitiveProperties\PrimitivePropertiesViewModel.cs" />
|
<Compile Include="Windows\ViewModels\PrimitiveProperties\PrimitivePropertiesViewModel.cs" />
|
||||||
|
<Compile Include="Windows\ViewModels\Primitives\RectangleControlViewModel.cs" />
|
||||||
<Compile Include="Windows\ViewModels\PrimitiveTemplates\RCs\RectangleBeamViewModel.cs" />
|
<Compile Include="Windows\ViewModels\PrimitiveTemplates\RCs\RectangleBeamViewModel.cs" />
|
||||||
<Compile Include="Infrastructure\UI\PrimitiveTemplates\TemplateFactory.cs" />
|
<Compile Include="Infrastructure\UI\PrimitiveTemplates\TemplateFactory.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -236,6 +240,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Infrastructure\UI\Resources\PrimitiveToolTips.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Infrastructure\UI\Resources\ShapeEditTemplates.xaml">
|
<Page Include="Infrastructure\UI\Resources\ShapeEditTemplates.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -284,7 +292,7 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Windows\PrimitiveProperiesWindow\PrimitivePropertiesView.xaml">
|
<Page Include="Windows\PrimitivePropertiesWindow\PrimitivePropertiesView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace StructureHelperCommon.Models.Shapes
|
namespace StructureHelperCommon.Models.Shapes
|
||||||
{
|
{
|
||||||
public interface IPoint : IShape
|
public interface IPointShape : IShape
|
||||||
{
|
{
|
||||||
double Area { get; set; }
|
double Area { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace StructureHelperCommon.Models.Shapes
|
namespace StructureHelperCommon.Models.Shapes
|
||||||
{
|
{
|
||||||
public class PointShape : IPoint
|
public class PointShape : IPointShape
|
||||||
{
|
{
|
||||||
public double Area { get; set; }
|
public double Area { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
<Compile Include="Models\Shapes\ICenterShape.cs" />
|
<Compile Include="Models\Shapes\ICenterShape.cs" />
|
||||||
<Compile Include="Models\Shapes\ICircle.cs" />
|
<Compile Include="Models\Shapes\ICircle.cs" />
|
||||||
<Compile Include="Models\Shapes\ILineShape.cs" />
|
<Compile Include="Models\Shapes\ILineShape.cs" />
|
||||||
<Compile Include="Models\Shapes\IPoint.cs" />
|
<Compile Include="Models\Shapes\IPointShape.cs" />
|
||||||
<Compile Include="Models\Shapes\IRectangleShape.cs" />
|
<Compile Include="Models\Shapes\IRectangleShape.cs" />
|
||||||
<Compile Include="Models\Shapes\IShape.cs" />
|
<Compile Include="Models\Shapes\IShape.cs" />
|
||||||
<Compile Include="Models\Shapes\LineShape.cs" />
|
<Compile Include="Models\Shapes\LineShape.cs" />
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -13,11 +14,21 @@ using StructureHelperLogics.Models.Materials;
|
|||||||
|
|
||||||
namespace StructureHelper.Models.Materials
|
namespace StructureHelper.Models.Materials
|
||||||
{
|
{
|
||||||
public class HeadMaterial : IHeadMaterial
|
public class HeadMaterial : IHeadMaterial, INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
|
private Color color;
|
||||||
|
|
||||||
public string Id { get; }
|
public string Id { get; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public Color Color { get; set; }
|
public Color Color
|
||||||
|
{
|
||||||
|
get => color;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
color = value;
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Color)));
|
||||||
|
}
|
||||||
|
}
|
||||||
public IHelperMaterial HelperMaterial {get; set;}
|
public IHelperMaterial HelperMaterial {get; set;}
|
||||||
|
|
||||||
public HeadMaterial()
|
public HeadMaterial()
|
||||||
@@ -26,6 +37,8 @@ namespace StructureHelper.Models.Materials
|
|||||||
Color = ColorProcessor.GetRandomColor();
|
Color = ColorProcessor.GetRandomColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||||
{
|
{
|
||||||
return HelperMaterial.GetLoaderMaterial(limitState, calcTerm);
|
return HelperMaterial.GetLoaderMaterial(limitState, calcTerm);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -6,7 +7,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
{
|
{
|
||||||
internal interface IHasDivisionSize
|
public interface IHasDivisionSize : INdmPrimitive
|
||||||
{
|
{
|
||||||
double NdmMaxSize { get; set; }
|
double NdmMaxSize { get; set; }
|
||||||
int NdmMinDivision { get; set; }
|
int NdmMinDivision { get; set; }
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
{
|
||||||
|
public interface ILinePrimitive : IHasDivisionSize, ILineShape
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,14 +5,16 @@ using System.Collections;
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Data.Materials;
|
using LoaderCalculator.Data.Materials;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Primitives
|
namespace StructureHelperLogics.Models.Primitives
|
||||||
{
|
{
|
||||||
public interface INdmPrimitive
|
public interface INdmPrimitive : ISaveable, ICloneable
|
||||||
{
|
{
|
||||||
string Name { get; set; }
|
string Name { get; set; }
|
||||||
ICenter Center { get; set; }
|
double CenterX { get; set; }
|
||||||
IShape Shape { get; set; }
|
double CenterY { get; set; }
|
||||||
IHeadMaterial HeadMaterial { get; set; }
|
IHeadMaterial HeadMaterial { get; set; }
|
||||||
double PrestrainKx { get; set; }
|
double PrestrainKx { get; set; }
|
||||||
double PrestrainKy { get; set; }
|
double PrestrainKy { get; set; }
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
{
|
||||||
|
public interface IPointPrimitive : INdmPrimitive, IPointShape
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
{
|
||||||
|
public interface IRectanglePrimitive : IHasDivisionSize, IRectangleShape
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,13 +14,12 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
{
|
{
|
||||||
public class LinePrimitive : INdmPrimitive, ILineShape, IHasDivisionSize, ISaveable, ICloneable
|
public class LinePrimitive : ILinePrimitive
|
||||||
{
|
{
|
||||||
public ICenter Center { get; set; }
|
|
||||||
public IShape Shape { get; set; }
|
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
public double CenterX { get; set; }
|
||||||
|
public double CenterY { get; set; }
|
||||||
public double NdmMaxSize { get; set; }
|
public double NdmMaxSize { get; set; }
|
||||||
public int NdmMinDivision { get; set; }
|
public int NdmMinDivision { get; set; }
|
||||||
public IHeadMaterial HeadMaterial { get; set; }
|
public IHeadMaterial HeadMaterial { get; set; }
|
||||||
@@ -32,6 +31,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
public ICenter EndPoint { get; set; }
|
public ICenter EndPoint { get; set; }
|
||||||
public double Thickness { get; set; }
|
public double Thickness { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public LinePrimitive()
|
public LinePrimitive()
|
||||||
{
|
{
|
||||||
StartPoint = new Center();
|
StartPoint = new Center();
|
||||||
@@ -44,8 +44,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
LinePrimitive primitive = new LinePrimitive();
|
var primitive = new LinePrimitive();
|
||||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
|
||||||
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
||||||
ShapeService.CopyLineProperties(this, primitive);
|
ShapeService.CopyLineProperties(this, primitive);
|
||||||
return primitive;
|
return primitive;
|
||||||
|
|||||||
@@ -6,42 +6,56 @@ using LoaderCalculator.Data.Ndms;
|
|||||||
using LoaderCalculator.Data.Materials;
|
using LoaderCalculator.Data.Materials;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Primitives
|
namespace StructureHelperLogics.Models.Primitives
|
||||||
{
|
{
|
||||||
public class NdmPrimitive : INdmPrimitive, ISaveable, ICloneable
|
public class PointPrimitive : IPointPrimitive
|
||||||
{
|
{
|
||||||
public ICenter Center { get; set; }
|
|
||||||
public IShape Shape { get; set; }
|
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public IHeadMaterial HeadMaterial { get; private set; }
|
public double CenterX { get; set; }
|
||||||
|
public double CenterY { get; set; }
|
||||||
|
public IHeadMaterial HeadMaterial { get; set; }
|
||||||
public double NdmMaxSize { get; set; }
|
public double NdmMaxSize { get; set; }
|
||||||
public int NdmMinDivision { get; set; }
|
public int NdmMinDivision { get; set; }
|
||||||
public double PrestrainKx { get; set; }
|
public double PrestrainKx { get; set; }
|
||||||
public double PrestrainKy { get; set; }
|
public double PrestrainKy { get; set; }
|
||||||
public double PrestrainEpsZ { get; set; }
|
public double PrestrainEpsZ { get; set; }
|
||||||
|
public double Area { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public NdmPrimitive(IHeadMaterial material)
|
public PointPrimitive()
|
||||||
|
{
|
||||||
|
Name = "New Point";
|
||||||
|
Area = 0.0005d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PointPrimitive(IHeadMaterial material)
|
||||||
{
|
{
|
||||||
HeadMaterial = material;
|
HeadMaterial = material;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<INdm> GetNdms(IMaterial material)
|
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
var options = new PointTriangulationLogicOptions(this);
|
||||||
|
IPointTriangulationLogic logic = new PointTriangulationLogic(options);
|
||||||
|
return logic.GetNdmCollection(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var primitive = new PointPrimitive();
|
||||||
|
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||||
|
primitive.Area = Area;
|
||||||
|
return primitive;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ using StructureHelperCommon.Infrastructures.Interfaces;
|
|||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Services.ShapeServices;
|
using StructureHelperCommon.Services.ShapeServices;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -14,27 +15,34 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
{
|
{
|
||||||
public class RectanglePrimitive : INdmPrimitive, IRectangleShape, IHasDivisionSize, ISaveable, ICloneable
|
public class RectanglePrimitive : IRectanglePrimitive
|
||||||
{
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public ICenter Center { get; set; }
|
public double CenterX { get; set; }
|
||||||
public IShape Shape { get; set; }
|
public double CenterY { get; set; }
|
||||||
public IHeadMaterial HeadMaterial { get; set; }
|
public IHeadMaterial HeadMaterial { get; set; }
|
||||||
public double PrestrainKx { get; set; }
|
public double PrestrainKx { get; set; }
|
||||||
public double PrestrainKy { get; set; }
|
public double PrestrainKy { get; set; }
|
||||||
public double PrestrainEpsZ { get; set; }
|
public double PrestrainEpsZ { get; set; }
|
||||||
public double NdmMaxSize { get; set; }
|
public double NdmMaxSize { get; set; }
|
||||||
public int NdmMinDivision { get; set; }
|
public int NdmMinDivision { get; set; }
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
public double Width { get; set; }
|
public double Width { get; set; }
|
||||||
public double Height { get; set; }
|
public double Height { get; set; }
|
||||||
public double Angle { get; set; }
|
public double Angle { get; set; }
|
||||||
|
|
||||||
|
public RectanglePrimitive()
|
||||||
|
{
|
||||||
|
Name = "New Rectangle";
|
||||||
|
Width = 0.4d;
|
||||||
|
Height = 0.6d;
|
||||||
|
NdmMaxSize = 0.01d;
|
||||||
|
NdmMinDivision = 10;
|
||||||
|
}
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
RectanglePrimitive primitive = new RectanglePrimitive();
|
RectanglePrimitive primitive = new RectanglePrimitive();
|
||||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
|
||||||
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
||||||
ShapeService.CopyRectangleProperties(this, primitive);
|
ShapeService.CopyRectangleProperties(this, primitive);
|
||||||
return primitive;
|
return primitive;
|
||||||
@@ -42,7 +50,11 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
|
|
||||||
public IEnumerable<INdm> GetNdms(IMaterial material)
|
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
List<INdm> ndms = new List<INdm>();
|
||||||
|
var options = new RectangleTriangulationLogicOptions(this);
|
||||||
|
ITriangulationLogic logic = new RectangleTriangulationLogic(options);
|
||||||
|
ndms.AddRange(logic.GetNdmCollection(material));
|
||||||
|
return ndms;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Strings;
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
{
|
{
|
||||||
@@ -29,13 +30,10 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
Area = area;
|
Area = area;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PointTriangulationLogicOptions(INdmPrimitive primitive)
|
public PointTriangulationLogicOptions(IPointPrimitive primitive)
|
||||||
{
|
{
|
||||||
if (!(primitive.Shape is IPoint)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
|
Center = new Center() { X = primitive.CenterX, Y = primitive.CenterY };
|
||||||
Center = primitive.Center;
|
Area = primitive.Area;
|
||||||
IPoint point = primitive.Shape as IPoint;
|
|
||||||
Center = primitive.Center;
|
|
||||||
Area = point.Area;
|
|
||||||
PrestrainKx = primitive.PrestrainKx;
|
PrestrainKx = primitive.PrestrainKx;
|
||||||
PrestrainKy = primitive.PrestrainKy;
|
PrestrainKy = primitive.PrestrainKy;
|
||||||
PrestrainEpsZ = primitive.PrestrainEpsZ;
|
PrestrainEpsZ = primitive.PrestrainEpsZ;
|
||||||
|
|||||||
@@ -33,16 +33,12 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
NdmMinDivision = ndmMinDivision;
|
NdmMinDivision = ndmMinDivision;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RectangleTriangulationLogicOptions(INdmPrimitive primitive)
|
public RectangleTriangulationLogicOptions(IRectanglePrimitive primitive)
|
||||||
{
|
{
|
||||||
if (! (primitive.Shape is IRectangleShape)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
|
Center = new Center() { X = primitive.CenterX, Y = primitive.CenterY };
|
||||||
Center = primitive.Center;
|
Rectangle = primitive;
|
||||||
Rectangle = primitive.Shape as IRectangleShape;
|
NdmMaxSize = primitive.NdmMaxSize;
|
||||||
if (primitive is IHasDivisionSize)
|
NdmMinDivision = primitive.NdmMinDivision;
|
||||||
{
|
|
||||||
NdmMaxSize = (primitive as IHasDivisionSize).NdmMaxSize;
|
|
||||||
NdmMinDivision = (primitive as IHasDivisionSize).NdmMinDivision;
|
|
||||||
}
|
|
||||||
PrestrainKx = primitive.PrestrainKx;
|
PrestrainKx = primitive.PrestrainKx;
|
||||||
PrestrainKy = primitive.PrestrainKy;
|
PrestrainKy = primitive.PrestrainKy;
|
||||||
PrestrainEpsZ = primitive.PrestrainEpsZ;
|
PrestrainEpsZ = primitive.PrestrainEpsZ;
|
||||||
|
|||||||
@@ -70,22 +70,23 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
private static IEnumerable<INdm> GetNdmsByPrimitive(INdmPrimitive primitive, IMaterial material)
|
private static IEnumerable<INdm> GetNdmsByPrimitive(INdmPrimitive primitive, IMaterial material)
|
||||||
{
|
{
|
||||||
List<INdm> ndms = new List<INdm>();
|
List<INdm> ndms = new List<INdm>();
|
||||||
ITriangulationLogicOptions options;
|
//ITriangulationLogicOptions options;
|
||||||
ICenter center = primitive.Center;
|
//ICenter center = primitive.Center;
|
||||||
IShape shape = primitive.Shape;
|
//IShape shape = primitive.Shape;
|
||||||
if (shape is IRectangleShape)
|
ndms.AddRange(primitive.GetNdms(material));
|
||||||
{
|
//if (shape is IRectangleShape)
|
||||||
options = new RectangleTriangulationLogicOptions(primitive);
|
//{
|
||||||
ITriangulationLogic logic = new RectangleTriangulationLogic(options);
|
// options = new RectangleTriangulationLogicOptions(primitive);
|
||||||
ndms.AddRange(logic.GetNdmCollection(material));
|
// ITriangulationLogic logic = new RectangleTriangulationLogic(options);
|
||||||
}
|
// ndms.AddRange(logic.GetNdmCollection(material));
|
||||||
else if (shape is IPoint)
|
//}
|
||||||
{
|
//else if (shape is IPoint)
|
||||||
options = new PointTriangulationLogicOptions(primitive);
|
//{
|
||||||
IPointTriangulationLogic logic = new PointTriangulationLogic(options);
|
// options = new PointTriangulationLogicOptions(primitive);
|
||||||
ndms.AddRange(logic.GetNdmCollection(material));
|
// IPointTriangulationLogic logic = new PointTriangulationLogic(options);
|
||||||
}
|
// ndms.AddRange(logic.GetNdmCollection(material));
|
||||||
else { throw new StructureHelperException($"{ErrorStrings.ShapeIsNotCorrect} :{nameof(primitive.Shape)}"); }
|
//}
|
||||||
|
//else { throw new StructureHelperException($"{ErrorStrings.ShapeIsNotCorrect} :{nameof(primitive.Shape)}"); }
|
||||||
return ndms;
|
return ndms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
|||||||
|
|
||||||
public static void CopyDivisionProperties(IHasDivisionSize source, IHasDivisionSize target)
|
public static void CopyDivisionProperties(IHasDivisionSize source, IHasDivisionSize target)
|
||||||
{
|
{
|
||||||
|
CopyNdmProperties(source, target);
|
||||||
target.NdmMaxSize = source.NdmMaxSize;
|
target.NdmMaxSize = source.NdmMaxSize;
|
||||||
target.NdmMinDivision = source.NdmMinDivision;
|
target.NdmMinDivision = source.NdmMinDivision;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
public IEnumerable<INdm> GetNdms(ICalculationProperty calculationProperty)
|
public IEnumerable<INdm> GetNdms(ICalculationProperty calculationProperty)
|
||||||
{
|
{
|
||||||
var unitSystem = unitSystemService.GetCurrentSystem();
|
var unitSystem = unitSystemService.GetCurrentSystem();
|
||||||
var ndmPrimitives = primitiveRepository.Primitives.Select(x => x.GetNdmPrimitive(unitSystem)).ToArray();
|
var ndmPrimitives = primitiveRepository.Primitives.Select(x => x.GetNdmPrimitive()).ToArray();
|
||||||
|
|
||||||
//Настройки триангуляции, пока опции могут быть только такие
|
//Настройки триангуляции, пока опции могут быть только такие
|
||||||
ITriangulationOptions options = new TriangulationOptions { LimiteState = calculationProperty.LimitState, CalcTerm = calculationProperty.CalcTerm };
|
ITriangulationOptions options = new TriangulationOptions { LimiteState = calculationProperty.LimitState, CalcTerm = calculationProperty.CalcTerm };
|
||||||
|
|||||||
@@ -7,21 +7,18 @@
|
|||||||
xmlns:infrastructure="clr-namespace:StructureHelper.Infrastructure"
|
xmlns:infrastructure="clr-namespace:StructureHelper.Infrastructure"
|
||||||
xmlns:dataTemplates="clr-namespace:StructureHelper.Infrastructure.UI.DataTemplates"
|
xmlns:dataTemplates="clr-namespace:StructureHelper.Infrastructure.UI.DataTemplates"
|
||||||
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
|
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
|
||||||
|
xmlns:vm="clr-namespace:StructureHelper.Windows.MainWindow"
|
||||||
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
|
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
|
||||||
xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow"
|
xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow"
|
||||||
xmlns:enums="clr-namespace:StructureHelper.Infrastructure.Enums"
|
xmlns:enums="clr-namespace:StructureHelper.Infrastructure.Enums"
|
||||||
xmlns:converters ="clr-namespace:StructureHelper.Infrastructure.UI.Converters.Units"
|
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance local:MainViewModel}"
|
d:DataContext="{d:DesignInstance local:MainViewModel}"
|
||||||
Title="StructureHelper" Height="700" Width="1000" MinHeight="400" MinWidth="600">
|
Title="StructureHelper" Height="700" Width="1000" MinHeight="400" MinWidth="600">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<converters:Length x:Key="LengthConverter"/>
|
<DataTemplate DataType="{x:Type dataContexts:RectangleViewPrimitive}">
|
||||||
<converters:Area x:Key="AreaConverter"/>
|
|
||||||
|
|
||||||
<DataTemplate DataType="{x:Type dataContexts:Rectangle}">
|
|
||||||
<dataTemplates:RectangleTemplate/>
|
<dataTemplates:RectangleTemplate/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate DataType="{x:Type dataContexts:Point}">
|
<DataTemplate DataType="{x:Type dataContexts:PointViewPrimitive}">
|
||||||
<dataTemplates:EllipseTemplate/>
|
<dataTemplates:EllipseTemplate/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
@@ -148,7 +145,7 @@
|
|||||||
</i:EventTrigger>
|
</i:EventTrigger>
|
||||||
</i:Interaction.Triggers>
|
</i:Interaction.Triggers>
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible">
|
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible">
|
||||||
<Canvas ClipToBounds="True" Width="{Binding CanvasWidth}" Height="{Binding CanvasHeight}">
|
<Canvas Name="WorkPlane" ClipToBounds="True" Width="{Binding CanvasWidth}" Height="{Binding CanvasHeight}">
|
||||||
<i:Interaction.Behaviors>
|
<i:Interaction.Behaviors>
|
||||||
<infrastructure:MouseBehaviour MouseX="{Binding PanelX, Mode=OneWayToSource}" MouseY="{Binding PanelY, Mode=OneWayToSource}"/>
|
<infrastructure:MouseBehaviour MouseX="{Binding PanelX, Mode=OneWayToSource}" MouseY="{Binding PanelY, Mode=OneWayToSource}"/>
|
||||||
</i:Interaction.Behaviors>
|
</i:Interaction.Behaviors>
|
||||||
@@ -180,9 +177,9 @@
|
|||||||
</DrawingBrush.Drawing>
|
</DrawingBrush.Drawing>
|
||||||
</DrawingBrush>
|
</DrawingBrush>
|
||||||
</Canvas.Background>
|
</Canvas.Background>
|
||||||
<Line X1="0" X2="{Binding XX2}" Y1="{Binding XY1}" Y2="{Binding XY1}" Stroke="Red" StrokeThickness="1"/>
|
<Line X1="0" X2="{Binding XX2}" Y1="{Binding XY1}" Y2="{Binding XY1}" Stroke="Red" StrokeThickness="{Binding AxisLineThickness}"/>
|
||||||
<Line X1="{Binding YX1}" X2="{Binding YX1}" Y1="0" Y2="{Binding YY2}" Stroke="ForestGreen" StrokeThickness="1"/>
|
<Line X1="{Binding YX1}" X2="{Binding YX1}" Y1="0" Y2="{Binding YY2}" Stroke="ForestGreen" StrokeThickness="{Binding AxisLineThickness}"/>
|
||||||
<ItemsControl ItemsSource="{Binding Primitives}" d:DataContext="{d:DesignInstance dataContexts:PrimitiveBase}">
|
<ItemsControl ItemsSource="{Binding Primitives}" d:DataContext="{d:DesignInstance vm:MainViewModel}">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<Canvas/>
|
<Canvas/>
|
||||||
@@ -191,8 +188,8 @@
|
|||||||
<ItemsControl.ItemContainerStyle>
|
<ItemsControl.ItemContainerStyle>
|
||||||
<Style TargetType="ContentPresenter">
|
<Style TargetType="ContentPresenter">
|
||||||
<Setter Property="Canvas.ZIndex" Value="{Binding ZIndex}"/>
|
<Setter Property="Canvas.ZIndex" Value="{Binding ZIndex}"/>
|
||||||
<Setter Property="Canvas.Left" Value="{Binding X, Converter={StaticResource LengthConverter}}"/>
|
<Setter Property="Canvas.Left" Value="{Binding PrimitiveLeft}"/>
|
||||||
<Setter Property="Canvas.Top" Value="{Binding Y, Converter={StaticResource LengthConverter}}"/>
|
<Setter Property="Canvas.Top" Value="{Binding PrimitiveTop}"/>
|
||||||
</Style>
|
</Style>
|
||||||
</ItemsControl.ItemContainerStyle>
|
</ItemsControl.ItemContainerStyle>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using StructureHelper.Infrastructure.UI.DataContexts;
|
|||||||
using StructureHelper.Infrastructure.UI.PrimitiveTemplates;
|
using StructureHelper.Infrastructure.UI.PrimitiveTemplates;
|
||||||
using StructureHelper.MaterialCatalogWindow;
|
using StructureHelper.MaterialCatalogWindow;
|
||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelper.Models.Primitives.Factories;
|
||||||
using StructureHelper.Services.Primitives;
|
using StructureHelper.Services.Primitives;
|
||||||
using StructureHelper.UnitSystem;
|
using StructureHelper.UnitSystem;
|
||||||
using StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow;
|
using StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow;
|
||||||
@@ -20,7 +21,9 @@ using StructureHelperCommon.Infrastructures.Enums;
|
|||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Strings;
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
using StructureHelperLogics.Models.Templates.RCs;
|
using StructureHelperLogics.Models.Templates.RCs;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using StructureHelperLogics.Services.NdmCalculations;
|
using StructureHelperLogics.Services.NdmCalculations;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -34,14 +37,14 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
{
|
{
|
||||||
public class MainViewModel : ViewModelBase
|
public class MainViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
|
const double ConstAxisLineThickness = 2d;
|
||||||
|
|
||||||
private List<IHeadMaterial> headMaterials;
|
private List<IHeadMaterial> headMaterials;
|
||||||
private readonly double scaleRate = 1.1;
|
private readonly double scaleRate = 1.1;
|
||||||
|
|
||||||
private IPrimitiveRepository PrimitiveRepository { get; }
|
private IPrimitiveRepository PrimitiveRepository { get; }
|
||||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||||
|
|
||||||
private readonly UnitSystemService unitSystemService;
|
|
||||||
|
|
||||||
private MainModel Model { get; }
|
private MainModel Model { get; }
|
||||||
public ObservableCollection<PrimitiveBase> Primitives { get; set; }
|
public ObservableCollection<PrimitiveBase> Primitives { get; set; }
|
||||||
|
|
||||||
@@ -75,7 +78,18 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
public double ScaleValue
|
public double ScaleValue
|
||||||
{
|
{
|
||||||
get => scaleValue;
|
get => scaleValue;
|
||||||
set => OnPropertyChanged(value, ref scaleValue);
|
set
|
||||||
|
{
|
||||||
|
OnPropertyChanged(value, ref scaleValue);
|
||||||
|
axisLineThickness = ConstAxisLineThickness / scaleValue;
|
||||||
|
OnPropertyChanged(nameof(AxisLineThickness));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double AxisLineThickness
|
||||||
|
{
|
||||||
|
get =>axisLineThickness == 0d? ConstAxisLineThickness: axisLineThickness;
|
||||||
|
set { axisLineThickness = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private double canvasWidth, canvasHeight, xX2, xY1, yX1, yY2;
|
private double canvasWidth, canvasHeight, xX2, xY1, yX1, yY2;
|
||||||
@@ -149,16 +163,14 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
public ICommand SetPopupCanBeClosedTrue { get; }
|
public ICommand SetPopupCanBeClosedTrue { get; }
|
||||||
public ICommand SetPopupCanBeClosedFalse { get; }
|
public ICommand SetPopupCanBeClosedFalse { get; }
|
||||||
|
|
||||||
public string UnitsSystemName => unitSystemService.GetCurrentSystem().Name;
|
|
||||||
|
|
||||||
private double delta = 0.0005;
|
private double delta = 0.0005;
|
||||||
|
private double axisLineThickness;
|
||||||
|
|
||||||
public MainViewModel(MainModel model, IPrimitiveRepository primitiveRepository, UnitSystemService unitSystemService)
|
public MainViewModel(MainModel model, IPrimitiveRepository primitiveRepository, UnitSystemService unitSystemService)
|
||||||
{
|
{
|
||||||
PrimitiveRepository = primitiveRepository;
|
PrimitiveRepository = primitiveRepository;
|
||||||
Model = model;
|
Model = model;
|
||||||
headMaterials = Model.HeadMaterialRepository.HeadMaterials;
|
headMaterials = Model.HeadMaterialRepository.HeadMaterials;
|
||||||
this.unitSystemService = unitSystemService;
|
|
||||||
CanvasWidth = 1500;
|
CanvasWidth = 1500;
|
||||||
CanvasHeight = 1000;
|
CanvasHeight = 1000;
|
||||||
XX2 = CanvasWidth;
|
XX2 = CanvasWidth;
|
||||||
@@ -169,25 +181,25 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
|
|
||||||
LeftButtonUp = new RelayCommand(o =>
|
LeftButtonUp = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
if (o is Rectangle rect) rect.BorderCaptured = false;
|
if (o is RectangleViewPrimitive rect) rect.BorderCaptured = false;
|
||||||
});
|
});
|
||||||
LeftButtonDown = new RelayCommand(o =>
|
LeftButtonDown = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
if (o is Rectangle rect) rect.BorderCaptured = true;
|
if (o is RectangleViewPrimitive rect) rect.BorderCaptured = true;
|
||||||
});
|
});
|
||||||
PreviewMouseMove = new RelayCommand(o =>
|
PreviewMouseMove = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
if (o is Rectangle rect && rect.BorderCaptured && !rect.ElementLock)
|
if (o is RectangleViewPrimitive rect && rect.BorderCaptured && !rect.ElementLock)
|
||||||
{
|
{
|
||||||
if (rect.PrimitiveWidth % 10d < delta || rect.PrimitiveWidth % 10d >= delta)
|
if (rect.PrimitiveWidth % 10d < delta || rect.PrimitiveWidth % 10d >= delta)
|
||||||
rect.PrimitiveWidth = Math.Round(PanelX / 10d) * 10d - rect.X + 10d;
|
rect.PrimitiveWidth = Math.Round(PanelX / 10d) * 10d - rect.PrimitiveLeft + 10d;
|
||||||
else
|
else
|
||||||
rect.PrimitiveWidth = PanelX - rect.X + 10d;
|
rect.PrimitiveWidth = PanelX - rect.PrimitiveLeft + 10d;
|
||||||
|
|
||||||
if (rect.PrimitiveHeight % 10d < delta || rect.PrimitiveHeight % 10d >= delta)
|
if (rect.PrimitiveHeight % 10d < delta || rect.PrimitiveHeight % 10d >= delta)
|
||||||
rect.PrimitiveHeight = Math.Round(PanelY / 10d) * 10d - rect.Y + 10d;
|
rect.PrimitiveHeight = Math.Round(PanelY / 10d) * 10d - rect.PrimitiveTop + 10d;
|
||||||
else
|
else
|
||||||
rect.PrimitiveHeight = PanelY - rect.Y + 10d;
|
rect.PrimitiveHeight = PanelY - rect.PrimitiveTop + 10d;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ClearSelection = new RelayCommand(o =>
|
ClearSelection = new RelayCommand(o =>
|
||||||
@@ -211,10 +223,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
var materialCatalogView = new MaterialCatalogView(true, primitive);
|
var materialCatalogView = new MaterialCatalogView(true, primitive);
|
||||||
materialCatalogView.ShowDialog();
|
materialCatalogView.ShowDialog();
|
||||||
});
|
});
|
||||||
OpenUnitsSystemSettings = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
OnPropertyChanged(nameof(UnitsSystemName));
|
|
||||||
});
|
|
||||||
SetColor = new RelayCommand(o =>
|
SetColor = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
var primitive = o as PrimitiveBase;
|
var primitive = o as PrimitiveBase;
|
||||||
@@ -259,18 +268,33 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
AddPrimitive = new RelayCommand(o =>
|
AddPrimitive = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
if (!(o is PrimitiveType primitiveType)) return;
|
if (!(o is PrimitiveType primitiveType)) return;
|
||||||
PrimitiveBase primitive;
|
PrimitiveBase viewPrimitive;
|
||||||
|
INdmPrimitive ndmPrimitive;
|
||||||
if (primitiveType == PrimitiveType.Rectangle)
|
if (primitiveType == PrimitiveType.Rectangle)
|
||||||
{
|
{
|
||||||
primitive = new Rectangle(0.60, 0.40, 0, 0, this);
|
var primitive = new RectanglePrimitive
|
||||||
|
{
|
||||||
|
Width = 0.4d,
|
||||||
|
Height = 0.6d
|
||||||
|
};
|
||||||
|
ndmPrimitive = primitive;
|
||||||
|
viewPrimitive = new RectangleViewPrimitive(primitive);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (primitiveType == PrimitiveType.Point)
|
else if (primitiveType == PrimitiveType.Point)
|
||||||
{
|
{
|
||||||
primitive = new Point(0.0005d, 0d, 0d, this);
|
var primitive = new PointPrimitive
|
||||||
|
{
|
||||||
|
Area = 0.0005d
|
||||||
|
};
|
||||||
|
ndmPrimitive = primitive;
|
||||||
|
viewPrimitive = new PointViewPrimitive(primitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(primitiveType)); }
|
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(primitiveType)); }
|
||||||
Primitives.Add(primitive);
|
viewPrimitive.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
||||||
PrimitiveRepository.Add(primitive);
|
Primitives.Add(viewPrimitive);
|
||||||
|
PrimitiveRepository.Add(viewPrimitive);
|
||||||
});
|
});
|
||||||
|
|
||||||
DeletePrimitive = new RelayCommand(
|
DeletePrimitive = new RelayCommand(
|
||||||
@@ -461,13 +485,6 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
if (wnd.DialogResult == true)
|
if (wnd.DialogResult == true)
|
||||||
{
|
{
|
||||||
var rect = template.Shape as StructureHelperCommon.Models.Shapes.RectangleShape;
|
|
||||||
var width = rect.Width;
|
|
||||||
var height = rect.Height;
|
|
||||||
var area1 = Math.PI * template.BottomDiameter * template.BottomDiameter / 4d;
|
|
||||||
var area2 = Math.PI * template.TopDiameter * template.TopDiameter / 4d;
|
|
||||||
var gap = template.CoverGap;
|
|
||||||
|
|
||||||
IHeadMaterial concrete = new HeadMaterial() { Name = "Concrete" };
|
IHeadMaterial concrete = new HeadMaterial() { Name = "Concrete" };
|
||||||
concrete.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Concrete & x.Name.Contains("40"))).First();
|
concrete.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Concrete & x.Name.Contains("40"))).First();
|
||||||
IHeadMaterial reinforcement = new HeadMaterial() { Name = "Reinforcement" };
|
IHeadMaterial reinforcement = new HeadMaterial() { Name = "Reinforcement" };
|
||||||
@@ -475,38 +492,14 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
headMaterials.Add(concrete);
|
headMaterials.Add(concrete);
|
||||||
headMaterials.Add(reinforcement);
|
headMaterials.Add(reinforcement);
|
||||||
OnPropertyChanged(nameof(headMaterials));
|
OnPropertyChanged(nameof(headMaterials));
|
||||||
|
var primitives = PrimitiveFactory.GetRectangleRCElement(template, concrete, reinforcement);
|
||||||
double[] xs = new double[] { -width / 2 + gap, width / 2 - gap };
|
foreach (var item in primitives)
|
||||||
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
|
||||||
|
|
||||||
yield return new Rectangle(width, height, 0, 0, this) { HeadMaterial = concrete, Name = "Concrete block" };
|
|
||||||
yield return new Point(area1, xs[0], ys[0], this) { HeadMaterial = reinforcement, Name = "Left bottom point" };
|
|
||||||
yield return new Point(area1, xs[1], ys[0], this) { HeadMaterial = reinforcement, Name = "Right bottom point" };
|
|
||||||
yield return new Point(area2, xs[0], ys[1], this) { HeadMaterial = reinforcement, Name = "Left top point" };
|
|
||||||
yield return new Point(area2, xs[1], ys[1], this) { HeadMaterial = reinforcement, Name = "Right top point" };
|
|
||||||
|
|
||||||
if (template.WidthCount > 2)
|
|
||||||
{
|
{
|
||||||
int count = template.WidthCount - 1;
|
item.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
||||||
double dist = (xs[1] - xs[0]) / count;
|
|
||||||
for (int i = 1; i < count; i++)
|
|
||||||
{
|
|
||||||
yield return new Point(area1, xs[0] + dist * i, ys[0], this) { HeadMaterial = reinforcement, Name = $"Bottom point {i}" };
|
|
||||||
yield return new Point(area2, xs[0] + dist * i, ys[1], this) { HeadMaterial = reinforcement, Name = $"Top point {i}" };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (template.HeightCount > 2)
|
|
||||||
{
|
|
||||||
int count = template.HeightCount - 1;
|
|
||||||
double dist = (ys[1] - ys[0]) / count;
|
|
||||||
for (int i = 1; i < count; i++)
|
|
||||||
{
|
|
||||||
yield return new Point(area1, xs[0], ys[0] + dist * i, this) { HeadMaterial = reinforcement, Name = $"Left point {i}" };
|
|
||||||
yield return new Point(area1, xs[1], ys[0] + dist * i, this) { HeadMaterial = reinforcement, Name = $"Right point {i}" };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return primitives;
|
||||||
}
|
}
|
||||||
|
return new List<PrimitiveBase>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,8 +16,8 @@ using System.Windows.Media;
|
|||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Point = StructureHelper.Infrastructure.UI.DataContexts.Point;
|
using PointViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.PointViewPrimitive;
|
||||||
using Rectangle = StructureHelper.Infrastructure.UI.DataContexts.Rectangle;
|
using RectangleViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.RectangleViewPrimitive;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.PrimitiveProperiesWindow
|
namespace StructureHelper.Windows.PrimitiveProperiesWindow
|
||||||
{
|
{
|
||||||
@@ -34,23 +34,16 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
|
|||||||
viewModel = new PrimitivePropertiesViewModel(this.primitive, materialRepository);
|
viewModel = new PrimitivePropertiesViewModel(this.primitive, materialRepository);
|
||||||
this.DataContext = viewModel;
|
this.DataContext = viewModel;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
if (primitive is Rectangle) { AddPrimitiveProperties(PrimitiveType.Rectangle); }
|
if (primitive is RectangleViewPrimitive) { AddPrimitiveProperties(PrimitiveType.Rectangle); }
|
||||||
else if (primitive is Point) { AddPrimitiveProperties(PrimitiveType.Point); }
|
else if (primitive is PointViewPrimitive) { AddPrimitiveProperties(PrimitiveType.Point); }
|
||||||
else { throw new Exception("Type of object is unknown"); }
|
else { throw new Exception("Type of object is unknown"); }
|
||||||
}
|
}
|
||||||
private void AddPrimitiveProperties(PrimitiveType type)
|
private void AddPrimitiveProperties(PrimitiveType type)
|
||||||
{
|
{
|
||||||
List<string> names = new List<string>();
|
List<string> names = new List<string>();
|
||||||
if (type == PrimitiveType.Rectangle)
|
if (primitive is IHasDivision) { names.Add("TriangulationProperties");}
|
||||||
{
|
if (primitive is RectangleViewPrimitive) { names.Add("RectangleProperties"); }
|
||||||
names.Add("TriangulationProperties");
|
else if (primitive is PointViewPrimitive) { names.Add("PointProperties"); }
|
||||||
names.Add("RectangleProperties");
|
|
||||||
}
|
|
||||||
else if (type == PrimitiveType.Point)
|
|
||||||
{
|
|
||||||
names.Add("PointProperties");
|
|
||||||
}
|
|
||||||
else { throw new Exception("Type of object is unknown"); }
|
|
||||||
foreach (var name in names)
|
foreach (var name in names)
|
||||||
{
|
{
|
||||||
ContentControl contentControl = new ContentControl();
|
ContentControl contentControl = new ContentControl();
|
||||||
@@ -16,8 +16,8 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Point = StructureHelper.Infrastructure.UI.DataContexts.Point;
|
using PointViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.PointViewPrimitive;
|
||||||
using Rectangle = StructureHelper.Infrastructure.UI.DataContexts.Rectangle;
|
using RectangleViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.RectangleViewPrimitive;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||||
{
|
{
|
||||||
@@ -41,15 +41,7 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
OnPropertyChanged(nameof(Name));
|
OnPropertyChanged(nameof(Name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string MaterialName
|
|
||||||
{
|
|
||||||
get => primitive.MaterialName;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
primitive.Name = value;
|
|
||||||
OnPropertyChanged(nameof(MaterialName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public IHeadMaterial PrimitiveMaterial
|
public IHeadMaterial PrimitiveMaterial
|
||||||
{ get => primitive.HeadMaterial;
|
{ get => primitive.HeadMaterial;
|
||||||
set
|
set
|
||||||
@@ -70,8 +62,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
{
|
{
|
||||||
primitive.CenterX = value;
|
primitive.CenterX = value;
|
||||||
OnPropertyChanged(nameof(CenterX));
|
OnPropertyChanged(nameof(CenterX));
|
||||||
OnPropertyChanged(nameof(primitive.ShowedX));
|
|
||||||
OnPropertyChanged(nameof(primitive.X));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -82,8 +72,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
{
|
{
|
||||||
primitive.CenterY = value;
|
primitive.CenterY = value;
|
||||||
OnPropertyChanged(nameof(CenterY));
|
OnPropertyChanged(nameof(CenterY));
|
||||||
OnPropertyChanged(nameof(primitive.ShowedY));
|
|
||||||
OnPropertyChanged("Y");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,36 +93,40 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
|
|
||||||
public int MinElementDivision
|
public int MinElementDivision
|
||||||
{
|
{
|
||||||
get => primitive.MinElementDivision;
|
get => (primitive as IHasDivision).NdmMinDivision;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
primitive.MinElementDivision = value;
|
(primitive as IHasDivision).NdmMinDivision = value;
|
||||||
OnPropertyChanged(nameof(MinElementDivision));
|
OnPropertyChanged(nameof(MinElementDivision));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double MaxElementSize
|
public double MaxElementSize
|
||||||
{
|
{
|
||||||
get => primitive.MaxElementSize;
|
get => (primitive as IHasDivision).NdmMaxSize;
|
||||||
set { primitive.MaxElementSize = value; }
|
set
|
||||||
|
{
|
||||||
|
(primitive as IHasDivision).NdmMaxSize = value;
|
||||||
|
OnPropertyChanged(nameof(MaxElementSize));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double Width
|
public double Width
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (primitive is Rectangle)
|
if (primitive is RectangleViewPrimitive)
|
||||||
{
|
{
|
||||||
var shape = primitive as Rectangle;
|
var shape = primitive as RectangleViewPrimitive;
|
||||||
return shape.PrimitiveWidth;
|
return shape.PrimitiveWidth;
|
||||||
}
|
}
|
||||||
return 0d;
|
return 0d;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (primitive is Rectangle)
|
if (primitive is RectangleViewPrimitive)
|
||||||
{
|
{
|
||||||
var shape = primitive as Rectangle;
|
var shape = primitive as RectangleViewPrimitive;
|
||||||
shape.PrimitiveWidth = value;
|
shape.PrimitiveWidth = value;
|
||||||
}
|
}
|
||||||
CenterX = CenterX;
|
CenterX = CenterX;
|
||||||
@@ -145,18 +137,18 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (primitive is Rectangle)
|
if (primitive is RectangleViewPrimitive)
|
||||||
{
|
{
|
||||||
var shape = primitive as Rectangle;
|
var shape = primitive as RectangleViewPrimitive;
|
||||||
return shape.PrimitiveHeight;
|
return shape.PrimitiveHeight;
|
||||||
}
|
}
|
||||||
return 0d;
|
return 0d;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (primitive is Rectangle)
|
if (primitive is RectangleViewPrimitive)
|
||||||
{
|
{
|
||||||
var shape = primitive as Rectangle;
|
var shape = primitive as RectangleViewPrimitive;
|
||||||
shape.PrimitiveHeight = value;
|
shape.PrimitiveHeight = value;
|
||||||
}
|
}
|
||||||
CenterY = CenterY; ;
|
CenterY = CenterY; ;
|
||||||
@@ -167,18 +159,18 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (primitive is Point)
|
if (primitive is PointViewPrimitive)
|
||||||
{
|
{
|
||||||
var shape = primitive as Point;
|
var shape = primitive as PointViewPrimitive;
|
||||||
return shape.Area;
|
return shape.Area;
|
||||||
}
|
}
|
||||||
return 0d;
|
return 0d;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (primitive is Point)
|
if (primitive is PointViewPrimitive)
|
||||||
{
|
{
|
||||||
var shape = primitive as Point;
|
var shape = primitive as PointViewPrimitive;
|
||||||
shape.Area = value;
|
shape.Area = value;
|
||||||
OnPropertyChanged(nameof(Area));
|
OnPropertyChanged(nameof(Area));
|
||||||
OnPropertyChanged(nameof(shape.Diameter));
|
OnPropertyChanged(nameof(shape.Diameter));
|
||||||
|
|||||||
22
Windows/ViewModels/Primitives/RectangleControlViewModel.cs
Normal file
22
Windows/ViewModels/Primitives/RectangleControlViewModel.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Primitives
|
||||||
|
{
|
||||||
|
internal class RectangleControlViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
private RectangleViewPrimitive primitive;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public RectangleControlViewModel(RectangleViewPrimitive _primitive)
|
||||||
|
{
|
||||||
|
primitive = _primitive;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user