Surrounding property was added
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ShapeEditTemplates.xaml"/>
|
<ResourceDictionary Source="Infrastructure/UI/Resources/ShapeEditTemplates.xaml"/>
|
||||||
<ResourceDictionary Source="Infrastructure/UI/Resources/PrimitiveToolTips.xaml"/>
|
<ResourceDictionary Source="Infrastructure/UI/Resources/PrimitiveToolTips.xaml"/>
|
||||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ITemEditPanels.xaml"/>
|
<ResourceDictionary Source="Infrastructure/UI/Resources/ITemEditPanels.xaml"/>
|
||||||
|
<ResourceDictionary Source="Infrastructure/UI/Resources/ForceTemplates.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
|||||||
14
StructureHelper/Infrastructure/Enums/ActionType.cs
Normal file
14
StructureHelper/Infrastructure/Enums/ActionType.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Infrastructure.Enums
|
||||||
|
{
|
||||||
|
public enum ActionType
|
||||||
|
{
|
||||||
|
ForceCombination,
|
||||||
|
ForceCombinationByFactor
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -263,13 +263,13 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
|
|
||||||
public virtual INdmPrimitive GetNdmPrimitive()
|
public virtual INdmPrimitive GetNdmPrimitive()
|
||||||
{
|
{
|
||||||
RefreshNdmPrimitive();
|
//RefreshNdmPrimitive();
|
||||||
return primitive;
|
return primitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void RefreshNdmPrimitive()
|
//public virtual void RefreshNdmPrimitive()
|
||||||
{
|
//{
|
||||||
}
|
//}
|
||||||
|
|
||||||
public void RefreshColor()
|
public void RefreshColor()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,26 +17,37 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
public static ObservableCollection<PrimitiveBase> ConvertNdmPrimitivesToPrimitiveBase(IEnumerable<INdmPrimitive> primitives)
|
public static ObservableCollection<PrimitiveBase> ConvertNdmPrimitivesToPrimitiveBase(IEnumerable<INdmPrimitive> primitives)
|
||||||
{
|
{
|
||||||
ObservableCollection<PrimitiveBase> viewItems = new ObservableCollection<PrimitiveBase>();
|
ObservableCollection<PrimitiveBase> viewItems = new ObservableCollection<PrimitiveBase>();
|
||||||
foreach (var item in primitives)
|
foreach (var primitive in primitives)
|
||||||
{
|
{
|
||||||
if (item is IRectanglePrimitive)
|
viewItems.Add(ConvertNdmPrimitiveToPrimitiveBase(primitive));
|
||||||
{
|
|
||||||
var rect = item as IRectanglePrimitive;
|
|
||||||
viewItems.Add(new RectangleViewPrimitive(rect));
|
|
||||||
}
|
|
||||||
else if (item is ICirclePrimitive)
|
|
||||||
{
|
|
||||||
var circle = item as ICirclePrimitive;
|
|
||||||
viewItems.Add(new CircleViewPrimitive(circle));
|
|
||||||
}
|
|
||||||
else if (item is IPointPrimitive)
|
|
||||||
{
|
|
||||||
var point = item as IPointPrimitive;
|
|
||||||
viewItems.Add(new PointViewPrimitive(point));
|
|
||||||
}
|
|
||||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
|
|
||||||
}
|
}
|
||||||
return viewItems;
|
return viewItems;
|
||||||
}
|
}
|
||||||
|
public static PrimitiveBase ConvertNdmPrimitiveToPrimitiveBase(INdmPrimitive primitive)
|
||||||
|
{
|
||||||
|
PrimitiveBase viewItem;
|
||||||
|
if (primitive is IRectanglePrimitive)
|
||||||
|
{
|
||||||
|
var rect = primitive as IRectanglePrimitive;
|
||||||
|
viewItem = new RectangleViewPrimitive(rect);
|
||||||
|
}
|
||||||
|
else if (primitive is ICirclePrimitive)
|
||||||
|
{
|
||||||
|
var circle = primitive as ICirclePrimitive;
|
||||||
|
viewItem = new CircleViewPrimitive(circle);
|
||||||
|
}
|
||||||
|
else if (primitive is IPointPrimitive & primitive is not ReinforcementPrimitive)
|
||||||
|
{
|
||||||
|
var point = primitive as IPointPrimitive;
|
||||||
|
viewItem = new PointViewPrimitive(point);
|
||||||
|
}
|
||||||
|
else if (primitive is ReinforcementPrimitive)
|
||||||
|
{
|
||||||
|
var point = primitive as ReinforcementPrimitive;
|
||||||
|
viewItem = new ReinforcementViewPrimitive(point);
|
||||||
|
}
|
||||||
|
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Actual type: {primitive.GetType()}");
|
||||||
|
return viewItem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,23 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||||
{
|
{
|
||||||
internal class ReinforcementViewPrimitive : PointViewPrimitive
|
public class ReinforcementViewPrimitive : PointViewPrimitive, IHasSurroundingPrimitive
|
||||||
{
|
{
|
||||||
public ReinforcementViewPrimitive(IPointPrimitive _primitive) : base(_primitive)
|
ReinforcementPrimitive primitive;
|
||||||
|
|
||||||
|
public INdmPrimitive SurroundingPrimitive
|
||||||
{
|
{
|
||||||
|
get => primitive.SurroundingPrimitive;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
primitive.SurroundingPrimitive = value;
|
||||||
|
OnPropertyChanged(nameof(SurroundingPrimitive));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReinforcementViewPrimitive(ReinforcementPrimitive _primitive) : base(_primitive)
|
||||||
|
{
|
||||||
|
primitive = _primitive;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<DataTemplate x:Key="ForceActionTemplate">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="200"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="Name"/>
|
||||||
|
<TextBox Grid.Column="1" Text="{Binding Name}"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Set force into initial Gravity Center"/>
|
||||||
|
<CheckBox Grid.Row="1" Grid.Column="1" Margin="3,5,3,5" IsChecked="{Binding SetInGravityCenter}"/>
|
||||||
|
<TextBlock Grid.Row="2" Text="Center X"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CenterX}" IsEnabled="{Binding CoordEnable}"/>
|
||||||
|
<TextBlock Grid.Row="3" Text="Center Y"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding CenterY}" IsEnabled="{Binding CoordEnable}"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="CombinationListTemplate">
|
||||||
|
<Grid Grid.Row="1" DataContext="{Binding DesignForces}">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition Width="80"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<DataGrid x:Name="ForceGrid" Style="{StaticResource ItemsDataGrid}">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridComboBoxColumn Header="Limit state" Width="80" MinWidth="70" SelectedItemBinding="{Binding LimitState}" ItemsSource="{Binding Source={StaticResource LimitStateEnum}}"/>
|
||||||
|
<DataGridComboBoxColumn Header="Duration" Width="80" MinWidth="70" SelectedItemBinding="{Binding CalcTerm}" ItemsSource="{Binding Source={StaticResource CalcTermEnum}}"/>
|
||||||
|
<DataGridTextColumn Header="Moment Mx" Width="85" Binding="{Binding ForceTuple.Mx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<DataGridTextColumn Header="Moment My" Width="85" Binding="{Binding ForceTuple.My, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<DataGridTextColumn Header="Force Nz" Width="85" Binding="{Binding ForceTuple.Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<StackPanel Grid.Column="1">
|
||||||
|
<Button Style="{StaticResource AddButton}"/>
|
||||||
|
<Button Style="{StaticResource DeleteButton}"/>
|
||||||
|
<Button Style="{StaticResource CopyButton}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -9,6 +9,9 @@
|
|||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Update="Windows\Forces\ForceCombinationByFactorView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Windows\MainWindow\AboutView.xaml.cs">
|
<Compile Update="Windows\MainWindow\AboutView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -17,6 +20,12 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Page Update="Infrastructure\UI\Resources\ForceTemplates.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Update="Windows\Forces\ForceCombinationByFactorView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Windows\MainWindow\AboutView.xaml">
|
<Page Update="Windows\MainWindow\AboutView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.Forces.ForceCombinationByFactorView"
|
||||||
|
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.Forces"
|
||||||
|
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Forces"
|
||||||
|
d:DataContext="{d:DesignInstance vm:ForceCombinationByFactorVM}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Force Combination By Factor" Height="250" Width="350" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="95"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<!--ForceTemplates.xaml-->
|
||||||
|
<ContentControl ContentTemplate="{StaticResource ResourceKey=ForceActionTemplate}" Content="{Binding}"/>
|
||||||
|
<StackPanel Grid.Row="1">
|
||||||
|
<TextBlock Text="Full service load combination"/>
|
||||||
|
<Grid DataContext="{Binding ForceTupleVM}">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock HorizontalAlignment="Center" Text="Mx" />
|
||||||
|
<TextBlock Grid.Column="1" HorizontalAlignment="Center" Text="My" />
|
||||||
|
<TextBlock Grid.Column="2" HorizontalAlignment="Center" Text="Nz" />
|
||||||
|
<TextBox Grid.Row="1" Text="{Binding Mx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding My, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="Long Term factor"/>
|
||||||
|
<TextBox Grid.Column="1" Text="{Binding LongTermFactor, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="ULS Safety Factor"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding ULSFactor, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using StructureHelper.Windows.ViewModels.Forces;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
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.Shapes;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.Forces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для ForceCombinationByFactor.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ForceCombinationByFactorView : Window
|
||||||
|
{
|
||||||
|
ForceCombinationByFactorVM viewModel;
|
||||||
|
public ForceCombinationByFactorView(IForceCombinationByFactor forceCombination)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
viewModel = new ForceCombinationByFactorVM(forceCombination);
|
||||||
|
DataContext = viewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,56 +9,14 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Force Combination" Height="250" Width="550" MinHeight="300" MinWidth="450" MaxWidth="500" WindowStartupLocation="CenterScreen">
|
Title="Force Combination" Height="250" Width="550" MinHeight="300" MinWidth="450" MaxWidth="500" WindowStartupLocation="CenterScreen">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<DataTemplate x:Key="ForceTemplate">
|
|
||||||
|
|
||||||
</DataTemplate>
|
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="95"/>
|
<RowDefinition Height="95"/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel>
|
<!--ForceTemplates.xaml-->
|
||||||
<Grid>
|
<ContentControl ContentTemplate="{StaticResource ResourceKey=ForceActionTemplate}" Content="{Binding}"/>
|
||||||
<Grid.RowDefinitions>
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource ResourceKey=CombinationListTemplate}" Content="{Binding}"/>
|
||||||
<RowDefinition/>
|
|
||||||
<RowDefinition/>
|
|
||||||
<RowDefinition/>
|
|
||||||
<RowDefinition/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="200"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<TextBlock Text="Name"/>
|
|
||||||
<TextBox Grid.Column="1" Text="{Binding Name}"/>
|
|
||||||
<TextBlock Grid.Row="1" Text="Set force into initial Gravity Center"/>
|
|
||||||
<CheckBox Grid.Row="1" Grid.Column="1" Margin="3,5,3,5" IsChecked="{Binding SetInGravityCenter}"/>
|
|
||||||
<TextBlock Grid.Row="2" Text="Center X"/>
|
|
||||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CenterX}" IsEnabled="{Binding CoordEnable}"/>
|
|
||||||
<TextBlock Grid.Row="3" Text="Center Y"/>
|
|
||||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding CenterY}" IsEnabled="{Binding CoordEnable}"/>
|
|
||||||
</Grid>
|
|
||||||
</StackPanel>
|
|
||||||
<Grid Grid.Row="1" DataContext="{Binding DesignForces}">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
<ColumnDefinition Width="80"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<DataGrid x:Name="ForceGrid" Style="{StaticResource ItemsDataGrid}">
|
|
||||||
<DataGrid.Columns>
|
|
||||||
<DataGridComboBoxColumn Header="Limit state" Width="80" MinWidth="70" SelectedItemBinding="{Binding LimitState}" ItemsSource="{Binding Source={StaticResource LimitStateEnum}}"/>
|
|
||||||
<DataGridComboBoxColumn Header="Duration" Width="80" MinWidth="70" SelectedItemBinding="{Binding CalcTerm}" ItemsSource="{Binding Source={StaticResource CalcTermEnum}}"/>
|
|
||||||
<DataGridTextColumn Header="Moment Mx" Width="85" Binding="{Binding ForceTuple.Mx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
<DataGridTextColumn Header="Moment My" Width="85" Binding="{Binding ForceTuple.My, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
<DataGridTextColumn Header="Force Nz" Width="85" Binding="{Binding ForceTuple.Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
</DataGrid.Columns>
|
|
||||||
</DataGrid>
|
|
||||||
<StackPanel Grid.Column="1">
|
|
||||||
<Button Style="{StaticResource AddButton}"/>
|
|
||||||
<Button Style="{StaticResource DeleteButton}"/>
|
|
||||||
<Button Style="{StaticResource CopyButton}"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -75,7 +75,10 @@
|
|||||||
<Expander Header="Actions" MinWidth="20" DataContext="{Binding CombinationsLogic}">
|
<Expander Header="Actions" MinWidth="20" DataContext="{Binding CombinationsLogic}">
|
||||||
<Expander.ContextMenu>
|
<Expander.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<Button Content="Add Force Combination" Command="{Binding Add}"/>
|
<MenuItem Header="Add">
|
||||||
|
<Button Content="Combination" Command="{Binding Add}" CommandParameter="{x:Static enums:ActionType.ForceCombination}"/>
|
||||||
|
<Button Content="Combination By Factors" Command="{Binding Add}" CommandParameter="{x:Static enums:ActionType.ForceCombinationByFactor}"/>
|
||||||
|
</MenuItem>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</Expander.ContextMenu>
|
</Expander.ContextMenu>
|
||||||
<ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}">
|
<ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}">
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
private readonly AnalysisVewModelLogic calculatorsLogic;
|
private readonly AnalysisVewModelLogic calculatorsLogic;
|
||||||
public AnalysisVewModelLogic CalculatorsLogic { get => calculatorsLogic;}
|
public AnalysisVewModelLogic CalculatorsLogic { get => calculatorsLogic;}
|
||||||
public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
|
public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
|
||||||
public IPrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
|
public PrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
|
||||||
public HelpLogic HelpLogic => new HelpLogic();
|
public HelpLogic HelpLogic => new HelpLogic();
|
||||||
|
|
||||||
private MainModel Model { get; }
|
private MainModel Model { get; }
|
||||||
@@ -214,7 +214,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
|
|
||||||
private double delta = 0.0005;
|
private double delta = 0.0005;
|
||||||
private ActionsViewModel combinationsLogic;
|
private ActionsViewModel combinationsLogic;
|
||||||
private IPrimitiveViewModelLogic primitiveLogic;
|
private PrimitiveViewModelLogic primitiveLogic;
|
||||||
private RelayCommand showVisualProperty;
|
private RelayCommand showVisualProperty;
|
||||||
private RelayCommand selectPrimitive;
|
private RelayCommand selectPrimitive;
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
section = model.Section;
|
section = model.Section;
|
||||||
combinationsLogic = new ActionsViewModel(repository);
|
combinationsLogic = new ActionsViewModel(repository);
|
||||||
calculatorsLogic = new AnalysisVewModelLogic(repository);
|
calculatorsLogic = new AnalysisVewModelLogic(repository);
|
||||||
primitiveLogic = new PrimitiveViewModelLogic(repository) { CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight };
|
primitiveLogic = new PrimitiveViewModelLogic(section) { CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight };
|
||||||
XX2 = CanvasWidth;
|
XX2 = CanvasWidth;
|
||||||
XY1 = CanvasHeight / 2d;
|
XY1 = CanvasHeight / 2d;
|
||||||
YX1 = CanvasWidth / 2d;
|
YX1 = CanvasWidth / 2d;
|
||||||
@@ -342,11 +342,6 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckAnalisysOptions()
|
|
||||||
{
|
|
||||||
if (CheckMaterials() == false) { return false; }
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
private bool CheckMaterials()
|
private bool CheckMaterials()
|
||||||
{
|
{
|
||||||
foreach (var item in primitiveLogic.Items)
|
foreach (var item in primitiveLogic.Items)
|
||||||
@@ -405,10 +400,10 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
var newRepository = newSection.SectionRepository;
|
var newRepository = newSection.SectionRepository;
|
||||||
repository.HeadMaterials.AddRange(newRepository.HeadMaterials);
|
repository.HeadMaterials.AddRange(newRepository.HeadMaterials);
|
||||||
repository.Primitives.AddRange(newRepository.Primitives);
|
repository.Primitives.AddRange(newRepository.Primitives);
|
||||||
repository.ForceCombinationLists.AddRange(newRepository.ForceCombinationLists);
|
repository.ForceActions.AddRange(newRepository.ForceActions);
|
||||||
repository.CalculatorsList.AddRange(newRepository.CalculatorsList);
|
repository.CalculatorsList.AddRange(newRepository.CalculatorsList);
|
||||||
OnPropertyChanged(nameof(HeadMaterials));
|
OnPropertyChanged(nameof(HeadMaterials));
|
||||||
CombinationsLogic.AddItems(newRepository.ForceCombinationLists);
|
CombinationsLogic.AddItems(newRepository.ForceActions);
|
||||||
CalculatorsLogic.AddItems(newRepository.CalculatorsList);
|
CalculatorsLogic.AddItems(newRepository.CalculatorsList);
|
||||||
var primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(newRepository.Primitives);
|
var primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(newRepository.Primitives);
|
||||||
foreach (var item in primitives)
|
foreach (var item in primitives)
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Grid.Row="0" Text="Inside of"/>
|
<TextBlock Grid.Row="0" Text="Inside of"/>
|
||||||
<ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding PrimitiveMaterial}">
|
<ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding SurroundingPrimitives}" SelectedItem="{Binding SurroundingPrimitive}">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -29,10 +30,10 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
|
|||||||
{
|
{
|
||||||
PrimitiveBase primitive;
|
PrimitiveBase primitive;
|
||||||
private PrimitivePropertiesViewModel viewModel;
|
private PrimitivePropertiesViewModel viewModel;
|
||||||
public PrimitivePropertiesView(PrimitiveBase primitive, IHasHeadMaterials headMaterials)
|
public PrimitivePropertiesView(PrimitiveBase primitive, ICrossSectionRepository sectionRepository)
|
||||||
{
|
{
|
||||||
this.primitive = primitive;
|
this.primitive = primitive;
|
||||||
viewModel = new PrimitivePropertiesViewModel(this.primitive, headMaterials);
|
viewModel = new PrimitivePropertiesViewModel(this.primitive, sectionRepository);
|
||||||
this.DataContext = viewModel;
|
this.DataContext = viewModel;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
if (primitive is RectangleViewPrimitive) { AddPrimitiveProperties(PrimitiveType.Rectangle); }
|
if (primitive is RectangleViewPrimitive) { AddPrimitiveProperties(PrimitiveType.Rectangle); }
|
||||||
@@ -42,13 +43,13 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
|
|||||||
}
|
}
|
||||||
private void AddPrimitiveProperties(PrimitiveType type)
|
private void AddPrimitiveProperties(PrimitiveType type)
|
||||||
{
|
{
|
||||||
List<string> names = new List<string>();
|
List<string> templateNames = new List<string>();
|
||||||
if (primitive.DivisionViewModel is not null) { names.Add("TriangulationProperties");}
|
if (primitive.DivisionViewModel is not null) { templateNames.Add("TriangulationProperties");}
|
||||||
if (primitive is RectangleViewPrimitive) { names.Add("RectangleProperties"); }
|
if (primitive is RectangleViewPrimitive) { templateNames.Add("RectangleProperties"); }
|
||||||
if (primitive is CircleViewPrimitive) { names.Add("CircleProperties"); }
|
if (primitive is CircleViewPrimitive) { templateNames.Add("CircleProperties"); }
|
||||||
if (primitive is PointViewPrimitive) { names.Add("PointProperties"); }
|
if (primitive is PointViewPrimitive) { templateNames.Add("PointProperties"); }
|
||||||
if (primitive is ReinforcementViewPrimitive) { names.Add("ReinforcementProperties"); }
|
if (primitive is ReinforcementViewPrimitive) { templateNames.Add("ReinforcementProperties"); }
|
||||||
foreach (var name in names)
|
foreach (var name in templateNames)
|
||||||
{
|
{
|
||||||
ContentControl contentControl = new ContentControl();
|
ContentControl contentControl = new ContentControl();
|
||||||
contentControl.SetResourceReference(ContentTemplateProperty, name);
|
contentControl.SetResourceReference(ContentTemplateProperty, name);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
|||||||
public class ForceCalculatorViewModel : ViewModelBase
|
public class ForceCalculatorViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
IEnumerable<INdmPrimitive> allowedPrimitives;
|
IEnumerable<INdmPrimitive> allowedPrimitives;
|
||||||
IEnumerable<IForceCombinationList> allowedForceCombinations;
|
IEnumerable<IForceAction> allowedForceCombinations;
|
||||||
ForceCalculator forcesCalculator;
|
ForceCalculator forcesCalculator;
|
||||||
SecondOrderViewModel secondOrderViewModel;
|
SecondOrderViewModel secondOrderViewModel;
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ 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<IForceCombinationList> CombinationViewModel { get; }
|
public ISourceToTargetViewModel<IForceAction> CombinationViewModel { get; }
|
||||||
public ISourceToTargetViewModel<PrimitiveBase> PrimitivesViewModel { get; }
|
public ISourceToTargetViewModel<PrimitiveBase> PrimitivesViewModel { get; }
|
||||||
|
|
||||||
public PrimitiveBase SelectedAllowedPrimitive { get; set; }
|
public PrimitiveBase SelectedAllowedPrimitive { get; set; }
|
||||||
@@ -146,15 +146,15 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForceCalculatorViewModel(IEnumerable<INdmPrimitive> _allowedPrimitives, IEnumerable<IForceCombinationList> _allowedForceCombinations, ForceCalculator _forcesCalculator)
|
public ForceCalculatorViewModel(IEnumerable<INdmPrimitive> _allowedPrimitives, IEnumerable<IForceAction> _allowedForceCombinations, ForceCalculator _forcesCalculator)
|
||||||
{
|
{
|
||||||
allowedPrimitives = _allowedPrimitives;
|
allowedPrimitives = _allowedPrimitives;
|
||||||
allowedForceCombinations = _allowedForceCombinations;
|
allowedForceCombinations = _allowedForceCombinations;
|
||||||
forcesCalculator = _forcesCalculator;
|
forcesCalculator = _forcesCalculator;
|
||||||
secondOrderViewModel = new SecondOrderViewModel(forcesCalculator.CompressedMember);
|
secondOrderViewModel = new SecondOrderViewModel(forcesCalculator.CompressedMember);
|
||||||
|
|
||||||
CombinationViewModel = new SourceToTargetViewModel<IForceCombinationList>();
|
CombinationViewModel = new SourceToTargetViewModel<IForceAction>();
|
||||||
CombinationViewModel.SetTargetItems(forcesCalculator.ForceCombinationLists);
|
CombinationViewModel.SetTargetItems(forcesCalculator.ForceActions);
|
||||||
CombinationViewModel.SetSourceItems(allowedForceCombinations);
|
CombinationViewModel.SetSourceItems(allowedForceCombinations);
|
||||||
CombinationViewModel.ItemDataDemplate = Application.Current.Resources["SimpleItemTemplate"] as DataTemplate;
|
CombinationViewModel.ItemDataDemplate = Application.Current.Resources["SimpleItemTemplate"] as DataTemplate;
|
||||||
|
|
||||||
@@ -180,10 +180,10 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
|||||||
public void Refresh()
|
public void Refresh()
|
||||||
{
|
{
|
||||||
var combinations = CombinationViewModel.GetTargetItems();
|
var combinations = CombinationViewModel.GetTargetItems();
|
||||||
forcesCalculator.ForceCombinationLists.Clear();
|
forcesCalculator.ForceActions.Clear();
|
||||||
foreach (var item in combinations)
|
foreach (var item in combinations)
|
||||||
{
|
{
|
||||||
forcesCalculator.ForceCombinationLists.Add(item);
|
forcesCalculator.ForceActions.Add(item);
|
||||||
}
|
}
|
||||||
forcesCalculator.Primitives.Clear();
|
forcesCalculator.Primitives.Clear();
|
||||||
foreach (var item in PrimitivesViewModel.GetTargetItems())
|
foreach (var item in PrimitivesViewModel.GetTargetItems())
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
using StructureHelper.Windows.Forces;
|
using StructureHelper.Infrastructure.Enums;
|
||||||
|
using StructureHelper.Windows.Forces;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
@@ -11,14 +14,27 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.Forces
|
namespace StructureHelper.Windows.ViewModels.Forces
|
||||||
{
|
{
|
||||||
public class ActionsViewModel : CRUDViewModelBase<IForceCombinationList>
|
public class ActionsViewModel : CRUDViewModelBase<IForceAction>
|
||||||
{
|
{
|
||||||
ICrossSectionRepository repository;
|
ICrossSectionRepository repository;
|
||||||
|
|
||||||
public override void AddMethod(object parameter)
|
public override void AddMethod(object parameter)
|
||||||
{
|
{
|
||||||
NewItem = new ForceCombinationList() { Name = "New Force Combination" };
|
if (parameter is not null)
|
||||||
base.AddMethod(parameter);
|
{
|
||||||
|
ActionType paramType = (ActionType)parameter;
|
||||||
|
if (paramType == ActionType.ForceCombination)
|
||||||
|
{
|
||||||
|
NewItem = new ForceCombinationList() { Name = "New Force Combination" };
|
||||||
|
}
|
||||||
|
else if (paramType == ActionType.ForceCombinationByFactor)
|
||||||
|
{
|
||||||
|
NewItem = new ForceCombinationByFactor() { Name = "New Factored Combination" };
|
||||||
|
}
|
||||||
|
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $": Actual type: {nameof(paramType)}");
|
||||||
|
base.AddMethod(parameter);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DeleteMethod(object parameter)
|
public override void DeleteMethod(object parameter)
|
||||||
@@ -32,11 +48,11 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
|||||||
if (item is IForceCalculator)
|
if (item is IForceCalculator)
|
||||||
{
|
{
|
||||||
var forceCalculator = item as IForceCalculator;
|
var forceCalculator = item as IForceCalculator;
|
||||||
var containSelected = forceCalculator.ForceCombinationLists.Contains(SelectedItem);
|
var containSelected = forceCalculator.ForceActions.Contains(SelectedItem);
|
||||||
if (containSelected)
|
if (containSelected)
|
||||||
{
|
{
|
||||||
var dialogResultCalc = MessageBox.Show($"Action is contained in calculator {item.Name}", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
var dialogResultCalc = MessageBox.Show($"Action is contained in calculator {item.Name}", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||||
if (dialogResultCalc == DialogResult.OK) { forceCalculator.ForceCombinationLists.Remove(SelectedItem); }
|
if (dialogResultCalc == DialogResult.OK) { forceCalculator.ForceActions.Remove(SelectedItem); }
|
||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,12 +63,23 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
|||||||
|
|
||||||
public override void EditMethod(object parameter)
|
public override void EditMethod(object parameter)
|
||||||
{
|
{
|
||||||
var wnd = new ForceCombinationView(SelectedItem);
|
System.Windows.Window wnd;
|
||||||
|
if (SelectedItem is IForceCombinationList)
|
||||||
|
{
|
||||||
|
var item = (IForceCombinationList)SelectedItem;
|
||||||
|
wnd = new ForceCombinationView(item);
|
||||||
|
}
|
||||||
|
else if (SelectedItem is IForceCombinationByFactor)
|
||||||
|
{
|
||||||
|
var item = (IForceCombinationByFactor)SelectedItem;
|
||||||
|
wnd = new ForceCombinationByFactorView(item);
|
||||||
|
}
|
||||||
|
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $"actual object type: {nameof(SelectedItem)}");
|
||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
base.EditMethod(parameter);
|
base.EditMethod(parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionsViewModel(ICrossSectionRepository repository) : base (repository.ForceCombinationLists)
|
public ActionsViewModel(ICrossSectionRepository repository) : base (repository.ForceActions)
|
||||||
{
|
{
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Forces
|
||||||
|
{
|
||||||
|
public abstract class ForceActionVMBase : ViewModelBase
|
||||||
|
{
|
||||||
|
IForceAction forceAction;
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get => forceAction.Name;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
forceAction.Name = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SetInGravityCenter
|
||||||
|
{
|
||||||
|
get => forceAction.SetInGravityCenter;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
forceAction.SetInGravityCenter = value;
|
||||||
|
OnPropertyChanged(nameof(SetInGravityCenter));
|
||||||
|
OnPropertyChanged(nameof(CoordEnable));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CoordEnable => !SetInGravityCenter;
|
||||||
|
|
||||||
|
public double CenterX
|
||||||
|
{
|
||||||
|
get => forceAction.ForcePoint.X;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
forceAction.ForcePoint.X = value;
|
||||||
|
OnPropertyChanged(nameof(CenterX));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double CenterY
|
||||||
|
{
|
||||||
|
get => forceAction.ForcePoint.Y;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
forceAction.ForcePoint.Y = value;
|
||||||
|
OnPropertyChanged(nameof(CenterY));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ForceActionVMBase(IForceAction forceAction)
|
||||||
|
{
|
||||||
|
this.forceAction = forceAction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Media.Media3D;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Forces
|
||||||
|
{
|
||||||
|
public class ForceCombinationByFactorVM : ForceActionVMBase, IDataErrorInfo
|
||||||
|
{
|
||||||
|
IForceCombinationByFactor forceAction;
|
||||||
|
ForceTupleVM forceTupleVM;
|
||||||
|
|
||||||
|
public double ULSFactor
|
||||||
|
{
|
||||||
|
get => forceAction.ULSFactor;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
forceAction.ULSFactor = value;
|
||||||
|
OnPropertyChanged(nameof(ULSFactor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceTupleVM ForceTupleVM => forceTupleVM;
|
||||||
|
|
||||||
|
public double LongTermFactor
|
||||||
|
{
|
||||||
|
get => forceAction.LongTermFactor;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value <0d) { value = 0d; }
|
||||||
|
if (value > 1d) { value = 1d; }
|
||||||
|
forceAction.LongTermFactor = value;
|
||||||
|
OnPropertyChanged(nameof(LongTermFactor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Error => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public string this[string columnName]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string error = null;
|
||||||
|
|
||||||
|
if (columnName == nameof(ULSFactor))
|
||||||
|
{
|
||||||
|
if (ULSFactor <= 0)
|
||||||
|
{
|
||||||
|
error = "Safety factor for ULS must be greater than zero";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (columnName == nameof(LongTermFactor))
|
||||||
|
{
|
||||||
|
if (LongTermFactor < 0d || LongTermFactor > 1d)
|
||||||
|
{
|
||||||
|
error = "Long term factor must be between 0.0 and 1.0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceCombinationByFactorVM(IForceCombinationByFactor forceAction) : base(forceAction)
|
||||||
|
{
|
||||||
|
this.forceAction = forceAction;
|
||||||
|
forceTupleVM = new ForceTupleVM(forceAction.FullSLSForces);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,61 +8,15 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.Forces
|
namespace StructureHelper.Windows.ViewModels.Forces
|
||||||
{
|
{
|
||||||
public class ForceCombinationViewModel : ViewModelBase
|
public class ForceCombinationViewModel : ForceActionVMBase
|
||||||
{
|
{
|
||||||
IForceCombinationList combinationList;
|
ForceTuplesViewModel designForces;
|
||||||
|
|
||||||
//public IDesignForceTuple SelectedTuple { get; set; }
|
public ForceTuplesViewModel DesignForces => designForces;
|
||||||
public ForceTuplesViewModel DesignForces { get;}
|
|
||||||
|
|
||||||
public string Name
|
public ForceCombinationViewModel(IForceCombinationList combinationList) : base(combinationList)
|
||||||
{
|
{
|
||||||
get => combinationList.Name;
|
designForces = new ForceTuplesViewModel(combinationList.DesignForces);
|
||||||
set
|
|
||||||
{
|
|
||||||
combinationList.Name = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SetInGravityCenter
|
|
||||||
{
|
|
||||||
get => combinationList.SetInGravityCenter;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
combinationList.SetInGravityCenter = value;
|
|
||||||
OnPropertyChanged(nameof(SetInGravityCenter));
|
|
||||||
OnPropertyChanged(nameof(CoordEnable));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CoordEnable => !SetInGravityCenter;
|
|
||||||
|
|
||||||
public double CenterX
|
|
||||||
{
|
|
||||||
get => combinationList.ForcePoint.X;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
combinationList.ForcePoint.X = value;
|
|
||||||
OnPropertyChanged(nameof(CenterX));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public double CenterY
|
|
||||||
{
|
|
||||||
get => combinationList.ForcePoint.Y;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
combinationList.ForcePoint.Y = value;
|
|
||||||
OnPropertyChanged(nameof(CenterY));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//public IEnumerable<IDesignForceTuple> ForceTuples { get => combinationList.DesignForces; }
|
|
||||||
|
|
||||||
public ForceCombinationViewModel(IForceCombinationList combinationList)
|
|
||||||
{
|
|
||||||
this.combinationList = combinationList;
|
|
||||||
DesignForces = new ForceTuplesViewModel(this.combinationList.DesignForces);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
73
StructureHelper/Windows/ViewModels/Forces/ForceTupleVM.cs
Normal file
73
StructureHelper/Windows/ViewModels/Forces/ForceTupleVM.cs
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Forces
|
||||||
|
{
|
||||||
|
public class ForceTupleVM : ViewModelBase
|
||||||
|
{
|
||||||
|
IForceTuple forceTuple;
|
||||||
|
public double Mx
|
||||||
|
{
|
||||||
|
get => forceTuple.Mx;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
forceTuple.Mx = value;
|
||||||
|
OnPropertyChanged(nameof(Mx));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double My
|
||||||
|
{
|
||||||
|
get => forceTuple.My;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
forceTuple.My = value;
|
||||||
|
OnPropertyChanged(nameof(My));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double Nz
|
||||||
|
{
|
||||||
|
get => forceTuple.Nz;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
forceTuple.Nz = value;
|
||||||
|
OnPropertyChanged(nameof(Nz));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double Qx
|
||||||
|
{
|
||||||
|
get => forceTuple.Qx;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
forceTuple.Qx = value;
|
||||||
|
OnPropertyChanged(nameof(Qx));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double Qy
|
||||||
|
{
|
||||||
|
get => forceTuple.Qy;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
forceTuple.Qy = value;
|
||||||
|
OnPropertyChanged(nameof(Qy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double Mz
|
||||||
|
{
|
||||||
|
get => forceTuple.Mz;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
forceTuple.Mz = value;
|
||||||
|
OnPropertyChanged(nameof(Mz));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ForceTupleVM(IForceTuple forceTuple)
|
||||||
|
{
|
||||||
|
this.forceTuple = forceTuple;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,7 +30,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
if (SelectedItem is ForceCalculator)
|
if (SelectedItem is ForceCalculator)
|
||||||
{
|
{
|
||||||
var calculator = SelectedItem as ForceCalculator;
|
var calculator = SelectedItem as ForceCalculator;
|
||||||
var vm = new ForceCalculatorViewModel(repository.Primitives, repository.ForceCombinationLists, calculator);
|
var vm = new ForceCalculatorViewModel(repository.Primitives, repository.ForceActions, calculator);
|
||||||
|
|
||||||
var wnd = new ForceCalculatorView(vm);
|
var wnd = new ForceCalculatorView(vm);
|
||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
{
|
{
|
||||||
private readonly ICrossSectionRepository repository;
|
private readonly ICrossSectionRepository repository;
|
||||||
|
|
||||||
public IForceCombinationList SelectedItem { get; set; }
|
public IForceAction SelectedItem { get; set; }
|
||||||
|
|
||||||
public ObservableCollection<IForceCombinationList> Items { get; private set; }
|
public ObservableCollection<IForceAction> Items { get; private set; }
|
||||||
|
|
||||||
private RelayCommand addForceCombinationCommand;
|
private RelayCommand addForceCombinationCommand;
|
||||||
public RelayCommand Add
|
public RelayCommand Add
|
||||||
@@ -41,7 +41,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
{
|
{
|
||||||
var item = new ForceCombinationList() { Name = "New Force Combination" };
|
var item = new ForceCombinationList() { Name = "New Force Combination" };
|
||||||
Items.Add(item);
|
Items.Add(item);
|
||||||
repository.ForceCombinationLists.Add(item);
|
repository.ForceActions.Add(item);
|
||||||
}
|
}
|
||||||
private RelayCommand deleteForceCombinationCommand;
|
private RelayCommand deleteForceCombinationCommand;
|
||||||
public RelayCommand Delete
|
public RelayCommand Delete
|
||||||
@@ -62,7 +62,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
var dialogResult = MessageBox.Show("Delete action?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
var dialogResult = MessageBox.Show("Delete action?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||||
if (dialogResult == DialogResult.Yes)
|
if (dialogResult == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
repository.ForceCombinationLists.Remove(SelectedItem);
|
repository.ForceActions.Remove(SelectedItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private RelayCommand editForceCombinationCommand;
|
private RelayCommand editForceCombinationCommand;
|
||||||
@@ -78,7 +78,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
{
|
{
|
||||||
EditForceCombination();
|
EditForceCombination();
|
||||||
Items.Clear();
|
Items.Clear();
|
||||||
AddItems(repository.ForceCombinationLists);
|
AddItems(repository.ForceActions);
|
||||||
OnPropertyChanged(nameof(Items));
|
OnPropertyChanged(nameof(Items));
|
||||||
}, o => SelectedItem != null));
|
}, o => SelectedItem != null));
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
copyCommand = new RelayCommand(o =>
|
copyCommand = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
var item = SelectedItem.Clone() as IForceCombinationList;
|
var item = SelectedItem.Clone() as IForceCombinationList;
|
||||||
repository.ForceCombinationLists.Add(item);
|
repository.ForceActions.Add(item);
|
||||||
Items.Add(item);
|
Items.Add(item);
|
||||||
OnPropertyChanged(nameof(Items));
|
OnPropertyChanged(nameof(Items));
|
||||||
}, o => SelectedItem != null));
|
}, o => SelectedItem != null));
|
||||||
@@ -102,11 +102,11 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
|
|
||||||
private void EditForceCombination()
|
private void EditForceCombination()
|
||||||
{
|
{
|
||||||
var wnd = new ForceCombinationView(SelectedItem);
|
//var wnd = new ForceCombinationView(SelectedItem);
|
||||||
wnd.ShowDialog();
|
//wnd.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddItems(IEnumerable<IForceCombinationList> items)
|
public void AddItems(IEnumerable<IForceAction> items)
|
||||||
{
|
{
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
@@ -117,8 +117,8 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
public ForceCombinationViewModelLogic(ICrossSectionRepository repository)
|
public ForceCombinationViewModelLogic(ICrossSectionRepository repository)
|
||||||
{
|
{
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
Items = new ObservableCollection<IForceCombinationList>();
|
Items = new ObservableCollection<IForceAction>();
|
||||||
AddItems(this.repository.ForceCombinationLists);
|
AddItems(this.repository.ForceActions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||||
{
|
{
|
||||||
public interface IForceCombinationViewModelLogic : ICRUDViewModel<IForceCombinationList>
|
public interface IForceCombinationViewModelLogic : ICRUDViewModel<IForceAction>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
using StructureHelper.Infrastructure;
|
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
|
||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|
||||||
{
|
|
||||||
public interface IPrimitiveViewModelLogic : ICRUDViewModel<PrimitiveBase>
|
|
||||||
{
|
|
||||||
RelayCommand SetToFront { get; }
|
|
||||||
RelayCommand SetToBack { get; }
|
|
||||||
int PrimitivesCount { get; }
|
|
||||||
void Refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,9 +22,10 @@ using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||||
{
|
{
|
||||||
public class PrimitiveViewModelLogic : ViewModelBase, IPrimitiveViewModelLogic
|
public class PrimitiveViewModelLogic : ViewModelBase, ICRUDViewModel<PrimitiveBase>
|
||||||
{
|
{
|
||||||
private readonly ICrossSectionRepository repository;
|
private ICrossSection section;
|
||||||
|
private ICrossSectionRepository repository => section.SectionRepository;
|
||||||
private RelayCommand addCommand;
|
private RelayCommand addCommand;
|
||||||
private RelayCommand deleteCommand;
|
private RelayCommand deleteCommand;
|
||||||
private RelayCommand editCommand;
|
private RelayCommand editCommand;
|
||||||
@@ -99,6 +100,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(primitiveType)); }
|
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(primitiveType)); }
|
||||||
viewPrimitive.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
viewPrimitive.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
||||||
repository.Primitives.Add(ndmPrimitive);
|
repository.Primitives.Add(ndmPrimitive);
|
||||||
|
ndmPrimitive.CrossSection = section;
|
||||||
Items.Add(viewPrimitive);
|
Items.Add(viewPrimitive);
|
||||||
OnPropertyChanged(nameof(Items));
|
OnPropertyChanged(nameof(Items));
|
||||||
OnPropertyChanged(nameof(PrimitivesCount));
|
OnPropertyChanged(nameof(PrimitivesCount));
|
||||||
@@ -132,6 +134,14 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
forceCalc.Primitives.Remove(ndmPrimitive);
|
forceCalc.Primitives.Remove(ndmPrimitive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach (var primitive in repository.Primitives)
|
||||||
|
{
|
||||||
|
if (primitive is IHasSurroundingPrimitive)
|
||||||
|
{
|
||||||
|
var sPrimitive = primitive as IHasSurroundingPrimitive;
|
||||||
|
if (sPrimitive.SurroundingPrimitive == ndmPrimitive) { sPrimitive.SurroundingPrimitive = null; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Items.Remove(SelectedItem);
|
Items.Remove(SelectedItem);
|
||||||
}
|
}
|
||||||
OnPropertyChanged(nameof(Items));
|
OnPropertyChanged(nameof(Items));
|
||||||
@@ -243,9 +253,9 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
OnPropertyChanged(nameof(PrimitivesCount));
|
OnPropertyChanged(nameof(PrimitivesCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrimitiveViewModelLogic(ICrossSectionRepository repository)
|
public PrimitiveViewModelLogic(ICrossSection section)
|
||||||
{
|
{
|
||||||
this.repository = repository;
|
this.section = section;
|
||||||
Items = new ObservableCollection<PrimitiveBase>();
|
Items = new ObservableCollection<PrimitiveBase>();
|
||||||
AddItems(PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(this.repository.Primitives));
|
AddItems(PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(this.repository.Primitives));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,14 +4,19 @@ using StructureHelper.Models.Materials;
|
|||||||
using StructureHelper.Windows.ColorPickerWindow;
|
using StructureHelper.Windows.ColorPickerWindow;
|
||||||
using StructureHelper.Windows.MainWindow.Materials;
|
using StructureHelper.Windows.MainWindow.Materials;
|
||||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Services.ColorServices;
|
using StructureHelperCommon.Services.ColorServices;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
@@ -25,12 +30,13 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
public class PrimitivePropertiesViewModel : ViewModelBase, IDataErrorInfo
|
public class PrimitivePropertiesViewModel : ViewModelBase, IDataErrorInfo
|
||||||
{
|
{
|
||||||
private PrimitiveBase primitive;
|
private PrimitiveBase primitive;
|
||||||
private IHasHeadMaterials hasHeadMaterials;
|
private ICrossSectionRepository sectionRepository;
|
||||||
|
|
||||||
public ICommand EditColorCommand { get; private set; }
|
public ICommand EditColorCommand { get; private set; }
|
||||||
public ICommand EditMaterialCommand { get; private set; }
|
public ICommand EditMaterialCommand { get; private set; }
|
||||||
|
|
||||||
public ObservableCollection<IHeadMaterial> HeadMaterials { get; private set; }
|
public ObservableCollection<IHeadMaterial> HeadMaterials { get; private set; }
|
||||||
|
public ObservableCollection<PrimitiveBase> SurroundingPrimitives { get; private set; }
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
@@ -54,7 +60,42 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public PrimitiveBase? SurroundingPrimitive
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (primitive is not IHasSurroundingPrimitive)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var sPrimitive = ((IHasSurroundingPrimitive)primitive).SurroundingPrimitive;
|
||||||
|
if (sPrimitive is null) { return null; }
|
||||||
|
foreach (var item in SurroundingPrimitives)
|
||||||
|
{
|
||||||
|
if (item.GetNdmPrimitive() == sPrimitive)
|
||||||
|
{
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value is not null)
|
||||||
|
{
|
||||||
|
if (primitive is IHasSurroundingPrimitive)
|
||||||
|
{
|
||||||
|
var sPrimitive = value.GetNdmPrimitive();
|
||||||
|
((IHasSurroundingPrimitive)primitive).SurroundingPrimitive = sPrimitive;
|
||||||
|
OnPropertyChanged(nameof(SurroundingPrimitive));
|
||||||
|
}
|
||||||
|
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $", Actual type: {value.GetType()}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public double CenterX
|
public double CenterX
|
||||||
{
|
{
|
||||||
get => primitive.CenterX;
|
get => primitive.CenterX;
|
||||||
@@ -126,7 +167,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
CenterX = CenterX;
|
CenterX = CenterX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double Height
|
public double Height
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -148,7 +188,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
CenterY = CenterY; ;
|
CenterY = CenterY; ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double Area
|
public double Area
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -171,7 +210,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double Diameter
|
public double Diameter
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -194,7 +232,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color Color
|
public Color Color
|
||||||
{
|
{
|
||||||
get => primitive.Color;
|
get => primitive.Color;
|
||||||
@@ -204,7 +241,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
OnPropertyChanged(nameof(Color));
|
OnPropertyChanged(nameof(Color));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SetMaterialColor
|
public bool SetMaterialColor
|
||||||
{
|
{
|
||||||
get => primitive.SetMaterialColor;
|
get => primitive.SetMaterialColor;
|
||||||
@@ -215,7 +251,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
OnPropertyChanged(nameof(SetMaterialColor));
|
OnPropertyChanged(nameof(SetMaterialColor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int ZIndex
|
public int ZIndex
|
||||||
{ get => primitive.ZIndex;
|
{ get => primitive.ZIndex;
|
||||||
set
|
set
|
||||||
@@ -223,7 +258,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
primitive.ZIndex = value;
|
primitive.ZIndex = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsVisible
|
public bool IsVisible
|
||||||
{
|
{
|
||||||
get => primitive.IsVisible;
|
get => primitive.IsVisible;
|
||||||
@@ -233,7 +267,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
OnPropertyChanged(nameof(IsVisible));
|
OnPropertyChanged(nameof(IsVisible));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double Opacity
|
public double Opacity
|
||||||
{
|
{
|
||||||
get => primitive.Opacity * 100d;
|
get => primitive.Opacity * 100d;
|
||||||
@@ -245,7 +278,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
OnPropertyChanged(nameof(Opacity));
|
OnPropertyChanged(nameof(Opacity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string this[string columnName]
|
public string this[string columnName]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -267,23 +299,28 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
|
|
||||||
public string Error => throw new NotImplementedException();
|
public string Error => throw new NotImplementedException();
|
||||||
|
|
||||||
public PrimitivePropertiesViewModel(PrimitiveBase primitive, IHasHeadMaterials hasHeadMaterials)
|
public PrimitivePropertiesViewModel(PrimitiveBase primitive, ICrossSectionRepository sectionRepository)
|
||||||
{
|
{
|
||||||
this.primitive = primitive;
|
this.primitive = primitive;
|
||||||
this.hasHeadMaterials = hasHeadMaterials;
|
this.sectionRepository = sectionRepository;
|
||||||
HeadMaterials = new ObservableCollection<IHeadMaterial>();
|
HeadMaterials = new ObservableCollection<IHeadMaterial>();
|
||||||
foreach (var material in hasHeadMaterials.HeadMaterials)
|
foreach (var material in sectionRepository.HeadMaterials)
|
||||||
{
|
{
|
||||||
HeadMaterials.Add(material);
|
HeadMaterials.Add(material);
|
||||||
}
|
}
|
||||||
EditColorCommand = new RelayCommand(o => EditColor(), o => !SetMaterialColor);
|
EditColorCommand = new RelayCommand(o => EditColor(), o => !SetMaterialColor);
|
||||||
EditMaterialCommand = new RelayCommand(o => EditMaterial());
|
EditMaterialCommand = new RelayCommand(o => EditMaterial());
|
||||||
|
SurroundingPrimitives = new ObservableCollection<PrimitiveBase>();
|
||||||
|
foreach (var item in sectionRepository.Primitives)
|
||||||
|
{
|
||||||
|
if (item is RectanglePrimitive || item is CirclePrimitive)
|
||||||
|
{SurroundingPrimitives.Add(PrimitiveOperations.ConvertNdmPrimitiveToPrimitiveBase(item));}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EditMaterial()
|
private void EditMaterial()
|
||||||
{
|
{
|
||||||
var wnd = new HeadMaterialsView(hasHeadMaterials);
|
var wnd = new HeadMaterialsView(sectionRepository);
|
||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
|
|||||||
{
|
{
|
||||||
public interface IHasForceCombinations
|
public interface IHasForceCombinations
|
||||||
{
|
{
|
||||||
List<IForceCombinationList> ForceCombinationLists { get; }
|
List<IForceAction> ForceActions { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public bool SetInGravityCenter { get; set; }
|
public bool SetInGravityCenter { get; set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IPoint2D ForcePoint { get; private set; }
|
public IPoint2D ForcePoint { get; set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IForceTuple FullSLSForces { get; private set; }
|
public IForceTuple FullSLSForces { get; private set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -29,10 +29,15 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
SetInGravityCenter = true;
|
SetInGravityCenter = true;
|
||||||
ForcePoint = new Point2D();
|
ForcePoint = new Point2D();
|
||||||
FullSLSForces = new ForceTuple();
|
FullSLSForces = new ForceTuple();
|
||||||
|
LongTermFactor = 1d;
|
||||||
|
ULSFactor = 1.2d;
|
||||||
}
|
}
|
||||||
public List<IDesignForceTuple> GetCombination()
|
public IForceCombinationList GetCombinations()
|
||||||
{
|
{
|
||||||
var result = new List<IDesignForceTuple>();
|
var result = new ForceCombinationList();
|
||||||
|
result.SetInGravityCenter = this.SetInGravityCenter;
|
||||||
|
result.ForcePoint = this.ForcePoint;
|
||||||
|
result.DesignForces.Clear();
|
||||||
var limitStates = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS };
|
var limitStates = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS };
|
||||||
var calcTerms = new List<CalcTerms>() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
var calcTerms = new List<CalcTerms>() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
||||||
foreach (var limitState in limitStates)
|
foreach (var limitState in limitStates)
|
||||||
@@ -42,11 +47,21 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
{
|
{
|
||||||
var termFactor = calcTerm is CalcTerms.ShortTerm ? 1d : LongTermFactor;
|
var termFactor = calcTerm is CalcTerms.ShortTerm ? 1d : LongTermFactor;
|
||||||
var designForceTuple = new DesignForceTuple() { LimitState = limitState, CalcTerm = calcTerm };
|
var designForceTuple = new DesignForceTuple() { LimitState = limitState, CalcTerm = calcTerm };
|
||||||
designForceTuple.ForceTuple = ForceTupleService.MultiplyTuples(designForceTuple.ForceTuple, stateFactor * termFactor);
|
designForceTuple.ForceTuple = ForceTupleService.MultiplyTuples(FullSLSForces, stateFactor * termFactor);
|
||||||
result.Add(designForceTuple);
|
result.DesignForces.Add(designForceTuple);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
var newItem = new ForceCombinationByFactor();
|
||||||
|
ForceActionService.CopyActionProps(this, newItem);
|
||||||
|
newItem.FullSLSForces = FullSLSForces.Clone() as IForceTuple;
|
||||||
|
newItem.LongTermFactor = LongTermFactor;
|
||||||
|
newItem.ULSFactor = ULSFactor;
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public bool SetInGravityCenter { get; set; }
|
public bool SetInGravityCenter { get; set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IPoint2D ForcePoint { get; private set; }
|
public IPoint2D ForcePoint { get; set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public List<IDesignForceTuple> DesignForces { get; private set; }
|
public List<IDesignForceTuple> DesignForces { get; private set; }
|
||||||
|
|
||||||
@@ -35,10 +35,7 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
var newItem = new ForceCombinationList();
|
var newItem = new ForceCombinationList();
|
||||||
newItem.Name = Name + " copy";
|
ForceActionService.CopyActionProps(this, newItem);
|
||||||
newItem.SetInGravityCenter = SetInGravityCenter;
|
|
||||||
newItem.ForcePoint.X = ForcePoint.X;
|
|
||||||
newItem.ForcePoint.Y = ForcePoint.Y;
|
|
||||||
newItem.DesignForces.Clear();
|
newItem.DesignForces.Clear();
|
||||||
foreach (var item in DesignForces)
|
foreach (var item in DesignForces)
|
||||||
{
|
{
|
||||||
@@ -48,9 +45,10 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public List<IDesignForceTuple> GetCombination()
|
public IForceCombinationList GetCombinations()
|
||||||
{
|
{
|
||||||
var result = new List<IDesignForceTuple>();
|
var result = Clone() as IForceCombinationList;
|
||||||
|
result.DesignForces.Clear();
|
||||||
var limitStates = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS };
|
var limitStates = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS };
|
||||||
var calcTerms = new List<CalcTerms>() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
var calcTerms = new List<CalcTerms>() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
||||||
foreach (var limitState in limitStates)
|
foreach (var limitState in limitStates)
|
||||||
@@ -63,7 +61,7 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
{
|
{
|
||||||
designForceTuple.ForceTuple = ForceTupleService.SumTuples(designForceTuple.ForceTuple, item.ForceTuple);
|
designForceTuple.ForceTuple = ForceTupleService.SumTuples(designForceTuple.ForceTuple, item.ForceTuple);
|
||||||
}
|
}
|
||||||
result.Add(designForceTuple);
|
result.DesignForces.Add(designForceTuple);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces
|
namespace StructureHelperCommon.Models.Forces
|
||||||
{
|
{
|
||||||
public interface IForceAction : IAction
|
public interface IForceAction : IAction, ICloneable
|
||||||
{
|
{
|
||||||
bool SetInGravityCenter { get; set; }
|
bool SetInGravityCenter { get; set; }
|
||||||
IPoint2D ForcePoint { get; }
|
IPoint2D ForcePoint { get; set; }
|
||||||
List<IDesignForceTuple> GetCombination();
|
IForceCombinationList GetCombinations();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ using StructureHelperCommon.Models.Shapes;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces
|
namespace StructureHelperCommon.Models.Forces
|
||||||
{
|
{
|
||||||
public interface IForceCombinationList : IForceAction, ICloneable
|
public interface IForceCombinationList : IForceAction
|
||||||
{
|
{
|
||||||
List<IDesignForceTuple> DesignForces { get; }
|
List<IDesignForceTuple> DesignForces { get;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
21
StructureHelperCommon/Services/Forces/ForceActionService.cs
Normal file
21
StructureHelperCommon/Services/Forces/ForceActionService.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Services.Forces
|
||||||
|
{
|
||||||
|
internal static class ForceActionService
|
||||||
|
{
|
||||||
|
public static void CopyActionProps(IForceAction source, IForceAction target)
|
||||||
|
{
|
||||||
|
target.Name = source.Name;
|
||||||
|
target.SetInGravityCenter = source.SetInGravityCenter;
|
||||||
|
target.ForcePoint.X = source.ForcePoint.X;
|
||||||
|
target.ForcePoint.Y = source.ForcePoint.Y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,14 +13,14 @@ namespace StructureHelperLogics.Models.CrossSections
|
|||||||
{
|
{
|
||||||
public class CrossSectionRepository : ICrossSectionRepository
|
public class CrossSectionRepository : ICrossSectionRepository
|
||||||
{
|
{
|
||||||
public List<IForceCombinationList> ForceCombinationLists { get; private set; }
|
public List<IForceAction> ForceActions { get; private set; }
|
||||||
public List<IHeadMaterial> HeadMaterials { get; private set; }
|
public List<IHeadMaterial> HeadMaterials { get; private set; }
|
||||||
public List<INdmPrimitive> Primitives { get; }
|
public List<INdmPrimitive> Primitives { get; }
|
||||||
public List<INdmCalculator> CalculatorsList { get; private set; }
|
public List<INdmCalculator> CalculatorsList { get; private set; }
|
||||||
|
|
||||||
public CrossSectionRepository()
|
public CrossSectionRepository()
|
||||||
{
|
{
|
||||||
ForceCombinationLists = new List<IForceCombinationList>();
|
ForceActions = new List<IForceAction>();
|
||||||
HeadMaterials = new List<IHeadMaterial>();
|
HeadMaterials = new List<IHeadMaterial>();
|
||||||
Primitives = new List<INdmPrimitive>();
|
Primitives = new List<INdmPrimitive>();
|
||||||
CalculatorsList = new List<INdmCalculator>();
|
CalculatorsList = new List<INdmCalculator>();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace StructureHelperLogics.Models.CrossSections
|
|||||||
{
|
{
|
||||||
public interface ICrossSectionRepository : IHasHeadMaterials, IHasPrimitives
|
public interface ICrossSectionRepository : IHasHeadMaterials, IHasPrimitives
|
||||||
{
|
{
|
||||||
List<IForceCombinationList> ForceCombinationLists { get; }
|
List<IForceAction> ForceActions { get; }
|
||||||
List<INdmCalculator> CalculatorsList { get; }
|
List<INdmCalculator> CalculatorsList { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
public class CircleGeometryLogic : IRCGeometryLogic
|
public class CircleGeometryLogic : IRCGeometryLogic
|
||||||
{
|
{
|
||||||
ICircleTemplate template;
|
ICircleTemplate template;
|
||||||
|
CirclePrimitive concreteBlock;
|
||||||
|
|
||||||
public IEnumerable<IHeadMaterial> HeadMaterials { get; set; }
|
public IEnumerable<IHeadMaterial> HeadMaterials { get; set; }
|
||||||
|
|
||||||
@@ -35,8 +35,8 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
var diameter = template.Shape.Diameter;
|
var diameter = template.Shape.Diameter;
|
||||||
var concreteMaterial = HeadMaterials.ToList()[0];
|
var concreteMaterial = HeadMaterials.ToList()[0];
|
||||||
var primitives = new List<INdmPrimitive>();
|
var primitives = new List<INdmPrimitive>();
|
||||||
var rectangle = new CirclePrimitive() { Diameter = diameter, Name = "Concrete block", HeadMaterial = concreteMaterial };
|
concreteBlock = new CirclePrimitive() { Diameter = diameter, Name = "Concrete block", HeadMaterial = concreteMaterial };
|
||||||
primitives.Add(rectangle);
|
primitives.Add(concreteBlock);
|
||||||
return primitives;
|
return primitives;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,13 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
var angle = i * dAngle;
|
var angle = i * dAngle;
|
||||||
var x = radius * Math.Sin(angle);
|
var x = radius * Math.Sin(angle);
|
||||||
var y = radius * Math.Cos(angle);
|
var y = radius * Math.Cos(angle);
|
||||||
var point = new PointPrimitive() { CenterX = x, CenterY = y, Area = barArea, Name = "Left bottom point", HeadMaterial = reinforcementMaterial };
|
var point = new ReinforcementPrimitive()
|
||||||
|
{ CenterX = x,
|
||||||
|
CenterY = y,
|
||||||
|
Area = barArea,
|
||||||
|
Name = "Left bottom point",
|
||||||
|
HeadMaterial = reinforcementMaterial,
|
||||||
|
SurroundingPrimitive=concreteBlock };
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
}
|
}
|
||||||
return primitives;
|
return primitives;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
IRectangleBeamTemplate template;
|
IRectangleBeamTemplate template;
|
||||||
IHeadMaterial concrete => HeadMaterials.ToList()[0];
|
IHeadMaterial concrete => HeadMaterials.ToList()[0];
|
||||||
IHeadMaterial reinforcement => HeadMaterials.ToList()[1];
|
IHeadMaterial reinforcement => HeadMaterials.ToList()[1];
|
||||||
|
RectanglePrimitive concreteBlock;
|
||||||
|
|
||||||
RectangleShape rect => template.Shape as RectangleShape;
|
RectangleShape rect => template.Shape as RectangleShape;
|
||||||
double width => rect.Width;
|
double width => rect.Width;
|
||||||
@@ -47,8 +48,8 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
private IEnumerable<INdmPrimitive> GetConcretePrimitives()
|
private IEnumerable<INdmPrimitive> GetConcretePrimitives()
|
||||||
{
|
{
|
||||||
var primitives = new List<INdmPrimitive>();
|
var primitives = new List<INdmPrimitive>();
|
||||||
var rectangle = new RectanglePrimitive(concrete) { Width = width, Height = height, Name = "Concrete block" };
|
concreteBlock = new RectanglePrimitive(concrete) { Width = width, Height = height, Name = "Concrete block" };
|
||||||
primitives.Add(rectangle);
|
primitives.Add(concreteBlock);
|
||||||
return primitives;
|
return primitives;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,13 +59,13 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
||||||
|
|
||||||
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||||
var point = new PointPrimitive(reinforcement) { CenterX = xs[0], CenterY = ys[0], Area = area1, Name = "Left bottom point" };
|
var point = new ReinforcementPrimitive() { CenterX = xs[0], CenterY = ys[0], Area = area1, Name = "Left bottom point", HeadMaterial = reinforcement, SurroundingPrimitive=concreteBlock };
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
point = new PointPrimitive(reinforcement) { CenterX = xs[1], CenterY = ys[0], Area = area1, Name = "Right bottom point" };
|
point = new ReinforcementPrimitive() { CenterX = xs[1], CenterY = ys[0], Area = area1, Name = "Right bottom point", HeadMaterial = reinforcement, SurroundingPrimitive = concreteBlock };
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
point = new PointPrimitive(reinforcement) { CenterX = xs[0], CenterY = ys[1], Area = area2, Name = "Left top point" };
|
point = new ReinforcementPrimitive() { CenterX = xs[0], CenterY = ys[1], Area = area2, Name = "Left top point", HeadMaterial = reinforcement, SurroundingPrimitive = concreteBlock };
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
point = new PointPrimitive(reinforcement) { CenterX = xs[1], CenterY = ys[1], Area = area2, Name = "Right top point" };
|
point = new ReinforcementPrimitive() { CenterX = xs[1], CenterY = ys[1], Area = area2, Name = "Right top point", HeadMaterial = reinforcement, SurroundingPrimitive = concreteBlock };
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
return primitives;
|
return primitives;
|
||||||
}
|
}
|
||||||
@@ -82,9 +83,9 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
double dist = (xs[1] - xs[0]) / count;
|
double dist = (xs[1] - xs[0]) / count;
|
||||||
for (int i = 1; i < count; i++)
|
for (int i = 1; i < count; i++)
|
||||||
{
|
{
|
||||||
point = new PointPrimitive(reinforcement) { CenterX = xs[0] + dist * i, CenterY = ys[0], Area = area1, Name = $"Bottom point {i}" };
|
point = new ReinforcementPrimitive() { CenterX = xs[0] + dist * i, CenterY = ys[0], Area = area1, Name = $"Bottom point {i}", HeadMaterial = reinforcement, SurroundingPrimitive = concreteBlock };
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
point = new PointPrimitive(reinforcement) { CenterX = xs[0] + dist * i, CenterY = ys[1], Area = area2, Name = $"Top point {i}" };
|
point = new ReinforcementPrimitive() { CenterX = xs[0] + dist * i, CenterY = ys[1], Area = area2, Name = $"Top point {i}", HeadMaterial = reinforcement, SurroundingPrimitive = concreteBlock };
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,9 +95,9 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
double dist = (ys[1] - ys[0]) / count;
|
double dist = (ys[1] - ys[0]) / count;
|
||||||
for (int i = 1; i < count; i++)
|
for (int i = 1; i < count; i++)
|
||||||
{
|
{
|
||||||
point = new PointPrimitive(reinforcement) { CenterX = xs[0], CenterY = ys[0] + dist * i, Area = area1, Name = $"Left point {i}" };
|
point = new ReinforcementPrimitive() { CenterX = xs[0], CenterY = ys[0] + dist * i, Area = area1, Name = $"Left point {i}", HeadMaterial = reinforcement, SurroundingPrimitive = concreteBlock };
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
point = new PointPrimitive(reinforcement) { CenterX = xs[1], CenterY = ys[0] + dist * i, Area = area1, Name = $"Right point {i}" };
|
point = new ReinforcementPrimitive() { CenterX = xs[1], CenterY = ys[0] + dist * i, Area = area1, Name = $"Right point {i}", HeadMaterial = reinforcement, SurroundingPrimitive = concreteBlock };
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,10 +37,14 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
var materials = materialLogic.GetHeadMaterials();
|
var materials = materialLogic.GetHeadMaterials();
|
||||||
geometryLogic.HeadMaterials = materials;
|
geometryLogic.HeadMaterials = materials;
|
||||||
primitives = geometryLogic.GetNdmPrimitives();
|
primitives = geometryLogic.GetNdmPrimitives();
|
||||||
|
foreach (var primitive in primitives)
|
||||||
|
{
|
||||||
|
primitive.CrossSection = section;
|
||||||
|
}
|
||||||
repository.HeadMaterials.AddRange(materials);
|
repository.HeadMaterials.AddRange(materials);
|
||||||
repository.Primitives.AddRange(primitives);
|
repository.Primitives.AddRange(primitives);
|
||||||
combinations = forceLogic.GetCombinationList();
|
combinations = forceLogic.GetCombinationList();
|
||||||
repository.ForceCombinationLists.AddRange(combinations);
|
repository.ForceActions.AddRange(combinations);
|
||||||
calculators = calculatorLogic.GetNdmCalculators();
|
calculators = calculatorLogic.GetNdmCalculators();
|
||||||
AddAllForcesToCalculators();
|
AddAllForcesToCalculators();
|
||||||
AddAllPrimitivesToCalculator();
|
AddAllPrimitivesToCalculator();
|
||||||
@@ -55,7 +59,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
if (calculator is IHasForceCombinations)
|
if (calculator is IHasForceCombinations)
|
||||||
{
|
{
|
||||||
var forceCalculator = calculator as IHasForceCombinations;
|
var forceCalculator = calculator as IHasForceCombinations;
|
||||||
forceCalculator.ForceCombinationLists.AddRange(combinations);
|
forceCalculator.ForceActions.AddRange(combinations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public List<LimitStates> LimitStatesList { get; }
|
public List<LimitStates> LimitStatesList { get; }
|
||||||
public List<CalcTerms> CalcTermsList { get; }
|
public List<CalcTerms> CalcTermsList { get; }
|
||||||
public List<IForceCombinationList> ForceCombinationLists { get; }
|
public List<IForceAction> ForceActions { get; }
|
||||||
public List<INdmPrimitive> Primitives { get; }
|
public List<INdmPrimitive> Primitives { get; }
|
||||||
public INdmResult Result { get; private set; }
|
public INdmResult Result { get; private set; }
|
||||||
public ICompressedMember CompressedMember { get; }
|
public ICompressedMember CompressedMember { get; }
|
||||||
public IAccuracy Accuracy { get; set; }
|
public IAccuracy Accuracy { get; set; }
|
||||||
|
public List<IForceCombinationList> ForceCombinationLists { get; private set; }
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
var checkResult = CheckInputData();
|
var checkResult = CheckInputData();
|
||||||
@@ -39,7 +39,11 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
Result = new ForcesResults() { IsValid = false, Desctription = checkResult };
|
Result = new ForcesResults() { IsValid = false, Desctription = checkResult };
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else { CalculateResult(); }
|
else
|
||||||
|
{
|
||||||
|
GetCombinations();
|
||||||
|
CalculateResult();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateResult()
|
private void CalculateResult()
|
||||||
@@ -103,6 +107,15 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
Result = ndmResult;
|
Result = ndmResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void GetCombinations()
|
||||||
|
{
|
||||||
|
ForceCombinationLists = new List<IForceCombinationList>();
|
||||||
|
foreach (var item in ForceActions)
|
||||||
|
{
|
||||||
|
ForceCombinationLists.Add(item.GetCombinations());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private IForceTuple GetLongTuple(List<IDesignForceTuple> designForces, LimitStates limitState)
|
private IForceTuple GetLongTuple(List<IDesignForceTuple> designForces, LimitStates limitState)
|
||||||
{
|
{
|
||||||
IForceTuple longTuple;
|
IForceTuple longTuple;
|
||||||
@@ -143,7 +156,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
NdmPrimitivesService.CheckPrimitives(Primitives);
|
NdmPrimitivesService.CheckPrimitives(Primitives);
|
||||||
if (ForceCombinationLists.Count == 0) { result += "Calculator does not contain any forces \n"; }
|
if (ForceActions.Count == 0) { result += "Calculator does not contain any forces \n"; }
|
||||||
if (LimitStatesList.Count == 0) { result += "Calculator does not contain any limit states \n"; }
|
if (LimitStatesList.Count == 0) { result += "Calculator does not contain any limit states \n"; }
|
||||||
if (CalcTermsList.Count == 0) { result += "Calculator does not contain any duration \n"; }
|
if (CalcTermsList.Count == 0) { result += "Calculator does not contain any duration \n"; }
|
||||||
return result;
|
return result;
|
||||||
@@ -151,7 +164,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
|
|
||||||
public ForceCalculator()
|
public ForceCalculator()
|
||||||
{
|
{
|
||||||
ForceCombinationLists = new List<IForceCombinationList>();
|
ForceActions = new List<IForceAction>();
|
||||||
Primitives = new List<INdmPrimitive>();
|
Primitives = new List<INdmPrimitive>();
|
||||||
CompressedMember = new CompressedMember() { Buckling = false };
|
CompressedMember = new CompressedMember() { Buckling = false };
|
||||||
Accuracy = new Accuracy() { IterationAccuracy = 0.001d, MaxIterationCount = 1000 };
|
Accuracy = new Accuracy() { IterationAccuracy = 0.001d, MaxIterationCount = 1000 };
|
||||||
@@ -177,7 +190,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
AccuracyService.CopyProperties(Accuracy, target.Accuracy);
|
AccuracyService.CopyProperties(Accuracy, target.Accuracy);
|
||||||
CompressedMemberServices.CopyProperties(CompressedMember, target.CompressedMember);
|
CompressedMemberServices.CopyProperties(CompressedMember, target.CompressedMember);
|
||||||
target.Primitives.AddRange(Primitives);
|
target.Primitives.AddRange(Primitives);
|
||||||
target.ForceCombinationLists.AddRange(ForceCombinationLists);
|
target.ForceActions.AddRange(ForceActions);
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,5 +15,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
List<LimitStates> LimitStatesList { get; }
|
List<LimitStates> LimitStatesList { get; }
|
||||||
ICompressedMember CompressedMember { get; }
|
ICompressedMember CompressedMember { get; }
|
||||||
IAccuracy Accuracy { get; set; }
|
IAccuracy Accuracy { get; set; }
|
||||||
|
List<IForceCombinationList> ForceCombinationLists { get;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ using StructureHelper.Models.Materials;
|
|||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Services.ShapeServices;
|
using StructureHelperCommon.Services.ShapeServices;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
using System;
|
using System;
|
||||||
@@ -29,6 +30,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
public int NdmMinDivision { get; set; }
|
public int NdmMinDivision { get; set; }
|
||||||
public bool ClearUnderlying { get; set; }
|
public bool ClearUnderlying { get; set; }
|
||||||
public bool Triangulate { get; set; }
|
public bool Triangulate { get; set; }
|
||||||
|
public ICrossSection? CrossSection { get; set; }
|
||||||
|
|
||||||
public CirclePrimitive()
|
public CirclePrimitive()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
{
|
{
|
||||||
public interface IHasSorroundingPrimitive
|
public interface IHasSurroundingPrimitive
|
||||||
{
|
{
|
||||||
INdmPrimitive SorroundingPrimitive { get; set; }
|
INdmPrimitive? SurroundingPrimitive { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,7 @@ using System.Collections.Generic;
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
{
|
{
|
||||||
@@ -16,6 +17,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
string? Name { get; set; }
|
string? Name { get; set; }
|
||||||
double CenterX { get; set; }
|
double CenterX { get; set; }
|
||||||
double CenterY { get; set; }
|
double CenterY { get; set; }
|
||||||
|
ICrossSection? CrossSection { get; set; }
|
||||||
IHeadMaterial? HeadMaterial { get; set; }
|
IHeadMaterial? HeadMaterial { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flag of triangulation
|
/// Flag of triangulation
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using StructureHelperLogics.NdmCalculations.Primitives;
|
|||||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Primitives
|
namespace StructureHelperLogics.Models.Primitives
|
||||||
{
|
{
|
||||||
@@ -28,6 +29,7 @@ namespace StructureHelperLogics.Models.Primitives
|
|||||||
|
|
||||||
public IVisualProperty VisualProperty { get; }
|
public IVisualProperty VisualProperty { get; }
|
||||||
public bool Triangulate { get; set; }
|
public bool Triangulate { get; set; }
|
||||||
|
public ICrossSection? CrossSection { get; set; }
|
||||||
|
|
||||||
public PointPrimitive()
|
public PointPrimitive()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using StructureHelperCommon.Infrastructures.Interfaces;
|
|||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Services.ShapeServices;
|
using StructureHelperCommon.Services.ShapeServices;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
@@ -33,7 +34,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
public bool ClearUnderlying { get; set; }
|
public bool ClearUnderlying { get; set; }
|
||||||
public bool Triangulate { get; set; }
|
public bool Triangulate { get; set; }
|
||||||
public IVisualProperty VisualProperty { get; }
|
public IVisualProperty VisualProperty { get; }
|
||||||
|
public ICrossSection? CrossSection { get; set; }
|
||||||
|
|
||||||
public RectanglePrimitive()
|
public RectanglePrimitive()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
@@ -15,7 +16,7 @@ using System.Windows.Media.Media3D;
|
|||||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public class ReinforcementPrimitive : IPointPrimitive, IHasSorroundingPrimitive
|
public class ReinforcementPrimitive : IPointPrimitive, IHasSurroundingPrimitive
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
@@ -35,7 +36,8 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public double Area { get; set; }
|
public double Area { get; set; }
|
||||||
public INdmPrimitive SorroundingPrimitive { get; set; }
|
public INdmPrimitive SurroundingPrimitive { get; set; }
|
||||||
|
public ICrossSection? CrossSection { get; set; }
|
||||||
|
|
||||||
public ReinforcementPrimitive()
|
public ReinforcementPrimitive()
|
||||||
{
|
{
|
||||||
@@ -52,7 +54,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
var primitive = new ReinforcementPrimitive();
|
var primitive = new ReinforcementPrimitive();
|
||||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||||
primitive.Area = Area;
|
primitive.Area = Area;
|
||||||
primitive.SorroundingPrimitive = this.SorroundingPrimitive;
|
primitive.SurroundingPrimitive = SurroundingPrimitive;
|
||||||
return primitive;
|
return primitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,17 +23,21 @@ namespace StructureHelperLogics.Services.NdmCalculations
|
|||||||
CompressedMemberServices.CopyProperties(source.CompressedMember, calculator.CompressedMember);
|
CompressedMemberServices.CopyProperties(source.CompressedMember, calculator.CompressedMember);
|
||||||
calculator.Accuracy = source.Accuracy;
|
calculator.Accuracy = source.Accuracy;
|
||||||
calculator.Primitives.AddRange(source.Primitives);
|
calculator.Primitives.AddRange(source.Primitives);
|
||||||
calculator.ForceCombinationLists.Clear();
|
calculator.ForceActions.Clear();
|
||||||
var combination = new ForceCombinationList()
|
var forceTuples = ForceTupleService.InterpolateDesignTuple(finishDesignForce, startDesignForce, stepCount);
|
||||||
|
foreach (var forceTuple in forceTuples)
|
||||||
{
|
{
|
||||||
Name = "New combination",
|
var combination = new ForceCombinationList()
|
||||||
SetInGravityCenter = false
|
{
|
||||||
};
|
Name = "New combination",
|
||||||
combination.DesignForces.Clear();
|
SetInGravityCenter = false
|
||||||
combination.DesignForces.AddRange(ForceTupleService.InterpolateDesignTuple(finishDesignForce, startDesignForce, stepCount));
|
};
|
||||||
combination.ForcePoint.X = 0;
|
combination.DesignForces.Clear();
|
||||||
combination.ForcePoint.Y = 0;
|
combination.DesignForces.Add(forceTuple);
|
||||||
calculator.ForceCombinationLists.Add(combination);
|
combination.ForcePoint.X = 0;
|
||||||
|
combination.ForcePoint.Y = 0;
|
||||||
|
calculator.ForceActions.Add(combination);
|
||||||
|
}
|
||||||
return calculator;
|
return calculator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,18 @@ namespace StructureHelperTests.ViewModelTests
|
|||||||
Assert.NotNull(vm);
|
Assert.NotNull(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Circle_Run_ShouldPass()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018);
|
||||||
|
var primitive = new CirclePrimitive() { HeadMaterial = material};
|
||||||
|
var primitiveBase = new CircleViewPrimitive(primitive);
|
||||||
|
//Act
|
||||||
|
var vm = new PrimitivePropertiesViewModel(primitiveBase, new CrossSectionRepository());
|
||||||
|
//Assert
|
||||||
|
Assert.NotNull(vm);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Point_Run_ShouldPass()
|
public void Point_Run_ShouldPass()
|
||||||
{
|
{
|
||||||
@@ -45,5 +57,17 @@ namespace StructureHelperTests.ViewModelTests
|
|||||||
//Assert
|
//Assert
|
||||||
Assert.NotNull(vm);
|
Assert.NotNull(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Reinforcement_Run_ShouldPass()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018);
|
||||||
|
var primitive = new ReinforcementPrimitive() { HeadMaterial = material };
|
||||||
|
var primitiveBase = new ReinforcementViewPrimitive(primitive);
|
||||||
|
//Act
|
||||||
|
var vm = new PrimitivePropertiesViewModel(primitiveBase, new CrossSectionRepository());
|
||||||
|
//Assert
|
||||||
|
Assert.NotNull(vm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user