CompressedProperty was added
This commit is contained in:
@@ -49,6 +49,31 @@
|
||||
<TabItem Header="Primitives">
|
||||
<ContentControl ContentTemplate="{StaticResource SourceToTarget}" Content="{Binding PrimitivesViewModel}"/>
|
||||
</TabItem>
|
||||
<TabItem Header="SOrder" Visibility="Hidden">
|
||||
<Grid DataContext="{Binding SecondOrder}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="Consider second order effects"/>
|
||||
<TextBlock Grid.Row="1" Text="Geometry length"/>
|
||||
<TextBlock Grid.Row="2" Text="Buckling factor x-axis"/>
|
||||
<TextBlock Grid.Row="3" Text="Buckling factor y-axis"/>
|
||||
<CheckBox Grid.Column="1" IsChecked="{Binding Buckling}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding GeometryLength, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding LengthFactorX, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding LengthFactorY, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Iterations">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
|
||||
@@ -43,8 +43,8 @@ namespace StructureHelper.Windows.MainWindow
|
||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||
public IForceCombinationList SelectedForceCombinationList { get; set; }
|
||||
|
||||
private readonly AnalysisVewModel calculatorsLogic;
|
||||
public AnalysisVewModel CalculatorsLogic { get => calculatorsLogic;}
|
||||
private readonly AnalysisVewModelLogic calculatorsLogic;
|
||||
public AnalysisVewModelLogic CalculatorsLogic { get => calculatorsLogic;}
|
||||
public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
|
||||
public IPrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
Model = model;
|
||||
section = model.Section;
|
||||
combinationsLogic = new ActionsViewModel(repository);
|
||||
calculatorsLogic = new AnalysisVewModel(repository);
|
||||
calculatorsLogic = new AnalysisVewModelLogic(repository);
|
||||
primitiveLogic = new PrimitiveViewModelLogic(repository) { CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight };
|
||||
XX2 = CanvasWidth;
|
||||
XY1 = CanvasHeight / 2d;
|
||||
|
||||
@@ -83,28 +83,24 @@
|
||||
<TextBlock Grid.Row="2" Text="Center X"/>
|
||||
<TextBlock Grid.Row="3" Text="Center Y"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Name}"/>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<ComboBox Width="100" ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding PrimitiveMaterial}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle Grid.Column="0" Margin="3">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding Color}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<Button Width="50" Content="..." Command="{Binding EditMaterialCommand}">
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding PrimitiveMaterial}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle Grid.Column="0" Margin="3">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding Color}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Margin="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
</Grid>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
@@ -25,6 +26,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
IEnumerable<INdmPrimitive> allowedPrimitives;
|
||||
IEnumerable<IForceCombinationList> allowedForceCombinations;
|
||||
ForceCalculator forcesCalculator;
|
||||
SecondOrderViewModel secondOrderViewModel;
|
||||
|
||||
public string Name
|
||||
{
|
||||
@@ -34,16 +36,18 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
|
||||
public double IterationAccuracy
|
||||
{
|
||||
get { return forcesCalculator.IterationAccuracy; }
|
||||
set { forcesCalculator.IterationAccuracy = value;}
|
||||
get { return forcesCalculator.Accuracy.IterationAccuracy; }
|
||||
set { forcesCalculator.Accuracy.IterationAccuracy = value;}
|
||||
}
|
||||
|
||||
public int MaxIterationCount
|
||||
{
|
||||
get { return forcesCalculator.MaxIterationCount; }
|
||||
set { forcesCalculator.MaxIterationCount = value; }
|
||||
get { return forcesCalculator.Accuracy.MaxIterationCount; }
|
||||
set { forcesCalculator.Accuracy.MaxIterationCount = value; }
|
||||
}
|
||||
|
||||
public SecondOrderViewModel SecondOrder => secondOrderViewModel;
|
||||
|
||||
public bool ULS { get; set; }
|
||||
public bool SLS { get; set; }
|
||||
public bool ShortTerm { get; set; }
|
||||
@@ -147,6 +151,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
allowedPrimitives = _allowedPrimitives;
|
||||
allowedForceCombinations = _allowedForceCombinations;
|
||||
forcesCalculator = _forcesCalculator;
|
||||
secondOrderViewModel = new SecondOrderViewModel(forcesCalculator.CompressedMember);
|
||||
|
||||
CombinationViewModel = new SourceToTargetViewModel<IForceCombinationList>();
|
||||
CombinationViewModel.SetTargetItems(forcesCalculator.ForceCombinationLists);
|
||||
|
||||
@@ -15,7 +15,7 @@ using System.Windows.Forms;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public class AnalysisVewModel : CRUDViewModelBase<INdmCalculator>
|
||||
public class AnalysisVewModelLogic : CRUDViewModelBase<INdmCalculator>
|
||||
{
|
||||
private ICrossSectionRepository repository;
|
||||
private RelayCommand runCommand;
|
||||
@@ -69,7 +69,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
public AnalysisVewModel(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
|
||||
public AnalysisVewModelLogic(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
|
||||
{
|
||||
repository = sectionRepository;
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public class CalculatorsViewModelLogic : ViewModelBase, ICalculatorsViewModelLogic
|
||||
{
|
||||
private readonly ICrossSectionRepository repository;
|
||||
|
||||
public INdmCalculator SelectedItem { get; set; }
|
||||
public ObservableCollection<INdmCalculator> Items { get; private set; }
|
||||
|
||||
private RelayCommand addCommand;
|
||||
public RelayCommand Add
|
||||
{
|
||||
get
|
||||
{
|
||||
return addCommand ??
|
||||
(
|
||||
addCommand = new RelayCommand(o =>
|
||||
{
|
||||
AddCalculator();
|
||||
OnPropertyChanged(nameof(Items));
|
||||
}));
|
||||
}
|
||||
}
|
||||
private void AddCalculator()
|
||||
{
|
||||
var item = new ForceCalculator() { Name = "New force calculator" };
|
||||
Items.Add(item);
|
||||
repository.CalculatorsList.Add(item);
|
||||
}
|
||||
private RelayCommand editCommand;
|
||||
public RelayCommand Edit
|
||||
{
|
||||
get
|
||||
{
|
||||
return editCommand ??
|
||||
(
|
||||
editCommand = new RelayCommand(o =>
|
||||
{
|
||||
var tmpSelected = SelectedItem;
|
||||
EditCalculator();
|
||||
Items.Clear();
|
||||
AddItems(repository.CalculatorsList);
|
||||
OnPropertyChanged(nameof(Items));
|
||||
SelectedItem = tmpSelected;
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
private void EditCalculator()
|
||||
{
|
||||
if (SelectedItem is ForceCalculator)
|
||||
{
|
||||
var calculator = SelectedItem as ForceCalculator;
|
||||
var vm = new ForceCalculatorViewModel(repository.Primitives, repository.ForceCombinationLists, calculator);
|
||||
|
||||
var wnd = new ForceCalculatorView(vm);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
}
|
||||
private RelayCommand deleteCommand;
|
||||
private RelayCommand runCommand;
|
||||
private RelayCommand copyCommand;
|
||||
|
||||
public RelayCommand Delete
|
||||
{
|
||||
get
|
||||
{
|
||||
return deleteCommand ??
|
||||
(
|
||||
deleteCommand = new RelayCommand(o =>
|
||||
{
|
||||
DeleteCalculator();
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
public RelayCommand Run
|
||||
{
|
||||
get
|
||||
{
|
||||
return runCommand ??
|
||||
(
|
||||
runCommand = new RelayCommand(o =>
|
||||
{
|
||||
SelectedItem.Run();
|
||||
var result = SelectedItem.Result;
|
||||
if (result.IsValid == false)
|
||||
{
|
||||
MessageBox.Show(result.Desctription, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
var calculator = SelectedItem as IForceCalculator;
|
||||
var vm = new ForcesResultsViewModel(calculator);
|
||||
var wnd = new ForceResultsView(vm);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
public RelayCommand Copy
|
||||
{
|
||||
get
|
||||
{
|
||||
return copyCommand ??
|
||||
(
|
||||
copyCommand = new RelayCommand(o =>
|
||||
{
|
||||
var item = SelectedItem.Clone() as INdmCalculator;
|
||||
repository.CalculatorsList.Add(item);
|
||||
Items.Add(item);
|
||||
OnPropertyChanged(nameof(Items));
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
private void DeleteCalculator()
|
||||
{
|
||||
var dialogResult = MessageBox.Show("Delete calculator?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
repository.CalculatorsList.Remove(SelectedItem as INdmCalculator);
|
||||
OnPropertyChanged(nameof(Items));
|
||||
}
|
||||
}
|
||||
|
||||
public void AddItems(IEnumerable<INdmCalculator> items)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public CalculatorsViewModelLogic(ICrossSectionRepository repository)
|
||||
{
|
||||
this.repository = repository;
|
||||
Items = new ObservableCollection<INdmCalculator>();
|
||||
AddItems(this.repository.CalculatorsList);
|
||||
}
|
||||
}
|
||||
}
|
||||
60
Windows/ViewModels/NdmCrossSections/SecondOrderViewModel.cs
Normal file
60
Windows/ViewModels/NdmCrossSections/SecondOrderViewModel.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using FieldVisualizer.ViewModels;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public class SecondOrderViewModel : ViewModelBase
|
||||
{
|
||||
ICompressedMember member;
|
||||
|
||||
public bool Buckling
|
||||
{
|
||||
get => member.Buckling;
|
||||
set
|
||||
{
|
||||
member.Buckling = value;
|
||||
OnPropertyChanged(nameof(Buckling));
|
||||
}
|
||||
}
|
||||
|
||||
public double GeometryLength
|
||||
{
|
||||
get => member.GeometryLength;
|
||||
set
|
||||
{
|
||||
member.GeometryLength = value;
|
||||
OnPropertyChanged(nameof(GeometryLength));
|
||||
}
|
||||
}
|
||||
|
||||
public double LengthFactorX
|
||||
{
|
||||
get => member.LengthFactorX;
|
||||
set
|
||||
{
|
||||
member.GeometryLength = value;
|
||||
OnPropertyChanged(nameof(LengthFactorX));
|
||||
}
|
||||
}
|
||||
|
||||
public double LengthFactorY
|
||||
{
|
||||
get => member.LengthFactorY;
|
||||
set
|
||||
{
|
||||
member.GeometryLength = value;
|
||||
OnPropertyChanged(nameof(LengthFactorY));
|
||||
}
|
||||
}
|
||||
|
||||
public SecondOrderViewModel(ICompressedMember compressedMember)
|
||||
{
|
||||
member = compressedMember;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user