Carbon Fiber Material was Added
This commit is contained in:
@@ -10,6 +10,8 @@ namespace StructureHelper.Infrastructure.Enums
|
||||
{
|
||||
Concrete,
|
||||
Reinforcement,
|
||||
Elastic
|
||||
Elastic,
|
||||
CarbonFiber,
|
||||
GlassFiber
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,33 +81,33 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
}
|
||||
public double InvertedCenterY => - CenterY;
|
||||
public double PrestrainKx
|
||||
{ get => primitive.UsersPrestrain.Kx;
|
||||
{ get => primitive.UsersPrestrain.Mx;
|
||||
set
|
||||
{
|
||||
primitive.UsersPrestrain.Kx = value;
|
||||
primitive.UsersPrestrain.Mx = value;
|
||||
OnPropertyChanged(nameof(PrestrainKx));
|
||||
}
|
||||
}
|
||||
public double PrestrainKy
|
||||
{ get => primitive.UsersPrestrain.Ky;
|
||||
{ get => primitive.UsersPrestrain.My;
|
||||
set
|
||||
{
|
||||
primitive.UsersPrestrain.Ky = value;
|
||||
primitive.UsersPrestrain.My = value;
|
||||
OnPropertyChanged(nameof(PrestrainKy));
|
||||
}
|
||||
}
|
||||
public double PrestrainEpsZ
|
||||
{ get => primitive.UsersPrestrain.EpsZ;
|
||||
{ get => primitive.UsersPrestrain.Nz;
|
||||
set
|
||||
{
|
||||
primitive.UsersPrestrain.EpsZ = value;
|
||||
primitive.UsersPrestrain.Nz = value;
|
||||
OnPropertyChanged(nameof(PrestrainEpsZ));
|
||||
}
|
||||
}
|
||||
|
||||
public double AutoPrestrainKx => primitive.AutoPrestrain.Kx;
|
||||
public double AutoPrestrainKy => primitive.AutoPrestrain.Ky;
|
||||
public double AutoPrestrainEpsZ => primitive.AutoPrestrain.EpsZ;
|
||||
public double AutoPrestrainKx => primitive.AutoPrestrain.Mx;
|
||||
public double AutoPrestrainKy => primitive.AutoPrestrain.My;
|
||||
public double AutoPrestrainEpsZ => primitive.AutoPrestrain.Nz;
|
||||
|
||||
public IHeadMaterial HeadMaterial
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="SafetyFactors">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
@@ -23,6 +24,20 @@
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource MaterialSafetyFactors}" Content="{Binding DataContext, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window}}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="DirectSafetyFactors">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="200"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Button Content="Show Safety Factors" Command="{Binding ShowSafetyFactors}"/>
|
||||
<Button Grid.Row="1" Content="Show Partial Factors" Command="{Binding ShowPartialFactors}"/>
|
||||
<ContentControl Grid.Row="2" ContentTemplate="{StaticResource MaterialSafetyFactors}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="ConcreteLibMaterial">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Library material"/>
|
||||
@@ -36,6 +51,7 @@
|
||||
<ContentControl ContentTemplate="{StaticResource SafetyFactors}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="ConcreteMaterial">
|
||||
<StackPanel>
|
||||
<ContentControl ContentTemplate="{StaticResource LibraryMaterial}" Content="{Binding}"/>
|
||||
@@ -82,6 +98,7 @@
|
||||
<ContentControl ContentTemplate="{StaticResource SafetyFactors}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="ElasticMaterial">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
public partial class SetPrestrainView : Window
|
||||
{
|
||||
SetPrestrainViewModel viewModel;
|
||||
public IStrainTuple StrainTuple { get; set; }
|
||||
public StrainTuple StrainTuple { get; set; }
|
||||
|
||||
public SetPrestrainView(SetPrestrainViewModel vm)
|
||||
{
|
||||
|
||||
@@ -106,6 +106,8 @@
|
||||
<Button Content="Concrete" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Concrete}"/>
|
||||
<Button Content="Reinforcement" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Reinforcement}"/>
|
||||
<Button Content="Elastic" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Elastic}"/>
|
||||
<Button Content="CarbonFiber" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.CarbonFiber}"/>
|
||||
<Button Content="GlassFiber" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.GlassFiber}"/>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Expander.ContextMenu>
|
||||
|
||||
@@ -42,28 +42,36 @@ namespace StructureHelper.Windows.MainWindow.Materials
|
||||
var bindings = new Dictionary<string, Binding>();
|
||||
var helperMaterial = headMaterial.HelperMaterial;
|
||||
string templateName;
|
||||
var binding = new Binding();
|
||||
if (helperMaterial is IConcreteLibMaterial)
|
||||
{
|
||||
templateName = "ConcreteMaterial";
|
||||
var binding = new Binding();
|
||||
binding.Source = vm.HelperMaterialViewModel;
|
||||
bindings.Add(templateName, binding);
|
||||
}
|
||||
else if (helperMaterial is IReinforcementLibMaterial)
|
||||
{
|
||||
templateName = "ReinforcementMaterial";
|
||||
var binding = new Binding();
|
||||
binding.Source = vm.HelperMaterialViewModel;
|
||||
bindings.Add(templateName, binding);
|
||||
}
|
||||
else if (helperMaterial is IElasticMaterial)
|
||||
{
|
||||
templateName = "ElasticMaterial";
|
||||
var binding = new Binding();
|
||||
binding.Source = vm.HelperMaterialViewModel;
|
||||
bindings.Add(templateName, binding);
|
||||
templateName = "DirectSafetyFactors";
|
||||
var frBinding = new Binding();
|
||||
frBinding.Source = (vm.HelperMaterialViewModel as ElasticViewModel).SafetyFactors;
|
||||
bindings.Add(templateName, frBinding);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Expected: {typeof(IHelperMaterial)}, but was: {helperMaterial.GetType()}");
|
||||
}
|
||||
|
||||
bindings.Add(templateName, binding);
|
||||
foreach (var item in bindings)
|
||||
{
|
||||
ContentControl contentControl = new ContentControl();
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
foreach (var item in ndmPrimitives)
|
||||
{
|
||||
StrainTupleService.CopyProperties(wnd.StrainTuple, item.AutoPrestrain);
|
||||
ForceTupleService.CopyProperties(wnd.StrainTuple, item.AutoPrestrain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
public class SetPrestrainViewModel : ViewModelBase
|
||||
{
|
||||
IStrainTuple SourceTuple;
|
||||
StrainTuple SourceTuple;
|
||||
private double coefficient;
|
||||
|
||||
public double Coefficient
|
||||
@@ -26,16 +26,16 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
}
|
||||
}
|
||||
|
||||
public SetPrestrainViewModel(IStrainTuple sourceTuple)
|
||||
public SetPrestrainViewModel(StrainTuple sourceTuple)
|
||||
{
|
||||
SourceTuple = sourceTuple;
|
||||
coefficient = 1d;
|
||||
}
|
||||
|
||||
public IStrainTuple GetStrainTuple()
|
||||
public StrainTuple GetStrainTuple()
|
||||
{
|
||||
var result = new StrainTuple();
|
||||
StrainTupleService.CopyProperties(SourceTuple, result, coefficient);
|
||||
ForceTupleService.CopyProperties(SourceTuple, result, coefficient);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
internal class ElasticViewModel : HelperMaterialViewModel
|
||||
{
|
||||
IElasticMaterial material;
|
||||
SafetyFactorsViewModel safetyFactorsViewModel;
|
||||
public SafetyFactorsViewModel SafetyFactors => safetyFactorsViewModel;
|
||||
public double Modulus
|
||||
{
|
||||
get => material.Modulus;
|
||||
@@ -43,6 +45,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
public ElasticViewModel(IElasticMaterial material)
|
||||
{
|
||||
this.material = material;
|
||||
safetyFactorsViewModel = new SafetyFactorsViewModel(material.SafetyFactors);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
StructureHelper/Windows/ViewModels/Materials/FRViewModel.cs
Normal file
18
StructureHelper/Windows/ViewModels/Materials/FRViewModel.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
internal class FRViewModel : ElasticViewModel
|
||||
{
|
||||
public FRViewModel(IFRMaterial material) : base(material)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,8 +82,16 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
}
|
||||
else if (helperMaterial is IElasticMaterial)
|
||||
{
|
||||
var material = helperMaterial as IElasticMaterial;
|
||||
helperMaterialViewModel = new ElasticViewModel(material);
|
||||
if (helperMaterial is IFRMaterial)
|
||||
{
|
||||
var material = helperMaterial as IFRMaterial;
|
||||
helperMaterialViewModel = new FRViewModel(material);
|
||||
}
|
||||
else
|
||||
{
|
||||
var material = helperMaterial as IElasticMaterial;
|
||||
helperMaterialViewModel = new ElasticViewModel(material);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
internal interface ISafetyFactorViewModel<TItem> : ICRUDViewModel<TItem>
|
||||
{
|
||||
RelayCommand ShowPartialFactors { get; }
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,8 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
if (paramType == MaterialType.Concrete) { AddConcrete(); }
|
||||
else if (paramType == MaterialType.Reinforcement) { AddReinforcement(); }
|
||||
else if (paramType == MaterialType.Elastic) { AddElastic(); }
|
||||
else if (paramType == MaterialType.CarbonFiber) { AddCarbonFiber(); }
|
||||
else if (paramType == MaterialType.GlassFiber) { AddGlassFiber(); }
|
||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Expected: {typeof(MaterialType)}, Actual type: {nameof(paramType)}");
|
||||
base.AddMethod(parameter);
|
||||
}
|
||||
@@ -78,6 +80,18 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
material.Name = "New Elastic Material";
|
||||
NewItem = material;
|
||||
}
|
||||
private void AddCarbonFiber()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Carbon4000, ProgramSetting.CodeType);
|
||||
material.Name = "New CFR Material";
|
||||
NewItem = material;
|
||||
}
|
||||
private void AddGlassFiber()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Glass1200, ProgramSetting.CodeType);
|
||||
material.Name = "New GFR Material";
|
||||
NewItem = material;
|
||||
}
|
||||
private void AddReinforcement()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, ProgramSetting.CodeType);
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Windows.AddMaterialWindow;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
internal class SafetyFactorsViewModel : SelectedItemViewModel<IMaterialSafetyFactor>
|
||||
{
|
||||
List<IMaterialSafetyFactor> safetyFactors;
|
||||
private RelayCommand showPartialCommand;
|
||||
|
||||
public RelayCommand ShowPartialFactors
|
||||
@@ -28,6 +32,22 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
}
|
||||
}
|
||||
|
||||
private ICommand showSafetyFactors;
|
||||
|
||||
public ICommand ShowSafetyFactors
|
||||
{
|
||||
get
|
||||
{
|
||||
return showSafetyFactors ??= new RelayCommand(o =>
|
||||
{
|
||||
var wnd = new SafetyFactorsView(safetyFactors);
|
||||
wnd.ShowDialog();
|
||||
Refresh();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddMethod(object parameter)
|
||||
{
|
||||
NewItem = new MaterialSafetyFactor();
|
||||
@@ -36,6 +56,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
|
||||
public SafetyFactorsViewModel(List<IMaterialSafetyFactor> safetyFactors) : base(safetyFactors)
|
||||
{
|
||||
this.safetyFactors = safetyFactors;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user