CompressedProperty was added
This commit is contained in:
@@ -264,7 +264,8 @@
|
||||
<Compile Include="Windows\ViewModels\Materials\PartialFactorsViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\Materials\SafetyFactorsViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\Forces\ActionsViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\NdmCrossSections\AnalysisVewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\NdmCrossSections\AnalysisVewModelLogic.cs" />
|
||||
<Compile Include="Windows\ViewModels\NdmCrossSections\SecondOrderViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\NdmCrossSections\IPrimitiveViewModelLogic.cs" />
|
||||
<Compile Include="Windows\ViewModels\NdmCrossSections\PrimitiveViewModelLogic.cs" />
|
||||
<Compile Include="Windows\ViewModels\NdmCrossSections\CrossSectionViewVisualProperty.cs" />
|
||||
@@ -278,7 +279,6 @@
|
||||
<Compile Include="Windows\ViewModels\ICRUDViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\ISourceToTargetViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\Materials\HeadMaterialsViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\NdmCrossSections\CalculatorsViewModelLogic.cs" />
|
||||
<Compile Include="Windows\ViewModels\NdmCrossSections\ForceCombinationViewModelLogic.cs" />
|
||||
<Compile Include="Windows\ViewModels\NdmCrossSections\ICalculatorsViewModelLogic.cs" />
|
||||
<Compile Include="Windows\ViewModels\NdmCrossSections\IForceCombinationViewModelLogic.cs" />
|
||||
|
||||
14
StructureHelperCommon/Models/Calculators/Accuracy.cs
Normal file
14
StructureHelperCommon/Models/Calculators/Accuracy.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Calculators
|
||||
{
|
||||
public class Accuracy : IAccuracy
|
||||
{
|
||||
public double IterationAccuracy { get; set; }
|
||||
public int MaxIterationCount { get; set; }
|
||||
}
|
||||
}
|
||||
14
StructureHelperCommon/Models/Calculators/IAccuracy.cs
Normal file
14
StructureHelperCommon/Models/Calculators/IAccuracy.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Calculators
|
||||
{
|
||||
public interface IAccuracy
|
||||
{
|
||||
double IterationAccuracy { get; set; }
|
||||
int MaxIterationCount { get; set; }
|
||||
}
|
||||
}
|
||||
37
StructureHelperCommon/Models/Sections/CompressedMember.cs
Normal file
37
StructureHelperCommon/Models/Sections/CompressedMember.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using StructureHelperCommon.Services.Sections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Sections
|
||||
{
|
||||
public class CompressedMember : ICompressedMember
|
||||
{
|
||||
public bool Buckling { get; set; }
|
||||
public double GeometryLength { get; set; }
|
||||
public double LengthFactorX { get; set; }
|
||||
public double DiagramFactorX { get; set; }
|
||||
public double LengthFactorY { get; set; }
|
||||
public double DiagramFactorY { get; set; }
|
||||
|
||||
|
||||
public CompressedMember()
|
||||
{
|
||||
Buckling = true;
|
||||
GeometryLength = 3d;
|
||||
LengthFactorX = 1d;
|
||||
DiagramFactorX = 1d;
|
||||
LengthFactorY = 1d;
|
||||
DiagramFactorY = 1d;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var target = new CompressedMember();
|
||||
CompressedMemberServices.CopyProperties(this, target);
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
StructureHelperCommon/Models/Sections/ICompressedMember.cs
Normal file
18
StructureHelperCommon/Models/Sections/ICompressedMember.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Sections
|
||||
{
|
||||
public interface ICompressedMember : ICloneable
|
||||
{
|
||||
bool Buckling { get; set; }
|
||||
double GeometryLength { get; set; }
|
||||
double LengthFactorX { get; set; }
|
||||
double DiagramFactorX { get; set; }
|
||||
double LengthFactorY { get; set; }
|
||||
double DiagramFactorY { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using LoaderCalculator;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Services.Calculations
|
||||
{
|
||||
public static class AccuracyService
|
||||
{
|
||||
public static void CopyProperties(IAccuracy source, IAccuracy target)
|
||||
{
|
||||
target.IterationAccuracy = source.IterationAccuracy;
|
||||
target.MaxIterationCount = source.MaxIterationCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Services.Sections
|
||||
{
|
||||
public static class CompressedMemberServices
|
||||
{
|
||||
public static void CopyProperties(ICompressedMember source, ICompressedMember target)
|
||||
{
|
||||
target.Buckling = source.Buckling;
|
||||
target.GeometryLength = source.GeometryLength;
|
||||
target.LengthFactorX = source.LengthFactorX;
|
||||
target.DiagramFactorX = source.DiagramFactorX;
|
||||
target.LengthFactorY = source.LengthFactorY;
|
||||
target.DiagramFactorY = source.DiagramFactorY;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,8 @@
|
||||
<Compile Include="Infrastructures\Settings\ProgramSetting.cs" />
|
||||
<Compile Include="Infrastructures\Strings\ErrorString.cs" />
|
||||
<Compile Include="Infrastructures\Enums\MaterialTypes.cs" />
|
||||
<Compile Include="Models\Calculators\Accuracy.cs" />
|
||||
<Compile Include="Models\Calculators\IAccuracy.cs" />
|
||||
<Compile Include="Models\Calculators\IHelperCalculator.cs" />
|
||||
<Compile Include="Models\Forces\DesignForceTuple.cs" />
|
||||
<Compile Include="Models\Forces\Factories\DesignForceFactory.cs" />
|
||||
@@ -86,6 +88,8 @@
|
||||
<Compile Include="Models\Materials\Libraries\MaterialPartialFactor.cs" />
|
||||
<Compile Include="Models\Materials\Libraries\MaterialSafetyFactor.cs" />
|
||||
<Compile Include="Models\Materials\Libraries\ReinforcementMaterialEntity.cs" />
|
||||
<Compile Include="Models\Sections\CompressedMember.cs" />
|
||||
<Compile Include="Models\Sections\ICompressedMember.cs" />
|
||||
<Compile Include="Models\Shapes\Point2D.cs" />
|
||||
<Compile Include="Models\Shapes\IPoint2D.cs" />
|
||||
<Compile Include="Models\Shapes\ICenterShape.cs" />
|
||||
@@ -98,9 +102,11 @@
|
||||
<Compile Include="Models\Shapes\PointShape.cs" />
|
||||
<Compile Include="Models\Shapes\RectangleShape.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\Calculations\AccuracyService.cs" />
|
||||
<Compile Include="Services\ColorServices\ColorProcessor.cs" />
|
||||
<Compile Include="Services\Forces\ForceTupleService.cs" />
|
||||
<Compile Include="Services\Forces\StrainTupleService.cs" />
|
||||
<Compile Include="Services\Sections\CompressedMemberServices.cs" />
|
||||
<Compile Include="Services\ShapeServices\ShapeService.cs" />
|
||||
<Compile Include="Services\Units\IUnit.cs" />
|
||||
<Compile Include="Services\Units\Unit.cs" />
|
||||
|
||||
@@ -3,9 +3,13 @@ using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Data.SourceData;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Calculations;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperCommon.Services.Sections;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
@@ -17,14 +21,13 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public class ForceCalculator : IForceCalculator
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public double IterationAccuracy { get; set; }
|
||||
public int MaxIterationCount { get; set; }
|
||||
public List<LimitStates> LimitStatesList { get; }
|
||||
public List<CalcTerms> CalcTermsList { get; }
|
||||
public List<IForceCombinationList> ForceCombinationLists { get; }
|
||||
public List<INdmPrimitive> Primitives { get; }
|
||||
public INdmResult Result { get; private set; }
|
||||
|
||||
public ICompressedMember CompressedMember { get; }
|
||||
public IAccuracy Accuracy { get; }
|
||||
|
||||
public void Run()
|
||||
{
|
||||
@@ -82,8 +85,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
ForceCombinationLists = new List<IForceCombinationList>();
|
||||
Primitives = new List<INdmPrimitive>();
|
||||
IterationAccuracy = 0.001d;
|
||||
MaxIterationCount = 1000;
|
||||
CompressedMember = new CompressedMember();
|
||||
Accuracy = new Accuracy() { IterationAccuracy = 0.001d, MaxIterationCount = 1000 };
|
||||
LimitStatesList = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS };
|
||||
CalcTermsList = new List<CalcTerms>() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
||||
}
|
||||
@@ -100,8 +103,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
Preconditions = new Preconditions
|
||||
{
|
||||
ConditionRate = IterationAccuracy,
|
||||
MaxIterationCount = MaxIterationCount,
|
||||
ConditionRate = Accuracy.IterationAccuracy,
|
||||
MaxIterationCount = Accuracy.MaxIterationCount,
|
||||
StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz }
|
||||
},
|
||||
NdmCollection = ndmCollection
|
||||
@@ -109,7 +112,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
var calculator = new Calculator();
|
||||
calculator.Run(loaderData, new CancellationToken());
|
||||
var calcResult = calculator.Result;
|
||||
if (calcResult.AccuracyRate <= IterationAccuracy)
|
||||
if (calcResult.AccuracyRate <= Accuracy.IterationAccuracy)
|
||||
{
|
||||
return new ForcesResult() { IsValid = true, Desctription = "Analysis is done succsefully", LoaderResults = calcResult };
|
||||
}
|
||||
@@ -131,17 +134,16 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
IForceCalculator calculator = new ForceCalculator();
|
||||
calculator.Name = Name + " copy";
|
||||
calculator.LimitStatesList.Clear();
|
||||
calculator.LimitStatesList.AddRange(LimitStatesList);
|
||||
calculator.CalcTermsList.Clear();
|
||||
calculator.CalcTermsList.AddRange(CalcTermsList);
|
||||
calculator.IterationAccuracy = IterationAccuracy;
|
||||
calculator.MaxIterationCount = MaxIterationCount;
|
||||
calculator.Primitives.AddRange(Primitives);
|
||||
calculator.ForceCombinationLists.AddRange(ForceCombinationLists);
|
||||
return calculator;
|
||||
IForceCalculator target = new ForceCalculator { Name = Name + " copy"};
|
||||
target.LimitStatesList.Clear();
|
||||
target.LimitStatesList.AddRange(LimitStatesList);
|
||||
target.CalcTermsList.Clear();
|
||||
target.CalcTermsList.AddRange(CalcTermsList);
|
||||
AccuracyService.CopyProperties(Accuracy, target.Accuracy);
|
||||
CompressedMemberServices.CopyProperties(CompressedMember, target.CompressedMember);
|
||||
target.Primitives.AddRange(Primitives);
|
||||
target.ForceCombinationLists.AddRange(ForceCombinationLists);
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,8 +12,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public interface IForceCalculator : INdmCalculator, IHasPrimitives, IHasForceCombinations
|
||||
{
|
||||
List<CalcTerms> CalcTermsList { get; }
|
||||
double IterationAccuracy { get; set; }
|
||||
List<LimitStates> LimitStatesList { get; }
|
||||
int MaxIterationCount { get; set; }
|
||||
ICompressedMember CompressedMember { get; }
|
||||
IAccuracy Accuracy { get; }
|
||||
}
|
||||
}
|
||||
@@ -19,8 +19,8 @@ namespace StructureHelperLogics.Services.NdmCalculations
|
||||
calculator.LimitStatesList.Add(finishDesignForce.LimitState);
|
||||
calculator.CalcTermsList.Clear();
|
||||
calculator.CalcTermsList.Add(finishDesignForce.CalcTerm);
|
||||
calculator.IterationAccuracy = source.IterationAccuracy;
|
||||
calculator.MaxIterationCount = source.MaxIterationCount;
|
||||
calculator.Accuracy.IterationAccuracy = source.Accuracy.IterationAccuracy;
|
||||
calculator.Accuracy.MaxIterationCount = source.Accuracy.MaxIterationCount;
|
||||
calculator.Primitives.AddRange(source.Primitives);
|
||||
calculator.ForceCombinationLists.Clear();
|
||||
var combination = new ForceCombinationList()
|
||||
|
||||
@@ -49,6 +49,31 @@
|
||||
<TabItem Header="Primitives">
|
||||
<ContentControl ContentTemplate="{StaticResource SourceToTarget}" Content="{Binding PrimitivesViewModel}"/>
|
||||
</TabItem>
|
||||
<TabItem Header="SOrder" Visibility="Hidden">
|
||||
<Grid DataContext="{Binding SecondOrder}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="Consider second order effects"/>
|
||||
<TextBlock Grid.Row="1" Text="Geometry length"/>
|
||||
<TextBlock Grid.Row="2" Text="Buckling factor x-axis"/>
|
||||
<TextBlock Grid.Row="3" Text="Buckling factor y-axis"/>
|
||||
<CheckBox Grid.Column="1" IsChecked="{Binding Buckling}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding GeometryLength, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding LengthFactorX, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding LengthFactorY, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Iterations">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
|
||||
@@ -43,8 +43,8 @@ namespace StructureHelper.Windows.MainWindow
|
||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||
public IForceCombinationList SelectedForceCombinationList { get; set; }
|
||||
|
||||
private readonly AnalysisVewModel calculatorsLogic;
|
||||
public AnalysisVewModel CalculatorsLogic { get => calculatorsLogic;}
|
||||
private readonly AnalysisVewModelLogic calculatorsLogic;
|
||||
public AnalysisVewModelLogic CalculatorsLogic { get => calculatorsLogic;}
|
||||
public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
|
||||
public IPrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
Model = model;
|
||||
section = model.Section;
|
||||
combinationsLogic = new ActionsViewModel(repository);
|
||||
calculatorsLogic = new AnalysisVewModel(repository);
|
||||
calculatorsLogic = new AnalysisVewModelLogic(repository);
|
||||
primitiveLogic = new PrimitiveViewModelLogic(repository) { CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight };
|
||||
XX2 = CanvasWidth;
|
||||
XY1 = CanvasHeight / 2d;
|
||||
|
||||
@@ -83,8 +83,7 @@
|
||||
<TextBlock Grid.Row="2" Text="Center X"/>
|
||||
<TextBlock Grid.Row="3" Text="Center Y"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Name}"/>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<ComboBox Width="100" ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding PrimitiveMaterial}">
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding PrimitiveMaterial}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
@@ -102,9 +101,6 @@
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<Button Width="50" Content="..." Command="{Binding EditMaterialCommand}">
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Margin="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
</Grid>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
@@ -25,6 +26,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
IEnumerable<INdmPrimitive> allowedPrimitives;
|
||||
IEnumerable<IForceCombinationList> allowedForceCombinations;
|
||||
ForceCalculator forcesCalculator;
|
||||
SecondOrderViewModel secondOrderViewModel;
|
||||
|
||||
public string Name
|
||||
{
|
||||
@@ -34,16 +36,18 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
|
||||
public double IterationAccuracy
|
||||
{
|
||||
get { return forcesCalculator.IterationAccuracy; }
|
||||
set { forcesCalculator.IterationAccuracy = value;}
|
||||
get { return forcesCalculator.Accuracy.IterationAccuracy; }
|
||||
set { forcesCalculator.Accuracy.IterationAccuracy = value;}
|
||||
}
|
||||
|
||||
public int MaxIterationCount
|
||||
{
|
||||
get { return forcesCalculator.MaxIterationCount; }
|
||||
set { forcesCalculator.MaxIterationCount = value; }
|
||||
get { return forcesCalculator.Accuracy.MaxIterationCount; }
|
||||
set { forcesCalculator.Accuracy.MaxIterationCount = value; }
|
||||
}
|
||||
|
||||
public SecondOrderViewModel SecondOrder => secondOrderViewModel;
|
||||
|
||||
public bool ULS { get; set; }
|
||||
public bool SLS { get; set; }
|
||||
public bool ShortTerm { get; set; }
|
||||
@@ -147,6 +151,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
allowedPrimitives = _allowedPrimitives;
|
||||
allowedForceCombinations = _allowedForceCombinations;
|
||||
forcesCalculator = _forcesCalculator;
|
||||
secondOrderViewModel = new SecondOrderViewModel(forcesCalculator.CompressedMember);
|
||||
|
||||
CombinationViewModel = new SourceToTargetViewModel<IForceCombinationList>();
|
||||
CombinationViewModel.SetTargetItems(forcesCalculator.ForceCombinationLists);
|
||||
|
||||
@@ -15,7 +15,7 @@ using System.Windows.Forms;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public class AnalysisVewModel : CRUDViewModelBase<INdmCalculator>
|
||||
public class AnalysisVewModelLogic : CRUDViewModelBase<INdmCalculator>
|
||||
{
|
||||
private ICrossSectionRepository repository;
|
||||
private RelayCommand runCommand;
|
||||
@@ -69,7 +69,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
public AnalysisVewModel(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
|
||||
public AnalysisVewModelLogic(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
|
||||
{
|
||||
repository = sectionRepository;
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public class CalculatorsViewModelLogic : ViewModelBase, ICalculatorsViewModelLogic
|
||||
{
|
||||
private readonly ICrossSectionRepository repository;
|
||||
|
||||
public INdmCalculator SelectedItem { get; set; }
|
||||
public ObservableCollection<INdmCalculator> Items { get; private set; }
|
||||
|
||||
private RelayCommand addCommand;
|
||||
public RelayCommand Add
|
||||
{
|
||||
get
|
||||
{
|
||||
return addCommand ??
|
||||
(
|
||||
addCommand = new RelayCommand(o =>
|
||||
{
|
||||
AddCalculator();
|
||||
OnPropertyChanged(nameof(Items));
|
||||
}));
|
||||
}
|
||||
}
|
||||
private void AddCalculator()
|
||||
{
|
||||
var item = new ForceCalculator() { Name = "New force calculator" };
|
||||
Items.Add(item);
|
||||
repository.CalculatorsList.Add(item);
|
||||
}
|
||||
private RelayCommand editCommand;
|
||||
public RelayCommand Edit
|
||||
{
|
||||
get
|
||||
{
|
||||
return editCommand ??
|
||||
(
|
||||
editCommand = new RelayCommand(o =>
|
||||
{
|
||||
var tmpSelected = SelectedItem;
|
||||
EditCalculator();
|
||||
Items.Clear();
|
||||
AddItems(repository.CalculatorsList);
|
||||
OnPropertyChanged(nameof(Items));
|
||||
SelectedItem = tmpSelected;
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
private void EditCalculator()
|
||||
{
|
||||
if (SelectedItem is ForceCalculator)
|
||||
{
|
||||
var calculator = SelectedItem as ForceCalculator;
|
||||
var vm = new ForceCalculatorViewModel(repository.Primitives, repository.ForceCombinationLists, calculator);
|
||||
|
||||
var wnd = new ForceCalculatorView(vm);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
}
|
||||
private RelayCommand deleteCommand;
|
||||
private RelayCommand runCommand;
|
||||
private RelayCommand copyCommand;
|
||||
|
||||
public RelayCommand Delete
|
||||
{
|
||||
get
|
||||
{
|
||||
return deleteCommand ??
|
||||
(
|
||||
deleteCommand = new RelayCommand(o =>
|
||||
{
|
||||
DeleteCalculator();
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
public RelayCommand Run
|
||||
{
|
||||
get
|
||||
{
|
||||
return runCommand ??
|
||||
(
|
||||
runCommand = new RelayCommand(o =>
|
||||
{
|
||||
SelectedItem.Run();
|
||||
var result = SelectedItem.Result;
|
||||
if (result.IsValid == false)
|
||||
{
|
||||
MessageBox.Show(result.Desctription, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
var calculator = SelectedItem as IForceCalculator;
|
||||
var vm = new ForcesResultsViewModel(calculator);
|
||||
var wnd = new ForceResultsView(vm);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
public RelayCommand Copy
|
||||
{
|
||||
get
|
||||
{
|
||||
return copyCommand ??
|
||||
(
|
||||
copyCommand = new RelayCommand(o =>
|
||||
{
|
||||
var item = SelectedItem.Clone() as INdmCalculator;
|
||||
repository.CalculatorsList.Add(item);
|
||||
Items.Add(item);
|
||||
OnPropertyChanged(nameof(Items));
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
private void DeleteCalculator()
|
||||
{
|
||||
var dialogResult = MessageBox.Show("Delete calculator?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
repository.CalculatorsList.Remove(SelectedItem as INdmCalculator);
|
||||
OnPropertyChanged(nameof(Items));
|
||||
}
|
||||
}
|
||||
|
||||
public void AddItems(IEnumerable<INdmCalculator> items)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public CalculatorsViewModelLogic(ICrossSectionRepository repository)
|
||||
{
|
||||
this.repository = repository;
|
||||
Items = new ObservableCollection<INdmCalculator>();
|
||||
AddItems(this.repository.CalculatorsList);
|
||||
}
|
||||
}
|
||||
}
|
||||
60
Windows/ViewModels/NdmCrossSections/SecondOrderViewModel.cs
Normal file
60
Windows/ViewModels/NdmCrossSections/SecondOrderViewModel.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using FieldVisualizer.ViewModels;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public class SecondOrderViewModel : ViewModelBase
|
||||
{
|
||||
ICompressedMember member;
|
||||
|
||||
public bool Buckling
|
||||
{
|
||||
get => member.Buckling;
|
||||
set
|
||||
{
|
||||
member.Buckling = value;
|
||||
OnPropertyChanged(nameof(Buckling));
|
||||
}
|
||||
}
|
||||
|
||||
public double GeometryLength
|
||||
{
|
||||
get => member.GeometryLength;
|
||||
set
|
||||
{
|
||||
member.GeometryLength = value;
|
||||
OnPropertyChanged(nameof(GeometryLength));
|
||||
}
|
||||
}
|
||||
|
||||
public double LengthFactorX
|
||||
{
|
||||
get => member.LengthFactorX;
|
||||
set
|
||||
{
|
||||
member.GeometryLength = value;
|
||||
OnPropertyChanged(nameof(LengthFactorX));
|
||||
}
|
||||
}
|
||||
|
||||
public double LengthFactorY
|
||||
{
|
||||
get => member.LengthFactorY;
|
||||
set
|
||||
{
|
||||
member.GeometryLength = value;
|
||||
OnPropertyChanged(nameof(LengthFactorY));
|
||||
}
|
||||
}
|
||||
|
||||
public SecondOrderViewModel(ICompressedMember compressedMember)
|
||||
{
|
||||
member = compressedMember;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user