Add curvature calculator DTOs
This commit is contained in:
@@ -1,41 +1,19 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelper.Windows.ViewModels.Forces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures
|
||||
{
|
||||
public class CurvatureCalculatorInputDataViewModel : ViewModelBase
|
||||
{
|
||||
private ICurvatureCalculatorInputData inputData;
|
||||
private double deflectionFactor;
|
||||
private double spanLength;
|
||||
|
||||
public double DeflectionFactor
|
||||
{
|
||||
get => inputData.DeflectionFactor;
|
||||
set
|
||||
{
|
||||
inputData.DeflectionFactor = Math.Max(value, 0.0);
|
||||
OnPropertyChanged(nameof(DeflectionFactor));
|
||||
}
|
||||
}
|
||||
|
||||
public double SpanLength
|
||||
{
|
||||
get => inputData.SpanLength;
|
||||
set
|
||||
{
|
||||
inputData.SpanLength = Math.Max(value, 0.0);
|
||||
OnPropertyChanged(nameof(SpanLength));
|
||||
}
|
||||
}
|
||||
public DeflectionFactorViewModel DeflectionFactor { get; }
|
||||
|
||||
public SourceTargetVM<IForceAction> CombinationViewModel { get; }
|
||||
public SourceTargetVM<PrimitiveBase> PrimitivesViewModel { get; }
|
||||
@@ -45,6 +23,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures
|
||||
this.inputData = inputData;
|
||||
CombinationViewModel = SourceTargetFactory.GetSourceTargetVM(repository.ForceActions, inputData.ForceActions);
|
||||
PrimitivesViewModel = SourceTargetFactory.GetSourceTargetVM(repository.Primitives, inputData.Primitives);
|
||||
DeflectionFactor = new(inputData.DeflectionFactor);
|
||||
}
|
||||
public void Refresh()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures.CurvatureCalculatorResultView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures"
|
||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||
d:DataContext="{d:DesignInstance local:CurvatureCalculatorResultViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Result of calculation of curvatures and deflections" Height="450" Width="800" MinHeight="300" MinWidth="600" MaxHeight="800" MaxWidth="1000" WindowStartupLocation="CenterScreen">
|
||||
<DockPanel>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding ForcesResult}" SelectedItem="{Binding SelectedResult}">
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsValid}" Value="false">
|
||||
<Setter Property="Background" Value="{StaticResource ErrorColorBrush}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridCheckBoxColumn Header="Valid" Binding="{Binding Path=IsValid}"/>
|
||||
<DataGridTextColumn Header="Action name" Binding="{Binding InputData.TupleName}" Width="120"/>
|
||||
<DataGridTemplateColumn Header="Combination term" Width="120">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Long-term"/>
|
||||
<TextBlock Grid.Row="1" Text="Short-term"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Moment Mx" Width="90">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{Binding InputData.LongTermTuple.Mx, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right" />
|
||||
<TextBlock Grid.Row="1" Text="{Binding InputData.ShortTermTuple.Mx, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Moment My" Width="90">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{Binding InputData.LongTermTuple.My, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right"/>
|
||||
<TextBlock Grid.Row="1" Text="{Binding InputData.ShortTermTuple.My, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Force Nz" Width="90">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{Binding InputData.LongTermTuple.Nz, Converter={StaticResource ForceConverter}}" HorizontalAlignment="Right" />
|
||||
<TextBlock Grid.Row="1" Text="{Binding InputData.ShortTermTuple.Nz, Converter={StaticResource ForceConverter}}" HorizontalAlignment="Right" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Crack width" Width="80">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ContentControl ContentTemplate="{StaticResource CrackGrid}" Content="{Binding}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="Description" Width="300" Binding="{Binding Description}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<TextBlock Grid.Row="1" Text="{Binding CrackResult.Description}"/>
|
||||
<ContentControl Grid.Row="2" ContentTemplate="{StaticResource ResultValidness}" Content="{Binding ValidResultCounter}"/>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
@@ -0,0 +1,23 @@
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using System.Windows;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для CurvatureCalculatorResultView.xaml
|
||||
/// </summary>
|
||||
public partial class CurvatureCalculatorResultView : Window
|
||||
{
|
||||
private readonly CurvatureCalculatorResultViewModel viewModel;
|
||||
public CurvatureCalculatorResultView(CurvatureCalculatorResultViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.viewModel = viewModel;
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
|
||||
public CurvatureCalculatorResultView(ICurvatureCalculatorResult? curvatureResult) : this(new CurvatureCalculatorResultViewModel(curvatureResult))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures
|
||||
{
|
||||
public class CurvatureCalculatorResultViewModel : ViewModelBase
|
||||
{
|
||||
private readonly ICurvatureCalculatorResult resultModel;
|
||||
public CurvatureForceCalculatorResultViewModel SelectedResult { get; set; }
|
||||
public List<CurvatureForceCalculatorResultViewModel> ForcesResult { get; set; }
|
||||
public ICurvatureCalculatorResult Result => resultModel;
|
||||
public ValidResultCounterVM ValidResultCounter { get; }
|
||||
|
||||
public CurvatureCalculatorResultViewModel(ICurvatureCalculatorResult resultModel)
|
||||
{
|
||||
this.resultModel = resultModel;
|
||||
ValidResultCounter = new(this.resultModel.ForceCalculatorResults);
|
||||
ForcesResult = new();
|
||||
foreach (var item in resultModel.ForceCalculatorResults)
|
||||
{
|
||||
ForcesResult.Add(new CurvatureForceCalculatorResultViewModel(item));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||
d:DataContext="{d:DesignInstance local:CurvatureCalculatorViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Curvature Calculator" Height="250" Width="400" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||
Title="Curvature Calculator" Height="250" Width="400" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" Closing="Window_Closing">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
@@ -23,18 +23,13 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Name"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding CalculatorViewModel.Name}"/>
|
||||
<TextBlock Grid.Row="1" Text="Show trace data"/>
|
||||
<CheckBox Grid.Column="1" Grid.Row="1" Margin="0,3" IsChecked="{Binding CalculatorViewModel.ShowTraceData}"/>
|
||||
<TextBlock Grid.Row="2" Text="Deflection factor"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding InputDataViewModel.DeflectionFactor, Converter={StaticResource PlainDouble}}"/>
|
||||
<TextBlock Grid.Row="3" Text="Span length"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding InputDataViewModel.SpanLength, Converter={StaticResource LengthConverter}}"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Forces">
|
||||
@@ -43,6 +38,62 @@
|
||||
<TabItem Header="Primitives">
|
||||
<ContentControl ContentTemplate="{StaticResource SourceToTarget}" Content="{Binding InputDataViewModel.PrimitivesViewModel}"/>
|
||||
</TabItem>
|
||||
<TabItem Header="Deflections">
|
||||
<ScrollViewer>
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Span length"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding InputDataViewModel.DeflectionFactor.SpanLength, Converter={StaticResource LengthConverter}}"/>
|
||||
</Grid>
|
||||
<Expander Header="Maximum deflections" IsExpanded="True">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Along Y"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding InputDataViewModel.DeflectionFactor.MaxDeflections.Mx, Converter={StaticResource LengthConverter}}"/>
|
||||
<TextBlock Grid.Row="1" Text="Along X"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding InputDataViewModel.DeflectionFactor.MaxDeflections.My, Converter={StaticResource LengthConverter}}"/>
|
||||
<TextBlock Grid.Row="2" Text="Along Z"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding InputDataViewModel.DeflectionFactor.MaxDeflections.Nz, Converter={StaticResource LengthConverter}}"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
<Expander Header="Deflection factors">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Along Y"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding InputDataViewModel.DeflectionFactor.DeflectionFactors.Mx, Converter={StaticResource PlainDouble}}"/>
|
||||
<TextBlock Grid.Row="1" Text="Along X"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding InputDataViewModel.DeflectionFactor.DeflectionFactors.My, Converter={StaticResource PlainDouble}}"/>
|
||||
<TextBlock Grid.Row="2" Text="Along Z"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding InputDataViewModel.DeflectionFactor.DeflectionFactors.Nz, Converter={StaticResource PlainDouble}}"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
|
||||
@@ -15,5 +15,10 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures
|
||||
this.viewModel = viewModel;
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
viewModel.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures
|
||||
{
|
||||
public class CurvatureForceCalculatorResultViewModel : ViewModelBase
|
||||
{
|
||||
private readonly ICurvatureForceCalculatorResult resultModel;
|
||||
|
||||
public CurvatureForceCalculatorResultViewModel(ICurvatureForceCalculatorResult resultModel)
|
||||
{
|
||||
this.resultModel = resultModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Windows.ViewModels.Forces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures
|
||||
{
|
||||
public class DeflectionFactorViewModel : ViewModelBase
|
||||
{
|
||||
IDeflectionFactor deflectionFactor;
|
||||
public ForceTupleVM DeflectionFactors { get; }
|
||||
public ForceTupleVM MaxDeflections { get; }
|
||||
|
||||
public double SpanLength
|
||||
{
|
||||
get => deflectionFactor.SpanLength;
|
||||
set
|
||||
{
|
||||
deflectionFactor.SpanLength = Math.Max(value, 0.0);
|
||||
OnPropertyChanged(nameof(SpanLength));
|
||||
}
|
||||
}
|
||||
|
||||
public DeflectionFactorViewModel(IDeflectionFactor deflectionFactor)
|
||||
{
|
||||
this.deflectionFactor = deflectionFactor;
|
||||
DeflectionFactors = new(this.deflectionFactor.DeflectionFactors)
|
||||
{
|
||||
MinMx = 0.0,
|
||||
MinMy = 0.0,
|
||||
MinNz = 0.0
|
||||
};
|
||||
MaxDeflections = new(this.deflectionFactor.MaxDeflections)
|
||||
{
|
||||
MinMx = 0.0,
|
||||
MinMy = 0.0,
|
||||
MinNz = 0.0
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -307,7 +307,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
}
|
||||
private void SetPrestrain()
|
||||
{
|
||||
var source = TupleConverter.ConvertToStrainTuple(SelectedResult.ForcesTupleResult.LoaderResults.StrainMatrix);
|
||||
var source = ForceTupleConverter.ConvertToStrainTuple(SelectedResult.ForcesTupleResult.LoaderResults.StrainMatrix);
|
||||
var vm = new SetPrestrainViewModel(source);
|
||||
var wnd = new SetPrestrainView(vm);
|
||||
wnd.ShowDialog();
|
||||
|
||||
Reference in New Issue
Block a user