Head material was added
This commit is contained in:
@@ -3,6 +3,7 @@ using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Data.ResultData;
|
||||
using LoaderCalculator.Data.SourceData;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Services;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.UnitSystem;
|
||||
@@ -21,6 +22,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
public class MainModel
|
||||
{
|
||||
private IPrimitiveRepository primitiveRepository;
|
||||
public List<IHeadMaterial> HeadMaterials { get; }
|
||||
private CalculationService calculationService;
|
||||
private UnitSystemService unitSystemService;
|
||||
|
||||
@@ -33,6 +35,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
this.unitSystemService = unitSystemService;
|
||||
|
||||
CalculationProperty = new CalculationProperty();
|
||||
HeadMaterials = new List<IHeadMaterial>();
|
||||
}
|
||||
|
||||
public IStrainMatrix Calculate(double mx, double my, double nz)
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
<Button Content="Edit primitive" Command="{Binding EditPrimitive}"/>
|
||||
<Button Content="Delete primitive" Command="{Binding DeletePrimitive}"/>
|
||||
</MenuItem>
|
||||
<Button Content="Materials" Command="{Binding EditHeadMaterialsCommand}"/>
|
||||
<Button Content="Calculation properties" Command="{Binding Path=EditCalculationPropertyCommand}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Analisys">
|
||||
@@ -60,7 +61,24 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel>
|
||||
<Expander Header="Materials" ExpandDirection="Down" MinWidth="20" >
|
||||
|
||||
<ListBox ItemsSource="{Binding HeadMaterials}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<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>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Expander>
|
||||
<Expander Header="Geometry" ExpandDirection="Down" MinWidth="20" >
|
||||
<ListBox ItemsSource="{Binding Primitives}" SelectedItem="{Binding SelectedPrimitive}">
|
||||
@@ -71,7 +89,11 @@
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle Grid.Column="0" Margin="3" Fill="{Binding Brush}" />
|
||||
<Rectangle Grid.Column="0" Margin="3">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding Color}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.Windows.PrimitiveProperiesWindow;
|
||||
using StructureHelper.Infrastructure.Exceptions;
|
||||
using StructureHelper.Infrastructure.Strings;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
|
||||
namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
@@ -86,6 +87,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
get => canvasHeight;
|
||||
set => OnPropertyChanged(value, ref canvasHeight);
|
||||
}
|
||||
public List<IHeadMaterial> HeadMaterials { get => Model.HeadMaterials; }
|
||||
|
||||
public double XX2
|
||||
{
|
||||
@@ -111,6 +113,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
public ICommand Calculate { get; }
|
||||
public ICommand DeletePrimitive { get; }
|
||||
public ICommand EditCalculationPropertyCommand { get; }
|
||||
public ICommand EditHeadMaterialsCommand { get; }
|
||||
public ICommand EditPrimitive { get; }
|
||||
public ICommand AddTestCase { get; }
|
||||
public ICommand LeftButtonDown { get; }
|
||||
@@ -178,6 +181,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
primitive.ParameterCaptured = false;
|
||||
}
|
||||
});
|
||||
EditHeadMaterialsCommand = new RelayCommand(o => EditHeadMaterials());
|
||||
OpenMaterialCatalog = new RelayCommand(o =>
|
||||
{
|
||||
var materialCatalogView = new MaterialCatalogView();
|
||||
@@ -291,6 +295,12 @@ namespace StructureHelper.Windows.MainWindow
|
||||
});
|
||||
}
|
||||
|
||||
private void EditHeadMaterials()
|
||||
{
|
||||
var wnd = new HeadMaterialsView(HeadMaterials);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
|
||||
private void DeleteSelectedPrimitive()
|
||||
{
|
||||
if (! (SelectedPrimitive is null))
|
||||
@@ -331,13 +341,20 @@ namespace StructureHelper.Windows.MainWindow
|
||||
var area1 = Math.PI * 0.012d * 0.012d / 4d;
|
||||
var area2 = Math.PI * 0.025d * 0.025d / 4d;
|
||||
var gap = 0.05d;
|
||||
|
||||
var rectMaterial = new ConcreteDefinition("C40", 0, 40, 0, 1.3, 1.5);
|
||||
var pointMaterial = new RebarDefinition("S400", 2, 400, 400, 1.15, 1.15);
|
||||
yield return new Rectangle(width, height, 0, 0, this) { Material = rectMaterial, MaterialName = rectMaterial.MaterialClass };
|
||||
yield return new Point(area1, -width / 2 + gap, -height / 2 + gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass };
|
||||
yield return new Point(area1, width / 2 - gap, -height / 2 + gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass };
|
||||
yield return new Point(area2, -width / 2 + gap, height / 2 - gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass };
|
||||
yield return new Point(area2, width / 2 - gap, height / 2 - gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass };
|
||||
|
||||
IHeadMaterial concrete = new HeadMaterial() { Name = "Concrete C40", Material = rectMaterial };
|
||||
HeadMaterials.Add(concrete);
|
||||
IHeadMaterial reinforcement = new HeadMaterial() { Name = "Reinforcement S400", Material = pointMaterial };
|
||||
HeadMaterials.Add(reinforcement);
|
||||
|
||||
yield return new Rectangle(width, height, 0, 0, this) { Material = rectMaterial, MaterialName = rectMaterial.MaterialClass, HeadMaterial = concrete };
|
||||
yield return new Point(area1, -width / 2 + gap, -height / 2 + gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass, HeadMaterial = reinforcement };
|
||||
yield return new Point(area1, width / 2 - gap, -height / 2 + gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass, HeadMaterial = reinforcement };
|
||||
yield return new Point(area2, -width / 2 + gap, height / 2 - gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass, HeadMaterial = reinforcement };
|
||||
yield return new Point(area2, width / 2 - gap, height / 2 - gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass, HeadMaterial = reinforcement };
|
||||
}
|
||||
private void EditCalculationProperty()
|
||||
{
|
||||
|
||||
41
Windows/MainWindow/Materials/HeadMaterialsView.xaml
Normal file
41
Windows/MainWindow/Materials/HeadMaterialsView.xaml
Normal file
@@ -0,0 +1,41 @@
|
||||
<Window x:Class="StructureHelper.Windows.MainWindow.Materials.HeadMaterialsView"
|
||||
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.MainWindow.Materials"
|
||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Materials"
|
||||
d:DataContext="{d:DesignInstance vm:HeadMaterialsViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Materials" Height="350" Width="400" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox ItemsSource="{Binding HeadMaterials}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<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>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Content="New Concrete" Command="{Binding AddHeadMaterial}"/>
|
||||
<Button Content="New Reinforcement" Command="{Binding AddHeadMaterial}"/>
|
||||
<Button Content="Edit" Command="{Binding EditHeadMaterial}"/>
|
||||
<Button Content="Edit" Command="{Binding DeleteHeadMaterial}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
40
Windows/MainWindow/Materials/HeadMaterialsView.xaml.cs
Normal file
40
Windows/MainWindow/Materials/HeadMaterialsView.xaml.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.ViewModels.Materials;
|
||||
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.MainWindow.Materials
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для HeadMaterials.xaml
|
||||
/// </summary>
|
||||
public partial class HeadMaterialsView : Window
|
||||
{
|
||||
private HeadMaterialsViewModel viewmodel;
|
||||
|
||||
public HeadMaterialsView(IEnumerable<IHeadMaterial> materials)
|
||||
{
|
||||
viewmodel = new HeadMaterialsViewModel(materials);
|
||||
this.DataContext = viewmodel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public HeadMaterialsView(HeadMaterialsViewModel vm)
|
||||
{
|
||||
viewmodel = vm;
|
||||
this.DataContext = viewmodel;
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user