Window of calcultion's property is added
This commit is contained in:
@@ -7,6 +7,7 @@ using StructureHelper.Services;
|
||||
using StructureHelper.UnitSystem;
|
||||
using StructureHelper.UnitSystem.Systems;
|
||||
using StructureHelperLogics.Infrastructures.CommonEnums;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Services;
|
||||
using System.Collections;
|
||||
@@ -21,12 +22,16 @@ namespace StructureHelper.Windows.MainWindow
|
||||
private IPrimitiveRepository primitiveRepository;
|
||||
private CalculationService calculationService;
|
||||
private UnitSystemService unitSystemService;
|
||||
|
||||
public ICalculationProperty CalculationProperty { get; private set; }
|
||||
|
||||
public MainModel(IPrimitiveRepository primitiveRepository, CalculationService calculationService, UnitSystemService unitSystemService)
|
||||
{
|
||||
this.primitiveRepository = primitiveRepository;
|
||||
this.calculationService = calculationService;
|
||||
this.unitSystemService = unitSystemService;
|
||||
|
||||
CalculationProperty = new CalculationProperty();
|
||||
}
|
||||
|
||||
public IStrainMatrix Calculate(double mx, double my, double nz)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="40"/>
|
||||
@@ -30,7 +31,15 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border BorderBrush="Black" Background="White" BorderThickness="1" Margin="5" Grid.ColumnSpan="5">
|
||||
<Menu x:Name="menu">
|
||||
<MenuItem Header="File">
|
||||
|
||||
</MenuItem>
|
||||
<MenuItem Header="Edit">
|
||||
<Button Content="Calculation properties" Command="{Binding Path=EditCalculationPropertyCommand}"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Border BorderBrush="Black" Background="White" BorderThickness="1" Margin="5" Grid.ColumnSpan="5" Grid.Row="1">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="PreviewMouseDown">
|
||||
<i:InvokeCommandAction Command="{Binding ClearSelection}" CommandParameter="{Binding}"/>
|
||||
|
||||
@@ -16,6 +16,10 @@ using StructureHelper.Models.Materials;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Services.ResultViewers;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationProperies;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow;
|
||||
using StructureHelperLogics.Services;
|
||||
|
||||
namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
@@ -30,6 +34,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
public ObservableCollection<PrimitiveBase> Primitives { get; set; }
|
||||
|
||||
private double panelX, panelY, scrollPanelX, scrollPanelY;
|
||||
private CalculationProperty calculationProperty;
|
||||
|
||||
public double PanelX
|
||||
{
|
||||
@@ -111,6 +116,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
public ICommand Calculate { get; }
|
||||
public ICommand SetPopupCanBeClosedTrue { get; }
|
||||
public ICommand SetPopupCanBeClosedFalse { get; }
|
||||
public ICommand EditCalculationPropertyCommand { get; }
|
||||
public string UnitsSystemName => unitSystemService.GetCurrentSystem().Name;
|
||||
|
||||
private double delta = 0.5;
|
||||
@@ -126,6 +132,9 @@ namespace StructureHelper.Windows.MainWindow
|
||||
XY1 = CanvasHeight / 2;
|
||||
YX1 = CanvasWidth / 2;
|
||||
YY2 = CanvasHeight;
|
||||
calculationProperty = new CalculationProperty();
|
||||
|
||||
|
||||
LeftButtonUp = new RelayCommand(o =>
|
||||
{
|
||||
if (o is Rectangle rect) rect.BorderCaptured = false;
|
||||
@@ -231,6 +240,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
Primitives.Add(primitive);
|
||||
PrimitiveRepository.Add(primitive);
|
||||
}
|
||||
AddTestLoads();
|
||||
});
|
||||
|
||||
Calculate = new RelayCommand(o =>
|
||||
@@ -244,6 +254,8 @@ namespace StructureHelper.Windows.MainWindow
|
||||
CalculateResult();
|
||||
});
|
||||
|
||||
EditCalculationPropertyCommand = new RelayCommand (o => EditCalculationProperty());
|
||||
|
||||
SetPopupCanBeClosedTrue = new RelayCommand(o =>
|
||||
{
|
||||
if (!(o is PrimitiveBase primitive)) return;
|
||||
@@ -259,10 +271,14 @@ namespace StructureHelper.Windows.MainWindow
|
||||
|
||||
private void CalculateResult()
|
||||
{
|
||||
IForceMatrix forceMatrix = new ForceMatrix() { Mx = 10e3, My = 10e3, Nz = 0 };
|
||||
IEnumerable<INdm> ndms = Model.GetNdms();
|
||||
var loaderResult = Model.CalculateResult(ndms, forceMatrix);
|
||||
ShowIsoFieldResult.ShowResult(loaderResult.StrainMatrix, ndms, ResultFuncFactory.GetResultFuncs());
|
||||
CalculationService calculationService = new CalculationService();
|
||||
var loaderResults = calculationService.GetCalculationResults(calculationProperty, ndms);
|
||||
if (loaderResults[0].IsValid)
|
||||
{
|
||||
IStrainMatrix strainMatrix = loaderResults[0].LoaderResults.ForceStrainPair.StrainMatrix;
|
||||
ShowIsoFieldResult.ShowResult(strainMatrix, ndms, ResultFuncFactory.GetResultFuncs());
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<PrimitiveBase> GetTestCasePrimitives()
|
||||
@@ -279,5 +295,19 @@ namespace StructureHelper.Windows.MainWindow
|
||||
yield return new Point(d2, -width / 2 + 50, height / 2 - 50, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass };
|
||||
yield return new Point(d2, width / 2 - 50, height / 2 - 50, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass };
|
||||
}
|
||||
private void EditCalculationProperty()
|
||||
{
|
||||
CalculationPropertyViewModel viewModel = new CalculationPropertyViewModel(calculationProperty);
|
||||
var view = new CalculationPropertyView(viewModel);
|
||||
view.ShowDialog();
|
||||
}
|
||||
private void AddTestLoads()
|
||||
{
|
||||
calculationProperty.ForceCombinations.Clear();
|
||||
calculationProperty.ForceCombinations.Add(new ForceCombination());
|
||||
calculationProperty.ForceCombinations[0].ForceMatrix.Mx = 40e3d;
|
||||
calculationProperty.ForceCombinations[0].ForceMatrix.My = 20e3d;
|
||||
calculationProperty.ForceCombinations[0].ForceMatrix.Nz = 0d;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user