diff --git a/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_crack.png b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_crack.png new file mode 100644 index 0000000..a2b453b Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_crack.png differ diff --git a/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_fire.png b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_fire.png new file mode 100644 index 0000000..fbfba9c Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_fire.png differ diff --git a/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_graph_1.png b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_graph_1.png new file mode 100644 index 0000000..568ed9e Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_graph_1.png differ diff --git a/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_graph_2.png b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_graph_2.png new file mode 100644 index 0000000..bd0a5bc Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_graph_2.png differ diff --git a/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_1_1.png b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_1_1.png new file mode 100644 index 0000000..0134af1 Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_1_1.png differ diff --git a/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_2_1.png b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_2_1.png new file mode 100644 index 0000000..de1e60f Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_2_1.png differ diff --git a/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_3_1.png b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_3_1.png new file mode 100644 index 0000000..e3426e2 Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_3_1.png differ diff --git a/StructureHelper/StructureHelper.csproj b/StructureHelper/StructureHelper.csproj index 67628b4..ee00776 100644 --- a/StructureHelper/StructureHelper.csproj +++ b/StructureHelper/StructureHelper.csproj @@ -23,6 +23,10 @@ + + + + @@ -86,6 +90,10 @@ + + + + diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_crack.png b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_crack.png new file mode 100644 index 0000000..a2b453b Binary files /dev/null and b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_crack.png differ diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_1.png b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_1.png new file mode 100644 index 0000000..568ed9e Binary files /dev/null and b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_1.png differ diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png new file mode 100644 index 0000000..bd0a5bc Binary files /dev/null and b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png differ diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_interpolation_1_1.png b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_interpolation_1_1.png new file mode 100644 index 0000000..0134af1 Binary files /dev/null and b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_interpolation_1_1.png differ diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/InteractionDiagramLogic.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/InteractionDiagramLogic.cs new file mode 100644 index 0000000..d54bea5 --- /dev/null +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/InteractionDiagramLogic.cs @@ -0,0 +1,125 @@ +using LoaderCalculator.Data.Ndms; +using StructureHelper.Windows.Graphs; +using StructureHelper.Windows.ViewModels.Errors; +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Infrastructures.Interfaces; +using StructureHelperCommon.Infrastructures.Settings; +using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Models.Parameters; +using StructureHelperCommon.Models.Shapes; +using StructureHelperCommon.Services.Units; +using StructureHelperLogics.NdmCalculations.Analyses.ByForces; +using StructureHelperLogics.NdmCalculations.Primitives; +using StructureHelperLogics.NdmCalculations.Triangulations; +using StructureHelperLogics.Services.NdmPrimitives; +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 +{ + 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 static GeometryNames GeometryNames => ProgramSetting.GeometryNames; + + public int StepCount { get; } + + public Action SetProgress { get; set; } + public bool Result { get; set; } + public IEnumerable NdmPrimitives { get; set; } + public LimitStates LimitState { get; set; } + public CalcTerms CalcTerm { get; set; } + public ForceTuple ForceTuple { get; set; } + + private void Show() + { + var options = new TriangulationOptions() { LimiteState = LimitState, CalcTerm = CalcTerm }; + var ndmCollection = NdmPrimitives.SelectMany(x => x.GetNdms(options)); + //var ndmCollection = NdmPrimitivesService.GetNdms(NdmPrimitives, LimitState, CalcTerm); + + var predicateFactory = new PredicateFactory() + { + My = ForceTuple.My, + Ndms = ndmCollection + }; + Predicate predicate = predicateFactory.GetResult; + //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.Run(); + var 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"); + string[] labels = GetLabels(unitForce, unitMoment); + var items = interactionResult.Points; + arrayParameter = new ArrayParameter(items.Count(), labels.Count(), labels); + var data = arrayParameter.Data; + for (int i = 0; i < items.Count(); i++) + { + var valueList = new List + { + 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 static string[] GetLabels(IUnit unitForce, IUnit unitMoment) + { + return new string[] + { + $"{GeometryNames.MomFstName}, {unitMoment.Name}", + $"{GeometryNames.LongForceName}, {unitForce.Name}" + }; + } + + public void ShowWindow() + { + Show(); + Result = true; + SafetyProcessor.RunSafeProcess(() => + { + var wnd = new GraphView(arrayParameter); + wnd.ShowDialog(); + }, + "Errors appeared during showing a graph, see detailed information"); + } + + public void WorkerDoWork(object sender, DoWorkEventArgs e) + { + Show(); + Result = true; + } + + public void WorkerProgressChanged(object sender, ProgressChangedEventArgs e) + { + //nothing to do + } + + public void WorkerRunWorkCompleted(object sender, RunWorkerCompletedEventArgs e) + { + //nothing to do + } + } +} diff --git a/StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceResultLogic/ShowCrackResultLogic.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/ShowCrackResultLogic.cs similarity index 87% rename from StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceResultLogic/ShowCrackResultLogic.cs rename to StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/ShowCrackResultLogic.cs index fe9d8e3..797ce0a 100644 --- a/StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceResultLogic/ShowCrackResultLogic.cs +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/ShowCrackResultLogic.cs @@ -1,25 +1,16 @@ -using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews; -using StructureHelper.Windows.Errors; +using StructureHelper.Windows.Errors; using StructureHelper.Windows.Forces; using StructureHelper.Windows.ViewModels.Errors; -using StructureHelper.Windows.ViewModels.Forces; using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Settings; using StructureHelperCommon.Models.Forces; -using StructureHelperLogics.NdmCalculations.Analyses.ByForces; using StructureHelperLogics.NdmCalculations.Cracking; using StructureHelperLogics.NdmCalculations.Primitives; -using StructureHelperLogics.Services.NdmCalculations; using StructureHelperLogics.Services.NdmPrimitives; -using System; using System.Collections.Generic; -using System.Linq; -using System.Security.Policy; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; -namespace StructureHelper.Windows.ViewModels.Calculations.Calculators.ForceResultLogic +namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews { internal class ShowCrackResultLogic { diff --git a/StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceResultLogic/ShowCrackWidthLogic.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/ShowCrackWidthLogic.cs similarity index 92% rename from StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceResultLogic/ShowCrackWidthLogic.cs rename to StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/ShowCrackWidthLogic.cs index 6c901cf..950f84c 100644 --- a/StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceResultLogic/ShowCrackWidthLogic.cs +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/ShowCrackWidthLogic.cs @@ -8,7 +8,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace StructureHelper.Windows.ViewModels.Calculations.Calculators +namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews { internal class ShowCrackWidthLogic { diff --git a/StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceResultLogic/ShowDiagramLogic.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/ShowDiagramLogic.cs similarity index 96% rename from StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceResultLogic/ShowDiagramLogic.cs rename to StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/ShowDiagramLogic.cs index 63cd77e..2bd33b3 100644 --- a/StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceResultLogic/ShowDiagramLogic.cs +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/ShowDiagramLogic.cs @@ -12,7 +12,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; -namespace StructureHelper.Windows.ViewModels.Calculations.Calculators +namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews { internal class ShowDiagramLogic : ILongProcessLogic { @@ -25,7 +25,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators public int StepCount => ValidTupleList.Count(); - public Action SetProgress { get ; set; } + public Action SetProgress { get; set; } public bool Result { get; set; } public void WorkerDoWork(object sender, DoWorkEventArgs e) diff --git a/StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceResultLogic/ShowProgressLogic.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/ShowProgressLogic.cs similarity index 94% rename from StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceResultLogic/ShowProgressLogic.cs rename to StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/ShowProgressLogic.cs index 7dc3ed8..1d73543 100644 --- a/StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceResultLogic/ShowProgressLogic.cs +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceResultLogic/ShowProgressLogic.cs @@ -9,7 +9,7 @@ using System.Linq; using System.Windows; using System.Windows.Forms; -namespace StructureHelper.Windows.ViewModels.Calculations.Calculators +namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews { internal class ShowProgressLogic { @@ -31,7 +31,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators WindowTitle = WindowTitle }; - wndProgress =new ShowProgressView(progressViewModel); + wndProgress = new ShowProgressView(progressViewModel); wndProgress.Loaded += RunCalc; wndProgress.ShowDialog(); } diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsView.xaml b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsView.xaml index ce29d96..3d1cbee 100644 --- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsView.xaml +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsView.xaml @@ -4,16 +4,25 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews" - xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Calculations.Calculators" - d:DataContext="{d:DesignInstance vm:ForcesResultsViewModel}" + d:DataContext="{d:DesignInstance local:ForcesResultsViewModel}" mc:Ignorable="d" Title="Calculation Results" Height="350" Width="850" MinHeight="300" MinWidth="400" WindowStartupLocation="CenterScreen"> - + + + + @@ -48,14 +57,11 @@