Interpolation View for calculation result was added

This commit is contained in:
Evgeny Redikultsev
2023-01-08 14:11:16 +05:00
parent 2d7c8648ab
commit 401e3dd02b
52 changed files with 1428 additions and 61 deletions

View File

@@ -0,0 +1,60 @@
using StructureHelper.Windows.Forces;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace StructureHelper.Windows.ViewModels.Forces
{
public class ActionsViewModel : CRUDViewModelBase<IForceCombinationList>
{
ICrossSectionRepository repository;
public override void AddMethod(object parameter)
{
NewItem = new ForceCombinationList() { Name = "New Force Combination" };
base.AddMethod(parameter);
}
public override void DeleteMethod()
{
var dialogResult = MessageBox.Show("Delete action?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (dialogResult == DialogResult.Yes)
{
var calcRepository = repository.CalculatorsList;
foreach (var item in calcRepository)
{
if (item is IForceCalculator)
{
var forceCalculator = item as IForceCalculator;
var containSelected = forceCalculator.ForceCombinationLists.Contains(SelectedItem);
if (containSelected)
{
var dialogResultCalc = MessageBox.Show($"Action is contained in calculator {item.Name}", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (dialogResultCalc == DialogResult.OK) { forceCalculator.ForceCombinationLists.Remove(SelectedItem); }
else return;
}
}
}
base.DeleteMethod();
}
}
public override void EditMethod(object parameter)
{
var wnd = new ForceCombinationView(SelectedItem);
wnd.ShowDialog();
base.EditMethod(parameter);
}
public ActionsViewModel(ICrossSectionRepository repository) : base (repository.ForceCombinationLists)
{
this.repository = repository;
}
}
}

View File

@@ -12,7 +12,9 @@ namespace StructureHelper.Windows.ViewModels.Forces
{
IForceCombinationList combinationList;
public IDesignForceTuple SelectedTuple { get; set; }
//public IDesignForceTuple SelectedTuple { get; set; }
public ForceTuplesViewModel DesignForces { get;}
public string Name
{
get => combinationList.Name;
@@ -55,11 +57,12 @@ namespace StructureHelper.Windows.ViewModels.Forces
}
}
public IEnumerable<IDesignForceTuple> ForceTuples { get => combinationList.DesignForces; }
//public IEnumerable<IDesignForceTuple> ForceTuples { get => combinationList.DesignForces; }
public ForceCombinationViewModel(IForceCombinationList combinationList)
{
this.combinationList = combinationList;
DesignForces = new ForceTuplesViewModel(this.combinationList.DesignForces);
}
}
}

View File

@@ -0,0 +1,25 @@
using StructureHelper.Properties;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.ViewModels.Forces
{
public class ForceTuplesViewModel : CRUDViewModelBase<IDesignForceTuple>
{
public override void AddMethod(object parameter)
{
NewItem = new DesignForceTuple() { LimitState=LimitStates.ULS, CalcTerm=CalcTerms.ShortTerm};
base.AddMethod(parameter);
}
public ForceTuplesViewModel(List<IDesignForceTuple> collection) : base(collection)
{
}
}
}

View File

@@ -0,0 +1,40 @@
using StructureHelper.Infrastructure;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.ViewModels.Forces
{
public class InterpolateTuplesViewModel : OkCancelViewModelBase
{
public IDesignForceTuple StartDesignForce { get; }
public IDesignForceTuple FinishDesignForce { get; }
public int StepCount { get; set; }
public InterpolateTuplesViewModel(IDesignForceTuple finishDesignForce, IDesignForceTuple startDesignForce=null, int stepCount = 100)
{
if (startDesignForce !=null)
{
if (startDesignForce.LimitState != finishDesignForce.LimitState) throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid);
if (startDesignForce.CalcTerm != finishDesignForce.CalcTerm) throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid);
StartDesignForce = startDesignForce;
}
else
{
StartDesignForce = new DesignForceTuple()
{
CalcTerm = finishDesignForce.CalcTerm,
LimitState = finishDesignForce.LimitState,
ForceTuple = new ForceTuple() { Mx = 0, My = 0, Nz = 0 },
};
}
FinishDesignForce = finishDesignForce;
StepCount = stepCount;
}
}
}