From 690af15e2ae56ae2a1928c7fa17574bfbc3a5ba5 Mon Sep 17 00:00:00 2001 From: Evgeny Redikultsev Date: Sat, 11 Jan 2025 21:58:58 +0500 Subject: [PATCH] Add import of forces from excel --- .../FilesForImport/Forces/DCF.xlsx | Bin 0 -> 16578 bytes .../Infrastructure/Enums/ActionType.cs | 3 +- .../UI/Resources/ForceTemplates.xaml | 33 +++++--- StructureHelper/StructureHelper.csproj | 1 + StructureHelper/StructureHelper.csproj.user | 18 ++++ .../Cracks/CrackResultView.xaml | 21 +++++ .../Cracks/CrackResultViewModel.cs | 10 ++- .../ForcesResultsViewModel.cs | 14 ++-- .../Forces/FactoredCombinationPropertyVM.cs | 33 +++++--- .../Forces/ForceCombinationByFactorVM.cs | 33 +++----- .../Forces/ForceCombinationByFactorView.xaml | 60 +++++++------ .../ForceCombinationByFactorView.xaml.cs | 9 +- .../Forces/ForceCombinationFromFileVM.cs | 44 ++++++++++ .../Forces/ForceCombinationFromFileView.xaml | 37 ++++++++ .../ForceCombinationFromFileView.xaml.cs | 39 +++++++++ .../Windows/Forces/ForceFilePropertyVM.cs | 65 ++++++++++++++ .../Windows/Forces/ForceFilePropertyView.xaml | 52 ++++++++++++ .../Forces/ForceFilePropertyView.xaml.cs | 27 ++++++ .../Windows/Forces/ListOfFilesVM.cs | 59 +++++++++++++ .../CrossSectionVisualPropertyVM.cs | 3 + .../Windows/MainWindow/CrossSectionView.xaml | 37 +++++++- .../MainWindow/CrossSectionViewModel.cs | 2 - .../Forces/FactoredCombination.xaml | 3 +- .../Forces/FactoredCombination.xaml.cs | 41 --------- .../UserControls/ListOfFileControl.xaml | 43 ++++++++++ .../UserControls/ListOfFileControl.xaml.cs | 28 +++++++ .../ViewModels/Forces/ActionsViewModel.cs | 32 ++++--- .../Models/Forces/ForceCombinationFromFile.cs | 25 +++++- .../Models/Forces/ForceFileProperty.cs | 8 +- .../Models/Forces/IFileProperty.cs | 9 ++ .../Forces/IForceCombinationFromFile.cs | 2 +- .../Models/Forces/IForceFileProperty.cs | 5 +- .../Forces/Logics/ActionUpdateStrategy.cs | 3 +- .../Forces/Logics/CheckForceActionsLogic.cs | 45 ++++++++++ .../Logics/ForceActionBaseUpdateStrategy.cs | 2 +- .../Logics/ForceActionUpdateStrategy.cs | 15 +++- .../ForceCombinationFromFileUpdateStrategy.cs | 21 +++-- .../Logics/ForceFilePropertyUpdateStrategy.cs | 2 - .../Forces/Logics/GetTupleFromFileLogic.cs | 79 ++++++++++++++++++ .../Forces/Logics/IGetTupleFromFileLogic.cs | 12 +++ .../StructureHelperCommon.csproj | 1 + .../ByForces/CheckForceCalculatorInputData.cs | 16 ++++ .../CheckCrackCalculatorInputDataLogic.cs | 17 ++++ 43 files changed, 843 insertions(+), 166 deletions(-) create mode 100644 StructureHelper/Documentation/FilesForImport/Forces/DCF.xlsx create mode 100644 StructureHelper/Windows/Forces/ForceCombinationFromFileVM.cs create mode 100644 StructureHelper/Windows/Forces/ForceCombinationFromFileView.xaml create mode 100644 StructureHelper/Windows/Forces/ForceCombinationFromFileView.xaml.cs create mode 100644 StructureHelper/Windows/Forces/ForceFilePropertyVM.cs create mode 100644 StructureHelper/Windows/Forces/ForceFilePropertyView.xaml create mode 100644 StructureHelper/Windows/Forces/ForceFilePropertyView.xaml.cs create mode 100644 StructureHelper/Windows/Forces/ListOfFilesVM.cs create mode 100644 StructureHelper/Windows/UserControls/ListOfFileControl.xaml create mode 100644 StructureHelper/Windows/UserControls/ListOfFileControl.xaml.cs create mode 100644 StructureHelperCommon/Models/Forces/IFileProperty.cs create mode 100644 StructureHelperCommon/Models/Forces/Logics/CheckForceActionsLogic.cs create mode 100644 StructureHelperCommon/Models/Forces/Logics/GetTupleFromFileLogic.cs create mode 100644 StructureHelperCommon/Models/Forces/Logics/IGetTupleFromFileLogic.cs diff --git a/StructureHelper/Documentation/FilesForImport/Forces/DCF.xlsx b/StructureHelper/Documentation/FilesForImport/Forces/DCF.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..e238b26e95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100644 --- a/StructureHelper/Infrastructure/Enums/ActionType.cs +++ b/StructureHelper/Infrastructure/Enums/ActionType.cs @@ -9,6 +9,7 @@ namespace StructureHelper.Infrastructure.Enums public enum ActionType { ForceCombination, - ForceCombinationByFactor + ForceCombinationByFactor, + ForceCombinationFromFile } } diff --git a/StructureHelper/Infrastructure/UI/Resources/ForceTemplates.xaml b/StructureHelper/Infrastructure/UI/Resources/ForceTemplates.xaml index 39c13cf..0e08bc1 100644 --- a/StructureHelper/Infrastructure/UI/Resources/ForceTemplates.xaml +++ b/StructureHelper/Infrastructure/UI/Resources/ForceTemplates.xaml @@ -1,27 +1,40 @@  - + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + diff --git a/StructureHelper/StructureHelper.csproj b/StructureHelper/StructureHelper.csproj index 1187d8f..3b413bc 100644 --- a/StructureHelper/StructureHelper.csproj +++ b/StructureHelper/StructureHelper.csproj @@ -90,6 +90,7 @@ + diff --git a/StructureHelper/StructureHelper.csproj.user b/StructureHelper/StructureHelper.csproj.user index 018a483..9e439e8 100644 --- a/StructureHelper/StructureHelper.csproj.user +++ b/StructureHelper/StructureHelper.csproj.user @@ -45,6 +45,12 @@ Code + + Code + + + Code + Code @@ -87,6 +93,9 @@ Code + + Code + Code @@ -152,6 +161,12 @@ Designer + + Designer + + + Designer + Designer @@ -194,6 +209,9 @@ Designer + + Designer + Designer diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/CrackResultView.xaml b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/CrackResultView.xaml index 15b7887..af65392 100644 --- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/CrackResultView.xaml +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/CrackResultView.xaml @@ -33,6 +33,7 @@ + @@ -114,6 +115,26 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/CrackResultViewModel.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/CrackResultViewModel.cs index 715ad19..5e839fa 100644 --- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/CrackResultViewModel.cs +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/CrackResultViewModel.cs @@ -12,10 +12,14 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews public class CrackResultViewModel : ViewModelBase { IShowCrackIsoFieldsLogic showCrackIsoFieldsLogic => new ShowCrackIsoFieldsLogic(); - private CrackResult crackResult; + private CrackResult resultModel; private RelayCommand? showIsoFieldCommand; private RelayCommand? showRebarsCommand; + public int ValidResultCount => resultModel.TupleResults.Count(x => x.IsValid == true); + public int InvalidResultCount => resultModel.TupleResults.Count(x => x.IsValid == false); + public int TotalResultCount => resultModel.TupleResults.Count; + public TupleCrackResult SelectedResult { get; set; } public List TupleResults => CrackResult.TupleResults; public ICommand ShowRebarsCommand @@ -41,11 +45,11 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews } } - public CrackResult CrackResult => crackResult; + public CrackResult CrackResult => resultModel; public CrackResultViewModel(CrackResult crackResult) { - this.crackResult = crackResult; + this.resultModel = crackResult; } } } diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsViewModel.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsViewModel.cs index 0bd9b3b..1c84a89 100644 --- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsViewModel.cs +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsViewModel.cs @@ -44,7 +44,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu private InteractionDiagramLogic interactionDiagramLogic; private static readonly ShowCrackResultLogic showCrackResultLogic = new(); //private static readonly ShowCrackWidthLogic showCrackWidthLogic = new(); - private IForcesResults forcesResults; + private IForcesResults resultModel; private IEnumerable ndmPrimitives; private IEnumerable selectedNdmPrimitives; private IEnumerable ndms; @@ -67,13 +67,13 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu private ICommand? graphValuepointsCommand; private ICommand showForceResultCommand; - public int ValidResultCount => forcesResults.ForcesResultList.Count(x => x.IsValid == true); - public int InvalidResultCount => forcesResults.ForcesResultList.Count(x => x.IsValid == false); - public int TotalResultCount => forcesResults.ForcesResultList.Count; + public int ValidResultCount => resultModel.ForcesResultList.Count(x => x.IsValid == true); + public int InvalidResultCount => resultModel.ForcesResultList.Count(x => x.IsValid == false); + public int TotalResultCount => resultModel.ForcesResultList.Count; public IForcesResults ForcesResults { - get => forcesResults; + get => resultModel; } public ICommand ShowInteractionDiagramCommand { @@ -150,7 +150,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu Filter = "csv |*.csv", Title = "Save in *.csv File" }; - var logic = new ExportForcesResultToCSVLogic(forcesResults); + var logic = new ExportForcesResultToCSVLogic(resultModel); var exportService = new ExportToFileService(inputData, logic); exportService.Export(); } @@ -429,7 +429,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu public ForcesResultsViewModel(ForceCalculator forceCalculator) { this.forceCalculator = forceCalculator; - forcesResults = forceCalculator.Result as IForcesResults; + resultModel = forceCalculator.Result as IForcesResults; ndmPrimitives = forceCalculator.InputData.Primitives; } diff --git a/StructureHelper/Windows/Forces/FactoredCombinationPropertyVM.cs b/StructureHelper/Windows/Forces/FactoredCombinationPropertyVM.cs index 75584de..28f04e2 100644 --- a/StructureHelper/Windows/Forces/FactoredCombinationPropertyVM.cs +++ b/StructureHelper/Windows/Forces/FactoredCombinationPropertyVM.cs @@ -7,7 +7,7 @@ using System.ComponentModel; namespace StructureHelper.Windows.Forces { - public class FactoredCombinationPropertyVM : ViewModelBase, IFactoredCombinationProperty + public class FactoredCombinationPropertyVM : ViewModelBase, IDataErrorInfo { private IFactoredCombinationProperty sourceProperty; @@ -63,18 +63,29 @@ namespace StructureHelper.Windows.Forces } } - internal void UpdateCombinationProperty(IFactoredCombinationProperty? newValue) - { - sourceProperty = newValue; - Refresh(); - } + public string Error => throw new NotImplementedException(); - private void Refresh() + public string this[string columnName] { - OnPropertyChanged(nameof(ULSFactor)); - OnPropertyChanged(nameof(LongTermFactor)); - OnPropertyChanged(nameof(CalcTerm)); - OnPropertyChanged(nameof(LimitState)); + get + { + string error = null; + if (columnName == nameof(ULSFactor)) + { + if (ULSFactor <= 0) + { + error = "Safety factor for ULS must be greater than zero"; + } + } + if (columnName == nameof(LongTermFactor)) + { + if (LongTermFactor < 0d || LongTermFactor > 1d) + { + error = "Long term factor must be between 0.0 and 1.0"; + } + } + return error; + } } } } diff --git a/StructureHelper/Windows/Forces/ForceCombinationByFactorVM.cs b/StructureHelper/Windows/Forces/ForceCombinationByFactorVM.cs index be21677..aba7a37 100644 --- a/StructureHelper/Windows/Forces/ForceCombinationByFactorVM.cs +++ b/StructureHelper/Windows/Forces/ForceCombinationByFactorVM.cs @@ -12,18 +12,21 @@ namespace StructureHelper.Windows.Forces { public class ForceCombinationByFactorVM : ForceActionVMBase, IDataErrorInfo { - IForceFactoredList forceAction; + IForceFactoredList model; ForceTupleVM forceTupleVM; + private FactoredCombinationPropertyVM combinationProperty; public ForceTupleVM ForceTupleVM => forceTupleVM; - public IFactoredCombinationProperty CombinationProperty + public FactoredCombinationPropertyVM CombinationProperty { - get + get => combinationProperty; set { - return forceAction.CombinationProperty; + combinationProperty = value; + OnPropertyChanged(nameof(CombinationProperty)); } } + public string Error => throw new NotImplementedException(); public string this[string columnName] @@ -31,29 +34,15 @@ namespace StructureHelper.Windows.Forces get { string error = null; - - //if (columnName == nameof(ULSFactor)) - //{ - // if (ULSFactor <= 0) - // { - // error = "Safety factor for ULS must be greater than zero"; - // } - //} - //if (columnName == nameof(LongTermFactor)) - //{ - // if (LongTermFactor < 0d || LongTermFactor > 1d) - // { - // error = "Long term factor must be between 0.0 and 1.0"; - // } - //} return error; } } - public ForceCombinationByFactorVM(IForceFactoredList forceAction) : base(forceAction) + public ForceCombinationByFactorVM(IForceFactoredList model) : base(model) { - this.forceAction = forceAction; - forceTupleVM = new ForceTupleVM(this.forceAction.ForceTuples[0]); + this.model = model; + forceTupleVM = new ForceTupleVM(this.model.ForceTuples[0]); + CombinationProperty = new FactoredCombinationPropertyVM(model.CombinationProperty); } } } diff --git a/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml b/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml index eb7d754..4632a5f 100644 --- a/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml +++ b/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml @@ -7,36 +7,46 @@ xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls" d:DataContext="{d:DesignInstance local:ForceCombinationByFactorVM}" mc:Ignorable="d" - Title="Force Combination By Factor" Height="340" Width="350" MinHeight="290" WindowStartupLocation="CenterScreen" ResizeMode="NoResize"> + Title="Force Combination By Factor" Height="220" Width="350" WindowStartupLocation="CenterScreen" ResizeMode="NoResize"> - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml.cs b/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml.cs index bb14bfa..7eaf223 100644 --- a/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml.cs +++ b/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml.cs @@ -20,14 +20,15 @@ namespace StructureHelper.Windows.Forces /// public partial class ForceCombinationByFactorView : Window { - ForceCombinationByFactorVM viewModel; + readonly ForceCombinationByFactorVM viewModel; public ForceCombinationByFactorView(IForceFactoredList forceCombination) { - viewModel = new ForceCombinationByFactorVM(forceCombination); + viewModel = new ForceCombinationByFactorVM(forceCombination) + { + ParentWindow = this + }; DataContext = viewModel; - viewModel.ParentWindow = this; InitializeComponent(); - FactoredCombination.CombinationProperty = viewModel.CombinationProperty; } } } diff --git a/StructureHelper/Windows/Forces/ForceCombinationFromFileVM.cs b/StructureHelper/Windows/Forces/ForceCombinationFromFileVM.cs new file mode 100644 index 0000000..ef5fc62 --- /dev/null +++ b/StructureHelper/Windows/Forces/ForceCombinationFromFileVM.cs @@ -0,0 +1,44 @@ +using StructureHelper.Windows.ViewModels; +using StructureHelper.Windows.ViewModels.Forces; +using StructureHelperCommon.Models.Forces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelper.Windows.Forces +{ + public class ForceCombinationFromFileVM : ForceActionVMBase + { + private readonly IForceCombinationFromFile model; + private ListOfFilesVM files; + private FactoredCombinationPropertyVM combinationProperty; + + public FactoredCombinationPropertyVM CombinationProperty + { + get => combinationProperty; set + { + combinationProperty = value; + OnPropertyChanged(nameof(CombinationProperty)); + } + } + + public ListOfFilesVM Files + { + get => files; set + { + files = value; + OnPropertyChanged(); + } + } + + public ForceCombinationFromFileVM(IForceCombinationFromFile model) : base(model) + { + this.model = model; + files = new(this.model.ForceFiles); + CombinationProperty = new FactoredCombinationPropertyVM(model.CombinationProperty); + } + + } +} diff --git a/StructureHelper/Windows/Forces/ForceCombinationFromFileView.xaml b/StructureHelper/Windows/Forces/ForceCombinationFromFileView.xaml new file mode 100644 index 0000000..8d83ad4 --- /dev/null +++ b/StructureHelper/Windows/Forces/ForceCombinationFromFileView.xaml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/StructureHelper/Windows/Forces/ForceCombinationFromFileView.xaml.cs b/StructureHelper/Windows/Forces/ForceCombinationFromFileView.xaml.cs new file mode 100644 index 0000000..90ca617 --- /dev/null +++ b/StructureHelper/Windows/Forces/ForceCombinationFromFileView.xaml.cs @@ -0,0 +1,39 @@ +using StructureHelperCommon.Models.Forces; +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.Forces +{ + /// + /// Interaction logic for ForceCombinationFromFile.xaml + /// + public partial class ForceCombinationFromFileView : Window + { + ForceCombinationFromFileVM viewModel; + + public ForceCombinationFromFileView(ForceCombinationFromFileVM viewModel) + { + this.viewModel = viewModel; + this.viewModel.ParentWindow = this; + InitializeComponent(); + this.DataContext = this.viewModel; + } + + public ForceCombinationFromFileView(IForceCombinationFromFile model) : this (new ForceCombinationFromFileVM(model)) + { + + } + + } +} diff --git a/StructureHelper/Windows/Forces/ForceFilePropertyVM.cs b/StructureHelper/Windows/Forces/ForceFilePropertyVM.cs new file mode 100644 index 0000000..1c96a7c --- /dev/null +++ b/StructureHelper/Windows/Forces/ForceFilePropertyVM.cs @@ -0,0 +1,65 @@ +using StructureHelper.Windows.ViewModels; +using StructureHelperCommon.Models.Forces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelper.Windows.Forces +{ + public class ForceFilePropertyVM : OkCancelViewModelBase + { + private IForceFileProperty model; + + public ForceFilePropertyVM(IForceFileProperty model) + { + this.model = model; + } + + public int SkipRowBeforeHeaderCount + { + get => model.SkipRowBeforeHeaderCount; + set + { + model.SkipRowBeforeHeaderCount = value; + OnPropertyChanged(nameof(SkipRowBeforeHeaderCount)); + } + } + public int SkipRowHeaderCount + { + get => model.SkipRowHeaderCount; + set + { + model.SkipRowHeaderCount = value; + OnPropertyChanged(nameof(SkipRowHeaderCount)); + } + } + public double GlobalFactor + { + get => model.GlobalFactor; + set + { + model.GlobalFactor = value; + OnPropertyChanged(nameof(GlobalFactor)); + } + } + public string FilePath + { + get => model.FilePath; + set + { + model.FilePath = value; + OnPropertyChanged(nameof(FilePath)); + } + } + + public IForceFileProperty Model + { + get + { + return model; + } + } + } +} diff --git a/StructureHelper/Windows/Forces/ForceFilePropertyView.xaml b/StructureHelper/Windows/Forces/ForceFilePropertyView.xaml new file mode 100644 index 0000000..63e2d67 --- /dev/null +++ b/StructureHelper/Windows/Forces/ForceFilePropertyView.xaml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/StructureHelper/Windows/Forces/ForceFilePropertyView.xaml.cs b/StructureHelper/Windows/Forces/ForceFilePropertyView.xaml.cs new file mode 100644 index 0000000..3d94d88 --- /dev/null +++ b/StructureHelper/Windows/Forces/ForceFilePropertyView.xaml.cs @@ -0,0 +1,27 @@ +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.Forces +{ + /// + /// Interaction logic for ForceFilePropertyView.xaml + /// + public partial class ForceFilePropertyView : Window + { + public ForceFilePropertyView() + { + InitializeComponent(); + } + } +} diff --git a/StructureHelper/Windows/Forces/ListOfFilesVM.cs b/StructureHelper/Windows/Forces/ListOfFilesVM.cs new file mode 100644 index 0000000..ed1e815 --- /dev/null +++ b/StructureHelper/Windows/Forces/ListOfFilesVM.cs @@ -0,0 +1,59 @@ +using StructureHelper.Infrastructure; +using StructureHelper.Windows.ViewModels; +using StructureHelperCommon.Models; +using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Services.FileServices; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms.Design; +using System.Windows.Input; + +namespace StructureHelper.Windows.Forces +{ + public class ListOfFilesVM : SelectItemVM + { + private ICommand openFileCommand; + public IShiftTraceLogger? TraceLogger; + + public ICommand FileOpen => openFileCommand ?? ( + openFileCommand = new RelayCommand(param => + { + OpenFileMethod(param); + } + )); + + private void OpenFileMethod(object param) + { + var result = GetFilePath(); + if (result.IsValid == false) + { + return; + } + ForceFileProperty fileProperty = new() + { + FilePath = result.FilePath, + }; + Collection.Add(fileProperty); + Refresh(); + } + + public ListOfFilesVM(List collection) : base(collection) + { + } + + private OpenFileResult GetFilePath() + { + var inputData = new OpenFileInputData() + { + FilterString = "MS Excel file (*.xlsx)|*.xlsx|All Files (*.*)|*.*", + TraceLogger = TraceLogger + }; + var fileDialog = new FileOpener(inputData); + var fileDialogResult = fileDialog.OpenFile(); + return fileDialogResult; + } + } +} diff --git a/StructureHelper/Windows/MainWindow/AxisCanvases/CrossSectionVisualPropertyVM.cs b/StructureHelper/Windows/MainWindow/AxisCanvases/CrossSectionVisualPropertyVM.cs index f69ddb9..591d342 100644 --- a/StructureHelper/Windows/MainWindow/AxisCanvases/CrossSectionVisualPropertyVM.cs +++ b/StructureHelper/Windows/MainWindow/AxisCanvases/CrossSectionVisualPropertyVM.cs @@ -43,6 +43,8 @@ namespace StructureHelper.Windows.MainWindow public double Height => AxisCanvasVM.Height; public double HalfOfWidth => AxisCanvasVM.Width / 2d; public double HalfOfHeight => AxisCanvasVM.Height / 2d; + public int MainTextFontSize => 14; + public double TextScaleValue => 1 / scaleValue; public string CanvasViewportSize { @@ -63,6 +65,7 @@ namespace StructureHelper.Windows.MainWindow OnPropertyChanged(value, ref scaleValue); OnPropertyChanged(nameof(AxisLineThickness)); OnPropertyChanged(nameof(GridLineThickness)); + OnPropertyChanged(nameof(TextScaleValue)); } } diff --git a/StructureHelper/Windows/MainWindow/CrossSectionView.xaml b/StructureHelper/Windows/MainWindow/CrossSectionView.xaml index ddc19de..4ba28bf 100644 --- a/StructureHelper/Windows/MainWindow/CrossSectionView.xaml +++ b/StructureHelper/Windows/MainWindow/CrossSectionView.xaml @@ -210,8 +210,9 @@ - + + + + + + + + + + + + + + + + + + diff --git a/StructureHelper/Windows/UserControls/ListOfFileControl.xaml.cs b/StructureHelper/Windows/UserControls/ListOfFileControl.xaml.cs new file mode 100644 index 0000000..9b0a413 --- /dev/null +++ b/StructureHelper/Windows/UserControls/ListOfFileControl.xaml.cs @@ -0,0 +1,28 @@ +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.UserControls +{ + /// + /// Interaction logic for ListOfFileControl.xaml + /// + public partial class ListOfFileControl : UserControl + { + public ListOfFileControl() + { + InitializeComponent(); + } + } +} diff --git a/StructureHelper/Windows/ViewModels/Forces/ActionsViewModel.cs b/StructureHelper/Windows/ViewModels/Forces/ActionsViewModel.cs index 92c0b3d..b7d5311 100644 --- a/StructureHelper/Windows/ViewModels/Forces/ActionsViewModel.cs +++ b/StructureHelper/Windows/ViewModels/Forces/ActionsViewModel.cs @@ -29,6 +29,10 @@ namespace StructureHelper.Windows.ViewModels.Forces { NewItem = new ForceFactoredList() { Name = "New Factored Combination" }; } + else if (paramType == ActionType.ForceCombinationFromFile) + { + NewItem = new ForceCombinationFromFile { Name = "New Combination from file" }; + } else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $": Actual type: {nameof(paramType)}"); //GlobalRepository.Actions.Create(NewItem); base.AddMethod(parameter); @@ -60,20 +64,22 @@ namespace StructureHelper.Windows.ViewModels.Forces { //var copyObject = GlobalRepository.Actions.GetById(SelectedItem.Id).Clone() as IAction; var copyObject = SelectedItem.Clone() as IAction; - System.Windows.Window wnd; - if (SelectedItem is IForceCombinationList) + System.Windows.Window modelEditorWindow; + if (SelectedItem is IForceCombinationList combinationList) { - var item = (IForceCombinationList)SelectedItem; - wnd = new ForceCombinationView(item); + modelEditorWindow = new ForceCombinationView(combinationList); } - else if (SelectedItem is IForceFactoredList) + else if (SelectedItem is IForceFactoredList factoredList) { - var item = (IForceFactoredList)SelectedItem; - wnd = new ForceCombinationByFactorView(item); + modelEditorWindow = new ForceCombinationByFactorView(factoredList); + } + else if (SelectedItem is IForceCombinationFromFile fileCombination) + { + modelEditorWindow = new ForceCombinationFromFileView(fileCombination); } else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $"actual object type: {nameof(SelectedItem)}"); - wnd.ShowDialog(); - if (wnd.DialogResult == true) + modelEditorWindow.ShowDialog(); + if (modelEditorWindow.DialogResult == true) { //GlobalRepository.Actions.Update(SelectedItem); } @@ -100,11 +106,15 @@ namespace StructureHelper.Windows.ViewModels.Forces var forceCombinations = forceCalculator.InputData as IHasForceActions; result = DeleteActionFromHost(result, calc, forceCombinations); } - else if (calc is CrackCalculator calculator) + else if (calc is CrackCalculator crackCalculator) { - var forceCombinations = calculator.InputData as IHasForceActions; + var forceCombinations = crackCalculator.InputData as IHasForceActions; result = DeleteActionFromHost(result, calc, forceCombinations); } + else if (calc is ILimitCurvesCalculator) + { + //nothing to do + } else { throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(ICalculator), calc)); diff --git a/StructureHelperCommon/Models/Forces/ForceCombinationFromFile.cs b/StructureHelperCommon/Models/Forces/ForceCombinationFromFile.cs index 0cdd239..2b72465 100644 --- a/StructureHelperCommon/Models/Forces/ForceCombinationFromFile.cs +++ b/StructureHelperCommon/Models/Forces/ForceCombinationFromFile.cs @@ -1,4 +1,6 @@ using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Infrastructures.Interfaces; +using StructureHelperCommon.Models.Forces.Logics; using StructureHelperCommon.Models.Shapes; using System; using System.Collections.Generic; @@ -8,9 +10,13 @@ using System.Threading.Tasks; namespace StructureHelperCommon.Models.Forces { - internal class ForceCombinationFromFile : IForceCombinationFromFile + public class ForceCombinationFromFile : IForceCombinationFromFile { - private IForceFactoredCombination factoredCombination; + IUpdateStrategy updateStrategy; + IUpdateStrategy propertyUpdateStrategy; + IGetTupleFromFileLogic getTupleFromFileLogic; + + private IForceFactoredList factoredCombination; public Guid Id { get; set; } public string Name { get; set; } = string.Empty; public List ForceFiles { get; set; } = new(); @@ -21,12 +27,25 @@ namespace StructureHelperCommon.Models.Forces public object Clone() { - throw new NotImplementedException(); + ForceCombinationFromFile newItem = new(); + updateStrategy ??= new ForceCombinationFromFileUpdateStrategy(); + updateStrategy.Update(newItem, this); + return newItem; } public List GetCombinations() { + getTupleFromFileLogic ??= new GetTupleFromFileLogic() { TraceLogger = new ShiftTraceLogger()}; factoredCombination = new ForceFactoredList(); + factoredCombination.ForceTuples.Clear(); + propertyUpdateStrategy ??= new FactoredCombinationPropertyUpdateStrategy(); + propertyUpdateStrategy.Update(factoredCombination.CombinationProperty, CombinationProperty); + foreach (var file in ForceFiles) + { + getTupleFromFileLogic.ForceFileProperty = file; + var tuples = getTupleFromFileLogic.GetTuples(); + factoredCombination.ForceTuples.AddRange(tuples); + } return factoredCombination.GetCombinations(); } } diff --git a/StructureHelperCommon/Models/Forces/ForceFileProperty.cs b/StructureHelperCommon/Models/Forces/ForceFileProperty.cs index c244c11..e83c6be 100644 --- a/StructureHelperCommon/Models/Forces/ForceFileProperty.cs +++ b/StructureHelperCommon/Models/Forces/ForceFileProperty.cs @@ -10,15 +10,13 @@ namespace StructureHelperCommon.Models.Forces public class ForceFileProperty : IForceFileProperty { public Guid Id { get; private set; } - public LimitStates LimitState { get; set; } = LimitStates.ULS; - public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm; public string FilePath { get; set; } = string.Empty; public int SkipRowBeforeHeaderCount { get; set; } = 2; public int SkipRowHeaderCount { get; set; } = 1; public double GlobalFactor { get; set; } = 1d; - public IColumnProperty Mx { get; set; } = new ColumnProperty("N"); - public IColumnProperty My { get; set; } = new ColumnProperty("My"); - public IColumnProperty Nz { get; set; } = new ColumnProperty("Mz"); + public IColumnProperty Nz { get; set; } = new ColumnProperty("N") { ColumnIndex = 6}; + public IColumnProperty Mx { get; set; } = new ColumnProperty("My") { ColumnIndex = 8}; + public IColumnProperty My { get; set; } = new ColumnProperty("Mz") { ColumnIndex = 10}; public ForceFileProperty(Guid id) { diff --git a/StructureHelperCommon/Models/Forces/IFileProperty.cs b/StructureHelperCommon/Models/Forces/IFileProperty.cs new file mode 100644 index 0000000..b0cf5c4 --- /dev/null +++ b/StructureHelperCommon/Models/Forces/IFileProperty.cs @@ -0,0 +1,9 @@ +using StructureHelperCommon.Infrastructures.Interfaces; + +namespace StructureHelperCommon.Models.Forces +{ + public interface IFileProperty : ISaveable + { + string FilePath { get; set; } + } +} \ No newline at end of file diff --git a/StructureHelperCommon/Models/Forces/IForceCombinationFromFile.cs b/StructureHelperCommon/Models/Forces/IForceCombinationFromFile.cs index 9ad6baf..38b1125 100644 --- a/StructureHelperCommon/Models/Forces/IForceCombinationFromFile.cs +++ b/StructureHelperCommon/Models/Forces/IForceCombinationFromFile.cs @@ -9,7 +9,7 @@ namespace StructureHelperCommon.Models.Forces /// /// Supports list of files which provides import of combination of forces /// - internal interface IForceCombinationFromFile : IForceFactoredCombination + public interface IForceCombinationFromFile : IForceFactoredCombination { /// /// List of file properties for import combination diff --git a/StructureHelperCommon/Models/Forces/IForceFileProperty.cs b/StructureHelperCommon/Models/Forces/IForceFileProperty.cs index fe42830..9e1cec5 100644 --- a/StructureHelperCommon/Models/Forces/IForceFileProperty.cs +++ b/StructureHelperCommon/Models/Forces/IForceFileProperty.cs @@ -11,11 +11,8 @@ namespace StructureHelperCommon.Models.Forces /// /// Settings for extracting force combination from MSExcel file /// - public interface IForceFileProperty : ISaveable + public interface IForceFileProperty : IFileProperty { - LimitStates LimitState { get; set; } - CalcTerms CalcTerm { get; set; } - string FilePath { get; set; } int SkipRowBeforeHeaderCount { get; set; } int SkipRowHeaderCount { get; set; } double GlobalFactor { get; set; } diff --git a/StructureHelperCommon/Models/Forces/Logics/ActionUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/Logics/ActionUpdateStrategy.cs index 855bd9c..19f5821 100644 --- a/StructureHelperCommon/Models/Forces/Logics/ActionUpdateStrategy.cs +++ b/StructureHelperCommon/Models/Forces/Logics/ActionUpdateStrategy.cs @@ -11,9 +11,10 @@ namespace StructureHelperCommon.Models.Forces { public class ActionUpdateStrategy : IUpdateStrategy { - readonly IUpdateStrategy forceUpdateStrategy = new ForceActionUpdateStrategy(); + private IUpdateStrategy forceUpdateStrategy; public void Update(IAction targetObject, IAction sourceObject) { + forceUpdateStrategy ??= new ForceActionUpdateStrategy(); CheckObject.IsNull(targetObject); CheckObject.IsNull(sourceObject); if (ReferenceEquals(targetObject, sourceObject)) { return; } diff --git a/StructureHelperCommon/Models/Forces/Logics/CheckForceActionsLogic.cs b/StructureHelperCommon/Models/Forces/Logics/CheckForceActionsLogic.cs new file mode 100644 index 0000000..0972afb --- /dev/null +++ b/StructureHelperCommon/Models/Forces/Logics/CheckForceActionsLogic.cs @@ -0,0 +1,45 @@ +using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Infrastructures.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperCommon.Models.Forces.Logics +{ + public class CheckForceActionsLogic : ICheckEntityLogic> + { + private bool result; + private string checkResult; + public string CheckResult => checkResult; + + public IShiftTraceLogger? TraceLogger { get; set; } + public IEnumerable Entity { get; set; } + + public bool Check() + { + result = true; + foreach (var item in Entity) + { + try + { + item.GetCombinations(); + } + catch (Exception ex) + { + result = false; + string errorString = $"Error of getting of combination of forces from action {item.Name}: {ex.Message}"; + TraceMessage(errorString); + } + } + return result; + } + + private void TraceMessage(string errorString) + { + checkResult += errorString + "\n"; + TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error); + } + } +} diff --git a/StructureHelperCommon/Models/Forces/Logics/ForceActionBaseUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/Logics/ForceActionBaseUpdateStrategy.cs index 0403a78..1c5cf3f 100644 --- a/StructureHelperCommon/Models/Forces/Logics/ForceActionBaseUpdateStrategy.cs +++ b/StructureHelperCommon/Models/Forces/Logics/ForceActionBaseUpdateStrategy.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace StructureHelperCommon.Models.Forces.Logics +namespace StructureHelperCommon.Models.Forces { public class ForceActionBaseUpdateStrategy : IUpdateStrategy { diff --git a/StructureHelperCommon/Models/Forces/Logics/ForceActionUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/Logics/ForceActionUpdateStrategy.cs index c674e80..d2bf4ae 100644 --- a/StructureHelperCommon/Models/Forces/Logics/ForceActionUpdateStrategy.cs +++ b/StructureHelperCommon/Models/Forces/Logics/ForceActionUpdateStrategy.cs @@ -10,6 +10,9 @@ using System.Threading.Tasks; using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Models.Forces.Logics; +//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia +//All rights reserved. + namespace StructureHelperCommon.Models.Forces { public class ForceActionUpdateStrategy : IUpdateStrategy @@ -18,24 +21,28 @@ namespace StructureHelperCommon.Models.Forces private readonly IUpdateStrategy forcePairUpdateStrategy; private readonly IUpdateStrategy factorUpdateStrategy; private readonly IUpdateStrategy forceListUpdateStrategy; + private readonly IUpdateStrategy fileCombinationUpdateStrategy; public ForceActionUpdateStrategy( IUpdateStrategy forceActionUpdateStrategy, IUpdateStrategy forcePairUpdateStrategy, IUpdateStrategy factorUpdateStrategy, - IUpdateStrategy forceListUpdateStrategy) + IUpdateStrategy forceListUpdateStrategy, + IUpdateStrategy fileCombinationUpdateStrategy) { this.forceActionUpdateStrategy = forceActionUpdateStrategy; this.forcePairUpdateStrategy = forcePairUpdateStrategy; this.factorUpdateStrategy = factorUpdateStrategy; this.forceListUpdateStrategy = forceListUpdateStrategy; + this.fileCombinationUpdateStrategy = fileCombinationUpdateStrategy; } public ForceActionUpdateStrategy() : this( new ForceActionBaseUpdateStrategy(), new ForcePairUpdateStrategy(), new ForceFactoredListUpdateStrategy(), - new ForceCombinationListUpdateStrategy() + new ForceCombinationListUpdateStrategy(), + new ForceCombinationFromFileUpdateStrategy() ) { @@ -64,6 +71,10 @@ namespace StructureHelperCommon.Models.Forces { forceListUpdateStrategy.Update(forceCombinationList, (IForceCombinationList)sourceObject); } + else if (targetObject is IForceCombinationFromFile fileCombination) + { + fileCombinationUpdateStrategy.Update(fileCombination, (IForceCombinationFromFile)sourceObject); + } else { ErrorCommonProcessor.ObjectTypeIsUnknown(typeof(IForceAction), targetObject.GetType()); diff --git a/StructureHelperCommon/Models/Forces/Logics/ForceCombinationFromFileUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/Logics/ForceCombinationFromFileUpdateStrategy.cs index d96b8f8..71542d8 100644 --- a/StructureHelperCommon/Models/Forces/Logics/ForceCombinationFromFileUpdateStrategy.cs +++ b/StructureHelperCommon/Models/Forces/Logics/ForceCombinationFromFileUpdateStrategy.cs @@ -13,17 +13,15 @@ namespace StructureHelperCommon.Models.Forces private IUpdateStrategy baseUpdateStrategy; private IUpdateStrategy fileUpdateStrategy; - public ForceCombinationFromFileUpdateStrategy(IUpdateStrategy baseUpdateStrategy, IUpdateStrategy fileUpdateStrategy) + public ForceCombinationFromFileUpdateStrategy(IUpdateStrategy baseUpdateStrategy, + IUpdateStrategy fileUpdateStrategy) { this.baseUpdateStrategy = baseUpdateStrategy; this.fileUpdateStrategy = fileUpdateStrategy; } - public ForceCombinationFromFileUpdateStrategy() : this ( - new ForceActionUpdateStrategy(), - new ForceFilePropertyUpdateStrategy()) - { - + public ForceCombinationFromFileUpdateStrategy() + { } void IUpdateStrategy.Update(IForceCombinationFromFile targetObject, IForceCombinationFromFile sourceObject) @@ -31,12 +29,21 @@ namespace StructureHelperCommon.Models.Forces CheckObject.IsNull(targetObject); CheckObject.IsNull(sourceObject); if (ReferenceEquals(targetObject, sourceObject)) { return; } + InitializeLogics(); baseUpdateStrategy.Update(targetObject, sourceObject); targetObject.ForceFiles.Clear(); foreach (var file in sourceObject.ForceFiles) { - throw new NotImplementedException(); + ForceFileProperty newProperty = new(); + fileUpdateStrategy.Update(newProperty, file); + targetObject.ForceFiles.Add(newProperty); } } + + private void InitializeLogics() + { + baseUpdateStrategy ??= new ForceActionBaseUpdateStrategy(); + fileUpdateStrategy ??= new ForceFilePropertyUpdateStrategy(); + } } } diff --git a/StructureHelperCommon/Models/Forces/Logics/ForceFilePropertyUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/Logics/ForceFilePropertyUpdateStrategy.cs index e65867d..f8cf5ba 100644 --- a/StructureHelperCommon/Models/Forces/Logics/ForceFilePropertyUpdateStrategy.cs +++ b/StructureHelperCommon/Models/Forces/Logics/ForceFilePropertyUpdateStrategy.cs @@ -27,8 +27,6 @@ namespace StructureHelperCommon.Models.Forces CheckObject.IsNull(targetObject); CheckObject.IsNull(sourceObject); if (ReferenceEquals(targetObject, sourceObject)) { return; } - targetObject.LimitState = sourceObject.LimitState; - targetObject.CalcTerm = sourceObject.CalcTerm; targetObject.FilePath = sourceObject.FilePath; targetObject.GlobalFactor = sourceObject.GlobalFactor; targetObject.SkipRowBeforeHeaderCount = sourceObject.SkipRowBeforeHeaderCount; diff --git a/StructureHelperCommon/Models/Forces/Logics/GetTupleFromFileLogic.cs b/StructureHelperCommon/Models/Forces/Logics/GetTupleFromFileLogic.cs new file mode 100644 index 0000000..e5d70c5 --- /dev/null +++ b/StructureHelperCommon/Models/Forces/Logics/GetTupleFromFileLogic.cs @@ -0,0 +1,79 @@ +using ExcelDataReader; +using StructureHelperCommon.Infrastructures.Exceptions; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperCommon.Models.Forces.Logics +{ + public class GetTupleFromFileLogic : IGetTupleFromFileLogic + { + public IForceFileProperty ForceFileProperty { get; set; } + public IShiftTraceLogger? TraceLogger { get; set; } + + public List GetTuples() + { + // Ensure ExcelDataReader's encoding provider is registered + System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); + + var result = ReadDataFromFile(); + return result; + } + + private List ReadDataFromFile() + { + List result = new(); + // Open the Excel file stream + using (var stream = File.Open(ForceFileProperty.FilePath, FileMode.Open, FileAccess.Read)) + { + // Create an Excel reader + using (var reader = ExcelReaderFactory.CreateReader(stream)) + { + // Skip the first two header rows if necessary (adjust based on structure) + int skipRows = ForceFileProperty.SkipRowBeforeHeaderCount + ForceFileProperty.SkipRowHeaderCount; + for (int i = 0; i < skipRows; i++) + { + reader.Read(); // Skip row + } + + // Loop through the rows + while (reader.Read()) + { + var nValue = reader.GetValue(ForceFileProperty.Nz.ColumnIndex)?.ToString(); + var mxValue = reader.GetValue(ForceFileProperty.Mx.ColumnIndex)?.ToString(); + var myValue = reader.GetValue(ForceFileProperty.My.ColumnIndex)?.ToString(); + TraceLogger?.AddMessage($"Values: Nz = {nValue}(N), Mx = {mxValue}(N*m), My = {myValue}(N*m) were gained", TraceLogStatuses.Debug); + if (nValue is not null && mxValue is not null && myValue is not null) + { + ForceTuple newTuple = GetForceTuple(nValue, mxValue, myValue); + result.Add(newTuple); + } + } + } + } + return result; + } + + private ForceTuple GetForceTuple(string? nValue, string? mxValue, string? myValue) + { + try + { + double nDouble = Convert.ToDouble(nValue); + double mxDouble = Convert.ToDouble(mxValue); + double myDouble = Convert.ToDouble(myValue); + TraceLogger?.AddMessage($"Values: Nz = {nDouble}(N), Mx = {mxDouble}(N*m), My = {myDouble}(N*m) were converted successfully", TraceLogStatuses.Debug); + ForceTuple newTuple = new() { Nz = nDouble, Mx = mxDouble, My = myDouble }; + return newTuple; + } + catch (Exception ex) + { + string errorString = ErrorStrings.DataIsInCorrect + $": incorrect data in file {ForceFileProperty.FilePath}, " + ex.Message; + TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error); + throw new StructureHelperException(errorString); + } + } + } +} diff --git a/StructureHelperCommon/Models/Forces/Logics/IGetTupleFromFileLogic.cs b/StructureHelperCommon/Models/Forces/Logics/IGetTupleFromFileLogic.cs new file mode 100644 index 0000000..df923a8 --- /dev/null +++ b/StructureHelperCommon/Models/Forces/Logics/IGetTupleFromFileLogic.cs @@ -0,0 +1,12 @@ +using StructureHelperCommon.Infrastructures.Interfaces; +using System.Collections.Generic; + +namespace StructureHelperCommon.Models.Forces.Logics +{ + public interface IGetTupleFromFileLogic : ILogic + { + IForceFileProperty ForceFileProperty { get; set; } + + List GetTuples(); + } +} \ No newline at end of file diff --git a/StructureHelperCommon/StructureHelperCommon.csproj b/StructureHelperCommon/StructureHelperCommon.csproj index 64f85c9..5300505 100644 --- a/StructureHelperCommon/StructureHelperCommon.csproj +++ b/StructureHelperCommon/StructureHelperCommon.csproj @@ -10,6 +10,7 @@ + diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/CheckForceCalculatorInputData.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/CheckForceCalculatorInputData.cs index 80be38f..5e64b55 100644 --- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/CheckForceCalculatorInputData.cs +++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/CheckForceCalculatorInputData.cs @@ -4,6 +4,7 @@ using StructureHelperCommon.Infrastructures.Settings; using StructureHelperCommon.Models; using StructureHelperCommon.Models.Calculators; using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Models.Forces.Logics; using StructureHelperLogics.NdmCalculations.Cracking; using System; using System.Collections.Generic; @@ -66,9 +67,24 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces result = false; } CheckAccuracy(); + CheckActions(); return result; } + private void CheckActions() + { + var checkLogic = new CheckForceActionsLogic() + { + Entity = InputData.ForceActions, + TraceLogger = TraceLogger + }; + if (checkLogic.Check() == false) + { + result = false; + } + TraceMessage(checkLogic.CheckResult); + } + private void CheckAccuracy() { checkAccuracyLogic.Entity = InputData.Accuracy; diff --git a/StructureHelperLogics/NdmCalculations/Cracking/CheckLogics/CheckCrackCalculatorInputDataLogic.cs b/StructureHelperLogics/NdmCalculations/Cracking/CheckLogics/CheckCrackCalculatorInputDataLogic.cs index bb3c702..78fb59c 100644 --- a/StructureHelperLogics/NdmCalculations/Cracking/CheckLogics/CheckCrackCalculatorInputDataLogic.cs +++ b/StructureHelperLogics/NdmCalculations/Cracking/CheckLogics/CheckCrackCalculatorInputDataLogic.cs @@ -2,6 +2,7 @@ using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Models; using StructureHelperCommon.Models.Calculators; +using StructureHelperCommon.Models.Forces.Logics; using StructureHelperCommon.Models.Loggers; using StructureHelperCommon.Models.Materials; using StructureHelperLogics.NdmCalculations.Primitives; @@ -74,7 +75,23 @@ namespace StructureHelperLogics.NdmCalculations.Cracking string message = "Calculator does not contain any actions\n"; CheckResult += message; TraceLogger?.AddMessage(message, TraceLogStatuses.Error); + return; }; + var checkLogic = new CheckForceActionsLogic() + { + Entity = InputData.ForceActions, + TraceLogger = TraceLogger + }; + if (checkLogic.Check() == false) + { + result = false; + } + TraceMessage(checkLogic.CheckResult); + } + private void TraceMessage(string errorString) + { + CheckResult += errorString + "\n"; + TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error); }