Options for primitive series in limit curves were added
This commit is contained in:
@@ -8,7 +8,13 @@
|
|||||||
<ColumnDefinition Width="60"/>
|
<ColumnDefinition Width="60"/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<ListBox ItemsSource="{Binding SourceItems}" SelectedItem="{Binding SelectedSourceItem}" ItemTemplate="{Binding ItemDataDemplate}"/>
|
<ListBox ItemsSource="{Binding SourceItems}"
|
||||||
|
SelectedItem="{Binding SelectedSourceItem}"
|
||||||
|
ItemTemplate="{Binding ItemDataDemplate}">
|
||||||
|
<!--<InputBindingCollection>
|
||||||
|
<MouseBinding Gesture="LeftDoubleClick" Command="{Binding AddSelected}"/>
|
||||||
|
</InputBindingCollection>-->
|
||||||
|
</ListBox>
|
||||||
<StackPanel Grid.Column="1">
|
<StackPanel Grid.Column="1">
|
||||||
<Button Content="Add all" Command="{Binding AddAll}"/>
|
<Button Content="Add all" Command="{Binding AddAll}"/>
|
||||||
<Button Content="Clear all" Command="{Binding ClearAll}"/>
|
<Button Content="Clear all" Command="{Binding ClearAll}"/>
|
||||||
@@ -16,7 +22,12 @@
|
|||||||
<Button Content="<<" Command="{Binding RemoveSelected}"/>
|
<Button Content="<<" Command="{Binding RemoveSelected}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<ListBox Grid.Column="2" ItemsSource="{Binding TargetItems}"
|
<ListBox Grid.Column="2" ItemsSource="{Binding TargetItems}"
|
||||||
SelectedItem="{Binding SelectedTargetItem}" ItemTemplate="{Binding ItemDataDemplate}"/>
|
SelectedItem="{Binding SelectedTargetItem}"
|
||||||
|
ItemTemplate="{Binding ItemDataDemplate}">
|
||||||
|
<!--<InputBindingCollection>
|
||||||
|
<MouseBinding Gesture="LeftDoubleClick" Command="{Binding RemoveSelected}"/>
|
||||||
|
</InputBindingCollection>-->
|
||||||
|
</ListBox>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate x:Key="SelectItems">
|
<DataTemplate x:Key="SelectItems">
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
<Compile Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\LimitCurveDataView.xaml.cs">
|
<Compile Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\LimitCurveDataView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\UserControls\LimitCurveControl.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\UserControls\SurroundDataControl.xaml.cs">
|
<Compile Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\UserControls\SurroundDataControl.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -74,6 +77,9 @@
|
|||||||
<Page Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\LimitCurveDataView.xaml">
|
<Page Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\LimitCurveDataView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\UserControls\LimitCurveControl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\UserControls\SurroundDataControl.xaml">
|
<Page Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\UserControls\SurroundDataControl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
{
|
{
|
||||||
InputData = inputData;
|
InputData = inputData;
|
||||||
stepCount = InputData.PointCount;
|
stepCount = InputData.PointCount;
|
||||||
|
stepCount *= inputData.PrimitiveSeries.Count;
|
||||||
stepCount *= InputData.LimitStates.Count();
|
stepCount *= InputData.LimitStates.Count();
|
||||||
stepCount *= InputData.CalcTerms.Count();
|
stepCount *= InputData.CalcTerms.Count();
|
||||||
stepCount *= InputData.PredicateEntries.Count();
|
stepCount *= InputData.PredicateEntries.Count();
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic
|
||||||
|
{
|
||||||
|
internal static class LimitCurveDataService
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,49 +6,14 @@
|
|||||||
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic"
|
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic"
|
||||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||||
xmlns:fc="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
|
xmlns:fc="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
|
||||||
d:DataContext ="{d:DesignInstance local:LimitCurveDataViewModel}"
|
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Diagram properties" Height="360" Width="400" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
Title="Diagram properties" Height="360" Width="400" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
|
|
||||||
<RowDefinition Height="35"/>
|
<RowDefinition Height="35"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TabControl>
|
<fc:LimitCurveControl x:Name="CurveData" LimitCurveViewModel="{Binding}"/>
|
||||||
<TabItem Header="Limits">
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
<RowDefinition Height="35"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<fc:SurroundDataControl x:Name="SurData" SurroundData="{Binding SurroundData}"/>
|
|
||||||
<Grid Grid.Row="1">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="25"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="150"/>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
<ColumnDefinition Width="120"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<TextBlock Text="Point count"/>
|
|
||||||
<TextBox Grid.Column="1" Text="{Binding PointCount, ValidatesOnDataErrors=True}"/>
|
|
||||||
<uc:MultiplyDouble Margin="2" Grid.Column="3" ValueChanged="PointCountChanged"/>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</TabItem>
|
|
||||||
<TabItem Header="Predicates">
|
|
||||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding PredicateItems}"/>
|
|
||||||
</TabItem>
|
|
||||||
<TabItem Header="States">
|
|
||||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding LimitStateItems}"/>
|
|
||||||
</TabItem>
|
|
||||||
<TabItem Header="Terms">
|
|
||||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding CalcTermITems}"/>
|
|
||||||
</TabItem>
|
|
||||||
</TabControl>
|
|
||||||
<!--<ContentControl ContentTemplate="{StaticResource SurroundData}" Content="{Binding SurroundDataViewModel}"/>-->
|
|
||||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using StructureHelper.Windows.UserControls;
|
using StructureHelper.Windows.UserControls;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -22,25 +23,13 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
public partial class LimitCurveDataView : Window
|
public partial class LimitCurveDataView : Window
|
||||||
{
|
{
|
||||||
private LimitCurveDataViewModel viewModel;
|
private LimitCurveDataViewModel viewModel;
|
||||||
public LimitCurveDataView(SurroundData surroundData) : this(new LimitCurveDataViewModel(surroundData)) { }
|
|
||||||
public LimitCurveDataView(LimitCurveDataViewModel vm)
|
public LimitCurveDataView(LimitCurveDataViewModel vm)
|
||||||
{
|
{
|
||||||
viewModel = vm;
|
viewModel = vm;
|
||||||
viewModel.ParentWindow = this;
|
viewModel.ParentWindow = this;
|
||||||
DataContext = viewModel;
|
DataContext = viewModel;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
SurData.SurroundData = vm.SurroundData;
|
CurveData.LimitCurveViewModel = viewModel;
|
||||||
}
|
|
||||||
private void PointCountChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
viewModel.PointCount = Convert.ToInt32(viewModel.PointCount * ChangeValue(sender));
|
|
||||||
}
|
|
||||||
|
|
||||||
private double ChangeValue(object sender)
|
|
||||||
{
|
|
||||||
var obj = (MultiplyDouble)sender;
|
|
||||||
var factor = obj.DoubleFactor;
|
|
||||||
return factor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
using StructureHelper.Windows.ViewModels;
|
using StructureHelper.Windows.ViewModels;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
@@ -23,84 +24,76 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
{
|
{
|
||||||
public class LimitCurveDataViewModel : OkCancelViewModelBase, IDataErrorInfo
|
public class LimitCurveDataViewModel : OkCancelViewModelBase, IDataErrorInfo
|
||||||
{
|
{
|
||||||
private int pointCount;
|
private LimitCurveInputData inputData;
|
||||||
|
|
||||||
|
|
||||||
//public SurroundDataViewModel SurroundDataViewModel { get; private set; }
|
//public SurroundDataViewModel SurroundDataViewModel { get; private set; }
|
||||||
public SurroundData SurroundData { get; set; }
|
public SurroundData SurroundData { get => inputData.SurroundData; }
|
||||||
public List<INdmPrimitive> Primitives { get; set; }
|
public SelectPrimitivesSourceTarget PrimitiveSeries { get; private set; }
|
||||||
public SelectItemsViewModel<PredicateEntry> PredicateItems { get; private set; }
|
public SelectItemsVM<PredicateEntry> PredicateItems { get; private set; }
|
||||||
public SelectItemsViewModel<LimitStateEntity> LimitStateItems { get; private set; }
|
public SelectItemsVM<LimitStateEntity> LimitStateItems { get; private set; }
|
||||||
public SelectItemsViewModel<CalcTermEntity> CalcTermITems { get; private set; }
|
public SelectItemsVM<CalcTermEntity> CalcTermITems { get; private set; }
|
||||||
|
public bool ShowPrimitivesTab { get; set; }
|
||||||
|
|
||||||
public int PointCount
|
public int PointCount
|
||||||
{
|
{
|
||||||
get => pointCount; set
|
get => inputData.PointCount; set
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pointCount = value;
|
inputData.PointCount = value;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
pointCount = 40;
|
inputData.PointCount = 40;
|
||||||
}
|
}
|
||||||
OnPropertyChanged(nameof(PointCount));
|
OnPropertyChanged(nameof(PointCount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LimitCurveDataViewModel(SurroundData surroundData)
|
public IEnumerable<INdmPrimitive> AllowedPrimitives { get; set; }
|
||||||
|
|
||||||
|
public LimitCurveDataViewModel(LimitCurveInputData inputData, IEnumerable<INdmPrimitive> allowedPrimitives)
|
||||||
{
|
{
|
||||||
//SurroundDataViewModel = new(surroundData);
|
this.inputData = inputData;
|
||||||
SurroundData = surroundData;
|
AllowedPrimitives = allowedPrimitives;
|
||||||
|
List<NamedValue<SourceTargetVM<PrimitiveBase>>> namedCollection = new List<NamedValue<SourceTargetVM<PrimitiveBase>>>();
|
||||||
|
foreach (var item in inputData.PrimitiveSeries)
|
||||||
|
{
|
||||||
|
var viewModel = SourceTargetFactory.GetSourceTargetVM(AllowedPrimitives, item.Collection);
|
||||||
|
var namedViewModel = new NamedValue<SourceTargetVM<PrimitiveBase>>()
|
||||||
|
{
|
||||||
|
Name = item.Name,
|
||||||
|
Value = viewModel
|
||||||
|
};
|
||||||
|
namedCollection.Add(namedViewModel);
|
||||||
|
}
|
||||||
|
PrimitiveSeries = new SelectPrimitivesSourceTarget(namedCollection);
|
||||||
|
PrimitiveSeries.AllowedPrimitives = allowedPrimitives.ToList();
|
||||||
GetPredicates();
|
GetPredicates();
|
||||||
GetLimitStates();
|
GetLimitStates();
|
||||||
GetCalcTerms();
|
GetCalcTerms();
|
||||||
pointCount = 80;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GetCalcTerms()
|
public void RefreshInputData()
|
||||||
{
|
{
|
||||||
CalcTermITems = new SelectItemsViewModel<CalcTermEntity>(ProgramSetting.CalcTermList.CalcTerms);
|
|
||||||
CalcTermITems.ShowButtons = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GetLimitStates()
|
|
||||||
{
|
|
||||||
LimitStateItems = new SelectItemsViewModel<LimitStateEntity>(ProgramSetting.LimitStatesList.LimitStates);
|
|
||||||
LimitStateItems.ShowButtons = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GetPredicates()
|
|
||||||
{
|
|
||||||
PredicateItems = new SelectItemsViewModel<PredicateEntry>(
|
|
||||||
new List<PredicateEntry>()
|
|
||||||
{
|
|
||||||
new PredicateEntry()
|
|
||||||
{ Name = "Strength", PredicateType = PredicateTypes.Strength },
|
|
||||||
new PredicateEntry()
|
|
||||||
{ Name = "Cracking", PredicateType = PredicateTypes.Cracking },
|
|
||||||
}
|
|
||||||
);
|
|
||||||
PredicateItems.ShowButtons = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LimitCurveDataViewModel() : this (new SurroundData())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public LimitCurveInputData GetLimitCurveInputData()
|
|
||||||
{
|
|
||||||
LimitCurveInputData inputData = new()
|
|
||||||
{
|
|
||||||
SurroundData = SurroundData,
|
|
||||||
PointCount = pointCount
|
|
||||||
};
|
|
||||||
inputData.LimitStates.AddRange(LimitStateItems.SelectedItems.Select(x => x.LimitState));
|
inputData.LimitStates.AddRange(LimitStateItems.SelectedItems.Select(x => x.LimitState));
|
||||||
inputData.CalcTerms.AddRange(CalcTermITems.SelectedItems.Select(x => x.CalcTerm));
|
inputData.CalcTerms.AddRange(CalcTermITems.SelectedItems.Select(x => x.CalcTerm));
|
||||||
inputData.PredicateEntries.AddRange(PredicateItems.SelectedItems);
|
inputData.PredicateEntries.AddRange(PredicateItems.SelectedItems);
|
||||||
inputData.Primitives = Primitives;
|
inputData.PrimitiveSeries.Clear();
|
||||||
return inputData;
|
foreach (var item in PrimitiveSeries.Collection)
|
||||||
|
{
|
||||||
|
var selectesPrimitives = item.Value.TargetItems.Select(x => x.NdmPrimitive).ToList();
|
||||||
|
inputData.PrimitiveSeries.Add
|
||||||
|
(
|
||||||
|
new NamedCollection<INdmPrimitive>()
|
||||||
|
{
|
||||||
|
Name = item.Name,
|
||||||
|
Collection = selectesPrimitives
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Check()
|
public bool Check()
|
||||||
{
|
{
|
||||||
if (PredicateItems.SelectedCount == 0 ||
|
if (PredicateItems.SelectedCount == 0 ||
|
||||||
@@ -111,9 +104,9 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Error => throw new NotImplementedException();
|
public string Error => throw new NotImplementedException();
|
||||||
|
|
||||||
|
|
||||||
public string this[string columnName]
|
public string this[string columnName]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -131,5 +124,31 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void GetCalcTerms()
|
||||||
|
{
|
||||||
|
CalcTermITems = new SelectItemsVM<CalcTermEntity>(ProgramSetting.CalcTermList.CalcTerms);
|
||||||
|
CalcTermITems.SelectedItems = ProgramSetting.CalcTermList.CalcTerms.Where(x => inputData.CalcTerms.Contains(x.CalcTerm));
|
||||||
|
CalcTermITems.ShowButtons = true;
|
||||||
|
}
|
||||||
|
private void GetLimitStates()
|
||||||
|
{
|
||||||
|
LimitStateItems = new SelectItemsVM<LimitStateEntity>(ProgramSetting.LimitStatesList.LimitStates);
|
||||||
|
LimitStateItems.SelectedItems = ProgramSetting.LimitStatesList.LimitStates.Where(x => inputData.LimitStates.Contains(x.LimitState));
|
||||||
|
LimitStateItems.ShowButtons = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
private void GetPredicates()
|
||||||
|
{
|
||||||
|
PredicateItems = new SelectItemsVM<PredicateEntry>(
|
||||||
|
new List<PredicateEntry>()
|
||||||
|
{
|
||||||
|
new PredicateEntry()
|
||||||
|
{ Name = "Strength", PredicateType = PredicateTypes.Strength },
|
||||||
|
new PredicateEntry()
|
||||||
|
{ Name = "Cracking", PredicateType = PredicateTypes.Cracking },
|
||||||
|
}
|
||||||
|
);
|
||||||
|
PredicateItems.ShowButtons = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,18 +84,25 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
|
|
||||||
private void ShowInteractionDiagram()
|
private void ShowInteractionDiagram()
|
||||||
{
|
{
|
||||||
var surroundDdata = new SurroundData();
|
var inputData = new LimitCurveInputData(ndmPrimitives);
|
||||||
var vm = new LimitCurveDataViewModel(surroundDdata);
|
var vm = new LimitCurveDataViewModel(inputData, ndmPrimitives);
|
||||||
|
vm.LimitStateItems.SetIsSelected();
|
||||||
|
vm.CalcTermITems.SetIsSelected();
|
||||||
|
vm.ShowPrimitivesTab = true;
|
||||||
|
var wnd = new LimitCurveDataView(vm);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
if (wnd.DialogResult != true) return;
|
||||||
if (vm.Check() == false)
|
if (vm.Check() == false)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ErrorStrings.DataIsInCorrect + ": nothing selected"); ;
|
MessageBox.Show(ErrorStrings.DataIsInCorrect + ": nothing selected"); ;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vm.Primitives = ndmPrimitives.ToList();
|
vm.RefreshInputData();
|
||||||
var wnd = new LimitCurveDataView(vm);
|
ShowInteractionDiagramByInputData(inputData);
|
||||||
wnd.ShowDialog();
|
}
|
||||||
if (wnd.DialogResult != true) return;
|
|
||||||
var inputData = vm.GetLimitCurveInputData();
|
private void ShowInteractionDiagramByInputData(LimitCurveInputData inputData)
|
||||||
|
{
|
||||||
interactionDiagramLogic = new(inputData);
|
interactionDiagramLogic = new(inputData);
|
||||||
showProgressLogic = new(interactionDiagramLogic)
|
showProgressLogic = new(interactionDiagramLogic)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,9 +4,10 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
|
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
|
||||||
d:DataContext ="{d:DesignInstance local:InteractionDiagramCalculatorViewModel}"
|
xmlns:fc="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
|
||||||
|
d:DataContext ="{d:DesignInstance local:LimitCurveCalculatorViewModel}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Interaction Diagram Calculator" Height="300" Width="400" MinHeight="300" MinWidth="400">
|
Title="Limit Curve Calculator" Height="300" Width="400" MinHeight="300" MinWidth="400">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
@@ -17,7 +18,25 @@
|
|||||||
<!--<local:SorroundDataControl/>-->
|
<!--<local:SorroundDataControl/>-->
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="Primitives">
|
<TabItem Header="Primitives">
|
||||||
<ContentControl ContentTemplate="{StaticResource SourceToTarget}" Content="{Binding PrimitivesViewModel}"/>
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="60"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ListBox>
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
|
||||||
|
<ContentControl ContentTemplate="{StaticResource SourceToTarget}" Content="{Binding PrimitivesViewModel}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
<StackPanel Grid.Column="1" Margin="2">
|
||||||
|
<Button Style="{StaticResource AddButton}"/>
|
||||||
|
<Button Style="{StaticResource DeleteButton}"/>
|
||||||
|
<Button Style="{StaticResource CopyButton}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="Predicates">
|
<TabItem Header="Predicates">
|
||||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding YItems}"/>
|
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding YItems}"/>
|
||||||
@@ -10,7 +10,8 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||||
{
|
{
|
||||||
internal class InteractionDiagramCalculatorViewModel : OkCancelViewModelBase
|
internal class LimitCurveCalculatorViewModel : OkCancelViewModelBase
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<UserControl x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.LimitCurveControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
|
||||||
|
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||||
|
xmlns:fr="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="325" d:DesignWidth="400">
|
||||||
|
<Grid DataContext="{Binding LimitCurveViewModel}">
|
||||||
|
<TabControl>
|
||||||
|
<TabItem Header="Limits">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="35"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<local:SurroundDataControl x:Name="Data" SurroundData="{Binding SurroundData}"/>
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="150"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition Width="120"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="Point count"/>
|
||||||
|
<TextBox Grid.Column="1" Text="{Binding PointCount, ValidatesOnDataErrors=True}"/>
|
||||||
|
<uc:MultiplyDouble Margin="2" Grid.Column="3" ValueChanged="PointCountChanged"/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Primitives" DataContext="{Binding PrimitiveSeries}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="60"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Expander>
|
||||||
|
<Expander.Header>
|
||||||
|
<TextBox Margin="20,0,0,0" Text="{Binding Name}"/>
|
||||||
|
</Expander.Header>
|
||||||
|
<Grid Width="300" Height="200">
|
||||||
|
<ContentControl ContentTemplate="{StaticResource SourceToTarget}" Content="{Binding Value}"/>
|
||||||
|
</Grid>
|
||||||
|
</Expander>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
<StackPanel Grid.Column="1" Margin="2">
|
||||||
|
<Button Style="{StaticResource AddButton}"/>
|
||||||
|
<Button Style="{StaticResource DeleteButton}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Predicates">
|
||||||
|
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding PredicateItems}"/>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="States">
|
||||||
|
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding LimitStateItems}"/>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Terms">
|
||||||
|
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding CalcTermITems}"/>
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic;
|
||||||
|
using StructureHelper.Windows.UserControls;
|
||||||
|
using StructureHelper.Windows.ViewModels.Materials;
|
||||||
|
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.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для LimitCurveControl.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class LimitCurveControl : UserControl
|
||||||
|
{
|
||||||
|
public static readonly DependencyProperty LimitCurveViewModelProperty =
|
||||||
|
DependencyProperty.Register("LimitCurveViewModel", typeof(LimitCurveDataViewModel), typeof(LimitCurveControl));
|
||||||
|
|
||||||
|
public LimitCurveDataViewModel LimitCurveViewModel
|
||||||
|
{
|
||||||
|
get { return (LimitCurveDataViewModel)GetValue(LimitCurveViewModelProperty); }
|
||||||
|
set { SetValue(LimitCurveViewModelProperty, value); }
|
||||||
|
}
|
||||||
|
public LimitCurveControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
DataContext = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PointCountChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LimitCurveViewModel.PointCount = Convert.ToInt32(LimitCurveViewModel.PointCount * ChangeValue(sender));
|
||||||
|
}
|
||||||
|
|
||||||
|
private double ChangeValue(object sender)
|
||||||
|
{
|
||||||
|
var obj = (MultiplyDouble)sender;
|
||||||
|
var factor = obj.DoubleFactor;
|
||||||
|
return factor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,7 +24,6 @@
|
|||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<GroupBox Header="{Binding YLabel}">
|
<GroupBox Header="{Binding YLabel}">
|
||||||
<Grid Margin="30,0,0,0">
|
<Grid Margin="30,0,0,0">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
public static readonly DependencyProperty SurroundDataProperty =
|
public static readonly DependencyProperty SurroundDataProperty =
|
||||||
DependencyProperty.Register(
|
DependencyProperty.Register(
|
||||||
"SurroundData",
|
"SurroundData",
|
||||||
typeof(SurroundData), // Change to the actual type of SurroundData
|
typeof(SurroundData),
|
||||||
typeof(SurroundDataControl),
|
typeof(SurroundDataControl),
|
||||||
new PropertyMetadata(null, OnSurroundDataChanged));
|
new PropertyMetadata(null, OnSurroundDataChanged));
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ namespace StructureHelper.Windows.Graphs
|
|||||||
private bool invertYValues;
|
private bool invertYValues;
|
||||||
private RelayCommand saveImageCommand;
|
private RelayCommand saveImageCommand;
|
||||||
|
|
||||||
public SelectedItemViewModel<IValueParameter<double>> XItems { get; private set; }
|
public SelectItemVM<IValueParameter<double>> XItems { get; private set; }
|
||||||
public SelectItemsViewModel<IValueParameter<double>> YItems { get; set; }
|
public SelectItemsVM<IValueParameter<double>> YItems { get; set; }
|
||||||
public ObservableCollection<ColumnInfo> Columns { get; } = new ObservableCollection<ColumnInfo>();
|
public ObservableCollection<ColumnInfo> Columns { get; } = new ObservableCollection<ColumnInfo>();
|
||||||
public ObservableCollection<Series> Series { get;}
|
public ObservableCollection<Series> Series { get;}
|
||||||
|
|
||||||
|
|||||||
@@ -80,9 +80,9 @@ namespace StructureHelper.Windows.Graphs
|
|||||||
OnPropertyChanged(nameof(MaxValue));
|
OnPropertyChanged(nameof(MaxValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public SelectItemsViewModel<IHeadMaterial> MaterialsModel { get; private set; }
|
public SelectItemsVM<IHeadMaterial> MaterialsModel { get; private set; }
|
||||||
public SelectItemsViewModel<LimitStateEntity> LimitStatesModel { get; private set; }
|
public SelectItemsVM<LimitStateEntity> LimitStatesModel { get; private set; }
|
||||||
public SelectItemsViewModel<CalcTermEntity> CalcTermsModel { get; private set; }
|
public SelectItemsVM<CalcTermEntity> CalcTermsModel { get; private set; }
|
||||||
public SeriesCollection SeriesCollection { get; set; }
|
public SeriesCollection SeriesCollection { get; set; }
|
||||||
public List<string> Labels { get; set; }
|
public List<string> Labels { get; set; }
|
||||||
public Func<double, string> YFormatter { get; set; }
|
public Func<double, string> YFormatter { get; set; }
|
||||||
@@ -103,9 +103,9 @@ namespace StructureHelper.Windows.Graphs
|
|||||||
|
|
||||||
public MaterialDiagramViewModel(IEnumerable<IHeadMaterial> headMaterials, IHeadMaterial material)
|
public MaterialDiagramViewModel(IEnumerable<IHeadMaterial> headMaterials, IHeadMaterial material)
|
||||||
{
|
{
|
||||||
MaterialsModel = new SelectItemsViewModel<IHeadMaterial>(headMaterials) { ShowButtons = true };
|
MaterialsModel = new SelectItemsVM<IHeadMaterial>(headMaterials) { ShowButtons = true };
|
||||||
LimitStatesModel = new SelectItemsViewModel<LimitStateEntity>(ProgramSetting.LimitStatesList.LimitStates) { ShowButtons = false };
|
LimitStatesModel = new SelectItemsVM<LimitStateEntity>(ProgramSetting.LimitStatesList.LimitStates) { ShowButtons = false };
|
||||||
CalcTermsModel = new SelectItemsViewModel<CalcTermEntity>(ProgramSetting.CalcTermList.CalcTerms) { ShowButtons = false };
|
CalcTermsModel = new SelectItemsVM<CalcTermEntity>(ProgramSetting.CalcTermList.CalcTerms) { ShowButtons = false };
|
||||||
foreach (var item in MaterialsModel.CollectionItems)
|
foreach (var item in MaterialsModel.CollectionItems)
|
||||||
{
|
{
|
||||||
if (item.Item == material)
|
if (item.Item == material)
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ namespace StructureHelper.Windows.Graphs
|
|||||||
private bool invertXValues;
|
private bool invertXValues;
|
||||||
private bool invertYValues;
|
private bool invertYValues;
|
||||||
|
|
||||||
public SelectedItemViewModel<IValueParameter<double>> XItems { get; }
|
public SelectItemVM<IValueParameter<double>> XItems { get; }
|
||||||
public SelectItemsViewModel<IValueParameter<double>> YItems { get; }
|
public SelectItemsVM<IValueParameter<double>> YItems { get; }
|
||||||
public bool InvertXValues
|
public bool InvertXValues
|
||||||
{
|
{
|
||||||
get { return invertXValues; }
|
get { return invertXValues; }
|
||||||
@@ -58,8 +58,8 @@ namespace StructureHelper.Windows.Graphs
|
|||||||
{
|
{
|
||||||
this.arrayParameter = arrayParameter;
|
this.arrayParameter = arrayParameter;
|
||||||
valueParameters = GetParameters();
|
valueParameters = GetParameters();
|
||||||
XItems = new SelectedItemViewModel<IValueParameter<double>>(valueParameters);
|
XItems = new SelectItemVM<IValueParameter<double>>(valueParameters);
|
||||||
YItems = new SelectItemsViewModel<IValueParameter<double>>(valueParameters);
|
YItems = new SelectItemsVM<IValueParameter<double>>(valueParameters);
|
||||||
YItems.ShowButtons = true;
|
YItems.ShowButtons = true;
|
||||||
XItems.SelectedItem = XItems.Collection[0];
|
XItems.SelectedItem = XItems.Collection[0];
|
||||||
YItems.UnSelectAllCommand.Execute(null);
|
YItems.UnSelectAllCommand.Execute(null);
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void afterMaterialEdit(SelectedItemViewModel<IHeadMaterial> sender, CRUDVMEventArgs e)
|
private void afterMaterialEdit(SelectItemVM<IHeadMaterial> sender, CRUDVMEventArgs e)
|
||||||
{
|
{
|
||||||
foreach (var primitive in primitiveLogic.Items)
|
foreach (var primitive in primitiveLogic.Items)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ namespace StructureHelper.Windows.PrimitivePropertiesWindow
|
|||||||
{
|
{
|
||||||
public class SelectPrimitivesViewModel : OkCancelViewModelBase
|
public class SelectPrimitivesViewModel : OkCancelViewModelBase
|
||||||
{
|
{
|
||||||
public SelectItemsViewModel<PrimitiveBase> Items { get; }
|
public SelectItemsVM<PrimitiveBase> Items { get; }
|
||||||
|
|
||||||
public SelectPrimitivesViewModel(IEnumerable<INdmPrimitive> primitives)
|
public SelectPrimitivesViewModel(IEnumerable<INdmPrimitive> primitives)
|
||||||
{
|
{
|
||||||
var primitiveViews = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(primitives);
|
var primitiveViews = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(primitives);
|
||||||
Items = new SelectItemsViewModel<PrimitiveBase>(primitiveViews) { ShowButtons = true };
|
Items = new SelectItemsVM<PrimitiveBase>(primitiveViews) { ShowButtons = true };
|
||||||
Items.ItemDataTemplate = Application.Current.Resources["ColoredItemTemplate"] as DataTemplate;
|
Items.ItemDataTemplate = Application.Current.Resources["ColoredItemTemplate"] as DataTemplate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
using StructureHelper.Infrastructure;
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
|
||||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Input;
|
|
||||||
|
|
||||||
|
|
||||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
@@ -20,8 +15,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
|||||||
{
|
{
|
||||||
public class ForceCalculatorViewModel : OkCancelViewModelBase
|
public class ForceCalculatorViewModel : OkCancelViewModelBase
|
||||||
{
|
{
|
||||||
IEnumerable<INdmPrimitive> allowedPrimitives;
|
|
||||||
IEnumerable<IForceAction> allowedForceCombinations;
|
|
||||||
ForceCalculator forcesCalculator;
|
ForceCalculator forcesCalculator;
|
||||||
SecondOrderViewModel secondOrderViewModel;
|
SecondOrderViewModel secondOrderViewModel;
|
||||||
|
|
||||||
@@ -50,119 +43,15 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
|||||||
public bool ShortTerm { get; set; }
|
public bool ShortTerm { get; set; }
|
||||||
public bool LongTerm { get; set; }
|
public bool LongTerm { get; set; }
|
||||||
|
|
||||||
public ISourceToTargetViewModel<IForceAction> CombinationViewModel { get; }
|
public SourceTargetVM<IForceAction> CombinationViewModel { get; }
|
||||||
public ISourceToTargetViewModel<PrimitiveBase> PrimitivesViewModel { get; }
|
public SourceTargetVM<PrimitiveBase> PrimitivesViewModel { get; private set; }
|
||||||
|
|
||||||
public PrimitiveBase SelectedAllowedPrimitive { get; set; }
|
public ForceCalculatorViewModel(IEnumerable<INdmPrimitive> allowedPrimitives, IEnumerable<IForceAction> allowedCombinations, ForceCalculator forcesCalculator)
|
||||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
|
||||||
|
|
||||||
public ObservableCollection<PrimitiveBase> AllowedPrimitives
|
|
||||||
{
|
{
|
||||||
get
|
this.forcesCalculator = forcesCalculator;
|
||||||
{
|
secondOrderViewModel = new SecondOrderViewModel(this.forcesCalculator.CompressedMember);
|
||||||
var sourceItems = forcesCalculator.Primitives;
|
CombinationViewModel = SourceTargetFactory.GetSourceTargetVM(allowedCombinations, this.forcesCalculator.ForceActions);
|
||||||
var rejectedItems = allowedPrimitives.Where(x => sourceItems.Contains(x));
|
PrimitivesViewModel = SourceTargetFactory.GetSourceTargetVM(allowedPrimitives, this.forcesCalculator.Primitives);
|
||||||
var filteredItems = allowedPrimitives.Except(rejectedItems);
|
|
||||||
return PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(filteredItems);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public ObservableCollection<PrimitiveBase> Primitives
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var sourceItems = forcesCalculator.Primitives;
|
|
||||||
return PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(sourceItems);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ICommand addAllPrimitivesCommand;
|
|
||||||
private ICommand clearAllPrimitivesCommand;
|
|
||||||
private RelayCommand addSelectedPrimitiveCommand;
|
|
||||||
private RelayCommand removeSelectedPrimitive;
|
|
||||||
|
|
||||||
public ICommand AddAllPrimitivesCommand
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return addAllPrimitivesCommand ??
|
|
||||||
(
|
|
||||||
addAllPrimitivesCommand = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
AddAllPrimitives();
|
|
||||||
OnPropertyChanged(nameof(AllowedPrimitives));
|
|
||||||
OnPropertyChanged(nameof(Primitives));
|
|
||||||
},o => allowedPrimitives.Count() > 0
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void AddAllPrimitives()
|
|
||||||
{
|
|
||||||
forcesCalculator.Primitives.Clear();
|
|
||||||
forcesCalculator.Primitives.AddRange(allowedPrimitives);
|
|
||||||
}
|
|
||||||
public ICommand ClearAllPrimitivesCommand
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return clearAllPrimitivesCommand ??
|
|
||||||
(
|
|
||||||
clearAllPrimitivesCommand = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
forcesCalculator.Primitives.Clear();
|
|
||||||
OnPropertyChanged(nameof(AllowedPrimitives));
|
|
||||||
OnPropertyChanged(nameof(Primitives));
|
|
||||||
}, o => forcesCalculator.Primitives.Count > 0 ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public ICommand AddSelectedPrimitiveCommand
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return addSelectedPrimitiveCommand ??
|
|
||||||
(
|
|
||||||
addSelectedPrimitiveCommand = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
forcesCalculator.Primitives.Add(SelectedAllowedPrimitive.GetNdmPrimitive());
|
|
||||||
OnPropertyChanged(nameof(AllowedPrimitives));
|
|
||||||
OnPropertyChanged(nameof(Primitives));
|
|
||||||
}, o => SelectedAllowedPrimitive != null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public RelayCommand RemoveSelectedPrimitiveCommand
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return removeSelectedPrimitive ??
|
|
||||||
(
|
|
||||||
removeSelectedPrimitive = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
forcesCalculator.Primitives.Remove(SelectedPrimitive.GetNdmPrimitive());
|
|
||||||
OnPropertyChanged(nameof(AllowedPrimitives));
|
|
||||||
OnPropertyChanged(nameof(Primitives));
|
|
||||||
}, o => SelectedPrimitive != null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ForceCalculatorViewModel(IEnumerable<INdmPrimitive> _allowedPrimitives, IEnumerable<IForceAction> _allowedForceCombinations, ForceCalculator _forcesCalculator)
|
|
||||||
{
|
|
||||||
allowedPrimitives = _allowedPrimitives;
|
|
||||||
allowedForceCombinations = _allowedForceCombinations;
|
|
||||||
forcesCalculator = _forcesCalculator;
|
|
||||||
secondOrderViewModel = new SecondOrderViewModel(forcesCalculator.CompressedMember);
|
|
||||||
|
|
||||||
CombinationViewModel = new SourceToTargetViewModel<IForceAction>();
|
|
||||||
CombinationViewModel.SetTargetItems(forcesCalculator.ForceActions);
|
|
||||||
CombinationViewModel.SetSourceItems(allowedForceCombinations);
|
|
||||||
CombinationViewModel.ItemDataDemplate = Application.Current.Resources["SimpleItemTemplate"] as DataTemplate;
|
|
||||||
|
|
||||||
PrimitivesViewModel = new SourceToTargetViewModel<PrimitiveBase>();
|
|
||||||
var targetItems = forcesCalculator.Primitives;
|
|
||||||
var sourceViewPrimitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(allowedPrimitives);
|
|
||||||
var viewPrimitives = sourceViewPrimitives.Where(x => targetItems.Contains(x.GetNdmPrimitive()));
|
|
||||||
PrimitivesViewModel.SetTargetItems(viewPrimitives);
|
|
||||||
PrimitivesViewModel.SetSourceItems(sourceViewPrimitives);
|
|
||||||
PrimitivesViewModel.ItemDataDemplate = Application.Current.Resources["ColoredItemTemplate"] as DataTemplate;
|
|
||||||
|
|
||||||
InputRefresh();
|
InputRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
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>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels
|
||||||
|
{
|
||||||
|
internal static class SourceTargetFactory
|
||||||
|
{
|
||||||
|
const string ColoredItemTemplate = "ColoredItemTemplate";
|
||||||
|
const string SimpleItemTemplate = "SimpleItemTemplate";
|
||||||
|
public static SourceTargetVM<PrimitiveBase> GetSourceTargetVM(IEnumerable<INdmPrimitive> allowedPrimitives, IEnumerable<INdmPrimitive> targetPrimitives)
|
||||||
|
{
|
||||||
|
var sourceViewPrimitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(allowedPrimitives);
|
||||||
|
var result = new SourceTargetVM<PrimitiveBase>();
|
||||||
|
if (targetPrimitives is not null)
|
||||||
|
{
|
||||||
|
var viewPrimitives = sourceViewPrimitives.Where(x => targetPrimitives.Contains(x.GetNdmPrimitive()));
|
||||||
|
result.SetTargetItems(viewPrimitives);
|
||||||
|
}
|
||||||
|
result.SetSourceItems(sourceViewPrimitives);
|
||||||
|
result.ItemDataDemplate = GetDataTemplate(ColoredItemTemplate);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SourceTargetVM<IForceAction> GetSourceTargetVM(IEnumerable<IForceAction> allowedCombinations, IEnumerable<IForceAction> targetCombinations)
|
||||||
|
{
|
||||||
|
var result = new SourceTargetVM<IForceAction>();
|
||||||
|
result.SetTargetItems(targetCombinations);
|
||||||
|
result.SetSourceItems(allowedCombinations);
|
||||||
|
result.ItemDataDemplate = GetDataTemplate(SimpleItemTemplate);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static DataTemplate GetDataTemplate(string dataTemplateName)
|
||||||
|
{
|
||||||
|
DataTemplate dataTemplate;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dataTemplate = Application.Current.Resources[dataTemplateName] as DataTemplate;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectNotFound);
|
||||||
|
}
|
||||||
|
if (dataTemplate is null)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.NullReference);
|
||||||
|
}
|
||||||
|
return dataTemplate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.Forces
|
namespace StructureHelper.Windows.ViewModels.Forces
|
||||||
{
|
{
|
||||||
public class ActionsViewModel : SelectedItemViewModel<IForceAction>
|
public class ActionsViewModel : SelectItemVM<IForceAction>
|
||||||
{
|
{
|
||||||
readonly IUpdateStrategy<IAction> updateStrategy = new ActionUpdateStrategy();
|
readonly IUpdateStrategy<IAction> updateStrategy = new ActionUpdateStrategy();
|
||||||
ICrossSectionRepository repository;
|
ICrossSectionRepository repository;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.Forces
|
namespace StructureHelper.Windows.ViewModels.Forces
|
||||||
{
|
{
|
||||||
public class ForceTuplesViewModel : SelectedItemViewModel<IDesignForceTuple>
|
public class ForceTuplesViewModel : SelectItemVM<IDesignForceTuple>
|
||||||
{
|
{
|
||||||
public override void AddMethod(object parameter)
|
public override void AddMethod(object parameter)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
using StructureHelper.Infrastructure;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels
|
|
||||||
{
|
|
||||||
public interface ISourceToTargetViewModel<TItem>
|
|
||||||
{
|
|
||||||
TItem SelectedSourceItem { get; set; }
|
|
||||||
TItem SelectedTargetItem { get; set; }
|
|
||||||
ObservableCollection<TItem> SourceItems { get; }
|
|
||||||
ObservableCollection<TItem> TargetItems { get; }
|
|
||||||
DataTemplate ItemDataDemplate { get; set; }
|
|
||||||
RelayCommand AddAll { get; }
|
|
||||||
RelayCommand ClearAll { get; }
|
|
||||||
RelayCommand AddSelected { get; }
|
|
||||||
RelayCommand RemoveSelected { get; }
|
|
||||||
void SetSourceItems(IEnumerable<TItem> allowedItems);
|
|
||||||
void SetTargetItems(IEnumerable<TItem> targetItems);
|
|
||||||
IEnumerable<TItem> GetTargetItems();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,7 +12,7 @@ using System.Windows.Input;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.Materials
|
namespace StructureHelper.Windows.ViewModels.Materials
|
||||||
{
|
{
|
||||||
public class MaterialsViewModel : SelectedItemViewModel<IHeadMaterial>
|
public class MaterialsViewModel : SelectItemVM<IHeadMaterial>
|
||||||
{
|
{
|
||||||
ICrossSectionRepository repository;
|
ICrossSectionRepository repository;
|
||||||
private ICommand editMaterialsCommand;
|
private ICommand editMaterialsCommand;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.Materials
|
namespace StructureHelper.Windows.ViewModels.Materials
|
||||||
{
|
{
|
||||||
internal class PartialFactorsViewModel : SelectedItemViewModel<IMaterialPartialFactor>
|
internal class PartialFactorsViewModel : SelectItemVM<IMaterialPartialFactor>
|
||||||
{
|
{
|
||||||
public override void AddMethod(object parameter)
|
public override void AddMethod(object parameter)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using System.Windows.Input;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.Materials
|
namespace StructureHelper.Windows.ViewModels.Materials
|
||||||
{
|
{
|
||||||
internal class SafetyFactorsViewModel : SelectedItemViewModel<IMaterialSafetyFactor>
|
internal class SafetyFactorsViewModel : SelectItemVM<IMaterialSafetyFactor>
|
||||||
{
|
{
|
||||||
List<IMaterialSafetyFactor> safetyFactors;
|
List<IMaterialSafetyFactor> safetyFactors;
|
||||||
private RelayCommand showPartialCommand;
|
private RelayCommand showPartialCommand;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||||
{
|
{
|
||||||
public class AnalysisVewModelLogic : SelectedItemViewModel<ICalculator>
|
public class AnalysisVewModelLogic : SelectItemVM<ICalculator>
|
||||||
{
|
{
|
||||||
private ICrossSectionRepository repository;
|
private ICrossSectionRepository repository;
|
||||||
private RelayCommand runCommand;
|
private RelayCommand runCommand;
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelper.Properties;
|
||||||
|
using StructureHelper.Windows.ViewModels.Materials;
|
||||||
|
using StructureHelperCommon.Models.Parameters;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels
|
||||||
|
{
|
||||||
|
public class SelectPrimitivesSourceTarget : SelectItemVM<NamedValue<SourceTargetVM<PrimitiveBase>>>
|
||||||
|
{
|
||||||
|
public List<INdmPrimitive> AllowedPrimitives { get; set; }
|
||||||
|
public override void AddMethod(object parameter)
|
||||||
|
{
|
||||||
|
var viewModel = SourceTargetFactory.GetSourceTargetVM(AllowedPrimitives, AllowedPrimitives);
|
||||||
|
var namedViewModel = new NamedValue<SourceTargetVM<PrimitiveBase>>()
|
||||||
|
{
|
||||||
|
Name = "New option",
|
||||||
|
Value = viewModel
|
||||||
|
};
|
||||||
|
NewItem = namedViewModel;
|
||||||
|
base.AddMethod(parameter);
|
||||||
|
}
|
||||||
|
public SelectPrimitivesSourceTarget(List<NamedValue<SourceTargetVM<PrimitiveBase>>> collection) : base(collection)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,18 +1,12 @@
|
|||||||
using Microsoft.VisualBasic;
|
using StructureHelper.Infrastructure;
|
||||||
using StructureHelper.Infrastructure;
|
|
||||||
using StructureHelperCommon.Models.Materials.Libraries;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels
|
namespace StructureHelper.Windows.ViewModels
|
||||||
{
|
{
|
||||||
public class SelectedItemViewModel<TItem> : ViewModelBase, ICRUDViewModel<TItem> where TItem : class
|
public class SelectItemVM<TItem> : ViewModelBase, ICRUDViewModel<TItem> where TItem : class
|
||||||
{
|
{
|
||||||
private ICommand addCommand;
|
private ICommand addCommand;
|
||||||
private ICommand deleteCommand;
|
private ICommand deleteCommand;
|
||||||
@@ -115,7 +109,7 @@ namespace StructureHelper.Windows.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SelectedItemViewModel(List<TItem> collection)
|
public SelectItemVM(List<TItem> collection)
|
||||||
{
|
{
|
||||||
Collection = collection;
|
Collection = collection;
|
||||||
Refresh();
|
Refresh();
|
||||||
@@ -126,7 +120,7 @@ namespace StructureHelper.Windows.ViewModels
|
|||||||
OnPropertyChanged(nameof(Items));
|
OnPropertyChanged(nameof(Items));
|
||||||
AfterItemsEdit?.Invoke(this, new CRUDVMEventArgs());
|
AfterItemsEdit?.Invoke(this, new CRUDVMEventArgs());
|
||||||
}
|
}
|
||||||
public delegate void CRUDHandler(SelectedItemViewModel<TItem> sender, CRUDVMEventArgs e);
|
public delegate void CRUDHandler(SelectItemVM<TItem> sender, CRUDVMEventArgs e);
|
||||||
public event CRUDHandler? AfterItemsEdit;
|
public event CRUDHandler? AfterItemsEdit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ namespace StructureHelper.Windows.ViewModels
|
|||||||
/// Represents a ViewModel for selecting items from a collection.
|
/// Represents a ViewModel for selecting items from a collection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TItem">The type of items in the collection.</typeparam>
|
/// <typeparam name="TItem">The type of items in the collection.</typeparam>
|
||||||
public class SelectItemsViewModel<TItem> : ViewModelBase
|
public class SelectItemsVM<TItem> : ViewModelBase
|
||||||
where TItem : class
|
where TItem : class
|
||||||
{
|
{
|
||||||
private ICommand? selectAllCommand;
|
private ICommand? selectAllCommand;
|
||||||
@@ -80,7 +80,7 @@ namespace StructureHelper.Windows.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InvertSelection()
|
public void InvertSelection()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
foreach (var item in CollectionItems)
|
foreach (var item in CollectionItems)
|
||||||
@@ -89,8 +89,11 @@ namespace StructureHelper.Windows.ViewModels
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
private void SetIsSelected(bool isSelected)
|
/// Select all if true, deselect all if false
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="isSelected">Default is true</param>
|
||||||
|
public void SetIsSelected(bool isSelected = true)
|
||||||
{
|
{
|
||||||
foreach (var item in CollectionItems)
|
foreach (var item in CollectionItems)
|
||||||
{
|
{
|
||||||
@@ -98,7 +101,7 @@ namespace StructureHelper.Windows.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SelectItemsViewModel(IEnumerable<TItem> items)
|
public SelectItemsVM(IEnumerable<TItem> items)
|
||||||
{
|
{
|
||||||
CollectionItems = new ObservableCollection<CollectionItem>(
|
CollectionItems = new ObservableCollection<CollectionItem>(
|
||||||
items
|
items
|
||||||
@@ -11,7 +11,7 @@ using System.Windows;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels
|
namespace StructureHelper.Windows.ViewModels
|
||||||
{
|
{
|
||||||
public class SourceToTargetViewModel<TItem> : ViewModelBase, ISourceToTargetViewModel<TItem>
|
public class SourceTargetVM<TItem> : ViewModelBase
|
||||||
{
|
{
|
||||||
private IEnumerable<TItem> allowedItems;
|
private IEnumerable<TItem> allowedItems;
|
||||||
private IEnumerable<TItem> targetItems;
|
private IEnumerable<TItem> targetItems;
|
||||||
@@ -65,6 +65,7 @@ namespace StructureHelper.Windows.ViewModels
|
|||||||
(
|
(
|
||||||
addSelected = new RelayCommand(o =>
|
addSelected = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
|
if (SelectedSourceItem is null) { return; }
|
||||||
TargetItems.Add(SelectedSourceItem);
|
TargetItems.Add(SelectedSourceItem);
|
||||||
SourceItems.Remove(SelectedSourceItem);
|
SourceItems.Remove(SelectedSourceItem);
|
||||||
}, o => SelectedSourceItem != null));
|
}, o => SelectedSourceItem != null));
|
||||||
@@ -78,6 +79,7 @@ namespace StructureHelper.Windows.ViewModels
|
|||||||
(
|
(
|
||||||
removeSelected = new RelayCommand(o =>
|
removeSelected = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
|
if (SelectedTargetItem is null) { return; }
|
||||||
SourceItems.Add(SelectedTargetItem);
|
SourceItems.Add(SelectedTargetItem);
|
||||||
TargetItems.Remove(SelectedTargetItem);
|
TargetItems.Remove(SelectedTargetItem);
|
||||||
}, o => SelectedTargetItem != null));
|
}, o => SelectedTargetItem != null));
|
||||||
@@ -85,8 +87,7 @@ namespace StructureHelper.Windows.ViewModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public SourceTargetVM()
|
||||||
public SourceToTargetViewModel()
|
|
||||||
{
|
{
|
||||||
SourceItems = new ObservableCollection<TItem>();
|
SourceItems = new ObservableCollection<TItem>();
|
||||||
TargetItems = new ObservableCollection<TItem>();
|
TargetItems = new ObservableCollection<TItem>();
|
||||||
@@ -24,5 +24,6 @@
|
|||||||
public static string ExpectedWas(System.Type expected, System.Type was) => $"{DataIsInCorrect}: Expected {expected}, but was {was}";
|
public static string ExpectedWas(System.Type expected, System.Type was) => $"{DataIsInCorrect}: Expected {expected}, but was {was}";
|
||||||
public static string ExpectedWas(System.Type expected, object obj) => ExpectedWas(expected, obj.GetType());
|
public static string ExpectedWas(System.Type expected, object obj) => ExpectedWas(expected, obj.GetType());
|
||||||
public static string NullReference => "#0018: Null reference";
|
public static string NullReference => "#0018: Null reference";
|
||||||
|
public static string ObjectNotFound => "#0018: Object not found";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
25
StructureHelperCommon/Models/Parameters/NamedCollection.cs
Normal file
25
StructureHelperCommon/Models/Parameters/NamedCollection.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Parameters
|
||||||
|
{
|
||||||
|
public class NamedCollection<T> : ISaveable
|
||||||
|
{
|
||||||
|
public Guid Id { get; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public List<T> Collection { get; set; }
|
||||||
|
public NamedCollection(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
Name = string.Empty;
|
||||||
|
Collection = new List<T>();
|
||||||
|
}
|
||||||
|
public NamedCollection() : this(Guid.NewGuid())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
StructureHelperCommon/Models/Parameters/NamedValue.cs
Normal file
22
StructureHelperCommon/Models/Parameters/NamedValue.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Parameters
|
||||||
|
{
|
||||||
|
public class NamedValue<T> : ISaveable
|
||||||
|
{
|
||||||
|
public Guid Id { get; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public T Value { get; set; }
|
||||||
|
public NamedValue(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
public NamedValue() : this (Guid.NewGuid())
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,8 +15,4 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Infrastructures\Predicates\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Parameters;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System;
|
using System;
|
||||||
@@ -18,7 +19,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve
|
|||||||
{
|
{
|
||||||
public List<LimitStates> LimitStates { get; }
|
public List<LimitStates> LimitStates { get; }
|
||||||
public List<CalcTerms> CalcTerms { get; }
|
public List<CalcTerms> CalcTerms { get; }
|
||||||
public List<INdmPrimitive> Primitives { get; set; }
|
public List<NamedCollection<INdmPrimitive>> PrimitiveSeries {get;}
|
||||||
public List<PredicateEntry> PredicateEntries { get; }
|
public List<PredicateEntry> PredicateEntries { get; }
|
||||||
public SurroundData SurroundData { get; set; }
|
public SurroundData SurroundData { get; set; }
|
||||||
public int PointCount { get; set; }
|
public int PointCount { get; set; }
|
||||||
@@ -26,10 +27,20 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve
|
|||||||
{
|
{
|
||||||
LimitStates = new();
|
LimitStates = new();
|
||||||
CalcTerms = new();
|
CalcTerms = new();
|
||||||
Primitives = new();
|
|
||||||
PredicateEntries = new();
|
PredicateEntries = new();
|
||||||
SurroundData = new();
|
SurroundData = new();
|
||||||
PointCount = 80;
|
PointCount = 80;
|
||||||
|
PrimitiveSeries = new List<NamedCollection<INdmPrimitive>>();
|
||||||
|
}
|
||||||
|
public LimitCurveInputData(IEnumerable<INdmPrimitive> primitives) : this()
|
||||||
|
{
|
||||||
|
PrimitiveSeries.Add
|
||||||
|
(new NamedCollection<INdmPrimitive>()
|
||||||
|
{
|
||||||
|
Name = "V1",
|
||||||
|
Collection = primitives.ToList()
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,16 +64,19 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve
|
|||||||
private List<ILimitCurveCalculator> GetCalulators()
|
private List<ILimitCurveCalculator> GetCalulators()
|
||||||
{
|
{
|
||||||
List<ILimitCurveCalculator> calculators = new();
|
List<ILimitCurveCalculator> calculators = new();
|
||||||
foreach (var limitState in InputData.LimitStates)
|
foreach (var primitiveSeries in InputData.PrimitiveSeries)
|
||||||
{
|
{
|
||||||
foreach (var calcTerm in InputData.CalcTerms)
|
foreach (var limitState in InputData.LimitStates)
|
||||||
{
|
{
|
||||||
var ndms = NdmPrimitivesService.GetNdms(InputData.Primitives, limitState, calcTerm);
|
foreach (var calcTerm in InputData.CalcTerms)
|
||||||
foreach (var predicateEntry in InputData.PredicateEntries)
|
|
||||||
{
|
{
|
||||||
string calcName = $"{predicateEntry.Name}_{limitState}_{calcTerm}";
|
var ndms = NdmPrimitivesService.GetNdms(primitiveSeries.Collection, limitState, calcTerm);
|
||||||
LimitCurveCalculator calculator = GetCalculator(ndms, predicateEntry.PredicateType, calcName);
|
foreach (var predicateEntry in InputData.PredicateEntries)
|
||||||
calculators.Add(calculator);
|
{
|
||||||
|
string calcName = $"{primitiveSeries.Name}_{predicateEntry.Name}_{limitState}_{calcTerm}";
|
||||||
|
LimitCurveCalculator calculator = GetCalculator(ndms, predicateEntry.PredicateType, calcName);
|
||||||
|
calculators.Add(calculator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user