diff --git a/StructureHelper/App.xaml b/StructureHelper/App.xaml
index dce5889..04fc9ba 100644
--- a/StructureHelper/App.xaml
+++ b/StructureHelper/App.xaml
@@ -18,6 +18,7 @@
+
diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataView.xaml b/StructureHelper/Infrastructure/UI/Resources/LimitCurveTemplates.xaml
similarity index 56%
rename from StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataView.xaml
rename to StructureHelper/Infrastructure/UI/Resources/LimitCurveTemplates.xaml
index 8e903bc..ce0d4a3 100644
--- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataView.xaml
+++ b/StructureHelper/Infrastructure/UI/Resources/LimitCurveTemplates.xaml
@@ -1,18 +1,8 @@
-
-
-
-
-
-
+
+
+
@@ -29,7 +19,7 @@
-
+
@@ -37,16 +27,19 @@
-
-
+
+
+
-
-
-
-
+
+
+
+
+
@@ -56,16 +49,19 @@
-
-
+
+
+
-
-
-
-
+
+
+
+
+
@@ -74,13 +70,15 @@
-
-
+
+
+
-
-
+
+
+
@@ -94,10 +92,9 @@
-
+
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/StructureHelper/StructureHelper.csproj.user b/StructureHelper/StructureHelper.csproj.user
index b51796c..e662ca4 100644
--- a/StructureHelper/StructureHelper.csproj.user
+++ b/StructureHelper/StructureHelper.csproj.user
@@ -12,7 +12,10 @@
Code
-
+
+ Code
+
+
Code
@@ -56,13 +59,19 @@
Designer
+
+ Designer
+
Designer
Designer
-
+
+ Designer
+
+
Designer
diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/InteractionDiagramLogic.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/InteractionDiagramLogic.cs
index d39a23d..1f8e896 100644
--- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/InteractionDiagramLogic.cs
+++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/InteractionDiagramLogic.cs
@@ -85,7 +85,8 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
{
var valueList = new List
{
- items[i].X * unitForce.Multiplyer,
+ // to do repair multiplay by surround data
+ items[i].X * unitForce.Multiplyer,
items[i].Y * unitMoment.Multiplyer
};
for (int j = 0; j < valueList.Count; j++)
diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/LimitCurveDataView.xaml b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/LimitCurveDataView.xaml
new file mode 100644
index 0000000..86fc3aa
--- /dev/null
+++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/LimitCurveDataView.xaml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/LimitCurveDataView.xaml.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/LimitCurveDataView.xaml.cs
new file mode 100644
index 0000000..d14f3b0
--- /dev/null
+++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/LimitCurveDataView.xaml.cs
@@ -0,0 +1,35 @@
+using StructureHelper.Windows.UserControls;
+using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic
+{
+ ///
+ /// Логика взаимодействия для SurroundDataView.xaml
+ ///
+ public partial class LimitCurveDataView : Window
+ {
+ private LimitCurveDataViewModel viewModel;
+ public LimitCurveDataView(SurroundData surroundData) : this(new LimitCurveDataViewModel(surroundData)) { }
+ public LimitCurveDataView(LimitCurveDataViewModel vm)
+ {
+ viewModel = vm;
+ viewModel.ParentWindow = this;
+ DataContext = viewModel;
+ InitializeComponent();
+ SurData.SurroundData = vm.SurroundData;
+ }
+ }
+}
diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/LimitCurveDataViewModel.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/LimitCurveDataViewModel.cs
new file mode 100644
index 0000000..8605a33
--- /dev/null
+++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/LimitCurveDataViewModel.cs
@@ -0,0 +1,32 @@
+using StructureHelper.Infrastructure.UI.Converters.Units;
+using StructureHelper.Windows.ViewModels;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Models.Shapes;
+using StructureHelperCommon.Services.Units;
+using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
+using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Windows.Data;
+
+//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
+//All rights reserved.
+
+namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic
+{
+ public class LimitCurveDataViewModel : OkCancelViewModelBase
+ {
+ //public SurroundDataViewModel SurroundDataViewModel { get; private set; }
+ public SurroundData SurroundData { get; set; }
+
+ public LimitCurveDataViewModel(SurroundData surroundData)
+ {
+ //SurroundDataViewModel = new(surroundData);
+ SurroundData = surroundData;
+ }
+
+ }
+}
diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataView.xaml.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataView.xaml.cs
deleted file mode 100644
index 1289d55..0000000
--- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataView.xaml.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using StructureHelper.Windows.UserControls;
-using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-
-namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic
-{
- ///
- /// Логика взаимодействия для SurroundDataView.xaml
- ///
- public partial class SurroundDataView : Window
- {
- private SurroundDataViewModel viewModel;
- public SurroundDataView(SurroundData surroundData) : this(new SurroundDataViewModel(surroundData)) { }
- public SurroundDataView(SurroundDataViewModel vm)
- {
- viewModel = vm;
- viewModel.ParentWindow = this;
- DataContext = viewModel;
- InitializeComponent();
- }
-
- private void XmaxChanged(object sender, EventArgs e)
- {
- viewModel.XMax *= ChangeValue(sender);
- }
- private void XminChanged(object sender, EventArgs e)
- {
- viewModel.XMin *= ChangeValue(sender);
- }
-
- private void YmaxChanged(object sender, EventArgs e)
- {
- viewModel.YMax *= ChangeValue(sender);
- }
- private void YminChanged(object sender, EventArgs e)
- {
- viewModel.YMin *= ChangeValue(sender);
- }
- private void ConstZChanged(object sender, EventArgs e)
- {
- viewModel.ConstZ *= ChangeValue(sender);
- }
- private void PointCountChanged(object sender, EventArgs e)
- {
- viewModel.PointCount = Convert.ToInt32(viewModel.PointCount * ChangeValue(sender));
- }
-
- private double ChangeValue(object sender)
- {
- var obj = (MultiplyDouble)sender;
- var factor = obj.DoubleFactor;
- return factor;
- }
- }
-}
diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataViewModel.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataViewModel.cs
deleted file mode 100644
index 9570076..0000000
--- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataViewModel.cs
+++ /dev/null
@@ -1,141 +0,0 @@
-using StructureHelper.Infrastructure.UI.Converters.Units;
-using StructureHelper.Windows.ViewModels;
-using StructureHelperCommon.Models.Shapes;
-using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
-using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Data;
-
-namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic
-{
- public class SurroundDataViewModel : OkCancelViewModelBase, IDataErrorInfo
- {
- private readonly SurroundData surroundData;
- public IValueConverter XValueConverter { get => new Force(); }
- public IValueConverter YValueConverter { get => new Moment();}
- public IValueConverter ZValueConverter { get => new Moment(); }
- public List Logics { get; }
- public ConstOneDirectionConverter Logic
- {
- get
- {
- var logic = surroundData.ConvertLogicEntity;
- return logic;
- }
- set
- {
- surroundData.ConvertLogicEntity = value;
- OnPropertyChanged(nameof(Logic));
- OnPropertyChanged(nameof(XLabel));
- OnPropertyChanged(nameof(YLabel));
- OnPropertyChanged(nameof(ZLabel));
- }
- }
-
- public string XLabel { get => surroundData.ConvertLogicEntity.XAxisName; }
- public string YLabel { get => surroundData.ConvertLogicEntity.YAxisName; }
- public string ZLabel { get => surroundData.ConvertLogicEntity.ConstAxisName; }
-
- public double XMax
- {
- get => surroundData.XMax; set
- {
- surroundData.XMax = value;
- OnPropertyChanged(nameof(XMax));
- }
- }
- public double XMin
- {
- get => surroundData.XMin; set
- {
- surroundData.XMin = value;
- OnPropertyChanged(nameof(XMin));
- }
- }
- public double YMax
- {
- get => surroundData.YMax; set
- {
- surroundData.YMax = value;
- OnPropertyChanged(nameof(YMax));
- }
- }
- public double YMin
- {
- get => surroundData.YMin; set
- {
- surroundData.YMin = value;
- OnPropertyChanged(nameof(YMin));
- }
- }
- public double ConstZ
- {
- get => surroundData.ConstZ; set
- {
- surroundData.ConstZ = value;
- OnPropertyChanged(nameof(ConstZ));
- }
- }
- public int PointCount
- {
- get => surroundData.PointCount; set
- {
- try
- {
- surroundData.PointCount = value;
- }
- catch (Exception)
- {
- surroundData.PointCount = 40;
- }
- OnPropertyChanged(nameof(PointCount));
- }
- }
-
- public string Error => throw new NotImplementedException();
-
- public string this[string columnName]
- {
- get
- {
- string error = String.Empty;
- switch (columnName)
- {
- case nameof(PointCount):
- if (PointCount < 24)
- {
- error = "Point count must be greater than 24";
- }
- break;
- }
- return error;
- }
- }
-
- public SurroundDataViewModel(SurroundData surroundData)
- {
- this.surroundData = surroundData;
- Logics = new();
- Logics.AddRange(ConvertLogics.ConverterLogics);
- Logic = Logics
- .Where(x => x.Id == surroundData.ConvertLogicEntity.Id)
- .Single();
- OnPropertyChanged(nameof(Logic));
- }
-
- internal void RefreshAll()
- {
- OnPropertyChanged(nameof(XMax));
- OnPropertyChanged(nameof(XMin));
- OnPropertyChanged(nameof(YMax));
- OnPropertyChanged(nameof(YMin));
- OnPropertyChanged(nameof(ConstZ));
- OnPropertyChanged(nameof(PointCount));
- }
- }
-}
diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsViewModel.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsViewModel.cs
index 7e21edd..cc873a7 100644
--- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsViewModel.cs
+++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsViewModel.cs
@@ -77,7 +77,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
var tuple = SelectedResult.DesignForceTuple.ForceTuple.Clone() as ForceTuple;
var data = new SurroundData();
//data.ConstZ = tuple.My;
- var wnd = new SurroundDataView(data);
+ var wnd = new LimitCurveDataView(data);
wnd.ShowDialog();
if (wnd.DialogResult != true) return;
interactionDiagramLogic = new(data)
diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/InteractionDiagramCalculatorView.xaml b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/InteractionDiagramCalculatorView.xaml
index 2824ef3..3268bdb 100644
--- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/InteractionDiagramCalculatorView.xaml
+++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/InteractionDiagramCalculatorView.xaml
@@ -14,10 +14,7 @@
-
-
-
-
+
diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/UserControls/SurroundDataControl.xaml b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/UserControls/SurroundDataControl.xaml
new file mode 100644
index 0000000..99606ea
--- /dev/null
+++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/UserControls/SurroundDataControl.xaml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/UserControls/SurroundDataControl.xaml.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/UserControls/SurroundDataControl.xaml.cs
new file mode 100644
index 0000000..2f53e31
--- /dev/null
+++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/UserControls/SurroundDataControl.xaml.cs
@@ -0,0 +1,105 @@
+using StructureHelper.Windows.UserControls;
+using StructureHelper.Windows.ViewModels.Materials;
+using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
+{
+ ///
+ /// Логика взаимодействия для SorroundDataControl.xaml
+ ///
+ public partial class SurroundDataControl : UserControl
+ {
+ // Using a DependencyProperty as the backing store for SurroundData.
+ // This enables animation, styling, binding, etc...
+ public static readonly DependencyProperty SurroundDataProperty =
+ DependencyProperty.Register(
+ "SurroundData",
+ typeof(SurroundData), // Change to the actual type of SurroundData
+ typeof(SurroundDataControl),
+ new PropertyMetadata(null, OnSurroundDataChanged));
+
+ private static void OnSurroundDataChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ SurroundDataControl surroundDataControl = (SurroundDataControl)d;
+ SurroundData newValue = (SurroundData)e.NewValue;
+
+ // Handle any additional logic when the SurroundData property changes
+
+ // Example: Update ViewModel.SurroundData
+ surroundDataControl.ViewModel.SurroundData = newValue;
+ }
+
+ private SurroundData surroundData;
+ public SurroundDataViewModel ViewModel { get; private set; }
+
+ public SurroundData SurroundData
+ {
+ get => (SurroundData)GetValue(SurroundDataProperty);
+ set
+ {
+ SetValue(SurroundDataProperty, value);
+ }
+ }
+
+ public SurroundDataControl()
+ {
+ if (SurroundData is null)
+ {
+ ViewModel = new SurroundDataViewModel(new() { PointCount = 40 });
+ }
+ else
+ {
+ ViewModel = new SurroundDataViewModel(SurroundData);
+ }
+ DataContext = this; // ViewModel;
+ InitializeComponent();
+ }
+
+ private void XmaxChanged(object sender, EventArgs e)
+ {
+ ViewModel.XMax *= ChangeValue(sender);
+ }
+ private void XminChanged(object sender, EventArgs e)
+ {
+ ViewModel.XMin *= ChangeValue(sender);
+ }
+
+ private void YmaxChanged(object sender, EventArgs e)
+ {
+ ViewModel.YMax *= ChangeValue(sender);
+ }
+ private void YminChanged(object sender, EventArgs e)
+ {
+ ViewModel.YMin *= ChangeValue(sender);
+ }
+ private void ConstZChanged(object sender, EventArgs e)
+ {
+ ViewModel.ConstZ *= ChangeValue(sender);
+ }
+ private void PointCountChanged(object sender, EventArgs e)
+ {
+ ViewModel.PointCount = Convert.ToInt32(ViewModel.PointCount * ChangeValue(sender));
+ }
+
+ private double ChangeValue(object sender)
+ {
+ var obj = (MultiplyDouble)sender;
+ var factor = obj.DoubleFactor;
+ return factor;
+ }
+ }
+}
diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/UserControls/SurroundDataViewModel.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/UserControls/SurroundDataViewModel.cs
new file mode 100644
index 0000000..9f5209f
--- /dev/null
+++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/UserControls/SurroundDataViewModel.cs
@@ -0,0 +1,242 @@
+using StructureHelper.Infrastructure.UI.Converters.Units;
+using StructureHelper.Windows.ViewModels;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Models.Shapes;
+using StructureHelperCommon.Services.Units;
+using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
+using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Windows.Data;
+
+//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
+//All rights reserved.
+
+namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
+{
+ public class SurroundDataViewModel : OkCancelViewModelBase, IDataErrorInfo
+ {
+ const string ForceUnitString = "kN";
+ const string MomentUnitString = "kNm";
+
+ public SurroundData SurroundData
+ {
+ get => surroundData; set
+ {
+ surroundData = value;
+ RefreshAll();
+ }
+ }
+
+ private void RefreshAll()
+ {
+ OnPropertyChanged(nameof(Logic));
+ OnPropertyChanged(nameof(XMax));
+ OnPropertyChanged(nameof(XMin));
+ OnPropertyChanged(nameof(YMax));
+ OnPropertyChanged(nameof(YMin));
+ OnPropertyChanged(nameof(ConstZ));
+ OnPropertyChanged(nameof(PointCount));
+ OnPropertyChanged(nameof(XLabel));
+ OnPropertyChanged(nameof(YLabel));
+ OnPropertyChanged(nameof(ZLabel));
+ OnPropertyChanged(nameof(XUnitLabel));
+ OnPropertyChanged(nameof(YUnitLabel));
+ OnPropertyChanged(nameof(ZUnitLabel));
+ }
+
+ private static readonly IUnit unitForce = CommonOperation.GetUnit(UnitTypes.Force, ForceUnitString);
+ private static readonly IUnit unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, MomentUnitString);
+ private SurroundData surroundData;
+
+ public IValueConverter ForceConverter { get => new Force(); }
+ public IValueConverter MomentConverter { get => new Moment();}
+ public List Logics { get; }
+ public ConstOneDirectionConverter Logic
+ {
+ get
+ {
+ var logic = SurroundData.ConvertLogicEntity;
+ return logic;
+ }
+ set
+ {
+ SurroundData.ConvertLogicEntity = value;
+ OnPropertyChanged(nameof(Logic));
+ OnPropertyChanged(nameof(XLabel));
+ OnPropertyChanged(nameof(YLabel));
+ OnPropertyChanged(nameof(ZLabel));
+ OnPropertyChanged(nameof(XUnitLabel));
+ OnPropertyChanged(nameof(YUnitLabel));
+ OnPropertyChanged(nameof(ZUnitLabel));
+ }
+ }
+
+ public string XLabel { get => SurroundData.ConvertLogicEntity.XAxisName; }
+ public string YLabel { get => SurroundData.ConvertLogicEntity.YAxisName; }
+ public string ZLabel { get => SurroundData.ConvertLogicEntity.ConstAxisName; }
+ public string XUnitLabel => GetLabel(SurroundData.ConvertLogicEntity.XForceType);
+ public string YUnitLabel => GetLabel(SurroundData.ConvertLogicEntity.YForceType);
+ public string ZUnitLabel => GetLabel(SurroundData.ConvertLogicEntity.ZForceType);
+
+ public double XMax
+ {
+ get
+ {
+ var factor = GetFactor(SurroundData.ConvertLogicEntity.XForceType);
+ return SurroundData.XMax * factor;
+ }
+
+ set
+ {
+ var factor = GetFactor(SurroundData.ConvertLogicEntity.XForceType);
+ SurroundData.XMax = value / factor;
+ OnPropertyChanged(nameof(XMax));
+ }
+ }
+
+ public double XMin
+ {
+ get
+ {
+ var factor = GetFactor(SurroundData.ConvertLogicEntity.XForceType);
+ return SurroundData.XMin * factor;
+ }
+
+ set
+ {
+ var factor = GetFactor(SurroundData.ConvertLogicEntity.XForceType);
+ SurroundData.XMin = value / factor;
+ OnPropertyChanged(nameof(XMin));
+ }
+ }
+
+ public double YMax
+ {
+ get
+ {
+ var factor = GetFactor(SurroundData.ConvertLogicEntity.YForceType);
+ return SurroundData.YMax * factor;
+ }
+
+ set
+ {
+ var factor = GetFactor(SurroundData.ConvertLogicEntity.YForceType);
+ SurroundData.YMax = value / factor;
+ OnPropertyChanged(nameof(YMax));
+ }
+ }
+
+ public double YMin
+ {
+ get
+ {
+ var factor = GetFactor(SurroundData.ConvertLogicEntity.YForceType);
+ return SurroundData.YMin * factor;
+ }
+
+ set
+ {
+ var factor = GetFactor(SurroundData.ConvertLogicEntity.YForceType);
+ SurroundData.YMin = value / factor;
+ OnPropertyChanged(nameof(YMin));
+ }
+ }
+
+ public double ConstZ
+ {
+ get
+ {
+ var factor = GetFactor(SurroundData.ConvertLogicEntity.ZForceType);
+ return SurroundData.ConstZ * factor;
+ }
+
+ set
+ {
+ var factor = GetFactor(SurroundData.ConvertLogicEntity.ZForceType);
+ SurroundData.ConstZ = value / factor;
+ OnPropertyChanged(nameof(ConstZ));
+ }
+ }
+
+ public int PointCount
+ {
+ get => SurroundData.PointCount; set
+ {
+ try
+ {
+ SurroundData.PointCount = value;
+ }
+ catch (Exception)
+ {
+ SurroundData.PointCount = 40;
+ }
+ OnPropertyChanged(nameof(PointCount));
+ }
+ }
+
+ public string Error => throw new NotImplementedException();
+
+ public string this[string columnName]
+ {
+ get
+ {
+ string error = String.Empty;
+ switch (columnName)
+ {
+ case nameof(PointCount):
+ if (PointCount < 24)
+ {
+ error = "Point count must be greater than 24";
+ }
+ break;
+ }
+ return error;
+ }
+ }
+
+ public SurroundDataViewModel(SurroundData surroundData)
+ {
+ this.SurroundData = surroundData;
+ Logics = new();
+ Logics.AddRange(ConvertLogics.ConverterLogics);
+ Logic = Logics
+ .Where(x => x.Id == surroundData.ConvertLogicEntity.Id)
+ .Single();
+ OnPropertyChanged(nameof(Logic));
+ }
+ private static double GetFactor(ForceTypes forceType)
+ {
+ if (forceType == ForceTypes.Force)
+ {
+ return unitForce.Multiplyer;
+ }
+ else if (forceType == ForceTypes.MomentMx || forceType == ForceTypes.MomentMy)
+ {
+ return unitMoment.Multiplyer;
+ }
+ else
+ {
+ throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(forceType));
+ }
+ }
+ private static string GetLabel(ForceTypes forceType)
+ {
+ if (forceType == ForceTypes.Force)
+ {
+ return unitForce.Name;
+ }
+ else if (forceType == ForceTypes.MomentMx || forceType == ForceTypes.MomentMy)
+ {
+ return unitMoment.Name;
+ }
+ else
+ {
+ throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(forceType));
+ }
+ }
+ }
+}
diff --git a/StructureHelperCommon/Services/Units/CommonOperation.cs b/StructureHelperCommon/Services/Units/CommonOperation.cs
index c31127f..1a88a7e 100644
--- a/StructureHelperCommon/Services/Units/CommonOperation.cs
+++ b/StructureHelperCommon/Services/Units/CommonOperation.cs
@@ -81,7 +81,7 @@ namespace StructureHelperCommon.Services.Units
return val;
}
- private static double GetMultiplyer(UnitTypes unitType, string unitName)
+ public static double GetMultiplyer(UnitTypes unitType, string unitName)
{
try
{
diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/ILimitCurveLogic.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/ILimitCurveLogic.cs
index ed646b4..2eebeb6 100644
--- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/ILimitCurveLogic.cs
+++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/ILimitCurveLogic.cs
@@ -6,10 +6,21 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
+//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
+//All rights reserved.
+
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
+ ///
+ /// Logic for build collection of points by surround points
+ ///
public interface ILimitCurveLogic : IHasActionByResult
{
- List GetPoints(List points);
+ ///
+ /// Returns list of points by source collection
+ ///
+ ///
+ ///
+ List GetPoints(IEnumerable points);
}
}
diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/LimitCurveCalculator.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/LimitCurveCalculator.cs
index 941c6ea..0ee69f3 100644
--- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/LimitCurveCalculator.cs
+++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/LimitCurveCalculator.cs
@@ -29,7 +29,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
this.limitCurveLogic = limitCurveLogic;
SurroundData = new();
- //SurroundProcLogic = new RoundSurroundProc();
SurroundProcLogic = new RectSurroundProc();
}
diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/LimitCurveLogic.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/LimitCurveLogic.cs
index 167fd9a..ed85a61 100644
--- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/LimitCurveLogic.cs
+++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/LimitCurveLogic.cs
@@ -1,17 +1,15 @@
-using StructureHelperCommon.Infrastructures.Exceptions;
-using StructureHelperCommon.Models.Calculators;
+using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Shapes;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+
+//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
+//All rights reserved.
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public class LimitCurveLogic : ILimitCurveLogic
{
private FindParameterResult result;
+ private List resultList;
private IPoint2D currentPoint;
private ILimitCurveParameterLogic parameterLogic;
public Predicate LimitPredicate { get; set; }
@@ -25,37 +23,46 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
LimitPredicate = limitPredicate;
}
- public List GetPoints(List points)
+ ///
+ public List GetPoints(IEnumerable points)
{
result = new();
- List resultList = new();
+ resultList = new();
if (LimitPredicate(new Point2D()) == true)
{
- throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": predicate for zero value is not valid");
+ var range = points.Select(point => new Point2D { X = point.X * 0d, Y = point.Y * 0d }).ToList();
+ resultList.AddRange(range);
+ return resultList;
+ //throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": predicate for zero value is not valid");
}
foreach (var point in points)
{
- double parameter;
- currentPoint = point.Clone() as IPoint2D;
- parameterLogic.CurrentPoint = currentPoint;
- if (LimitPredicate(point) == false)
- {
- parameter = 1d;
- }
- else
- {
- parameter = parameterLogic.GetParameter();
- }
- var resultPoint = new Point2D()
- {
- X = currentPoint.X * parameter,
- Y = currentPoint.Y * parameter
- };
- resultList.Add(resultPoint);
- result.IterationNumber = resultList.Count;
- ActionToOutputResults?.Invoke(result);
+ FindParameter(point);
}
return resultList;
}
+
+ private void FindParameter(IPoint2D point)
+ {
+ double parameter;
+ currentPoint = point.Clone() as IPoint2D;
+ parameterLogic.CurrentPoint = currentPoint;
+ if (LimitPredicate(point) == false)
+ {
+ parameter = 1d;
+ }
+ else
+ {
+ parameter = parameterLogic.GetParameter();
+ }
+ var resultPoint = new Point2D()
+ {
+ X = currentPoint.X * parameter,
+ Y = currentPoint.Y * parameter
+ };
+ resultList.Add(resultPoint);
+ result.IterationNumber = resultList.Count;
+ ActionToOutputResults?.Invoke(result);
+ }
}
}
diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/StabLimitCurveLogic.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/StabLimitCurveLogic.cs
index 3c836af..1ac3893 100644
--- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/StabLimitCurveLogic.cs
+++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/StabLimitCurveLogic.cs
@@ -12,7 +12,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public Action ActionToOutputResults { get; set; }
- public List GetPoints(List points)
+ public List GetPoints(IEnumerable points)
{
var result = new List();
foreach (var item in points)