IReport is added
This commit is contained in:
@@ -41,8 +41,8 @@
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Content="Add" Command="{Binding Path=AddForceCombinationCommand}"/>
|
||||
<Button Content="Remove" Command="{Binding Path=RemoveForceCombinationCommand}"/>
|
||||
<Button Margin="3" Content="Add" Command="{Binding Path=AddForceCombinationCommand}"/>
|
||||
<Button Margin="3" Content="Remove" Command="{Binding Path=RemoveForceCombinationCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculationResultWindow.CalculationResultView"
|
||||
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.CalculationResultWindow"
|
||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Calculations.CalculationResult"
|
||||
d:DataContext="{d:DesignInstance vm:CalculationResultViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Results of calculations" Height="400" Width="800" MinHeight="400" MinWidth="600">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="60"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<DataGrid x:Name="ResultGrid" IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding CalculationResults}" SelectedItem="{Binding SelectedResult}" >
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsValid}" Value="false">
|
||||
<Setter Property="Background" Value="Pink"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridCheckBoxColumn Header="Valid" Binding="{Binding Path=IsValid}"/>
|
||||
<DataGridTextColumn Header="Moment Mx" Width="90" Binding="{Binding Path=LoaderResults.ForceStrainPair.ForceMatrix.Mx}"/>
|
||||
<DataGridTextColumn Header="Moment My" Width="90" Binding="{Binding Path=LoaderResults.ForceStrainPair.ForceMatrix.My}"/>
|
||||
<DataGridTextColumn Header="Force Nz" Width="90" Binding="{Binding Path=LoaderResults.ForceStrainPair.ForceMatrix.Nz}"/>
|
||||
<DataGridTextColumn Header="Accuracy" Width="90" Binding="{Binding Path=LoaderResults.AccuracyRate}"/>
|
||||
<DataGridTextColumn Header="Max Iteration" Width="90" Binding="{Binding Path=LoaderResults.IterationCounter}"/>
|
||||
<DataGridTextColumn Header="Description" Width="300" Binding="{Binding Path=Desctription}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Margin="3" Content="Graphic" Command="{Binding ShowIsoFieldCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,31 @@
|
||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationResult;
|
||||
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.CalculationResultWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для CalculationResultView.xaml
|
||||
/// </summary>
|
||||
public partial class CalculationResultView : Window
|
||||
{
|
||||
private CalculationResultViewModel viewModel;
|
||||
public CalculationResultView(CalculationResultViewModel resultViewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
viewModel = resultViewModel;
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="20"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="40"/>
|
||||
@@ -33,11 +33,17 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<Menu x:Name="menu">
|
||||
<MenuItem Header="File">
|
||||
|
||||
</MenuItem>
|
||||
<MenuItem Header="Edit">
|
||||
<MenuItem Header="Primitives">
|
||||
<Button Content="Add Rectangle" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||
<Button Content="Add Point" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||
</MenuItem>
|
||||
<Button Content="Calculation properties" Command="{Binding Path=EditCalculationPropertyCommand}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Analisys">
|
||||
<Button Content="Solve problem" Command="{Binding Path=Calculate}"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Border BorderBrush="Black" Background="White" BorderThickness="1" Margin="5" Grid.ColumnSpan="5" Grid.Row="1">
|
||||
<i:Interaction.Triggers>
|
||||
@@ -97,16 +103,15 @@
|
||||
</Canvas>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
<Button VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Content="Справочник" Command="{Binding OpenMaterialCatalog}"/>
|
||||
<Button VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Content="Система едениц" Command="{Binding OpenUnitsSystemSettings}"/>
|
||||
<Label VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Content="{Binding UnitsSystemName}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0.333,0.333,39.667" Grid.RowSpan="2" Width="519">
|
||||
<Button VerticalAlignment="Center" Margin="5" Content="Добавить тестовые примитивы" Command="{Binding AddTestCase}"/>
|
||||
<Button VerticalAlignment="Center" Margin="5" Content="Добавить прямоугольник" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||
<Button VerticalAlignment="Center" Margin="5" Content="Добавить точку" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||
</StackPanel>
|
||||
<Button Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5" Content="Рассчитать" Command="{Binding Calculate}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -20,6 +20,8 @@ using StructureHelper.Windows.ViewModels.Calculations.CalculationProperies;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow;
|
||||
using StructureHelperLogics.Services;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculationResultWindow;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationResult;
|
||||
|
||||
namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
@@ -274,11 +276,8 @@ namespace StructureHelper.Windows.MainWindow
|
||||
IEnumerable<INdm> ndms = Model.GetNdms();
|
||||
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());
|
||||
}
|
||||
var wnd = new CalculationResultView(new CalculationResultViewModel(loaderResults, ndms));
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
|
||||
private IEnumerable<PrimitiveBase> GetTestCasePrimitives()
|
||||
@@ -308,6 +307,14 @@ namespace StructureHelper.Windows.MainWindow
|
||||
calculationProperty.ForceCombinations[0].ForceMatrix.Mx = 40e3d;
|
||||
calculationProperty.ForceCombinations[0].ForceMatrix.My = 20e3d;
|
||||
calculationProperty.ForceCombinations[0].ForceMatrix.Nz = 0d;
|
||||
calculationProperty.ForceCombinations.Add(new ForceCombination());
|
||||
calculationProperty.ForceCombinations[1].ForceMatrix.Mx = 200e3d;
|
||||
calculationProperty.ForceCombinations[1].ForceMatrix.My = 0d;
|
||||
calculationProperty.ForceCombinations[1].ForceMatrix.Nz = 0d;
|
||||
calculationProperty.ForceCombinations.Add(new ForceCombination());
|
||||
calculationProperty.ForceCombinations[2].ForceMatrix.Mx = 50e3d;
|
||||
calculationProperty.ForceCombinations[2].ForceMatrix.My = 50e3d;
|
||||
calculationProperty.ForceCombinations[2].ForceMatrix.Nz = 0d;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,10 +86,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.CalculationProperies
|
||||
public ICommand AddForceCombinationCommand { get; private set; }
|
||||
public ICommand RemoveForceCombinationCommand { get; private set; }
|
||||
|
||||
|
||||
|
||||
private readonly ICalculationProperty calculationProperty;
|
||||
|
||||
public CalculationPropertyViewModel(ICalculationProperty calculationProperty)
|
||||
{
|
||||
this.calculationProperty = calculationProperty;
|
||||
@@ -102,8 +99,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.CalculationProperies
|
||||
RemoveForceCombinationCommand = new RelayCommand(o => RemoveForceCombination(), o => SelectedCombination != null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SaveProperties()
|
||||
{
|
||||
calculationProperty.ForceCombinations.Clear();
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Services.Reports;
|
||||
using StructureHelper.Services.Reports.CalculationReports;
|
||||
using StructureHelper.Services.ResultViewers;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationsResults;
|
||||
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.CalculationResult
|
||||
{
|
||||
public class CalculationResultViewModel
|
||||
{
|
||||
public ICalculationResult SelectedResult { get; set; }
|
||||
public ICommand ShowIsoFieldCommand { get; set; }
|
||||
private ObservableCollection<ICalculationResult> calculationResults;
|
||||
private IEnumerable<INdm> ndms;
|
||||
private IReport isoFieldReport;
|
||||
|
||||
|
||||
public CalculationResultViewModel(IEnumerable<ICalculationResult> results, IEnumerable<INdm> ndmCollection)
|
||||
{
|
||||
ShowIsoFieldCommand = new RelayCommand(o=>ShowIsoField(), o=> !(SelectedResult is null) && SelectedResult.IsValid);
|
||||
//
|
||||
calculationResults = new ObservableCollection<ICalculationResult>();
|
||||
ndms = ndmCollection;
|
||||
foreach (var result in results)
|
||||
{
|
||||
calculationResults.Add(result);
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<ICalculationResult> CalculationResults
|
||||
{
|
||||
get
|
||||
{
|
||||
return calculationResults;
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowIsoField()
|
||||
{
|
||||
IStrainMatrix strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ResultFuncFactory.GetResultFuncs());
|
||||
isoFieldReport = new IsoFieldReport(primitiveSets);
|
||||
isoFieldReport.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user