Interpolation of results was added

This commit is contained in:
Evgeny Redikultsev
2022-12-22 11:42:32 +05:00
parent 52c6917a0d
commit b3952767c8
26 changed files with 524 additions and 96 deletions

View File

@@ -15,19 +15,27 @@ using System.Windows.Input;
namespace StructureHelper.Windows.ViewModels.Calculations.CalculationResult
{
public class CalculationResultViewModel
public class CalculationResultViewModel : ViewModelBase
{
public ICalculationResult SelectedResult { get; set; }
public ICommand ShowIsoFieldCommand { get;}
private ObservableCollection<ICalculationResult> calculationResults;
private IEnumerable<INdm> ndms;
private IReport isoFieldReport;
private RelayCommand showIsoFieldCommand;
public RelayCommand ShowIsoFieldCommand
{ get
{
return showIsoFieldCommand ??
(
showIsoFieldCommand = new RelayCommand(o =>
ShowIsoField(),
o => !(SelectedResult is null) && SelectedResult.IsValid));
}
}
public CalculationResultViewModel(IEnumerable<ICalculationResult> results, IEnumerable<INdm> ndmCollection)
{
ShowIsoFieldCommand = new RelayCommand(o=>ShowIsoField(), o=> !(SelectedResult is null) && SelectedResult.IsValid);
//
calculationResults = new ObservableCollection<ICalculationResult>();
ndms = ndmCollection;
foreach (var result in results)

View File

@@ -6,14 +6,17 @@ using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelper.Services.Reports;
using StructureHelper.Services.Reports.CalculationReports;
using StructureHelper.Services.ResultViewers;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.Services.NdmCalculations;
using StructureHelperLogics.Services.NdmPrimitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Input;
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
@@ -27,26 +30,69 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
private IReport isoFieldReport;
public ForcesResult SelectedResult { get; set; }
private ICommand showIsoFieldCommand;
private RelayCommand showIsoFieldCommand;
private RelayCommand exportToCSVCommand;
private RelayCommand interpolateCommand;
public IForcesResults ForcesResults
{
get => forcesResults;
}
public ICommand ShowIsoFieldCommand
public RelayCommand ShowIsoFieldCommand
{
get
{
return showIsoFieldCommand ??
(
showIsoFieldCommand = new RelayCommand(o =>
(showIsoFieldCommand = new RelayCommand(o =>
{
GetNdms();
ShowIsoField();
}, o => (SelectedResult != null) && SelectedResult.IsValid));
}
}
public RelayCommand ExportToCSVCommand
{
get
{
return exportToCSVCommand ??
(exportToCSVCommand = new RelayCommand(o =>
{
}
));
}
}
public RelayCommand InterpolateCommand
{
get
{
return interpolateCommand ??
(interpolateCommand = new RelayCommand(o =>
{
Interpolate();
}, o => SelectedResult != null));
}
}
private void Interpolate()
{
int stepCount = 100;
var calculator = InterpolateService.InterpolateForceCalculator(forceCalculator, SelectedResult.DesignForceTuple, stepCount);
calculator.Run();
var result = calculator.Result;
if (result is null || result.IsValid == false)
{
MessageBox.Show(result.Desctription, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
var vm = new ForcesResultsViewModel(calculator);
var wnd = new ForceResultsView(vm);
wnd.Show();
}
}
public ForcesResultsViewModel(IForceCalculator forceCalculator)