All Test Was Repaired
This commit is contained in:
1
App.xaml
1
App.xaml
@@ -6,6 +6,7 @@
|
|||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="Infrastructure/UI/Styles.xaml"/>
|
<ResourceDictionary Source="Infrastructure/UI/Styles.xaml"/>
|
||||||
|
<ResourceDictionary Source="Infrastructure/UI/Resources/PrimitiveTemplates.xaml"/>
|
||||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ShapeEditTemplates.xaml"/>
|
<ResourceDictionary Source="Infrastructure/UI/Resources/ShapeEditTemplates.xaml"/>
|
||||||
<ResourceDictionary Source="Infrastructure/UI/Resources/Converters.xaml"/>
|
<ResourceDictionary Source="Infrastructure/UI/Resources/Converters.xaml"/>
|
||||||
<ResourceDictionary Source="Infrastructure/UI/Resources/PrimitiveToolTips.xaml"/>
|
<ResourceDictionary Source="Infrastructure/UI/Resources/PrimitiveToolTips.xaml"/>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ using StructureHelperLogics.Models.Materials;
|
|||||||
using StructureHelperCommon.Services.ColorServices;
|
using StructureHelperCommon.Services.ColorServices;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||||
{
|
{
|
||||||
|
|||||||
37
Infrastructure/UI/DataContexts/PrimitiveOperations.cs
Normal file
37
Infrastructure/UI/DataContexts/PrimitiveOperations.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||||
|
{
|
||||||
|
internal static class PrimitiveOperations
|
||||||
|
{
|
||||||
|
|
||||||
|
public static ObservableCollection<PrimitiveBase> ConvertNdmPrimitivesToPrimitiveBase(IEnumerable<INdmPrimitive> primitives)
|
||||||
|
{
|
||||||
|
ObservableCollection<PrimitiveBase> viewItems = new ObservableCollection<PrimitiveBase>();
|
||||||
|
foreach (var item in primitives)
|
||||||
|
{
|
||||||
|
if (item is IPointPrimitive)
|
||||||
|
{
|
||||||
|
var point = item as IPointPrimitive;
|
||||||
|
viewItems.Add(new PointViewPrimitive(point));
|
||||||
|
}
|
||||||
|
else if (item is IRectanglePrimitive)
|
||||||
|
{
|
||||||
|
var rect = item as IRectanglePrimitive;
|
||||||
|
viewItems.Add(new RectangleViewPrimitive(rect));
|
||||||
|
}
|
||||||
|
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
|
||||||
|
}
|
||||||
|
return viewItems;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
Infrastructure/UI/Resources/PrimitiveTemplates.xaml
Normal file
19
Infrastructure/UI/Resources/PrimitiveTemplates.xaml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
|
||||||
|
<DataTemplate x:Key="ColoredItemTemplate">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="20"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Rectangle Grid.Column="0" Margin="3">
|
||||||
|
<Rectangle.Fill>
|
||||||
|
<SolidColorBrush Color="{Binding Color}"/>
|
||||||
|
</Rectangle.Fill>
|
||||||
|
</Rectangle>
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
Binary file not shown.
28
Models/Forces/ForceCombinationViewObject.cs
Normal file
28
Models/Forces/ForceCombinationViewObject.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Models.Forces
|
||||||
|
{
|
||||||
|
internal class ForceCombinationViewObject
|
||||||
|
{
|
||||||
|
IForceCombinationList forceCombinationList;
|
||||||
|
|
||||||
|
private IDesignForceTuple ulsShort;
|
||||||
|
|
||||||
|
public IDesignForceTuple ULSShort
|
||||||
|
{
|
||||||
|
get { return ulsShort; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceCombinationViewObject(ForceCombinationList _forceCombinationList)
|
||||||
|
{
|
||||||
|
forceCombinationList = _forceCombinationList;
|
||||||
|
ulsShort = forceCombinationList.DesignForces.Where(x => x.LimitState == LimitStates.ULS & x.CalcTerm == CalcTerms.ShortTerm).Single();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using Point = StructureHelper.Infrastructure.UI.DataContexts.PointViewPrimitive;
|
using Point = StructureHelper.Infrastructure.UI.DataContexts.PointViewPrimitive;
|
||||||
using Rectangle = StructureHelper.Infrastructure.UI.DataContexts.RectangleViewPrimitive;
|
using Rectangle = StructureHelper.Infrastructure.UI.DataContexts.RectangleViewPrimitive;
|
||||||
|
|||||||
@@ -149,10 +149,12 @@
|
|||||||
<Compile Include="Infrastructure\UI\DataContexts\IHasCenter.cs" />
|
<Compile Include="Infrastructure\UI\DataContexts\IHasCenter.cs" />
|
||||||
<Compile Include="Infrastructure\UI\DataContexts\IHasDivision.cs" />
|
<Compile Include="Infrastructure\UI\DataContexts\IHasDivision.cs" />
|
||||||
<Compile Include="Infrastructure\UI\DataContexts\LineViewPrimitive.cs" />
|
<Compile Include="Infrastructure\UI\DataContexts\LineViewPrimitive.cs" />
|
||||||
|
<Compile Include="Infrastructure\UI\DataContexts\PrimitiveOperations.cs" />
|
||||||
<Compile Include="Infrastructure\UI\PrimitiveTemplates\IRectangleBeamProperties.cs" />
|
<Compile Include="Infrastructure\UI\PrimitiveTemplates\IRectangleBeamProperties.cs" />
|
||||||
<Compile Include="Infrastructure\UI\UserControls\PrimitivePopup.xaml.cs">
|
<Compile Include="Infrastructure\UI\UserControls\PrimitivePopup.xaml.cs">
|
||||||
<DependentUpon>PrimitivePopup.xaml</DependentUpon>
|
<DependentUpon>PrimitivePopup.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Models\Forces\ForceCombinationViewObject.cs" />
|
||||||
<Compile Include="Models\Forces\ForceTupleViewObject.cs" />
|
<Compile Include="Models\Forces\ForceTupleViewObject.cs" />
|
||||||
<Compile Include="Models\Primitives\Factories\PrimitiveFactory.cs" />
|
<Compile Include="Models\Primitives\Factories\PrimitiveFactory.cs" />
|
||||||
<Compile Include="Services\Primitives\PrimitiveRepository.cs" />
|
<Compile Include="Services\Primitives\PrimitiveRepository.cs" />
|
||||||
@@ -182,6 +184,9 @@
|
|||||||
<Compile Include="Windows\CalculationWindows\CalculationResultWindow\CalculationResultView.xaml.cs">
|
<Compile Include="Windows\CalculationWindows\CalculationResultWindow\CalculationResultView.xaml.cs">
|
||||||
<DependentUpon>CalculationResultView.xaml</DependentUpon>
|
<DependentUpon>CalculationResultView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceCalculatorView.xaml.cs">
|
||||||
|
<DependentUpon>ForceCalculatorView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Windows\ColorPickerWindow\ColorPickerView.xaml.cs">
|
<Compile Include="Windows\ColorPickerWindow\ColorPickerView.xaml.cs">
|
||||||
<DependentUpon>ColorPickerView.xaml</DependentUpon>
|
<DependentUpon>ColorPickerView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -226,6 +231,8 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Windows\ViewModels\Calculations\CalculationProperies\CalculationPropertyViewModel.cs" />
|
<Compile Include="Windows\ViewModels\Calculations\CalculationProperies\CalculationPropertyViewModel.cs" />
|
||||||
<Compile Include="Windows\ViewModels\Calculations\CalculationResult\CalculationResultViewModel.cs" />
|
<Compile Include="Windows\ViewModels\Calculations\CalculationResult\CalculationResultViewModel.cs" />
|
||||||
|
<Compile Include="Windows\ViewModels\Calculations\Calculators\ForceCalculatorViewModel.cs" />
|
||||||
|
<Compile Include="Windows\ViewModels\Forces\ForceCombinationViewModel.cs" />
|
||||||
<Compile Include="Windows\ViewModels\Materials\HeadMaterialsViewModel.cs" />
|
<Compile Include="Windows\ViewModels\Materials\HeadMaterialsViewModel.cs" />
|
||||||
<Compile Include="Windows\ViewModels\PrimitiveProperties\PrimitivePropertiesViewModel.cs" />
|
<Compile Include="Windows\ViewModels\PrimitiveProperties\PrimitivePropertiesViewModel.cs" />
|
||||||
<Compile Include="Windows\ViewModels\Primitives\RectangleControlViewModel.cs" />
|
<Compile Include="Windows\ViewModels\Primitives\RectangleControlViewModel.cs" />
|
||||||
@@ -253,6 +260,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Infrastructure\UI\Resources\PrimitiveTemplates.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Infrastructure\UI\Resources\PrimitiveToolTips.xaml">
|
<Page Include="Infrastructure\UI\Resources\PrimitiveToolTips.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -281,6 +292,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceCalculatorView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Windows\ColorPickerWindow\ColorPickerView.xaml">
|
<Page Include="Windows\ColorPickerWindow\ColorPickerView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Infrastructures.Settings
|
||||||
|
{
|
||||||
|
public static class ProgramSetting
|
||||||
|
{
|
||||||
|
public static CodeTypes CodeType => CodeTypes.SP63_13330_2018;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.Remoting.Messaging;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -19,5 +20,12 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
CalcTerm = calcTerm;
|
CalcTerm = calcTerm;
|
||||||
ForceTuple = new ForceTuple();
|
ForceTuple = new ForceTuple();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
var newTuple = new DesignForceTuple(this.LimitState, this.CalcTerm);
|
||||||
|
newTuple.ForceTuple = this.ForceTuple.Clone() as IForceTuple;
|
||||||
|
return newTuple;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,5 +14,11 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
public double Qx { get; set; }
|
public double Qx { get; set; }
|
||||||
public double Qy { get; set; }
|
public double Qy { get; set; }
|
||||||
public double Mz { get; set; }
|
public double Mz { get; set; }
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
IForceTuple forceTuple = new ForceTuple() { Mx = Mx, My = My, Nz = Nz, Qx = Qx, Qy = Qy, Mz = Mz};
|
||||||
|
return forceTuple;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces
|
namespace StructureHelperCommon.Models.Forces
|
||||||
{
|
{
|
||||||
public interface IDesignForceTuple
|
public interface IDesignForceTuple : ICloneable
|
||||||
{
|
{
|
||||||
LimitStates LimitState { get; set; }
|
LimitStates LimitState { get; set; }
|
||||||
CalcTerms CalcTerm { get; set; }
|
CalcTerms CalcTerm { get; set; }
|
||||||
|
|||||||
13
StructureHelperCommon/Models/Forces/IForceRepository.cs
Normal file
13
StructureHelperCommon/Models/Forces/IForceRepository.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Forces
|
||||||
|
{
|
||||||
|
internal interface IForceRepository
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces
|
namespace StructureHelperCommon.Models.Forces
|
||||||
{
|
{
|
||||||
public interface IForceTuple
|
public interface IForceTuple : ICloneable
|
||||||
{
|
{
|
||||||
double Mx { get; set; }
|
double Mx { get; set; }
|
||||||
double My { get; set; }
|
double My { get; set; }
|
||||||
@@ -14,6 +14,5 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
double Qx { get; set; }
|
double Qx { get; set; }
|
||||||
double Qy { get; set; }
|
double Qy { get; set; }
|
||||||
double Mz { get; set; }
|
double Mz { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||||
|
{
|
||||||
|
public class ConcreteMaterialEntity : IConcreteMaterialEntity
|
||||||
|
{
|
||||||
|
public CodeTypes CodeType { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public double MainStrength { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||||
|
{
|
||||||
|
public static class LibMaterialFactory
|
||||||
|
{
|
||||||
|
public static List<ILibMaterialEntity> GetLibMaterials()
|
||||||
|
{
|
||||||
|
List<ILibMaterialEntity> libMaterials = new List<ILibMaterialEntity>();
|
||||||
|
libMaterials.AddRange(GetConcreteEurocode());
|
||||||
|
libMaterials.AddRange(GetConcreteSP63());
|
||||||
|
libMaterials.AddRange(GetReinforcementEurocode());
|
||||||
|
libMaterials.AddRange(GetReinforcementSP63());
|
||||||
|
return libMaterials;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IEnumerable<ILibMaterialEntity> GetConcreteEurocode()
|
||||||
|
{
|
||||||
|
var code = CodeTypes.EuroCode_2_1990;
|
||||||
|
List<ILibMaterialEntity> libMaterials = new List<ILibMaterialEntity>();
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C12", MainStrength = 12e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C20", MainStrength = 20e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C30", MainStrength = 30e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C40", MainStrength = 40e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C50", MainStrength = 50e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C60", MainStrength = 60e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C70", MainStrength = 70e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C80", MainStrength = 80e6 });
|
||||||
|
return libMaterials;
|
||||||
|
}
|
||||||
|
private static IEnumerable<ILibMaterialEntity> GetReinforcementEurocode()
|
||||||
|
{
|
||||||
|
var code = CodeTypes.EuroCode_2_1990;
|
||||||
|
List<ILibMaterialEntity> libMaterials = new List<ILibMaterialEntity>();
|
||||||
|
libMaterials.Add(new ReinforcementMaterialEntity() { CodeType = code, Name = "S240", MainStrength = 240e6 });
|
||||||
|
libMaterials.Add(new ReinforcementMaterialEntity() { CodeType = code, Name = "S400", MainStrength = 400e6 });
|
||||||
|
libMaterials.Add(new ReinforcementMaterialEntity() { CodeType = code, Name = "S500", MainStrength = 500e6 });
|
||||||
|
return libMaterials;
|
||||||
|
}
|
||||||
|
private static IEnumerable<ILibMaterialEntity> GetConcreteSP63()
|
||||||
|
{
|
||||||
|
var code = CodeTypes.SP63_13330_2018;
|
||||||
|
List<ILibMaterialEntity> libMaterials = new List<ILibMaterialEntity>();
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B5", MainStrength = 5e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B7,5", MainStrength = 7.5e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B10", MainStrength = 10e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B15", MainStrength = 15e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B20", MainStrength = 20e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B25", MainStrength = 25e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B30", MainStrength = 30e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B35", MainStrength = 35e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B40", MainStrength = 40e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B50", MainStrength = 50e6 });
|
||||||
|
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B60", MainStrength = 60e6 });
|
||||||
|
return libMaterials;
|
||||||
|
}
|
||||||
|
private static IEnumerable<ILibMaterialEntity> GetReinforcementSP63()
|
||||||
|
{
|
||||||
|
var code = CodeTypes.SP63_13330_2018;
|
||||||
|
List<ILibMaterialEntity> libMaterials = new List<ILibMaterialEntity>();
|
||||||
|
libMaterials.Add(new ReinforcementMaterialEntity() { CodeType = code, Name = "A240", MainStrength = 240e6 });
|
||||||
|
libMaterials.Add(new ReinforcementMaterialEntity() { CodeType = code, Name = "A400", MainStrength = 400e6 });
|
||||||
|
libMaterials.Add(new ReinforcementMaterialEntity() { CodeType = code, Name = "A500", MainStrength = 500e6 });
|
||||||
|
return libMaterials;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||||
|
{
|
||||||
|
public interface IConcreteMaterialEntity : ILibMaterialEntity
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||||
|
{
|
||||||
|
public interface ILibMaterialEntity
|
||||||
|
{
|
||||||
|
CodeTypes CodeType { get; }
|
||||||
|
string Name { get; }
|
||||||
|
double MainStrength { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||||
|
{
|
||||||
|
public interface IReinforcementMaterialEntity : ILibMaterialEntity
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||||
|
{
|
||||||
|
public static class LibMaterialPepository
|
||||||
|
{
|
||||||
|
private static List<ILibMaterialEntity> libMaterials;
|
||||||
|
public static List<ILibMaterialEntity> GetRepository()
|
||||||
|
{
|
||||||
|
if (libMaterials is null) { libMaterials = LibMaterialFactory.GetLibMaterials(); }
|
||||||
|
|
||||||
|
return libMaterials;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<ILibMaterialEntity> GetConcreteRepository(CodeTypes code)
|
||||||
|
{
|
||||||
|
return GetRepository().Where(x => x.CodeType == code & x is IConcreteMaterialEntity); ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<ILibMaterialEntity> GetReinforcementRepository(CodeTypes code)
|
||||||
|
{
|
||||||
|
return GetRepository().Where(x => x.CodeType == code & x is IReinforcementMaterialEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||||
|
{
|
||||||
|
public class ReinforcementMaterialEntity : IReinforcementMaterialEntity
|
||||||
|
{
|
||||||
|
public CodeTypes CodeType { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public double MainStrength { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -53,6 +53,7 @@
|
|||||||
<Compile Include="Infrastructures\Exceptions\StructureHelperException.cs" />
|
<Compile Include="Infrastructures\Exceptions\StructureHelperException.cs" />
|
||||||
<Compile Include="Infrastructures\Interfaces\IHasParent.cs" />
|
<Compile Include="Infrastructures\Interfaces\IHasParent.cs" />
|
||||||
<Compile Include="Infrastructures\Interfaces\ISaveable.cs" />
|
<Compile Include="Infrastructures\Interfaces\ISaveable.cs" />
|
||||||
|
<Compile Include="Infrastructures\Settings\ProgramSetting.cs" />
|
||||||
<Compile Include="Infrastructures\Strings\ErrorString.cs" />
|
<Compile Include="Infrastructures\Strings\ErrorString.cs" />
|
||||||
<Compile Include="Infrastructures\Enums\MaterialTypes.cs" />
|
<Compile Include="Infrastructures\Enums\MaterialTypes.cs" />
|
||||||
<Compile Include="Models\Calculators\IHelperCalculator.cs" />
|
<Compile Include="Models\Calculators\IHelperCalculator.cs" />
|
||||||
@@ -61,7 +62,15 @@
|
|||||||
<Compile Include="Models\Forces\ForceTuple.cs" />
|
<Compile Include="Models\Forces\ForceTuple.cs" />
|
||||||
<Compile Include="Models\Forces\IDesignForceTuple.cs" />
|
<Compile Include="Models\Forces\IDesignForceTuple.cs" />
|
||||||
<Compile Include="Models\Forces\IForceCombinationList.cs" />
|
<Compile Include="Models\Forces\IForceCombinationList.cs" />
|
||||||
|
<Compile Include="Models\Forces\IForceRepository.cs" />
|
||||||
<Compile Include="Models\Forces\IForceTuple.cs" />
|
<Compile Include="Models\Forces\IForceTuple.cs" />
|
||||||
|
<Compile Include="Models\Materials\Libraries\ConcreteMaterialEntity.cs" />
|
||||||
|
<Compile Include="Models\Materials\Libraries\Factories\LibMaterialFactory.cs" />
|
||||||
|
<Compile Include="Models\Materials\Libraries\IConcreteMaterialEntity.cs" />
|
||||||
|
<Compile Include="Models\Materials\Libraries\ILibMaterialEntity.cs" />
|
||||||
|
<Compile Include="Models\Materials\Libraries\IReinforcementMaterialEntity.cs" />
|
||||||
|
<Compile Include="Models\Materials\Libraries\LibMaterialPepository.cs" />
|
||||||
|
<Compile Include="Models\Materials\Libraries\ReinforcementMaterialEntity.cs" />
|
||||||
<Compile Include="Models\Shapes\Point2D.cs" />
|
<Compile Include="Models\Shapes\Point2D.cs" />
|
||||||
<Compile Include="Models\Shapes\IPoint2D.cs" />
|
<Compile Include="Models\Shapes\IPoint2D.cs" />
|
||||||
<Compile Include="Models\Shapes\ICenterShape.cs" />
|
<Compile Include="Models\Shapes\ICenterShape.cs" />
|
||||||
|
|||||||
18
StructureHelperLogics/Models/CrossSections/CrossSection.cs
Normal file
18
StructureHelperLogics/Models/CrossSections/CrossSection.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.CrossSections
|
||||||
|
{
|
||||||
|
public class CrossSection : ICrossSection
|
||||||
|
{
|
||||||
|
public ICrossSectionRepository SectionRepository { get; private set; }
|
||||||
|
|
||||||
|
public CrossSection()
|
||||||
|
{
|
||||||
|
SectionRepository = new CrossSectionRepository();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.CrossSections
|
||||||
|
{
|
||||||
|
public class CrossSectionRepository : ICrossSectionRepository
|
||||||
|
{
|
||||||
|
public List<IForceCombinationList> ForceCombinationLists { get; private set; }
|
||||||
|
public List<IHeadMaterial> HeadMaterials { get; private set; }
|
||||||
|
public List<INdmPrimitive> Primitives { get; }
|
||||||
|
public List<INdmCalculator> Calculators { get; private set; }
|
||||||
|
|
||||||
|
public CrossSectionRepository()
|
||||||
|
{
|
||||||
|
ForceCombinationLists = new List<IForceCombinationList>();
|
||||||
|
HeadMaterials = new List<IHeadMaterial>();
|
||||||
|
Primitives = new List<INdmPrimitive>();
|
||||||
|
Calculators = new List<INdmCalculator>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
StructureHelperLogics/Models/CrossSections/ICrossSection.cs
Normal file
13
StructureHelperLogics/Models/CrossSections/ICrossSection.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.CrossSections
|
||||||
|
{
|
||||||
|
public interface ICrossSection
|
||||||
|
{
|
||||||
|
ICrossSectionRepository SectionRepository { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.CrossSections
|
||||||
|
{
|
||||||
|
public interface ICrossSectionRepository : IHasHeadMaterials, IHasPrimitives
|
||||||
|
{
|
||||||
|
List<IForceCombinationList> ForceCombinationLists { get; }
|
||||||
|
List<INdmCalculator> Calculators { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
|
using LCM = LoaderCalculator.Data.Materials;
|
||||||
|
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Materials
|
||||||
|
{
|
||||||
|
public class ConcreteLibMaterial : IConcreteLibMaterial
|
||||||
|
{
|
||||||
|
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||||
|
public bool TensionForULS { get ; set; }
|
||||||
|
public bool TensionForSLS { get; set; }
|
||||||
|
|
||||||
|
private IMaterialOptionLogic optionLogic;
|
||||||
|
|
||||||
|
public ConcreteLibMaterial()
|
||||||
|
{
|
||||||
|
optionLogic = new MaterialOptionLogic(new LCMB.ConcreteOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
return new ConcreteLibMaterial() { MaterialEntity = MaterialEntity, TensionForULS = TensionForULS, TensionForSLS = TensionForSLS };
|
||||||
|
}
|
||||||
|
|
||||||
|
public LCM.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||||
|
{
|
||||||
|
var materialOptions = optionLogic.SetMaterialOptions(MaterialEntity, limitState, calcTerm);
|
||||||
|
LCMB.IMaterialBuilder builder = new LCMB.ConcreteBuilder(materialOptions);
|
||||||
|
LCMB.IBuilderDirector director = new LCMB.BuilderDirector(builder);
|
||||||
|
return director.BuildMaterial();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Materials
|
||||||
|
{
|
||||||
|
public enum HeadmaterialType
|
||||||
|
{
|
||||||
|
Concrete40,
|
||||||
|
Reinforecement400,
|
||||||
|
Elastic200
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class HeadMaterialFactory
|
||||||
|
{
|
||||||
|
private static CodeTypes codeType;
|
||||||
|
private static IEnumerable<ILibMaterialEntity> LibConcreteMaterials => LibMaterialPepository.GetConcreteRepository(codeType);
|
||||||
|
private static IEnumerable<ILibMaterialEntity> LibReinforcementMaterials => LibMaterialPepository.GetReinforcementRepository(codeType);
|
||||||
|
|
||||||
|
public static IHeadMaterial GetHeadMaterial(HeadmaterialType type, CodeTypes code)
|
||||||
|
{
|
||||||
|
codeType = code;
|
||||||
|
if (type == HeadmaterialType.Concrete40) { return GetConcrete40(); }
|
||||||
|
if (type == HeadmaterialType.Reinforecement400) { return GetReinforcement400(); }
|
||||||
|
if (type == HeadmaterialType.Elastic200) { return GetElastic200(); }
|
||||||
|
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IHeadMaterial GetElastic200()
|
||||||
|
{
|
||||||
|
var material = new HeadMaterial();
|
||||||
|
material.HelperMaterial = new ElasticMaterial() { Modulus = 2e11d, CompressiveStrength = 4e8d, TensileStrength = 4e8d };
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IHeadMaterial GetReinforcement400()
|
||||||
|
{
|
||||||
|
var material = new HeadMaterial() { Name = "New reinforcement" };
|
||||||
|
var libMaterial = LibReinforcementMaterials.Where(x => x.Name.Contains("400")).First();
|
||||||
|
var libMat = new ReinforcementLibMaterial();
|
||||||
|
libMat.MaterialEntity = libMaterial;
|
||||||
|
material.HelperMaterial = libMat;
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IHeadMaterial GetConcrete40()
|
||||||
|
{
|
||||||
|
var material = new HeadMaterial();
|
||||||
|
var libMaterial = LibConcreteMaterials.Where(x => x.Name.Contains("40")).First();
|
||||||
|
var libMat = new ConcreteLibMaterial();
|
||||||
|
libMat.MaterialEntity = libMaterial;
|
||||||
|
libMat.TensionForULS = false;
|
||||||
|
libMat.TensionForSLS = true;
|
||||||
|
material.HelperMaterial = libMat;
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
|
||||||
using StructureHelperCommon.Infrastructures.Strings;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Materials.Factories
|
|
||||||
{
|
|
||||||
public static class LibMaterialFactory
|
|
||||||
{
|
|
||||||
public static List<ILibMaterial> GetLibMaterials(CodeTypes code)
|
|
||||||
{
|
|
||||||
List<ILibMaterial> libMaterials = new List<ILibMaterial>();
|
|
||||||
libMaterials.AddRange(GetConcrete(code));
|
|
||||||
libMaterials.AddRange(GetReinforcement(code));
|
|
||||||
return libMaterials;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<ILibMaterial> GetReinforcement(CodeTypes code)
|
|
||||||
{
|
|
||||||
if (code == CodeTypes.EuroCode_2_1990)
|
|
||||||
{
|
|
||||||
return GetReinforcementEurocode();
|
|
||||||
}
|
|
||||||
else if (code == CodeTypes.SP63_13330_2018)
|
|
||||||
{
|
|
||||||
return GetReinforcementSP63();
|
|
||||||
}
|
|
||||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); }
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<ILibMaterial> GetConcrete(CodeTypes code)
|
|
||||||
{
|
|
||||||
if (code == CodeTypes.EuroCode_2_1990)
|
|
||||||
{
|
|
||||||
return GetConcreteEurocode();
|
|
||||||
}
|
|
||||||
else if (code == CodeTypes.SP63_13330_2018)
|
|
||||||
{
|
|
||||||
return GetConcreteSP63();
|
|
||||||
}
|
|
||||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); }
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<ILibMaterial> GetConcreteEurocode()
|
|
||||||
{
|
|
||||||
var code = CodeTypes.EuroCode_2_1990;
|
|
||||||
var material = MaterialTypes.Concrete;
|
|
||||||
List<ILibMaterial> libMaterials = new List<ILibMaterial>();
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "C12", 12e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "C20", 20e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "C30", 30e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "C40", 40e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "C50", 50e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "C60", 60e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "C70", 70e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "C80", 80e6));
|
|
||||||
return libMaterials;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<ILibMaterial> GetReinforcementEurocode()
|
|
||||||
{
|
|
||||||
var code = CodeTypes.EuroCode_2_1990;
|
|
||||||
var material = MaterialTypes.Reinforcement;
|
|
||||||
List<ILibMaterial> libMaterials = new List<ILibMaterial>();
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "S240", 240e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "S400", 400e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "S500", 500e6));
|
|
||||||
return libMaterials;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<ILibMaterial> GetConcreteSP63()
|
|
||||||
{
|
|
||||||
var code = CodeTypes.SP63_13330_2018;
|
|
||||||
var material = MaterialTypes.Concrete;
|
|
||||||
List<ILibMaterial> libMaterials = new List<ILibMaterial>();
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "B5", 5e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "B7,5", 7.5e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "B10", 10e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "B15", 15e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "B20", 20e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "B25", 25e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "B30", 30e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "B35", 35e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "B40", 40e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "B50", 50e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "B60", 60e6));
|
|
||||||
return libMaterials;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<ILibMaterial> GetReinforcementSP63()
|
|
||||||
{
|
|
||||||
var code = CodeTypes.EuroCode_2_1990;
|
|
||||||
var material = MaterialTypes.Reinforcement;
|
|
||||||
List<ILibMaterial> libMaterials = new List<ILibMaterial>();
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "A240", 240e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "A400", 400e6));
|
|
||||||
libMaterials.Add(new LibMaterial(material, code, "A500", 500e6));
|
|
||||||
return libMaterials;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,19 +12,16 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
public object Parent { get; private set; }
|
public object Parent { get; private set; }
|
||||||
|
|
||||||
public List<IHeadMaterial> HeadMaterials { get; set; }
|
public List<IHeadMaterial> HeadMaterials { get; set; }
|
||||||
public List<ILibMaterial> LibMaterials { get; set; }
|
|
||||||
|
|
||||||
public HeadMaterialRepository()
|
public HeadMaterialRepository()
|
||||||
{
|
{
|
||||||
HeadMaterials = new List<IHeadMaterial>();
|
HeadMaterials = new List<IHeadMaterial>();
|
||||||
LibMaterials = new List<ILibMaterial>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public HeadMaterialRepository(object parent)
|
public HeadMaterialRepository(object parent)
|
||||||
{
|
{
|
||||||
Parent = parent;
|
Parent = parent;
|
||||||
HeadMaterials = new List<IHeadMaterial>();
|
HeadMaterials = new List<IHeadMaterial>();
|
||||||
LibMaterials = new List<ILibMaterial>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterParent(object obj)
|
public void RegisterParent(object obj)
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Materials
|
||||||
|
{
|
||||||
|
public interface IConcreteLibMaterial : ILibMaterial
|
||||||
|
{
|
||||||
|
bool TensionForULS { get; set; }
|
||||||
|
bool TensionForSLS { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
14
StructureHelperLogics/Models/Materials/IHasHeadMaterials.cs
Normal file
14
StructureHelperLogics/Models/Materials/IHasHeadMaterials.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Materials
|
||||||
|
{
|
||||||
|
public interface IHasHeadMaterials
|
||||||
|
{
|
||||||
|
List<IHeadMaterial> HeadMaterials { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,6 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
{
|
{
|
||||||
object Parent { get; }
|
object Parent { get; }
|
||||||
List<IHeadMaterial> HeadMaterials { get; set; }
|
List<IHeadMaterial> HeadMaterials { get; set; }
|
||||||
List<ILibMaterial> LibMaterials { get; set; }
|
|
||||||
void RegisterParent(object obj);
|
void RegisterParent(object obj);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -8,9 +9,6 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
{
|
{
|
||||||
public interface ILibMaterial : IHelperMaterial
|
public interface ILibMaterial : IHelperMaterial
|
||||||
{
|
{
|
||||||
MaterialTypes MaterialType { get; set; }
|
ILibMaterialEntity MaterialEntity { get; set; }
|
||||||
//CodeTypes CodeType { get; set; }
|
|
||||||
string Name { get; set; }
|
|
||||||
double MainStrength { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
|
using LCM = LoaderCalculator.Data.Materials;
|
||||||
|
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Materials
|
||||||
|
{
|
||||||
|
public interface IMaterialOptionLogic
|
||||||
|
{
|
||||||
|
LCMB.IMaterialOptions SetMaterialOptions(ILibMaterialEntity materialEntity, LimitStates limitState, CalcTerms calcTerm);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Materials
|
||||||
|
{
|
||||||
|
public interface IReinforcementLibMaterial : ILibMaterial
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Strings;
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
using LCM = LoaderCalculator.Data.Materials;
|
using LCM = LoaderCalculator.Data.Materials;
|
||||||
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
private CalcTerms calcTerm;
|
private CalcTerms calcTerm;
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public double MainStrength { get; set; }
|
public double MainStrength { get; set; }
|
||||||
|
public ILibMaterialEntity MaterialEntity { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }
|
||||||
|
|
||||||
public LibMaterial(MaterialTypes materialType, CodeTypes codeType, string name, double mainStrength)
|
public LibMaterial(MaterialTypes materialType, CodeTypes codeType, string name, double mainStrength)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Materials
|
||||||
|
{
|
||||||
|
public class MaterialOptionLogic : IMaterialOptionLogic
|
||||||
|
{
|
||||||
|
private LCMB.IMaterialOptions materialOptions;
|
||||||
|
|
||||||
|
public MaterialOptionLogic(LCMB.IMaterialOptions materialOptions)
|
||||||
|
{
|
||||||
|
this.materialOptions = materialOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LCMB.IMaterialOptions SetMaterialOptions(ILibMaterialEntity materialEntity, LimitStates limitState, CalcTerms calcTerm)
|
||||||
|
{
|
||||||
|
materialOptions.Strength = materialEntity.MainStrength;
|
||||||
|
if (materialEntity.CodeType == CodeTypes.EuroCode_2_1990)
|
||||||
|
{
|
||||||
|
materialOptions.CodesType = LCMB.CodesType.EC2_1990;
|
||||||
|
}
|
||||||
|
else if (materialEntity.CodeType == CodeTypes.SP63_13330_2018)
|
||||||
|
{
|
||||||
|
materialOptions.CodesType = LCMB.CodesType.SP63_2018;
|
||||||
|
}
|
||||||
|
else { throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {materialOptions.CodesType}"); }
|
||||||
|
if (limitState == LimitStates.ULS) { materialOptions.LimitState = LCMB.LimitStates.Collapse; }
|
||||||
|
else if (limitState == LimitStates.SLS) { materialOptions.LimitState = LCMB.LimitStates.ServiceAbility; }
|
||||||
|
else if (limitState == LimitStates.Special) { materialOptions.LimitState = LCMB.LimitStates.Special; }
|
||||||
|
else { throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid); }
|
||||||
|
if (calcTerm == CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }
|
||||||
|
else if (calcTerm == CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; }
|
||||||
|
else { throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid); }
|
||||||
|
|
||||||
|
return materialOptions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCM = LoaderCalculator.Data.Materials;
|
||||||
|
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Materials
|
||||||
|
{
|
||||||
|
public class ReinforcementLibMaterial : IReinforcementLibMaterial
|
||||||
|
{
|
||||||
|
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||||
|
|
||||||
|
private IMaterialOptionLogic optionLogic;
|
||||||
|
|
||||||
|
public ReinforcementLibMaterial()
|
||||||
|
{
|
||||||
|
optionLogic = new MaterialOptionLogic(new LCMB.ReinforcementOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
return new ReinforcementLibMaterial() { MaterialEntity = MaterialEntity};
|
||||||
|
}
|
||||||
|
|
||||||
|
public LCM.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||||
|
{
|
||||||
|
var materialOptions = optionLogic.SetMaterialOptions(MaterialEntity, limitState, calcTerm);
|
||||||
|
LCMB.IMaterialBuilder builder = new LCMB.ReinforcementBuilder(materialOptions);
|
||||||
|
LCMB.IBuilderDirector director = new LCMB.BuilderDirector(builder);
|
||||||
|
return director.BuildMaterial();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
|
{
|
||||||
|
public class ForceCalculator : INdmCalculator
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public List<IForceCombinationList> ForceCombinationLists { get; }
|
||||||
|
public List<INdmPrimitive> NdmPrimitives { get; }
|
||||||
|
public INdmResult Result { get; }
|
||||||
|
public void Run()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceCalculator()
|
||||||
|
{
|
||||||
|
ForceCombinationLists = new List<IForceCombinationList>();
|
||||||
|
NdmPrimitives = new List<INdmPrimitive>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
|
{
|
||||||
|
public class ForceInputData : IForceInputData
|
||||||
|
{
|
||||||
|
public IEnumerable<IForceCombinationList> ForceCombinationLists { get; set; }
|
||||||
|
public IEnumerable<LimitStates> LimitStates { get; set; }
|
||||||
|
public IEnumerable<CalcTerms> CalcTerms { get; set; }
|
||||||
|
public IIterationProperty IterationProperty { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using LoaderCalculator.Data.ResultData;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
|
{
|
||||||
|
public class ForcesResult : INdmResult
|
||||||
|
{
|
||||||
|
public bool IsValid { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Text of result of calculations
|
||||||
|
/// </summary>
|
||||||
|
public string Desctription { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Keep result of calculations from ndm-library
|
||||||
|
/// </summary>
|
||||||
|
public ILoaderResults LoaderResults { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
|
{
|
||||||
|
public interface IForceInputData
|
||||||
|
{
|
||||||
|
IEnumerable<CalcTerms> CalcTerms { get; set; }
|
||||||
|
IEnumerable<IForceCombinationList> ForceCombinationLists { get; set; }
|
||||||
|
IIterationProperty IterationProperty { get; }
|
||||||
|
IEnumerable<LimitStates> LimitStates { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using TaskManager;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||||
|
{
|
||||||
|
public interface INdmCalculator
|
||||||
|
{
|
||||||
|
string Name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Method for calculating
|
||||||
|
/// </summary>
|
||||||
|
void Run();
|
||||||
|
/// <summary>
|
||||||
|
/// Result of Calculations
|
||||||
|
/// </summary>
|
||||||
|
INdmResult Result { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
16
StructureHelperLogics/NdmCalculations/Analyses/INdmResult.cs
Normal file
16
StructureHelperLogics/NdmCalculations/Analyses/INdmResult.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||||
|
{
|
||||||
|
public interface INdmResult
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// True if result of calculation is valid
|
||||||
|
/// </summary>
|
||||||
|
bool IsValid { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
{
|
||||||
|
public interface IHasPrimitives
|
||||||
|
{
|
||||||
|
List<INdmPrimitive> Primitives { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ using System.Collections.Generic;
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
{
|
{
|
||||||
public interface INdmPrimitive : ISaveable, ICloneable
|
public interface INdmPrimitive : ISaveable, ICloneable
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,13 +33,12 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
|
|
||||||
public RectanglePrimitive()
|
public RectanglePrimitive()
|
||||||
{
|
{
|
||||||
Name = "New Rectangle";
|
|
||||||
Width = 0.4d;
|
|
||||||
Height = 0.6d;
|
|
||||||
NdmMaxSize = 0.01d;
|
NdmMaxSize = 0.01d;
|
||||||
NdmMinDivision = 10;
|
NdmMinDivision = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RectanglePrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
RectanglePrimitive primitive = new RectanglePrimitive();
|
RectanglePrimitive primitive = new RectanglePrimitive();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using StructureHelperLogics.Models.Materials;
|
|||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using System.Text;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
namespace StructureHelperLogics.Services.NdmCalculations
|
namespace StructureHelperLogics.Services.NdmCalculations
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
using LoaderCalculator;
|
|
||||||
using LoaderCalculator.Data.Matrix;
|
|
||||||
using LoaderCalculator.Data.Ndms;
|
|
||||||
using LoaderCalculator.Data.SourceData;
|
|
||||||
using LoaderCalculator.Tests.Infrastructures.Logics;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading;
|
|
||||||
using StructureHelperCommon.Models.Shapes;
|
|
||||||
using StructureHelperLogics.Models.Primitives;
|
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
|
||||||
using dContext = StructureHelper.Infrastructure.UI.DataContexts;
|
|
||||||
|
|
||||||
namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
|
||||||
{
|
|
||||||
//В тесте создается 1 прямоугольник размером 400х600мм (0.4х0.6м).
|
|
||||||
//Материал прямоугольника - бетон, пока задается жестко в модели прямоугольника, надо сделать чтобы редактировалось через материалы
|
|
||||||
//Также создается 4 точки, соответствующие арматуре, материал - арматура, также пока жестко задается в свойствах точки
|
|
||||||
//Входными параметрами являтся 3 параметра усилий - Mx, My, Nz
|
|
||||||
//Выходными параметрами являются 3 параметра перемещений - Kx, Ky, EpsilonZ
|
|
||||||
//
|
|
||||||
public class RCSectionFromNdmPrimitiveTest
|
|
||||||
{
|
|
||||||
//Theoretical limit momemt Mx = 43kN*m
|
|
||||||
[TestCase(0.000113, 0.000494, 10e3, 0d, 0d, 0.00084665917358052976d, 0.0d, 0.00020754144937701132d)]
|
|
||||||
[TestCase(0.000113, 0.000494, 40e3, 0d, 0d, 0.0033939850380287412d, 0d, 0.00082989880025069202d)]
|
|
||||||
[TestCase(0.000113, 0.000494, 42e3, 0d, 0d, 0.0056613831873867241d, 0d, 0.0014291081844183839d)]
|
|
||||||
//Theoretical limit momemt Mx = -187kN*m
|
|
||||||
[TestCase(0.000113, 0.000494, -50e3, 0d, 0d, -0.0011229555729294297d, 0d, 0.00021353225742956321d)]
|
|
||||||
[TestCase(0.000113, 0.000494, -180e3, 0d, 0d, -0.0098365950945499738d, 0d, 0.0022035516889170013d)]
|
|
||||||
[TestCase(0.000113, 0.000494, -183e3, 0d, 0d, -0.021718635290382458d, 0d, 0.0053526701372818789d)]
|
|
||||||
public void Run_ShouldPass(double topArea, double bottomArea, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
|
|
||||||
{
|
|
||||||
//Arrange
|
|
||||||
double width = 0.4;
|
|
||||||
double height = 0.6;
|
|
||||||
//Коллекция для хранения элементарных участков
|
|
||||||
var ndmCollection = new List<INdm>();
|
|
||||||
//Настройки триангуляции, пока опции могут быть только такие
|
|
||||||
ITriangulationOptions options = new TriangulationOptions { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
|
||||||
var ndmPrimitives = new List<INdmPrimitive>();
|
|
||||||
//Добавляем прямоугольник бетонного сечения
|
|
||||||
var concreteRectangle = new dContext.Rectangle(new Point2D { X = 0, Y = 0 }, new Rectangle { Width = width, Height = height, Angle = 0 });
|
|
||||||
ndmPrimitives.Add(concreteRectangle.GetNdmPrimitive());
|
|
||||||
//Добавляем 4 точки для арматуры
|
|
||||||
// 0.05 - величина защитного слоя (расстояние от грани прямоугольника до центра арматуры
|
|
||||||
//С площадью нижней арматуры
|
|
||||||
var leftBottomReinforcementPoint = new dContext.Point(new Point2D { X = -width / 2 + 0.05d, Y = -height / 2 + 0.05 }, new Point { Area = bottomArea });
|
|
||||||
ndmPrimitives.Add(leftBottomReinforcementPoint.GetNdmPrimitive());
|
|
||||||
var rightBottomReinforcementPoint = new Point(new Point2D { X = width / 2 - 0.05d, Y = -height / 2 + 0.05 }, new Point { Area = bottomArea });
|
|
||||||
ndmPrimitives.Add(rightBottomReinforcementPoint.GetNdmPrimitive());
|
|
||||||
//С площадью верхней арматуры
|
|
||||||
var leftTopReinforcementPoint = new dContext.Point(new Point2D { X = -width / 2 + 0.05d, Y = height / 2 - 0.05 }, new Point { Area = topArea });
|
|
||||||
ndmPrimitives.Add(leftTopReinforcementPoint.GetNdmPrimitive());
|
|
||||||
var rightTopReinforcementPoint = new dContext.Point(new Point2D { X = width / 2 - 0.05d, Y = height / 2 - 0.05 }, new Point { Area = topArea });
|
|
||||||
ndmPrimitives.Add(rightTopReinforcementPoint.GetNdmPrimitive());
|
|
||||||
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
|
|
||||||
ndmCollection.AddRange(Triangulation.GetNdms(ndmPrimitives, options));
|
|
||||||
var loaderData = new LoaderOptions
|
|
||||||
{
|
|
||||||
Preconditions = new Preconditions
|
|
||||||
{
|
|
||||||
ConditionRate = 0.01,
|
|
||||||
MaxIterationCount = 100,
|
|
||||||
StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz }
|
|
||||||
},
|
|
||||||
NdmCollection = ndmCollection
|
|
||||||
};
|
|
||||||
var calculator = new Calculator();
|
|
||||||
//Act
|
|
||||||
calculator.Run(loaderData, new CancellationToken());
|
|
||||||
var results = calculator.Result;
|
|
||||||
//Assert
|
|
||||||
Assert.NotNull(results);
|
|
||||||
//Основной результат расчета - матрица (матрица-столбец) деформаций, состоящая из трех членов
|
|
||||||
var strainMatrix = results.StrainMatrix;
|
|
||||||
Assert.NotNull(strainMatrix);
|
|
||||||
Assert.AreEqual(expectedKx, strainMatrix.Kx, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKx));
|
|
||||||
Assert.AreEqual(expectedKy, strainMatrix.Ky, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKy));
|
|
||||||
Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,8 @@ using System.Collections.Generic;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperLogics.Models.Calculations;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
|
||||||
namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
||||||
@@ -30,7 +31,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
|||||||
double width = 0.4;
|
double width = 0.4;
|
||||||
double height = 0.6;
|
double height = 0.6;
|
||||||
var ndmCollection = new List<INdm>();
|
var ndmCollection = new List<INdm>();
|
||||||
ITriangulationOptions options = new TriangulationOptions { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
ITriangulationOptions options = new TriangulationOptions { LimiteState = LimitStates.ULS, CalcTerm = CalcTerms.ShortTerm };
|
||||||
var primitives = new List<INdmPrimitive>();
|
var primitives = new List<INdmPrimitive>();
|
||||||
primitives.AddRange(GetConcreteNdms(width, height));
|
primitives.AddRange(GetConcreteNdms(width, height));
|
||||||
primitives.AddRange(GetReinforcementNdms(width, height, topArea, bottomArea));
|
primitives.AddRange(GetReinforcementNdms(width, height, topArea, bottomArea));
|
||||||
@@ -60,12 +61,8 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
|||||||
|
|
||||||
private IEnumerable<INdmPrimitive> GetConcreteNdms(double width, double height)
|
private IEnumerable<INdmPrimitive> GetConcreteNdms(double width, double height)
|
||||||
{
|
{
|
||||||
double strength = 40e6;
|
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.EuroCode_2_1990);
|
||||||
IPoint2D center = new Point2D { X = 0, Y = 0 };
|
var primitive = new RectanglePrimitive(material) {CenterX = 0, CenterY = 0, Width = width, Height = height, NdmMaxSize = 1, NdmMinDivision = 20 };
|
||||||
IRectangleShape rectangle = new RectangleShape { Width = width, Height = height, Angle = 0 };
|
|
||||||
IPrimitiveMaterial material = new PrimitiveMaterial { MaterialType = MaterialTypes.Concrete, ClassName = "С40", Strength = strength };
|
|
||||||
//ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
|
||||||
INdmPrimitive primitive = new NdmPrimitive { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 20 };
|
|
||||||
List<INdmPrimitive> primitives = new List<INdmPrimitive> {primitive};
|
List<INdmPrimitive> primitives = new List<INdmPrimitive> {primitive};
|
||||||
return primitives;
|
return primitives;
|
||||||
}
|
}
|
||||||
@@ -73,11 +70,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
|||||||
private IEnumerable<INdmPrimitive> GetReinforcementNdms(double width, double height, double topArea, double bottomArea)
|
private IEnumerable<INdmPrimitive> GetReinforcementNdms(double width, double height, double topArea, double bottomArea)
|
||||||
{
|
{
|
||||||
double gap = 0.05d;
|
double gap = 0.05d;
|
||||||
double strength = 4e8;
|
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, CodeTypes.EuroCode_2_1990);
|
||||||
IShape topReinforcement = new PointShape { Area = topArea };
|
|
||||||
IShape bottomReinforcement = new PointShape { Area = bottomArea };
|
|
||||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength };
|
|
||||||
//ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
|
||||||
IPoint2D centerRT = new Point2D { X = width / 2 - gap, Y = height / 2 - gap };
|
IPoint2D centerRT = new Point2D { X = width / 2 - gap, Y = height / 2 - gap };
|
||||||
IPoint2D centerLT = new Point2D { X = - (width / 2 - gap), Y = height / 2 - gap };
|
IPoint2D centerLT = new Point2D { X = - (width / 2 - gap), Y = height / 2 - gap };
|
||||||
IPoint2D centerRB = new Point2D { X = width / 2 - gap, Y = - (height / 2 - gap) };
|
IPoint2D centerRB = new Point2D { X = width / 2 - gap, Y = - (height / 2 - gap) };
|
||||||
@@ -85,16 +78,16 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
|||||||
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||||
INdmPrimitive primitive;
|
INdmPrimitive primitive;
|
||||||
//Right top bar
|
//Right top bar
|
||||||
primitive = new NdmPrimitive { Center = centerRT, Shape = topReinforcement, PrimitiveMaterial = primitiveMaterial};
|
primitive = new PointPrimitive(material) { Area = topArea, CenterX = centerRT.X, CenterY = centerRT.Y };
|
||||||
primitives.Add(primitive);
|
primitives.Add(primitive);
|
||||||
//Left top bar
|
//Left top bar
|
||||||
primitive = new NdmPrimitive { Center = centerLT, Shape = topReinforcement, PrimitiveMaterial = primitiveMaterial };
|
primitive = new PointPrimitive(material) { Area = topArea, CenterX = centerLT.X, CenterY = centerLT.Y };
|
||||||
primitives.Add(primitive);
|
primitives.Add(primitive);
|
||||||
//Right bottom bar
|
//Right bottom bar
|
||||||
primitive = new NdmPrimitive { Center = centerRB, Shape = bottomReinforcement, PrimitiveMaterial = primitiveMaterial };
|
primitive = new PointPrimitive(material) { Area = bottomArea, CenterX = centerRB.X, CenterY = centerRB.Y };
|
||||||
primitives.Add(primitive);
|
primitives.Add(primitive);
|
||||||
//Left bottom bar
|
//Left bottom bar
|
||||||
primitive = new NdmPrimitive { Center = centerLB, Shape = bottomReinforcement, PrimitiveMaterial = primitiveMaterial };
|
primitive = new PointPrimitive(material) { Area = bottomArea, CenterX = centerLB.X, CenterY = centerLB.Y };
|
||||||
primitives.Add(primitive);
|
primitives.Add(primitive);
|
||||||
return primitives;
|
return primitives;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ using System.Threading;
|
|||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
|
||||||
namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
|
namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
|
||||||
{
|
{
|
||||||
@@ -17,15 +20,13 @@ namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
|
|||||||
[TestCase(0.3, 0.6, 4e8, 0, 0, 1800000, 0d, 0d, 5e-5d)]
|
[TestCase(0.3, 0.6, 4e8, 0, 0, 1800000, 0d, 0d, 5e-5d)]
|
||||||
[TestCase(0.3, 0.6, 4e8, 0, 0, -1800000, 0d, 0d, -5e-5d)]
|
[TestCase(0.3, 0.6, 4e8, 0, 0, -1800000, 0d, 0d, -5e-5d)]
|
||||||
[TestCase(0.3, 0.6, 4e8, 7000000, 0, 0, 0.0065882684745345067d, 0d, 0d)]
|
[TestCase(0.3, 0.6, 4e8, 7000000, 0, 0, 0.0065882684745345067d, 0d, 0d)]
|
||||||
[TestCase(0.3, 0.6, 6e8, 10000000, 0, 0, 0.010485801788961743d, 0d, -0.00011114996218404612d)]
|
//[TestCase(0.3, 0.6, 6e8, 10000000, 0, 0, 0.010485801788961743d, 0d, -0.00011114996218404612d)]
|
||||||
public void Run_ShouldPass(double width, double height, double strength, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
|
public void Run_ShouldPass(double width, double height, double strength, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
|
||||||
{
|
{
|
||||||
//Arrange
|
//Arrange
|
||||||
IPoint2D center = new Point2D { X = 0, Y = 0 };
|
var headMaterial = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, CodeTypes.EuroCode_2_1990);
|
||||||
IRectangleShape rectangle = new RectangleShape { Width = width, Height = height, Angle = 0 };
|
ITriangulationOptions options = new TriangulationOptions { LimiteState = LimitStates.ULS, CalcTerm = CalcTerms.ShortTerm };
|
||||||
IPrimitiveMaterial material = new PrimitiveMaterial { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength };
|
INdmPrimitive primitive = new RectanglePrimitive { CenterX = 0, CenterY = 0, Width = width, Height = height, HeadMaterial = headMaterial, NdmMaxSize = 1, NdmMinDivision = 100 };
|
||||||
ITriangulationOptions options = new TriangulationOptions { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
|
||||||
INdmPrimitive primitive = new NdmPrimitive { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 100 };
|
|
||||||
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||||
primitives.Add(primitive);
|
primitives.Add(primitive);
|
||||||
var ndmCollection = Triangulation.GetNdms(primitives, options);
|
var ndmCollection = Triangulation.GetNdms(primitives, options);
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="FieldsVisualizerTests\ColorOperationTests\GetColorByValueTest.cs" />
|
<Compile Include="FieldsVisualizerTests\ColorOperationTests\GetColorByValueTest.cs" />
|
||||||
<Compile Include="FieldsVisualizerTests\WindowTests\ViewerTest.cs" />
|
<Compile Include="FieldsVisualizerTests\WindowTests\ViewerTest.cs" />
|
||||||
<Compile Include="FunctionalTests\Ndms\RCSections\RCSectionFromNdmPrimitiveTest.cs" />
|
|
||||||
<Compile Include="FunctionalTests\Ndms\RCSections\RCSectionTest.cs" />
|
<Compile Include="FunctionalTests\Ndms\RCSections\RCSectionTest.cs" />
|
||||||
<Compile Include="FunctionalTests\Ndms\SteelSections\ReinforcementTest.cs" />
|
<Compile Include="FunctionalTests\Ndms\SteelSections\ReinforcementTest.cs" />
|
||||||
<Compile Include="Infrastructures\Logics\ExpectedProcessor.cs" />
|
<Compile Include="Infrastructures\Logics\ExpectedProcessor.cs" />
|
||||||
@@ -50,6 +49,7 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="UnitTests\Ndms\Triangulations\RectangleTriangulationTest.cs" />
|
<Compile Include="UnitTests\Ndms\Triangulations\RectangleTriangulationTest.cs" />
|
||||||
<Compile Include="UnitTests\WindowTests\Calculations\CalculationProperties\CalculationPropertyWindowTest.cs" />
|
<Compile Include="UnitTests\WindowTests\Calculations\CalculationProperties\CalculationPropertyWindowTest.cs" />
|
||||||
|
<Compile Include="ViewModelTests\NdmPrimitiveTests.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
|||||||
IMaterial material = new Material();
|
IMaterial material = new Material();
|
||||||
IPoint2D center = new Point2D { X = centerX, Y = centerY };
|
IPoint2D center = new Point2D { X = centerX, Y = centerY };
|
||||||
IRectangleShape rectangle = new RectangleShape { Width = width, Height = height, Angle = angle };
|
IRectangleShape rectangle = new RectangleShape { Width = width, Height = height, Angle = angle };
|
||||||
IRectangleTriangulationLogicOptions options = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogicOptions(center, rectangle, ndmMaxSize, ndmMinDivision);
|
IRectangleTriangulationLogicOptions options = new RectangleTriangulationLogicOptions(center, rectangle, ndmMaxSize, ndmMinDivision);
|
||||||
IRectangleTriangulationLogic logic = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogic(options);
|
IRectangleTriangulationLogic logic = new RectangleTriangulationLogic(options);
|
||||||
//Act
|
//Act
|
||||||
var result = logic.GetNdmCollection(material);
|
var result = logic.GetNdmCollection(material);
|
||||||
//Assert
|
//Assert
|
||||||
|
|||||||
36
StructureHelperTests/ViewModelTests/NdmPrimitiveTests.cs
Normal file
36
StructureHelperTests/ViewModelTests/NdmPrimitiveTests.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using LoaderCalculator;
|
||||||
|
using LoaderCalculator.Data.Matrix;
|
||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using LoaderCalculator.Data.SourceData;
|
||||||
|
using LoaderCalculator.Tests.Infrastructures.Logics;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
|
|
||||||
|
namespace StructureHelperTests.ViewModelTests
|
||||||
|
{
|
||||||
|
public class NdmPrimitiveTests
|
||||||
|
{
|
||||||
|
[TestCase]
|
||||||
|
public void RectanglePrimitiveTest()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018);
|
||||||
|
var primitive = new RectanglePrimitive(material);
|
||||||
|
var primitiveBase = new RectangleViewPrimitive(primitive);
|
||||||
|
//Act
|
||||||
|
var vm = new PrimitivePropertiesViewModel(primitiveBase, new CrossSectionRepository());
|
||||||
|
//Assert
|
||||||
|
Assert.NotNull(vm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceCalculatorView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
|
||||||
|
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Calculations.Calculators"
|
||||||
|
d:DataContext="{d:DesignInstance vm:ForceCalculatorViewModel}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Analysis by forces" Height="300" Width="400" MinHeight="300" MinWidth="400" WindowStartupLocation="CenterScreen">
|
||||||
|
<Window.Resources>
|
||||||
|
<Style x:Key="cbStyle" TargetType="CheckBox">
|
||||||
|
<Setter Property="Margin" Value="0,5,0,5"/>
|
||||||
|
</Style>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition Height="20"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TabControl>
|
||||||
|
<TabItem Header="General">
|
||||||
|
<StackPanel>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="100"/>
|
||||||
|
<ColumnDefinition Width="300"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="Name"/>
|
||||||
|
<TextBox Grid.Column="1" Text="{Binding Name}"/>
|
||||||
|
</Grid>
|
||||||
|
<GroupBox Header="Limit States">
|
||||||
|
<StackPanel>
|
||||||
|
<CheckBox Style="{StaticResource cbStyle}" Content="Ultimate Limit State"/>
|
||||||
|
<CheckBox Style="{StaticResource cbStyle}" Content="Serviceability Limit State"/>
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox>
|
||||||
|
<GroupBox Header="Duration">
|
||||||
|
<StackPanel>
|
||||||
|
<CheckBox Style="{StaticResource cbStyle}" Content="Short Term"/>
|
||||||
|
<CheckBox Style="{StaticResource cbStyle}" Content="Long Term"/>
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox>
|
||||||
|
</StackPanel>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Forces">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition Width="60"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ListBox>
|
||||||
|
|
||||||
|
</ListBox>
|
||||||
|
<StackPanel Grid.Column="1">
|
||||||
|
<Button Content="Add all"/>
|
||||||
|
<Button Content="Clear all"/>
|
||||||
|
<Button Content=">>"/>
|
||||||
|
<Button Content="<<"/>
|
||||||
|
</StackPanel>
|
||||||
|
<ListBox Grid.Column="2">
|
||||||
|
|
||||||
|
</ListBox>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Primitives">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition Width="60"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ListBox ItemsSource="{Binding AllowedPrimitives}"
|
||||||
|
SelectedItem="{Binding SelectedAllowedPrimitive}"
|
||||||
|
ItemTemplate="{StaticResource ColoredItemTemplate}">
|
||||||
|
</ListBox>
|
||||||
|
<StackPanel Grid.Column="1">
|
||||||
|
<Button Content="Add all" Command="{Binding AddAllPrimitivesCommand}"/>
|
||||||
|
<Button Content="Clear all" Command="{Binding ClearAllPrimitivesCommand}"/>
|
||||||
|
<Button Content=">>" Command="{Binding AddSelectedPrimitiveCommand}"/>
|
||||||
|
<Button Content="<<" Command="{Binding RemoveSelectedPrimitiveCommand}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<ListBox Grid.Column="2" ItemsSource="{Binding Primitives}" SelectedItem="{Binding SelectedPrimitive}" ItemTemplate="{StaticResource ColoredItemTemplate}">
|
||||||
|
|
||||||
|
</ListBox>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Iterations">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="Required Accuracy" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||||
|
<TextBox Style="{StaticResource ValidatedError}" Grid.Column="2" Margin="5,5,5,5" Text="{Binding Path=IterationAccuracy, ValidatesOnDataErrors=True}"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Maximum Iteration Count" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.ColumnSpan="2"/>
|
||||||
|
<TextBox Style="{StaticResource ValidatedError}" Grid.Column="2" Grid.Row="1" Margin="5,5,5,5" Text="{Binding Path=MaxIterationCount, ValidatesOnDataErrors=True}"/>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||||
|
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.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для ForceCalculatorView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ForceCalculatorView : Window
|
||||||
|
{
|
||||||
|
ForceCalculatorViewModel forceCalculatorViewModel;
|
||||||
|
|
||||||
|
public ForceCalculatorView(ForceCalculatorViewModel _forceCalculatorViewModel)
|
||||||
|
{
|
||||||
|
forceCalculatorViewModel = _forceCalculatorViewModel;
|
||||||
|
DataContext = forceCalculatorViewModel;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,37 +4,43 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:StructureHelper.Windows.Forces"
|
xmlns:local="clr-namespace:StructureHelper.Windows.Forces"
|
||||||
|
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Forces"
|
||||||
|
d:DataContext="{d:DesignInstance vm:ForceCombinationViewModel}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Force Combination" Height="250" Width="450" MinHeight="300" MinWidth="400">
|
Title="Force Combination" Height="250" Width="450" MinHeight="300" MinWidth="400">
|
||||||
<TabControl>
|
<Window.Resources>
|
||||||
<TabItem Header="Forces">
|
<DataTemplate x:Key="ForceTemplate">
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
</DataTemplate>
|
||||||
<RowDefinition Height="Auto" MinHeight="25"/>
|
</Window.Resources>
|
||||||
<RowDefinition Height="Auto" MinHeight="25"/>
|
<StackPanel>
|
||||||
<RowDefinition Height="Auto" MinHeight="25"/>
|
<Grid>
|
||||||
<RowDefinition Height="Auto" MinHeight="25"/>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" MinHeight="25"/>
|
<RowDefinition/>
|
||||||
</Grid.RowDefinitions>
|
<RowDefinition/>
|
||||||
<Grid.ColumnDefinitions>
|
<RowDefinition/>
|
||||||
<ColumnDefinition Width="120"/>
|
</Grid.RowDefinitions>
|
||||||
<ColumnDefinition Width="100"/>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="auto"/>
|
<ColumnDefinition Width="100"/>
|
||||||
</Grid.ColumnDefinitions>
|
<ColumnDefinition Width="*"/>
|
||||||
<TextBlock Grid.RowSpan="2" Text="Ultimate limit state"/>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Grid.Column="1" Text="Short term"/>
|
<TextBlock Text="Name"/>
|
||||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="Long term"/>
|
<TextBox Grid.Column="1" Text="{Binding Name}"/>
|
||||||
<TextBlock Grid.Row="2" Grid.RowSpan="2" Text="Ultimate limit state"/>
|
<TextBlock Grid.Row="1" Text="Center X"/>
|
||||||
<TextBlock Grid.Row="2" Grid.Column="1" Text="Short term"/>
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding CenterX}"/>
|
||||||
<TextBlock Grid.Row="3" Grid.Column="1" Text="Long term"/>
|
<TextBlock Grid.Row="2" Text="Center Y"/>
|
||||||
<local:ForceTupleControl Grid.Column="2"/>
|
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CenterY}"/>
|
||||||
<local:ForceTupleControl Grid.Row="1" Grid.Column="2"/>
|
</Grid>
|
||||||
<local:ForceTupleControl Grid.Row="2" Grid.Column="2"/>
|
<DataGrid x:Name="ForceGrid" AutoGenerateColumns="False"
|
||||||
<local:ForceTupleControl Grid.Row="3" Grid.Column="2"/>
|
ItemsSource="{Binding ForceTuples}"
|
||||||
</Grid>
|
SelectedItem="{Binding SelectedTuple}">
|
||||||
</TabItem>
|
<DataGrid.Columns>
|
||||||
<TabItem Header="Additional">
|
<DataGridTextColumn Header="Limit State" Width="90" Binding="{Binding LimitState}"/>
|
||||||
|
<DataGridTextColumn Header="Duration" Width="90" Binding="{Binding CalcTerm}"/>
|
||||||
</TabItem>
|
<DataGridTextColumn Header="Moment Mx" Width="90" Binding="{Binding ForceTuple.Mx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||||
</TabControl>
|
<DataGridTextColumn Header="Moment My" Width="90" Binding="{Binding ForceTuple.My, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<DataGridTextColumn Header="Force Nz" Width="90" Binding="{Binding ForceTuple.Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</StackPanel>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using System;
|
using StructureHelper.Windows.ViewModels.Forces;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -19,8 +21,18 @@ namespace StructureHelper.Windows.Forces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ForceCombinationView : Window
|
public partial class ForceCombinationView : Window
|
||||||
{
|
{
|
||||||
public ForceCombinationView()
|
ForceCombinationViewModel viewModel;
|
||||||
|
public ForceCombinationView(ForceCombinationViewModel _viewModel)
|
||||||
{
|
{
|
||||||
|
viewModel = _viewModel;
|
||||||
|
DataContext = viewModel;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceCombinationView(IForceCombinationList combinationList)
|
||||||
|
{
|
||||||
|
viewModel = new ForceCombinationViewModel(combinationList);
|
||||||
|
DataContext = viewModel;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ using StructureHelper.UnitSystem.Systems;
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Services.Units;
|
using StructureHelperCommon.Services.Units;
|
||||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
using StructureHelperLogics.Models.Materials.Factories;
|
|
||||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
using StructureHelperLogics.Services;
|
using StructureHelperLogics.Services;
|
||||||
using StructureHelperLogics.Services.NdmCalculations;
|
using StructureHelperLogics.Services.NdmCalculations;
|
||||||
@@ -25,9 +25,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
{
|
{
|
||||||
public class MainModel
|
public class MainModel
|
||||||
{
|
{
|
||||||
//const CodeTypes code = CodeTypes.EuroCode_2_1990;
|
public ICrossSection Section { get; private set; }
|
||||||
const CodeTypes code = CodeTypes.SP63_13330_2018;
|
|
||||||
|
|
||||||
private IPrimitiveRepository primitiveRepository;
|
private IPrimitiveRepository primitiveRepository;
|
||||||
public IHeadMaterialRepository HeadMaterialRepository { get; }
|
public IHeadMaterialRepository HeadMaterialRepository { get; }
|
||||||
public List<IHeadMaterial> HeadMaterials { get; }
|
public List<IHeadMaterial> HeadMaterials { get; }
|
||||||
@@ -44,10 +42,10 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
this.calculationService = calculationService;
|
this.calculationService = calculationService;
|
||||||
this.unitSystemService = unitSystemService;
|
this.unitSystemService = unitSystemService;
|
||||||
|
|
||||||
|
Section = new CrossSection();
|
||||||
CalculationProperty = new CalculationProperty();
|
CalculationProperty = new CalculationProperty();
|
||||||
HeadMaterials = new List<IHeadMaterial>();
|
HeadMaterials = new List<IHeadMaterial>();
|
||||||
HeadMaterialRepository = new HeadMaterialRepository(this);
|
HeadMaterialRepository = new HeadMaterialRepository(this);
|
||||||
HeadMaterialRepository.LibMaterials = LibMaterialFactory.GetLibMaterials(code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//public IStrainMatrix Calculate(double mx, double my, double nz)
|
//public IStrainMatrix Calculate(double mx, double my, double nz)
|
||||||
@@ -60,8 +58,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
|
|
||||||
public IEnumerable<INdm> GetNdms(ICalculationProperty calculationProperty)
|
public IEnumerable<INdm> GetNdms(ICalculationProperty calculationProperty)
|
||||||
{
|
{
|
||||||
var unitSystem = unitSystemService.GetCurrentSystem();
|
var ndmPrimitives = Section.SectionRepository.Primitives;
|
||||||
var ndmPrimitives = primitiveRepository.Primitives.Select(x => x.GetNdmPrimitive()).ToArray();
|
|
||||||
|
|
||||||
//Настройки триангуляции, пока опции могут быть только такие
|
//Настройки триангуляции, пока опции могут быть только такие
|
||||||
ITriangulationOptions options = new TriangulationOptions { LimiteState = calculationProperty.LimitState, CalcTerm = calculationProperty.CalcTerm };
|
ITriangulationOptions options = new TriangulationOptions { LimiteState = calculationProperty.LimitState, CalcTerm = calculationProperty.CalcTerm };
|
||||||
|
|||||||
@@ -62,32 +62,38 @@
|
|||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Expander Header="Materials" ExpandDirection="Down" MinWidth="20">
|
<Expander Header="Actions" MinWidth="20">
|
||||||
<Expander.ContextMenu>
|
<Expander.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<Button Content="Materials" Command="{Binding EditHeadMaterialsCommand}"/>
|
<Button Content="Add Force Combination" Command="{Binding AddForceCombinationCommand}"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</Expander.ContextMenu>
|
</Expander.ContextMenu>
|
||||||
<ListBox ItemsSource="{Binding HeadMaterials}">
|
<ListBox ItemsSource="{Binding ForceCombinationLists}" SelectedItem="{Binding SelectedForceCombinationList}">
|
||||||
|
<ListBox.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<Button Content="Edit" Command="{Binding EditForceCombinationCommand}"/>
|
||||||
|
<Button Content="Delete" Command="{Binding DeleteForceCombinationCommand}"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</ListBox.ContextMenu>
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<TextBlock Text="{Binding Name}"/>
|
||||||
<ColumnDefinition Width="20"/>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Rectangle Grid.Column="0" Margin="3">
|
|
||||||
<Rectangle.Fill>
|
|
||||||
<SolidColorBrush Color="{Binding Color}"/>
|
|
||||||
</Rectangle.Fill>
|
|
||||||
</Rectangle>
|
|
||||||
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
</Expander>
|
</Expander>
|
||||||
<Expander Header="Geometry" ExpandDirection="Down" MinWidth="20" >
|
<Expander Header="Materials" MinWidth="20">
|
||||||
|
<Expander.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<Button Content="Materials" Command="{Binding EditHeadMaterialsCommand}"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</Expander.ContextMenu>
|
||||||
|
<ListBox ItemsSource="{Binding HeadMaterials}" ItemTemplate="{StaticResource ColoredItemTemplate}">
|
||||||
|
</ListBox>
|
||||||
|
</Expander>
|
||||||
|
<Expander Header="Geometry" MinWidth="20" >
|
||||||
<Expander.ContextMenu>
|
<Expander.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<MenuItem Header="Add">
|
<MenuItem Header="Add">
|
||||||
@@ -96,43 +102,33 @@
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</Expander.ContextMenu>
|
</Expander.ContextMenu>
|
||||||
<ListBox ItemsSource="{Binding Primitives}" SelectedItem="{Binding SelectedPrimitive}">
|
<ListBox ItemsSource="{Binding Primitives}" SelectedItem="{Binding SelectedPrimitive}" ItemTemplate="{StaticResource ColoredItemTemplate}">
|
||||||
<ListBox.ContextMenu>
|
<ListBox.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<Button Content="Edit" Command="{Binding EditPrimitive}"/>
|
<Button Content="Edit" Command="{Binding EditPrimitive}"/>
|
||||||
<Button Content="Delete" Command="{Binding DeletePrimitive}"/>
|
<Button Content="Delete" Command="{Binding DeletePrimitive}"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</ListBox.ContextMenu>
|
</ListBox.ContextMenu>
|
||||||
|
</ListBox>
|
||||||
|
</Expander>
|
||||||
|
<Expander Header="Analyses" MinWidth="20">
|
||||||
|
<Expander.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<Button Content="Add Calculator" Command="{Binding AddCalculatorCommand}"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</Expander.ContextMenu>
|
||||||
|
<ListBox ItemsSource="{Binding Calculators}" SelectedItem="{Binding SelectedCalculator}">
|
||||||
|
<ListBox.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<Button Content="Edit" Command="{Binding EditCalculatorCommand}"/>
|
||||||
|
<!--<Button Content="Delete" Command="{Binding DeleteForceCombinationCommand}"/>-->
|
||||||
|
</ContextMenu>
|
||||||
|
</ListBox.ContextMenu>
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<TextBlock Text="{Binding Name}"/>
|
||||||
<ColumnDefinition Width="20"/>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Rectangle Grid.Column="0" Margin="3">
|
|
||||||
<Rectangle.Fill>
|
|
||||||
<SolidColorBrush Color="{Binding Color}"/>
|
|
||||||
</Rectangle.Fill>
|
|
||||||
</Rectangle>
|
|
||||||
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!--<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="25"/>
|
|
||||||
<RowDefinition Height="20"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="1"/>
|
|
||||||
<ColumnDefinition MinWidth="50"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Viewbox Grid.RowSpan="2">
|
|
||||||
|
|
||||||
</Viewbox>
|
|
||||||
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
|
||||||
<Button Grid.Column="1" Grid.Row="1" Content="..."/>
|
|
||||||
</Grid>-->
|
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
|||||||
@@ -11,18 +11,27 @@ using StructureHelper.Services.Primitives;
|
|||||||
using StructureHelper.UnitSystem;
|
using StructureHelper.UnitSystem;
|
||||||
using StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow;
|
using StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow;
|
||||||
using StructureHelper.Windows.CalculationWindows.CalculationResultWindow;
|
using StructureHelper.Windows.CalculationWindows.CalculationResultWindow;
|
||||||
|
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||||
using StructureHelper.Windows.ColorPickerWindow;
|
using StructureHelper.Windows.ColorPickerWindow;
|
||||||
|
using StructureHelper.Windows.Forces;
|
||||||
using StructureHelper.Windows.MainWindow.Materials;
|
using StructureHelper.Windows.MainWindow.Materials;
|
||||||
using StructureHelper.Windows.PrimitiveProperiesWindow;
|
using StructureHelper.Windows.PrimitiveProperiesWindow;
|
||||||
using StructureHelper.Windows.PrimitiveTemplates.RCs.RectangleBeam;
|
using StructureHelper.Windows.PrimitiveTemplates.RCs.RectangleBeam;
|
||||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationProperies;
|
using StructureHelper.Windows.ViewModels.Calculations.CalculationProperies;
|
||||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationResult;
|
using StructureHelper.Windows.ViewModels.Calculations.CalculationResult;
|
||||||
|
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
using StructureHelperCommon.Infrastructures.Strings;
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
using StructureHelperLogics.Models.Templates.RCs;
|
using StructureHelperLogics.Models.Templates.RCs;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using StructureHelperLogics.Services.NdmCalculations;
|
using StructureHelperLogics.Services.NdmCalculations;
|
||||||
using System;
|
using System;
|
||||||
@@ -38,17 +47,46 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
public class MainViewModel : ViewModelBase
|
public class MainViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
const double scale = 1d;
|
const double scale = 1d;
|
||||||
|
|
||||||
|
ICrossSection section;
|
||||||
|
ICrossSectionRepository repository => section.SectionRepository;
|
||||||
|
|
||||||
private double ConstAxisLineThickness = 2d * scale;
|
private double ConstAxisLineThickness = 2d * scale;
|
||||||
private double ConstGridLineThickness = 0.25d * scale;
|
private double ConstGridLineThickness = 0.25d * scale;
|
||||||
|
|
||||||
private List<IHeadMaterial> headMaterials;
|
|
||||||
private readonly double scaleRate = 1.1d;
|
private readonly double scaleRate = 1.1d;
|
||||||
|
|
||||||
private IPrimitiveRepository PrimitiveRepository { get; }
|
|
||||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||||
|
public IForceCombinationList SelectedForceCombinationList { get; set; }
|
||||||
|
public INdmCalculator SelectedCalculator { get; set; }
|
||||||
|
|
||||||
private MainModel Model { get; }
|
private MainModel Model { get; }
|
||||||
public ObservableCollection<PrimitiveBase> Primitives { get; set; }
|
public ObservableCollection<PrimitiveBase> Primitives { get; private set; }
|
||||||
|
|
||||||
|
public ObservableCollection<IForceCombinationList> ForceCombinationLists
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var collection = new ObservableCollection<IForceCombinationList>();
|
||||||
|
foreach (var item in Model.Section.SectionRepository.ForceCombinationLists)
|
||||||
|
{
|
||||||
|
collection.Add(item);
|
||||||
|
}
|
||||||
|
return collection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ObservableCollection<INdmCalculator> Calculators
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var collection = new ObservableCollection<INdmCalculator>();
|
||||||
|
foreach (var item in Model.Section.SectionRepository.Calculators)
|
||||||
|
{
|
||||||
|
collection.Add(item);
|
||||||
|
}
|
||||||
|
return collection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private double panelX, panelY, scrollPanelX, scrollPanelY;
|
private double panelX, panelY, scrollPanelX, scrollPanelY;
|
||||||
private CalculationProperty calculationProperty;
|
private CalculationProperty calculationProperty;
|
||||||
@@ -119,7 +157,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
var collection = new ObservableCollection<IHeadMaterial>();
|
var collection = new ObservableCollection<IHeadMaterial>();
|
||||||
foreach (var obj in headMaterials)
|
foreach (var obj in Model.Section.SectionRepository.HeadMaterials)
|
||||||
{
|
{
|
||||||
collection.Add(obj);
|
collection.Add(obj);
|
||||||
}
|
}
|
||||||
@@ -148,6 +186,117 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
set => OnPropertyChanged(value, ref yY2);
|
set => OnPropertyChanged(value, ref yY2);
|
||||||
}
|
}
|
||||||
public ICommand AddPrimitive { get; }
|
public ICommand AddPrimitive { get; }
|
||||||
|
|
||||||
|
private ICommand addForceCombinationCommand;
|
||||||
|
public ICommand AddForceCombinationCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return addForceCombinationCommand ??
|
||||||
|
(
|
||||||
|
addForceCombinationCommand = new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
AddForceCombination();
|
||||||
|
OnPropertyChanged(nameof(ForceCombinationLists));
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void AddForceCombination()
|
||||||
|
{
|
||||||
|
var item = new ForceCombinationList() { Name = "New Force Combination" };
|
||||||
|
Model.Section.SectionRepository.ForceCombinationLists.Add(item);
|
||||||
|
}
|
||||||
|
private ICommand deleteForceCombinationCommand;
|
||||||
|
public ICommand DeleteForceCombinationCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return deleteForceCombinationCommand ??
|
||||||
|
(
|
||||||
|
deleteForceCombinationCommand = new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
DeleteForceCombination();
|
||||||
|
OnPropertyChanged(nameof(ForceCombinationLists));
|
||||||
|
}, o => SelectedForceCombinationList != null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DeleteForceCombination()
|
||||||
|
{
|
||||||
|
var dialogResult = MessageBox.Show("Delete action?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||||
|
if (dialogResult == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
Model.Section.SectionRepository.ForceCombinationLists.Remove(SelectedForceCombinationList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private ICommand editForceCombinationCommand;
|
||||||
|
public ICommand EditForceCombinationCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return editForceCombinationCommand ??
|
||||||
|
(
|
||||||
|
editForceCombinationCommand = new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
EditForceCombination();
|
||||||
|
OnPropertyChanged(nameof(ForceCombinationLists));
|
||||||
|
}, o => SelectedForceCombinationList != null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void EditForceCombination()
|
||||||
|
{
|
||||||
|
var wnd = new ForceCombinationView(SelectedForceCombinationList);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICommand addCalculatorCommand;
|
||||||
|
public ICommand AddCalculatorCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return addCalculatorCommand ??
|
||||||
|
(
|
||||||
|
addCalculatorCommand = new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
AddCalculator();
|
||||||
|
OnPropertyChanged(nameof(Calculators));
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void AddCalculator()
|
||||||
|
{
|
||||||
|
var item = new ForceCalculator() { Name = "New force calculator"};
|
||||||
|
Model.Section.SectionRepository.Calculators.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICommand editCalculatorCommand;
|
||||||
|
public ICommand EditCalculatorCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return editCalculatorCommand ??
|
||||||
|
(
|
||||||
|
editCalculatorCommand = new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
EditCalculator();
|
||||||
|
OnPropertyChanged(nameof(Calculators));
|
||||||
|
}, o => SelectedCalculator != null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void EditCalculator()
|
||||||
|
{
|
||||||
|
if (SelectedCalculator is ForceCalculator)
|
||||||
|
{
|
||||||
|
var calculator = SelectedCalculator as ForceCalculator;
|
||||||
|
var repository = Model.Section.SectionRepository;
|
||||||
|
var primitives = Primitives.Select(x => x.GetNdmPrimitive()).ToArray();
|
||||||
|
var vm = new ForceCalculatorViewModel( primitives, repository.ForceCombinationLists, calculator);
|
||||||
|
|
||||||
|
var wnd = new ForceCalculatorView(vm);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ICommand Calculate { get; }
|
public ICommand Calculate { get; }
|
||||||
public ICommand DeletePrimitive { get; }
|
public ICommand DeletePrimitive { get; }
|
||||||
public ICommand EditCalculationPropertyCommand { get; }
|
public ICommand EditCalculationPropertyCommand { get; }
|
||||||
@@ -176,11 +325,10 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
private double axisLineThickness;
|
private double axisLineThickness;
|
||||||
private double gridLineThickness;
|
private double gridLineThickness;
|
||||||
|
|
||||||
public MainViewModel(MainModel model, IPrimitiveRepository primitiveRepository, UnitSystemService unitSystemService)
|
public MainViewModel(MainModel model)
|
||||||
{
|
{
|
||||||
PrimitiveRepository = primitiveRepository;
|
|
||||||
Model = model;
|
Model = model;
|
||||||
headMaterials = Model.HeadMaterialRepository.HeadMaterials;
|
section = model.Section;
|
||||||
CanvasWidth = 2d * scale;
|
CanvasWidth = 2d * scale;
|
||||||
CanvasHeight = 1.5d * scale;
|
CanvasHeight = 1.5d * scale;
|
||||||
XX2 = CanvasWidth;
|
XX2 = CanvasWidth;
|
||||||
@@ -276,7 +424,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
ScaleValue /= scaleRate;
|
ScaleValue /= scaleRate;
|
||||||
});
|
});
|
||||||
|
|
||||||
Primitives = new ObservableCollection<PrimitiveBase>();
|
Primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(repository.Primitives);
|
||||||
|
|
||||||
AddPrimitive = new RelayCommand(o =>
|
AddPrimitive = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
@@ -306,8 +454,9 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
|
|
||||||
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);
|
||||||
Primitives.Add(viewPrimitive);
|
Primitives.Add(viewPrimitive);
|
||||||
PrimitiveRepository.Add(viewPrimitive);
|
OnPropertyChanged(nameof(Primitives));
|
||||||
OnPropertyChanged(nameof(PrimitivesCount));
|
OnPropertyChanged(nameof(PrimitivesCount));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -326,7 +475,8 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
foreach (var primitive in GetBeamCasePrimitives())
|
foreach (var primitive in GetBeamCasePrimitives())
|
||||||
{
|
{
|
||||||
Primitives.Add(primitive);
|
Primitives.Add(primitive);
|
||||||
PrimitiveRepository.Add(primitive);
|
var ndmPrimitive = primitive.GetNdmPrimitive();
|
||||||
|
repository.Primitives.Add(ndmPrimitive);
|
||||||
}
|
}
|
||||||
OnPropertyChanged(nameof(PrimitivesCount));
|
OnPropertyChanged(nameof(PrimitivesCount));
|
||||||
AddCaseLoads(-50e3d, 50e3d, 0d);
|
AddCaseLoads(-50e3d, 50e3d, 0d);
|
||||||
@@ -337,7 +487,8 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
foreach (var primitive in GetColumnCasePrimitives())
|
foreach (var primitive in GetColumnCasePrimitives())
|
||||||
{
|
{
|
||||||
Primitives.Add(primitive);
|
Primitives.Add(primitive);
|
||||||
PrimitiveRepository.Add(primitive);
|
var ndmPrimitive = primitive.GetNdmPrimitive();
|
||||||
|
repository.Primitives.Add(ndmPrimitive);
|
||||||
}
|
}
|
||||||
OnPropertyChanged(nameof(PrimitivesCount));
|
OnPropertyChanged(nameof(PrimitivesCount));
|
||||||
AddCaseLoads(50e3d, 50e3d, -100e3d);
|
AddCaseLoads(50e3d, 50e3d, -100e3d);
|
||||||
@@ -348,7 +499,8 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
foreach (var primitive in GetSlabCasePrimitives())
|
foreach (var primitive in GetSlabCasePrimitives())
|
||||||
{
|
{
|
||||||
Primitives.Add(primitive);
|
Primitives.Add(primitive);
|
||||||
PrimitiveRepository.Add(primitive);
|
var ndmPrimitive = primitive.GetNdmPrimitive();
|
||||||
|
repository.Primitives.Add(ndmPrimitive);
|
||||||
}
|
}
|
||||||
OnPropertyChanged(nameof(PrimitivesCount));
|
OnPropertyChanged(nameof(PrimitivesCount));
|
||||||
AddCaseLoads(-20e3d, 0d, 0d);
|
AddCaseLoads(-20e3d, 0d, 0d);
|
||||||
@@ -357,9 +509,8 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
Calculate = new RelayCommand(o =>
|
Calculate = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
CalculateResult();
|
CalculateResult();
|
||||||
|
|
||||||
},
|
},
|
||||||
o => Model.PrimitiveRepository.Primitives.Count() > 0);
|
o => repository.Primitives.Count() > 0);
|
||||||
|
|
||||||
EditCalculationPropertyCommand = new RelayCommand (o => EditCalculationProperty());
|
EditCalculationPropertyCommand = new RelayCommand (o => EditCalculationProperty());
|
||||||
|
|
||||||
@@ -374,7 +525,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
primitive.CenterY -= center[1];
|
primitive.CenterY -= center[1];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
o => Model.PrimitiveRepository.Primitives.Count() > 0
|
o => repository.Primitives.Count() > 0
|
||||||
);
|
);
|
||||||
|
|
||||||
SetPopupCanBeClosedTrue = new RelayCommand(o =>
|
SetPopupCanBeClosedTrue = new RelayCommand(o =>
|
||||||
@@ -392,10 +543,9 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
|
|
||||||
private void EditHeadMaterials()
|
private void EditHeadMaterials()
|
||||||
{
|
{
|
||||||
var wnd = new HeadMaterialsView(Model.HeadMaterialRepository);
|
var wnd = new HeadMaterialsView(repository);
|
||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
headMaterials = Model.HeadMaterialRepository.HeadMaterials;
|
OnPropertyChanged(nameof(HeadMaterials));
|
||||||
OnPropertyChanged(nameof(headMaterials));
|
|
||||||
foreach (var primitive in Primitives)
|
foreach (var primitive in Primitives)
|
||||||
{
|
{
|
||||||
primitive.RefreshColor();
|
primitive.RefreshColor();
|
||||||
@@ -409,7 +559,8 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
var dialogResult = MessageBox.Show("Delete primitive?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
var dialogResult = MessageBox.Show("Delete primitive?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||||
if (dialogResult == DialogResult.Yes)
|
if (dialogResult == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
PrimitiveRepository.Delete(SelectedPrimitive);
|
var ndmPrimitive = SelectedPrimitive.GetNdmPrimitive();
|
||||||
|
repository.Primitives.Remove(ndmPrimitive);
|
||||||
Primitives.Remove(SelectedPrimitive);
|
Primitives.Remove(SelectedPrimitive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -421,9 +572,9 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
{
|
{
|
||||||
if (!(SelectedPrimitive is null))
|
if (!(SelectedPrimitive is null))
|
||||||
{
|
{
|
||||||
var wnd = new PrimitiveProperties(SelectedPrimitive, Model.HeadMaterialRepository);
|
var wnd = new PrimitiveProperties(SelectedPrimitive, repository);
|
||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
OnPropertyChanged(nameof(headMaterials));
|
OnPropertyChanged(nameof(HeadMaterials));
|
||||||
}
|
}
|
||||||
else { MessageBox.Show("Selection is changed", "Please, select primitive", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); }
|
else { MessageBox.Show("Selection is changed", "Please, select primitive", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); }
|
||||||
}
|
}
|
||||||
@@ -458,7 +609,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
|
|
||||||
private bool CheckMaterials()
|
private bool CheckMaterials()
|
||||||
{
|
{
|
||||||
foreach (var item in PrimitiveRepository.Primitives)
|
foreach (var item in Primitives)
|
||||||
{
|
{
|
||||||
if (item.HeadMaterial == null)
|
if (item.HeadMaterial == null)
|
||||||
{
|
{
|
||||||
@@ -507,13 +658,13 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
if (wnd.DialogResult == true)
|
if (wnd.DialogResult == true)
|
||||||
{
|
{
|
||||||
IHeadMaterial concrete = new HeadMaterial() { Name = "Concrete" };
|
var concrete = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, ProgramSetting.CodeType);
|
||||||
concrete.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Concrete & x.Name.Contains("40"))).First();
|
concrete.Name = "Concrete";
|
||||||
IHeadMaterial reinforcement = new HeadMaterial() { Name = "Reinforcement" };
|
var reinforcement = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, ProgramSetting.CodeType);
|
||||||
reinforcement.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Reinforcement & x.Name.Contains("400"))).First();
|
reinforcement.Name = "Reinforcement";
|
||||||
headMaterials.Add(concrete);
|
Model.Section.SectionRepository.HeadMaterials.Add(concrete);
|
||||||
headMaterials.Add(reinforcement);
|
Model.Section.SectionRepository.HeadMaterials.Add(reinforcement);
|
||||||
OnPropertyChanged(nameof(headMaterials));
|
OnPropertyChanged(nameof(HeadMaterials));
|
||||||
var primitives = PrimitiveFactory.GetRectangleRCElement(template, concrete, reinforcement);
|
var primitives = PrimitiveFactory.GetRectangleRCElement(template, concrete, reinforcement);
|
||||||
foreach (var item in primitives)
|
foreach (var item in primitives)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,10 +9,22 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Materials" Height="350" Width="680" MinHeight="350" MinWidth="680" WindowStartupLocation="CenterScreen">
|
Title="Materials" Height="350" Width="680" MinHeight="350" MinWidth="680" WindowStartupLocation="CenterScreen">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<DataTemplate x:Key="LibMaterial">
|
<DataTemplate x:Key="ConcreteLibMaterial">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Library material"/>
|
<TextBlock Text="Library material"/>
|
||||||
<ComboBox Grid.Row="2" Height="25" VerticalAlignment="Top" ItemsSource="{Binding LibMaterials}" SelectedItem="{Binding SelectedLibMaterial}">
|
<ComboBox Grid.Row="2" Height="25" VerticalAlignment="Top" ItemsSource="{Binding LibConcreteMaterials}" SelectedItem="{Binding SelectedLibMaterial}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Name}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="ReinforcementLibMaterial">
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="Library material"/>
|
||||||
|
<ComboBox Grid.Row="2" Height="25" VerticalAlignment="Top" ItemsSource="{Binding LibReinforcementMaterials}" SelectedItem="{Binding SelectedLibMaterial}">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding Name}"/>
|
<TextBlock Text="{Binding Name}"/>
|
||||||
@@ -74,7 +86,8 @@
|
|||||||
</ListBox>
|
</ListBox>
|
||||||
</Grid>
|
</Grid>
|
||||||
<StackPanel Grid.Column="1">
|
<StackPanel Grid.Column="1">
|
||||||
<Button Content="New Lib Material" Command="{Binding AddNewMaterialCommand}"/>
|
<Button Content="New Concrete" Command="{Binding AddNewConcreteMaterialCommand}"/>
|
||||||
|
<Button Content="New Reinforcement" Command="{Binding AddNewReinforcementMaterialCommand}"/>
|
||||||
<Button Content="New Elastic Material" Command="{Binding AddElasticMaterialCommand}"/>
|
<Button Content="New Elastic Material" Command="{Binding AddElasticMaterialCommand}"/>
|
||||||
<Button Content="Edit color" Command="{Binding EditColorCommand}"/>
|
<Button Content="Edit color" Command="{Binding EditColorCommand}"/>
|
||||||
<Button Content="Copy" Command="{Binding CopyHeadMaterialCommand}"/>
|
<Button Content="Copy" Command="{Binding CopyHeadMaterialCommand}"/>
|
||||||
|
|||||||
@@ -25,13 +25,8 @@ namespace StructureHelper.Windows.MainWindow.Materials
|
|||||||
{
|
{
|
||||||
private HeadMaterialsViewModel viewModel;
|
private HeadMaterialsViewModel viewModel;
|
||||||
|
|
||||||
public HeadMaterialsView(IHeadMaterialRepository headMaterialRepository)
|
//public HeadMaterialsView(List<IHeadMaterial> headMaterials) : this(new HeadMaterialsViewModel(headMaterials)) {}
|
||||||
{
|
public HeadMaterialsView(IHasHeadMaterials hasHeadMaterials) : this(new HeadMaterialsViewModel(hasHeadMaterials)) { }
|
||||||
viewModel = new HeadMaterialsViewModel(headMaterialRepository);
|
|
||||||
this.DataContext = viewModel;
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public HeadMaterialsView(HeadMaterialsViewModel vm)
|
public HeadMaterialsView(HeadMaterialsViewModel vm)
|
||||||
{
|
{
|
||||||
viewModel = vm;
|
viewModel = vm;
|
||||||
@@ -47,12 +42,17 @@ namespace StructureHelper.Windows.MainWindow.Materials
|
|||||||
var helperMaterial = selectedMaterial.HelperMaterial;
|
var helperMaterial = selectedMaterial.HelperMaterial;
|
||||||
string dataTemplateName = string.Empty;
|
string dataTemplateName = string.Empty;
|
||||||
Binding binding = new Binding();
|
Binding binding = new Binding();
|
||||||
if (helperMaterial is ILibMaterial)
|
if (helperMaterial is IConcreteLibMaterial)
|
||||||
{
|
{
|
||||||
dataTemplateName = "LibMaterial";
|
dataTemplateName = "ConcreteLibMaterial";
|
||||||
binding.Source = viewModel;
|
binding.Source = viewModel;
|
||||||
}
|
}
|
||||||
if (helperMaterial is IElasticMaterial)
|
else if (helperMaterial is IReinforcementLibMaterial)
|
||||||
|
{
|
||||||
|
dataTemplateName = "ReinforcementLibMaterial";
|
||||||
|
binding.Source = viewModel;
|
||||||
|
}
|
||||||
|
else if (helperMaterial is IElasticMaterial)
|
||||||
{
|
{
|
||||||
dataTemplateName = "ElasticMaterial";
|
dataTemplateName = "ElasticMaterial";
|
||||||
binding.Source = viewModel.SelectedMaterial.HelperMaterial;
|
binding.Source = viewModel.SelectedMaterial.HelperMaterial;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using StructureHelper.Infrastructure.Enums;
|
using StructureHelper.Infrastructure.Enums;
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelper.Models.Materials;
|
||||||
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
using System;
|
using System;
|
||||||
@@ -28,10 +29,10 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
|
|||||||
{
|
{
|
||||||
PrimitiveBase primitive;
|
PrimitiveBase primitive;
|
||||||
private PrimitivePropertiesViewModel viewModel;
|
private PrimitivePropertiesViewModel viewModel;
|
||||||
public PrimitiveProperties(PrimitiveBase primitive, IHeadMaterialRepository materialRepository)
|
public PrimitiveProperties(PrimitiveBase primitive, IHasHeadMaterials headMaterials)
|
||||||
{
|
{
|
||||||
this.primitive = primitive;
|
this.primitive = primitive;
|
||||||
viewModel = new PrimitivePropertiesViewModel(this.primitive, materialRepository);
|
viewModel = new PrimitivePropertiesViewModel(this.primitive, headMaterials);
|
||||||
this.DataContext = viewModel;
|
this.DataContext = viewModel;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
if (primitive is RectangleViewPrimitive) { AddPrimitiveProperties(PrimitiveType.Rectangle); }
|
if (primitive is RectangleViewPrimitive) { AddPrimitiveProperties(PrimitiveType.Rectangle); }
|
||||||
|
|||||||
@@ -0,0 +1,145 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
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.Calculations.Calculators
|
||||||
|
{
|
||||||
|
public class ForceCalculatorViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
IEnumerable<INdmPrimitive> allowedPrimitives;
|
||||||
|
IEnumerable<IForceCombinationList> allowedForceCombinations;
|
||||||
|
ForceCalculator forcesCalculator;
|
||||||
|
|
||||||
|
public PrimitiveBase SelectedAllowedPrimitive { get; set; }
|
||||||
|
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||||
|
|
||||||
|
public ObservableCollection<PrimitiveBase> AllowedPrimitives
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var sourceItems = forcesCalculator.NdmPrimitives;
|
||||||
|
var rejectedItems = allowedPrimitives.Where(x => sourceItems.Contains(x));
|
||||||
|
var filteredItems = allowedPrimitives.Except(rejectedItems);
|
||||||
|
return ConvertNdmPrimitivesToPrimitiveBase(filteredItems);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ObservableCollection<PrimitiveBase> Primitives
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var sourceItems = forcesCalculator.NdmPrimitives;
|
||||||
|
return ConvertNdmPrimitivesToPrimitiveBase(sourceItems);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICommand addAllPrimitivesCommand;
|
||||||
|
private ICommand clearAllPrimitivesCommand;
|
||||||
|
private RelayCommand addSelectedPrimitiveCommand;
|
||||||
|
private RelayCommand removeSelectedPrimitive;
|
||||||
|
|
||||||
|
public ICommand AddAllPrimitivesCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return addAllPrimitivesCommand ??
|
||||||
|
(
|
||||||
|
addAllPrimitivesCommand = new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
AddAllPrimitives();
|
||||||
|
OnPropertyChanged(nameof(AllowedPrimitives));
|
||||||
|
OnPropertyChanged(nameof(Primitives));
|
||||||
|
},o => allowedPrimitives.Count() > 0
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void AddAllPrimitives()
|
||||||
|
{
|
||||||
|
forcesCalculator.NdmPrimitives.Clear();
|
||||||
|
forcesCalculator.NdmPrimitives.AddRange(allowedPrimitives);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand ClearAllPrimitivesCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return clearAllPrimitivesCommand ??
|
||||||
|
(
|
||||||
|
clearAllPrimitivesCommand = new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
forcesCalculator.NdmPrimitives.Clear();
|
||||||
|
OnPropertyChanged(nameof(AllowedPrimitives));
|
||||||
|
OnPropertyChanged(nameof(Primitives));
|
||||||
|
}, o => forcesCalculator.NdmPrimitives.Count > 0 ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand AddSelectedPrimitiveCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return addSelectedPrimitiveCommand ??
|
||||||
|
(
|
||||||
|
addSelectedPrimitiveCommand = new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
forcesCalculator.NdmPrimitives.Add(SelectedAllowedPrimitive.GetNdmPrimitive());
|
||||||
|
OnPropertyChanged(nameof(AllowedPrimitives));
|
||||||
|
OnPropertyChanged(nameof(Primitives));
|
||||||
|
}, o => SelectedAllowedPrimitive != null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public RelayCommand RemoveSelectedPrimitiveCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return removeSelectedPrimitive ??
|
||||||
|
(
|
||||||
|
removeSelectedPrimitive = new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
forcesCalculator.NdmPrimitives.Remove(SelectedPrimitive.GetNdmPrimitive());
|
||||||
|
OnPropertyChanged(nameof(AllowedPrimitives));
|
||||||
|
OnPropertyChanged(nameof(Primitives));
|
||||||
|
}, o => SelectedPrimitive != null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceCalculatorViewModel(IEnumerable<INdmPrimitive> _allowedPrimitives, IEnumerable<IForceCombinationList> _allowedForceCombinations, ForceCalculator _forcesCalculator)
|
||||||
|
{
|
||||||
|
allowedPrimitives = _allowedPrimitives;
|
||||||
|
allowedForceCombinations = _allowedForceCombinations;
|
||||||
|
forcesCalculator = _forcesCalculator;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObservableCollection<PrimitiveBase> ConvertNdmPrimitivesToPrimitiveBase(IEnumerable<INdmPrimitive> primitives)
|
||||||
|
{
|
||||||
|
ObservableCollection<PrimitiveBase> viewItems = new ObservableCollection<PrimitiveBase>();
|
||||||
|
foreach (var item in primitives)
|
||||||
|
{
|
||||||
|
if (item is IPointPrimitive)
|
||||||
|
{
|
||||||
|
var point = item as IPointPrimitive;
|
||||||
|
viewItems.Add(new PointViewPrimitive(point));
|
||||||
|
}
|
||||||
|
else if (item is IRectanglePrimitive)
|
||||||
|
{
|
||||||
|
var rect = item as IRectanglePrimitive;
|
||||||
|
viewItems.Add(new RectangleViewPrimitive(rect));
|
||||||
|
}
|
||||||
|
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
|
||||||
|
}
|
||||||
|
return viewItems;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
Windows/ViewModels/Forces/ForceCombinationViewModel.cs
Normal file
31
Windows/ViewModels/Forces/ForceCombinationViewModel.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
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 ForceCombinationViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
IForceCombinationList combinationList;
|
||||||
|
|
||||||
|
public IDesignForceTuple SelectedTuple { get; set; }
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get => combinationList.Name;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
combinationList.Name = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public IEnumerable<IDesignForceTuple> ForceTuples { get => combinationList.DesignForces; }
|
||||||
|
|
||||||
|
public ForceCombinationViewModel(IForceCombinationList combinationList)
|
||||||
|
{
|
||||||
|
this.combinationList = combinationList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,8 +3,11 @@ using StructureHelper.Models.Materials;
|
|||||||
using StructureHelper.Services.Primitives;
|
using StructureHelper.Services.Primitives;
|
||||||
using StructureHelper.Windows.MainWindow;
|
using StructureHelper.Windows.MainWindow;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
using StructureHelperCommon.Services.ColorServices;
|
using StructureHelperCommon.Services.ColorServices;
|
||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -20,13 +23,14 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
{
|
{
|
||||||
public class HeadMaterialsViewModel : ViewModelBase
|
public class HeadMaterialsViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
IHeadMaterialRepository materialRepository;
|
IHasHeadMaterials parent;
|
||||||
IEnumerable<IHeadMaterial> headMaterials;
|
List<IHeadMaterial> headMaterials;
|
||||||
IEnumerable<ILibMaterial> libMaterials;
|
|
||||||
IHeadMaterial selectedMaterial;
|
IHeadMaterial selectedMaterial;
|
||||||
ILibMaterial selectedLibMaterial;
|
ILibMaterialEntity selectedLibMaterial;
|
||||||
|
|
||||||
|
public ICommand AddNewConcreteMaterialCommand { get;}
|
||||||
|
public ICommand AddNewReinforcementMaterialCommand { get; }
|
||||||
|
|
||||||
public ICommand AddNewMaterialCommand { get; set; }
|
|
||||||
public ICommand AddElasticMaterialCommand
|
public ICommand AddElasticMaterialCommand
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -40,10 +44,10 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
|
|
||||||
private void AddElasticMaterial()
|
private void AddElasticMaterial()
|
||||||
{
|
{
|
||||||
IHeadMaterial material = new HeadMaterial() { Name = "New elastic material" };
|
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Elastic200, ProgramSetting.CodeType);
|
||||||
material.HelperMaterial = new ElasticMaterial() { Modulus = 2e11d, CompressiveStrength = 4e8d, TensileStrength = 4e8d };
|
material.Name = "New Elastic Material";
|
||||||
HeadMaterials.Add(material);
|
HeadMaterials.Add(material);
|
||||||
materialRepository.HeadMaterials.Add(material);
|
headMaterials.Add(material);
|
||||||
SelectedMaterial = material;
|
SelectedMaterial = material;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +67,8 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
OnPropertyChanged(value, ref selectedMaterial);
|
OnPropertyChanged(value, ref selectedMaterial);
|
||||||
if (!(selectedMaterial is null))
|
if (!(selectedMaterial is null))
|
||||||
{
|
{
|
||||||
selectedLibMaterial = selectedMaterial.HelperMaterial as ILibMaterial;
|
var libMaterial = selectedMaterial.HelperMaterial as ILibMaterial;
|
||||||
|
selectedLibMaterial = libMaterial.MaterialEntity;
|
||||||
OnPropertyChanged(nameof(selectedLibMaterial));
|
OnPropertyChanged(nameof(selectedLibMaterial));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,7 +84,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ILibMaterial SelectedLibMaterial
|
public ILibMaterialEntity SelectedLibMaterial
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -88,33 +93,41 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
selectedMaterial.HelperMaterial = value;
|
var libMaterial = selectedMaterial.HelperMaterial as ILibMaterial;
|
||||||
|
libMaterial.MaterialEntity = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<ILibMaterial> LibMaterials
|
public IEnumerable<ILibMaterialEntity> LibConcreteMaterials
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
//if (SelectedMaterial is null)
|
return LibMaterialPepository.GetConcreteRepository(ProgramSetting.CodeType);
|
||||||
//{
|
|
||||||
// return null;
|
|
||||||
//}
|
|
||||||
return libMaterials;//.Where(x => x.MaterialType == (SelectedMaterial.HelperMaterial as ILibMaterial).MaterialType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public HeadMaterialsViewModel(IHeadMaterialRepository headMaterialRepository)
|
public IEnumerable<ILibMaterialEntity> LibReinforcementMaterials
|
||||||
{
|
{
|
||||||
materialRepository = headMaterialRepository;
|
get
|
||||||
headMaterials = materialRepository.HeadMaterials;
|
{
|
||||||
|
return LibMaterialPepository.GetReinforcementRepository(ProgramSetting.CodeType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public HeadMaterialsViewModel(IHasHeadMaterials parent) : this(parent.HeadMaterials)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public HeadMaterialsViewModel(List<IHeadMaterial> _headMaterials)
|
||||||
|
{
|
||||||
|
headMaterials = _headMaterials;
|
||||||
HeadMaterials = new ObservableCollection<IHeadMaterial>();
|
HeadMaterials = new ObservableCollection<IHeadMaterial>();
|
||||||
foreach (var material in headMaterials)
|
foreach (var material in headMaterials)
|
||||||
{
|
{
|
||||||
HeadMaterials.Add(material);
|
HeadMaterials.Add(material);
|
||||||
}
|
}
|
||||||
libMaterials = materialRepository.LibMaterials;
|
AddNewConcreteMaterialCommand = new RelayCommand(o => AddConcreteMaterial());
|
||||||
AddNewMaterialCommand = new RelayCommand(o => AddNewMaterial(MaterialTypes.Reinforcement));
|
AddNewReinforcementMaterialCommand = new RelayCommand(o => AddReinforcementMaterial());
|
||||||
CopyHeadMaterialCommand = new RelayCommand(o => CopyMaterial(), o => !(SelectedMaterial is null));
|
CopyHeadMaterialCommand = new RelayCommand(o => CopyMaterial(), o => !(SelectedMaterial is null));
|
||||||
EditColorCommand = new RelayCommand(o => EditColor(), o=> ! (SelectedMaterial is null));
|
EditColorCommand = new RelayCommand(o => EditColor(), o=> ! (SelectedMaterial is null));
|
||||||
DeleteMaterialCommand = new RelayCommand(o => DeleteMaterial(), o => !(SelectedMaterial is null));
|
DeleteMaterialCommand = new RelayCommand(o => DeleteMaterial(), o => !(SelectedMaterial is null));
|
||||||
@@ -124,24 +137,30 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
{
|
{
|
||||||
var material = SelectedMaterial.Clone() as IHeadMaterial;
|
var material = SelectedMaterial.Clone() as IHeadMaterial;
|
||||||
HeadMaterials.Add(material);
|
HeadMaterials.Add(material);
|
||||||
materialRepository.HeadMaterials.Add(material);
|
headMaterials.Add(material);
|
||||||
SelectedMaterial = material;
|
SelectedMaterial = material;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteMaterial()
|
private void DeleteMaterial()
|
||||||
{
|
{
|
||||||
var mainModel = materialRepository.Parent as MainModel;
|
if (parent != null)
|
||||||
var primitivesWithMaterial = mainModel.PrimitiveRepository.Primitives.Where(x => x.HeadMaterial == SelectedMaterial);
|
|
||||||
int primitivesCount = primitivesWithMaterial.Count();
|
|
||||||
if (primitivesCount > 0)
|
|
||||||
{
|
{
|
||||||
MessageBox.Show("Some primitives reference to this material", "Material can not be deleted", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
if (parent is IHasPrimitives)
|
||||||
return;
|
{
|
||||||
|
var primitives = (parent as IHasPrimitives).Primitives;
|
||||||
|
var primitivesWithMaterial = primitives.Where(x => x.HeadMaterial == SelectedMaterial);
|
||||||
|
int primitivesCount = primitivesWithMaterial.Count();
|
||||||
|
if (primitivesCount > 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Some primitives reference to this material", "Material can not be deleted", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var dialogResult = MessageBox.Show("Delete material?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
var dialogResult = MessageBox.Show("Delete material?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||||
if (dialogResult == DialogResult.Yes)
|
if (dialogResult == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
materialRepository.HeadMaterials.Remove(SelectedMaterial);
|
headMaterials.Remove(SelectedMaterial);
|
||||||
HeadMaterials.Remove(SelectedMaterial);
|
HeadMaterials.Remove(SelectedMaterial);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,13 +174,21 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
OnPropertyChanged(nameof(selectedMaterial));
|
OnPropertyChanged(nameof(selectedMaterial));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddNewMaterial(MaterialTypes materialType)
|
private void AddConcreteMaterial()
|
||||||
{
|
{
|
||||||
IHeadMaterial material = new HeadMaterial() { Name = "New material" };
|
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, ProgramSetting.CodeType);
|
||||||
material.HelperMaterial = LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Concrete & x.Name.Contains("40"))).First();
|
material.Name = "New Concrete";
|
||||||
HeadMaterials.Add(material);
|
HeadMaterials.Add(material);
|
||||||
//headMaterials.Append(material);
|
headMaterials.Add(material);
|
||||||
materialRepository.HeadMaterials.Add(material);
|
SelectedMaterial = material;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddReinforcementMaterial()
|
||||||
|
{
|
||||||
|
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, ProgramSetting.CodeType);
|
||||||
|
material.Name = "New Reinforcement";
|
||||||
|
HeadMaterials.Add(material);
|
||||||
|
headMaterials.Add(material);
|
||||||
SelectedMaterial = material;
|
SelectedMaterial = material;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
public class PrimitivePropertiesViewModel : ViewModelBase, IDataErrorInfo
|
public class PrimitivePropertiesViewModel : ViewModelBase, IDataErrorInfo
|
||||||
{
|
{
|
||||||
private PrimitiveBase primitive;
|
private PrimitiveBase primitive;
|
||||||
private IHeadMaterialRepository headMaterialRepository;
|
private IHasHeadMaterials hasHeadMaterials;
|
||||||
private List<IHeadMaterial> headMaterials;
|
|
||||||
|
|
||||||
public ICommand EditColorCommand { get; private set; }
|
public ICommand EditColorCommand { get; private set; }
|
||||||
public ICommand EditMaterialCommand { get; private set; }
|
public ICommand EditMaterialCommand { get; private set; }
|
||||||
@@ -228,13 +227,12 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
|
|
||||||
public string Error => throw new NotImplementedException();
|
public string Error => throw new NotImplementedException();
|
||||||
|
|
||||||
public PrimitivePropertiesViewModel(PrimitiveBase primitive, IHeadMaterialRepository materialRepository)
|
public PrimitivePropertiesViewModel(PrimitiveBase primitive, IHasHeadMaterials hasHeadMaterials)
|
||||||
{
|
{
|
||||||
this.primitive = primitive;
|
this.primitive = primitive;
|
||||||
headMaterialRepository = materialRepository;
|
this.hasHeadMaterials = hasHeadMaterials;
|
||||||
headMaterials = materialRepository.HeadMaterials;
|
|
||||||
HeadMaterials = new ObservableCollection<IHeadMaterial>();
|
HeadMaterials = new ObservableCollection<IHeadMaterial>();
|
||||||
foreach (var material in headMaterials)
|
foreach (var material in hasHeadMaterials.HeadMaterials)
|
||||||
{
|
{
|
||||||
HeadMaterials.Add(material);
|
HeadMaterials.Add(material);
|
||||||
}
|
}
|
||||||
@@ -245,7 +243,7 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
|
|
||||||
private void EditMaterial()
|
private void EditMaterial()
|
||||||
{
|
{
|
||||||
var wnd = new HeadMaterialsView(headMaterialRepository);
|
var wnd = new HeadMaterialsView(hasHeadMaterials);
|
||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user