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