SourceToTargetViewModel was added
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
@@ -22,6 +23,31 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
IEnumerable<IForceCombinationList> allowedForceCombinations;
|
||||
ForceCalculator forcesCalculator;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return forcesCalculator.Name; }
|
||||
set { forcesCalculator.Name = value; }
|
||||
}
|
||||
|
||||
public double IterationAccuracy
|
||||
{
|
||||
get { return forcesCalculator.IterationAccuracy; }
|
||||
set { forcesCalculator.IterationAccuracy = value;}
|
||||
}
|
||||
|
||||
public int MaxIterationCount
|
||||
{
|
||||
get { return forcesCalculator.MaxIterationCount; }
|
||||
set { forcesCalculator.MaxIterationCount = value; }
|
||||
}
|
||||
|
||||
public bool ULS { get; set; }
|
||||
public bool SLS { get; set; }
|
||||
public bool ShortTerm { get; set; }
|
||||
public bool LongTerm { get; set; }
|
||||
|
||||
public ISourceToTargetViewModel<IForceCombinationList> CombinationViewModel { get; }
|
||||
|
||||
public PrimitiveBase SelectedAllowedPrimitive { get; set; }
|
||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||
|
||||
@@ -69,7 +95,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
forcesCalculator.NdmPrimitives.Clear();
|
||||
forcesCalculator.NdmPrimitives.AddRange(allowedPrimitives);
|
||||
}
|
||||
|
||||
public ICommand ClearAllPrimitivesCommand
|
||||
{
|
||||
get
|
||||
@@ -84,7 +109,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
}, o => forcesCalculator.NdmPrimitives.Count > 0 ));
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand AddSelectedPrimitiveCommand
|
||||
{
|
||||
get
|
||||
@@ -99,7 +123,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
}, o => SelectedAllowedPrimitive != null));
|
||||
}
|
||||
}
|
||||
|
||||
public RelayCommand RemoveSelectedPrimitiveCommand
|
||||
{
|
||||
get
|
||||
@@ -120,6 +143,12 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
allowedPrimitives = _allowedPrimitives;
|
||||
allowedForceCombinations = _allowedForceCombinations;
|
||||
forcesCalculator = _forcesCalculator;
|
||||
|
||||
CombinationViewModel = new SourceToTargetViewModel<IForceCombinationList>();
|
||||
CombinationViewModel.SetTargetItems(forcesCalculator.ForceCombinationLists);
|
||||
CombinationViewModel.SetSourceItems(allowedForceCombinations);
|
||||
|
||||
InputRefresh();
|
||||
}
|
||||
|
||||
private ObservableCollection<PrimitiveBase> ConvertNdmPrimitivesToPrimitiveBase(IEnumerable<INdmPrimitive> primitives)
|
||||
@@ -141,5 +170,29 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
}
|
||||
return viewItems;
|
||||
}
|
||||
|
||||
public void InputRefresh()
|
||||
{
|
||||
ULS = forcesCalculator.LimitStatesList.Contains(LimitStates.ULS);
|
||||
SLS = forcesCalculator.LimitStatesList.Contains(LimitStates.SLS);
|
||||
ShortTerm = forcesCalculator.CalcTermsList.Contains(CalcTerms.ShortTerm);
|
||||
LongTerm = forcesCalculator.CalcTermsList.Contains(CalcTerms.LongTerm);
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
var combinations = CombinationViewModel.GetTargetItems();
|
||||
forcesCalculator.ForceCombinationLists.Clear();
|
||||
foreach (var item in combinations)
|
||||
{
|
||||
forcesCalculator.ForceCombinationLists.Add(item);
|
||||
}
|
||||
forcesCalculator.LimitStatesList.Clear();
|
||||
if (ULS == true) { forcesCalculator.LimitStatesList.Add(LimitStates.ULS); }
|
||||
if (SLS == true) { forcesCalculator.LimitStatesList.Add(LimitStates.SLS); }
|
||||
forcesCalculator.CalcTermsList.Clear();
|
||||
if (ShortTerm == true) { forcesCalculator.CalcTermsList.Add(CalcTerms.ShortTerm); }
|
||||
if (LongTerm == true) { forcesCalculator.CalcTermsList.Add(CalcTerms.LongTerm); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
public interface ICombinationSourceToTargetViewModel : ISourceToTargetViewModel<IForceCombinationList>
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user