diff --git a/StructureHelper/Infrastructure/UI/Resources/GraphsTemplates.xaml b/StructureHelper/Infrastructure/UI/Resources/GraphsTemplates.xaml
index 722d7de..de9dadd 100644
--- a/StructureHelper/Infrastructure/UI/Resources/GraphsTemplates.xaml
+++ b/StructureHelper/Infrastructure/UI/Resources/GraphsTemplates.xaml
@@ -13,6 +13,11 @@
+
+
+
+
+
diff --git a/StructureHelper/StructureHelper.csproj.user b/StructureHelper/StructureHelper.csproj.user
index 6687d82..b51796c 100644
--- a/StructureHelper/StructureHelper.csproj.user
+++ b/StructureHelper/StructureHelper.csproj.user
@@ -12,6 +12,9 @@
Code
+
+ Code
+
Code
@@ -39,7 +42,7 @@
Code
-
+
Code
@@ -59,6 +62,9 @@
Designer
+
+ Designer
+
Designer
@@ -86,7 +92,7 @@
Designer
-
+
Designer
diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/InteractionDiagramLogic.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/InteractionDiagramLogic.cs
index d54bea5..195ad2a 100644
--- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/InteractionDiagramLogic.cs
+++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/InteractionDiagramLogic.cs
@@ -2,8 +2,10 @@
using StructureHelper.Windows.Graphs;
using StructureHelper.Windows.ViewModels.Errors;
using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Infrastructures.Settings;
+using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Parameters;
using StructureHelperCommon.Models.Shapes;
@@ -18,20 +20,18 @@ using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Windows;
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
{
internal class InteractionDiagramLogic : ILongProcessLogic
{
- const double xmax = 0.7e6d;
- const double xmin = -0.7e6d;
- const double ymax = 1.5e6d;
- const double ymin = -9e6d;
-
private ArrayParameter arrayParameter;
+ private IResult result;
+
private static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
- public int StepCount { get; }
+ public int StepCount => SurroundData.PointCount;
public Action SetProgress { get; set; }
public bool Result { get; set; }
@@ -40,29 +40,40 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
public CalcTerms CalcTerm { get; set; }
public ForceTuple ForceTuple { get; set; }
- private void Show()
+ public SurroundData SurroundData { get; set; }
+
+ public InteractionDiagramLogic(SurroundData surroundData)
{
- var options = new TriangulationOptions() { LimiteState = LimitState, CalcTerm = CalcTerm };
- var ndmCollection = NdmPrimitives.SelectMany(x => x.GetNdms(options));
- //var ndmCollection = NdmPrimitivesService.GetNdms(NdmPrimitives, LimitState, CalcTerm);
+ SurroundData = surroundData;
+ }
+
+ private void DoCalculations()
+ {
+ var ndmCollection = NdmPrimitivesService.GetNdms(NdmPrimitives, LimitState, CalcTerm);
var predicateFactory = new PredicateFactory()
{
- My = ForceTuple.My,
+ My = SurroundData.ConstZ,
Ndms = ndmCollection
};
- Predicate predicate = predicateFactory.GetResult;
+ Predicate predicate = predicateFactory.IsSectionFailure;
+ //Predicate predicate = predicateFactory.IsSectionCracked;
//var logic = new StabLimitCurveLogic();
var logic = new LimitCurveLogic(predicate);
var calculator = new LimitCurveCalculator(logic);
- calculator.SurroundData.XMax = xmax;
- calculator.SurroundData.XMin = xmin;
- calculator.SurroundData.YMax = ymax;
- calculator.SurroundData.YMin = ymin;
- calculator.SurroundData.PointCount = 40;
+ calculator.SurroundData = SurroundData;
+ calculator.ActionToOutputResults = SetProgressByResult;
+ SafetyProcessor.RunSafeProcess(() =>
+ {
+ CalcResult(calculator);
+ }, "Errors appeared during showing a graph, see detailed information");
+ }
+
+ private void CalcResult(LimitCurveCalculator calculator)
+ {
calculator.Run();
- var result = calculator.Result;
- if (result.IsValid = false) { return; }
+ result = calculator.Result;
+ if (result.IsValid == false) { return; }
var interactionResult = result as LimitCurveResult;
var unitForce = CommonOperation.GetUnit(UnitTypes.Force, "kN");
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm");
@@ -73,18 +84,27 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
for (int i = 0; i < items.Count(); i++)
{
var valueList = new List
- {
- items[i].X * unitForce.Multiplyer,
- items[i].Y * unitMoment.Multiplyer
- };
+ {
+ items[i].X * unitForce.Multiplyer,
+ items[i].Y * unitMoment.Multiplyer
+ };
for (int j = 0; j < valueList.Count; j++)
{
data[i, j] = valueList[j];
}
- SetProgress?.Invoke(i);
}
}
+ private void SetProgressByResult(IResult calcResult)
+ {
+ if (calcResult is not LimitCurveResult)
+ {
+ throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(LimitCurveResult), calcResult));
+ }
+ var parameterResult = calcResult as LimitCurveResult;
+ SetProgress?.Invoke(parameterResult.IterationNumber);
+ }
+
private static string[] GetLabels(IUnit unitForce, IUnit unitMoment)
{
return new string[]
@@ -96,19 +116,25 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
public void ShowWindow()
{
- Show();
Result = true;
SafetyProcessor.RunSafeProcess(() =>
{
- var wnd = new GraphView(arrayParameter);
- wnd.ShowDialog();
+ if (result.IsValid == true)
+ {
+ var wnd = new GraphView(arrayParameter);
+ wnd.ShowDialog();
+ }
+ else
+ {
+ MessageBox.Show(result.Description);
+ }
},
"Errors appeared during showing a graph, see detailed information");
}
public void WorkerDoWork(object sender, DoWorkEventArgs e)
{
- Show();
+ DoCalculations();
Result = true;
}
diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataView.xaml b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataView.xaml
new file mode 100644
index 0000000..687cfc6
--- /dev/null
+++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataView.xaml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataView.xaml.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataView.xaml.cs
new file mode 100644
index 0000000..1289d55
--- /dev/null
+++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataView.xaml.cs
@@ -0,0 +1,67 @@
+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
new file mode 100644
index 0000000..55ff844
--- /dev/null
+++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/SurroundDataViewModel.cs
@@ -0,0 +1,107 @@
+using StructureHelper.Windows.ViewModels;
+using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic
+{
+ public class SurroundDataViewModel : OkCancelViewModelBase, IDataErrorInfo
+ {
+ private readonly SurroundData surroundData;
+
+ 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;
+ }
+
+ 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 8a5e381..7203182 100644
--- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsViewModel.cs
+++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsViewModel.cs
@@ -5,6 +5,7 @@ using StructureHelper.Services.Exports;
using StructureHelper.Services.Reports;
using StructureHelper.Services.Reports.CalculationReports;
using StructureHelper.Services.ResultViewers;
+using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.GeometryCalculatorViews;
using StructureHelper.Windows.Errors;
using StructureHelper.Windows.Forces;
@@ -38,7 +39,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
private ForceCalculator forceCalculator;
private ILongProcessLogic progressLogic;
private ShowProgressLogic showProgressLogic;
- private InteractionDiagramLogic interactionDiagramLogic = new();
+ private InteractionDiagramLogic interactionDiagramLogic;
private static readonly ShowCrackResultLogic showCrackResultLogic = new();
private static readonly ShowCrackWidthLogic showCrackWidthLogic = new();
private IForcesResults forcesResults;
@@ -73,11 +74,25 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
return showInteractionDiagramCommand ??
(showInteractionDiagramCommand = new RelayCommand(o =>
{
- interactionDiagramLogic.ForceTuple = SelectedResult.DesignForceTuple.ForceTuple.Clone() as ForceTuple;
- interactionDiagramLogic.LimitState = SelectedResult.DesignForceTuple.LimitState;
- interactionDiagramLogic.CalcTerm = SelectedResult.DesignForceTuple.CalcTerm;
- interactionDiagramLogic.NdmPrimitives = ndmPrimitives;
- interactionDiagramLogic.ShowWindow();
+ var tuple = SelectedResult.DesignForceTuple.ForceTuple.Clone() as ForceTuple;
+ var data = new SurroundData();
+ data.ConstZ = tuple.My;
+ var wnd = new SurroundDataView(data);
+ wnd.ShowDialog();
+ if (wnd.DialogResult != true) return;
+ interactionDiagramLogic = new(data)
+ {
+ ForceTuple = tuple,
+ LimitState = SelectedResult.DesignForceTuple.LimitState,
+ CalcTerm = SelectedResult.DesignForceTuple.CalcTerm,
+ NdmPrimitives = ndmPrimitives
+ };
+ showProgressLogic = new(interactionDiagramLogic)
+ {
+ WindowTitle = "Diagram creating...",
+ ShowResult = interactionDiagramLogic.ShowWindow
+ };
+ showProgressLogic.Show();
}, o => SelectedResult != null && SelectedResult.IsValid));
}
}
diff --git a/StructureHelper/Windows/Forces/InterpolateTuplesView.xaml b/StructureHelper/Windows/Forces/InterpolateTuplesView.xaml
index fdfdbd7..5823dfc 100644
--- a/StructureHelper/Windows/Forces/InterpolateTuplesView.xaml
+++ b/StructureHelper/Windows/Forces/InterpolateTuplesView.xaml
@@ -8,7 +8,7 @@
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
d:DataContext="{d:DesignInstance local:InterpolateTuplesViewModel}"
mc:Ignorable="d"
- Title="Interpolate Combinations" Height="200" Width="400" MinHeight="180" MinWidth="400" WindowStartupLocation="CenterScreen">
+ Title="Interpolate Combinations" Height="200" Width="460" MinHeight="180" MinWidth="460" WindowStartupLocation="CenterScreen">