Operation Move primitives to center was added
This commit is contained in:
@@ -54,11 +54,19 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
||||
{
|
||||
primitiveSet = value;
|
||||
OnPropertyChanged(nameof(PrimitiveSet));
|
||||
AreaTotal = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Sum(x => x.Area);
|
||||
OnPropertyChanged(nameof(AreaTotal));
|
||||
AreaNeg = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value < 0d).Sum(x => x.Area);
|
||||
OnPropertyChanged(nameof(AreaNeg));
|
||||
AreaZero = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value == 0d).Sum(x => x.Area);
|
||||
OnPropertyChanged(nameof(AreaZero));
|
||||
AreaPos = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value > 0d).Sum(x => x.Area);
|
||||
OnPropertyChanged(nameof(AreaPos));
|
||||
SumTotal = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Sum(x => x.Value);
|
||||
OnPropertyChanged(nameof(SumTotal));
|
||||
SumNeg = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value < 0).Sum(x => x.Value);
|
||||
SumNeg = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value < 0d).Sum(x => x.Value);
|
||||
OnPropertyChanged(nameof(SumNeg));
|
||||
SumPos = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value > 0).Sum(x => x.Value);
|
||||
SumPos = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value > 0d).Sum(x => x.Value);
|
||||
OnPropertyChanged(nameof(SumPos));
|
||||
|
||||
}
|
||||
@@ -122,6 +130,10 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
||||
}
|
||||
}
|
||||
}
|
||||
public double AreaTotal { get; private set; }
|
||||
public double AreaNeg { get; private set; }
|
||||
public double AreaZero { get; private set; }
|
||||
public double AreaPos { get; private set; }
|
||||
public double SumTotal { get; private set;}
|
||||
public double SumNeg { get; private set; }
|
||||
public double SumPos { get; private set; }
|
||||
|
||||
@@ -52,6 +52,14 @@
|
||||
</Expander>
|
||||
<Expander Header="Summary information" IsExpanded="False">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Total area:"/>
|
||||
<TextBlock Text="{Binding AreaTotal}"/>
|
||||
<TextBlock Text="Negative value area:"/>
|
||||
<TextBlock Text="{Binding AreaNeg}"/>
|
||||
<TextBlock Text="Zero value area:"/>
|
||||
<TextBlock Text="{Binding AreaZero}"/>
|
||||
<TextBlock Text="Positive value area:"/>
|
||||
<TextBlock Text="{Binding AreaPos}"/>
|
||||
<TextBlock Text="Total sum: "/>
|
||||
<TextBlock Text="{Binding SumTotal}"/>
|
||||
<TextBlock Text="Sum negative: "/>
|
||||
|
||||
Binary file not shown.
@@ -15,7 +15,17 @@ namespace StructureHelperLogics.Models.Materials
|
||||
|
||||
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
IMaterial material = new Material();
|
||||
material.InitModulus = Modulus;
|
||||
IEnumerable<double> parameters = new List<double>() { Modulus};
|
||||
material.DiagramParameters = parameters;
|
||||
material.Diagram = GetStress;
|
||||
return material;
|
||||
}
|
||||
|
||||
private double GetStress (IEnumerable<double> parameters, double strain)
|
||||
{
|
||||
return parameters.First() * strain;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
|
||||
@@ -24,8 +24,12 @@
|
||||
</Grid.RowDefinitions>
|
||||
<TabControl>
|
||||
<TabItem Header="Forces">
|
||||
<StackPanel>
|
||||
<GroupBox Header="Combinations of forces" Height="160">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="80"/>
|
||||
</Grid.RowDefinitions>
|
||||
<GroupBox Grid.Row="0" Header="Combinations of forces" Height="160">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@@ -46,7 +50,7 @@
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<Grid Height="80">
|
||||
<Grid Grid.Row="1" Height="80">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
@@ -64,7 +68,7 @@
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Iterations">
|
||||
<Grid>
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
</MenuItem>
|
||||
<Button Content="Materials" Command="{Binding EditHeadMaterialsCommand}"/>
|
||||
<Button Content="Calculation properties" Command="{Binding Path=EditCalculationPropertyCommand}"/>
|
||||
<Button Content="Move primitives to center" Command="{Binding Path=MovePrimitiveToGravityCenterCommand}"/>
|
||||
<MenuItem Header="Templates">
|
||||
<Button Content="Concrete beam" Command="{Binding AddBeamCase}"/>
|
||||
<Button Content="Concrete column" Command="{Binding AddColumnCase}"/>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Logics.Geometry;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
@@ -25,6 +26,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
|
||||
@@ -133,6 +135,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
public ICommand AddSlabCase { get; }
|
||||
public ICommand LeftButtonDown { get; }
|
||||
public ICommand LeftButtonUp { get; }
|
||||
public ICommand MovePrimitiveToGravityCenterCommand { get; }
|
||||
public ICommand PreviewMouseMove { get; }
|
||||
public ICommand ClearSelection { get; }
|
||||
public ICommand OpenMaterialCatalog { get; }
|
||||
@@ -313,10 +316,25 @@ namespace StructureHelper.Windows.MainWindow
|
||||
Calculate = new RelayCommand(o =>
|
||||
{
|
||||
CalculateResult();
|
||||
});
|
||||
|
||||
},
|
||||
o => Model.PrimitiveRepository.Primitives.Count() > 0);
|
||||
|
||||
EditCalculationPropertyCommand = new RelayCommand (o => EditCalculationProperty());
|
||||
|
||||
MovePrimitiveToGravityCenterCommand = new RelayCommand(o =>
|
||||
{
|
||||
IEnumerable<INdm> ndms = Model.GetNdms(calculationProperty);
|
||||
double[] center = GeometryOperations.GetGravityCenter(ndms);
|
||||
foreach (var primitive in Model.PrimitiveRepository.Primitives)
|
||||
{
|
||||
primitive.CenterX -= center[0];
|
||||
primitive.CenterY -= center[1];
|
||||
}
|
||||
},
|
||||
o => Model.PrimitiveRepository.Primitives.Count() > 0
|
||||
);
|
||||
|
||||
SetPopupCanBeClosedTrue = new RelayCommand(o =>
|
||||
{
|
||||
if (!(o is PrimitiveBase primitive)) return;
|
||||
@@ -345,8 +363,8 @@ namespace StructureHelper.Windows.MainWindow
|
||||
var dialogResult = MessageBox.Show("Delete primitive?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
Primitives.Remove(SelectedPrimitive);
|
||||
PrimitiveRepository.Delete(SelectedPrimitive);
|
||||
Primitives.Remove(SelectedPrimitive);
|
||||
}
|
||||
}
|
||||
else { MessageBox.Show("Selection is changed", "Please, select primitive", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); }
|
||||
|
||||
Reference in New Issue
Block a user