HeadMaterial Window was fixed
This commit is contained in:
10
App.xaml
10
App.xaml
@@ -5,16 +5,16 @@
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/CommonEnums.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Styles.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/DataGridStyles.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ButtonStyles.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/Converters.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/DataGridTemplates.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/PrimitiveTemplates.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ShapeEditTemplates.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/Converters.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/PrimitiveToolTips.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ITemEditPanels.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ButtonStyles.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/CommonEnums.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/DataGridTemplates.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/DataGridStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
@@ -254,7 +254,6 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
|
||||
public virtual void RefreshNdmPrimitive()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RefreshColor()
|
||||
|
||||
@@ -11,5 +11,4 @@
|
||||
<Setter Property="SelectedItem" Value="{Binding SelectedItem}"/>
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -18,5 +18,4 @@
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</DataTemplate>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -49,5 +49,5 @@ using System.Windows;
|
||||
// Можно задать все значения или принять номера сборки и редакции по умолчанию
|
||||
// используя "*", как показано ниже:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("2023.01.08.01")]
|
||||
[assembly: AssemblyFileVersion("2023.01.08.01")]
|
||||
|
||||
@@ -238,6 +238,9 @@
|
||||
<Compile Include="Windows\MainWindow\Materials\HeadMaterialsView.xaml.cs">
|
||||
<DependentUpon>HeadMaterialsView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Windows\MainWindow\VisualPropertyView.xaml.cs">
|
||||
<DependentUpon>VisualPropertyView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Windows\PrimitivePropertiesWindow\PrimitivePropertiesView.xaml.cs">
|
||||
<DependentUpon>PrimitivePropertiesView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -259,6 +262,7 @@
|
||||
<Compile Include="Windows\ViewModels\Forces\ActionsViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\NdmCrossSections\IPrimitiveViewModelLogic.cs" />
|
||||
<Compile Include="Windows\ViewModels\NdmCrossSections\PrimitiveViewModelLogic.cs" />
|
||||
<Compile Include="Windows\ViewModels\NdmCrossSections\CrossSectionViewVisualProperty.cs" />
|
||||
<Compile Include="Windows\ViewModels\OkCancelViewModelBase.cs" />
|
||||
<Compile Include="Windows\ViewModels\PrimitiveProperties\SelectPrimitivesViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\SelectItemsViewModel.cs" />
|
||||
@@ -407,6 +411,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Windows\MainWindow\VisualPropertyView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Windows\PrimitivePropertiesWindow\PrimitivePropertiesView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -48,14 +48,6 @@ namespace StructureHelper.Windows.MainWindow
|
||||
HeadMaterialRepository = new HeadMaterialRepository(this);
|
||||
}
|
||||
|
||||
//public IStrainMatrix Calculate(double mx, double my, double nz)
|
||||
//{
|
||||
// var unitSystem = unitSystemService.GetCurrentSystem();
|
||||
// return calculationService.GetPrimitiveStrainMatrix(primitiveRepository.Primitives.Select(x => x.GetNdmPrimitive(unitSystem)).ToArray(),
|
||||
// mx, my, nz,
|
||||
// CalculationProperty.LimitState, CalculationProperty.CalcTerm);
|
||||
//}
|
||||
|
||||
public IEnumerable<INdm> GetNdms(ICalculationProperty calculationProperty)
|
||||
{
|
||||
var ndmPrimitives = Section.SectionRepository.Primitives;
|
||||
@@ -69,22 +61,5 @@ namespace StructureHelper.Windows.MainWindow
|
||||
|
||||
return ndmCollection;
|
||||
}
|
||||
|
||||
//public ILoaderResults CalculateResult(IEnumerable<INdm> ndmCollection, IForceMatrix forceMatrix)
|
||||
//{
|
||||
// var loaderData = new LoaderOptions
|
||||
// {
|
||||
// Preconditions = new Preconditions
|
||||
// {
|
||||
// ConditionRate = 0.01,
|
||||
// MaxIterationCount = 100,
|
||||
// StartForceMatrix = forceMatrix
|
||||
// },
|
||||
// NdmCollection = ndmCollection
|
||||
// };
|
||||
// var calculator = new Calculator();
|
||||
// calculator.Run(loaderData, new CancellationToken());
|
||||
// return calculator.Result;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,9 +52,10 @@
|
||||
<Button Content="Concrete slab" Command="{Binding AddSlabCase}"/>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<!--<MenuItem Header="Analysis">
|
||||
<MenuItem Header="Tools">
|
||||
<Button Content="Settings" Command="{Binding ShowVisualProperty}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Help">
|
||||
<!--<MenuItem Header="Help">
|
||||
</MenuItem>-->
|
||||
</Menu>
|
||||
<Grid Grid.Row="1">
|
||||
@@ -168,10 +169,10 @@
|
||||
</Canvas.LayoutTransform>
|
||||
<Canvas.Background>
|
||||
<VisualBrush TileMode="Tile"
|
||||
Viewport="0,0,0.050,0.050" ViewportUnits="Absolute"
|
||||
Viewbox="0,0,0.050,0.050" ViewboxUnits="Absolute">
|
||||
Viewport="{Binding CanvasViewportSize}" ViewportUnits="Absolute"
|
||||
Viewbox="{Binding CanvasViewportSize}" ViewboxUnits="Absolute">
|
||||
<VisualBrush.Visual>
|
||||
<Rectangle StrokeThickness="{Binding GridLineThickness}" Height="0.050" Width="0.050" Stroke="Darkgray"/>
|
||||
<Rectangle StrokeThickness="{Binding GridLineThickness}" Height="{Binding GridSize}" Width="{Binding GridSize}" Stroke="Darkgray"/>
|
||||
</VisualBrush.Visual>
|
||||
</VisualBrush>
|
||||
</Canvas.Background>
|
||||
@@ -209,6 +210,12 @@
|
||||
<TextBlock Text="{Binding PrimitiveLogic.PrimitivesCount}"/>
|
||||
</StackPanel>
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Grid size: "/>
|
||||
<TextBlock Text="{Binding GridSize, Converter={StaticResource LengthConverter}}"/>
|
||||
</StackPanel>
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -13,6 +13,7 @@ using StructureHelper.Windows.ViewModels.Calculations.CalculationProperies;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationResult;
|
||||
using StructureHelper.Windows.ViewModels.Forces;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
@@ -20,6 +21,7 @@ using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
||||
using StructureHelperLogics.Models.Templates.RCs;
|
||||
using StructureHelperLogics.Services.NdmCalculations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -31,13 +33,10 @@ namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
public class MainViewModel : ViewModelBase
|
||||
{
|
||||
const double scale = 1d;
|
||||
|
||||
ICrossSection section;
|
||||
ICrossSectionRepository repository => section.SectionRepository;
|
||||
|
||||
private double ConstAxisLineThickness = 2d * scale;
|
||||
private double ConstGridLineThickness = 0.25d * scale;
|
||||
private CrossSectionViewVisualProperty visualProperty;
|
||||
|
||||
private readonly double scaleRate = 1.1d;
|
||||
|
||||
@@ -52,7 +51,6 @@ namespace StructureHelper.Windows.MainWindow
|
||||
private MainModel Model { get; }
|
||||
|
||||
private double panelX, panelY, scrollPanelX, scrollPanelY;
|
||||
private CalculationProperty calculationProperty;
|
||||
|
||||
public double PanelX
|
||||
{
|
||||
@@ -83,35 +81,44 @@ namespace StructureHelper.Windows.MainWindow
|
||||
set
|
||||
{
|
||||
OnPropertyChanged(value, ref scaleValue);
|
||||
axisLineThickness = ConstAxisLineThickness / scaleValue;
|
||||
OnPropertyChanged(nameof(AxisLineThickness));
|
||||
gridLineThickness = ConstGridLineThickness / scaleValue;
|
||||
OnPropertyChanged(nameof(GridLineThickness));
|
||||
}
|
||||
}
|
||||
|
||||
public double AxisLineThickness
|
||||
{
|
||||
get => axisLineThickness;
|
||||
get => visualProperty.AxisLineThickness / scaleValue;
|
||||
}
|
||||
|
||||
public double GridLineThickness
|
||||
{
|
||||
get => gridLineThickness;
|
||||
get => visualProperty.GridLineThickness / scaleValue;
|
||||
}
|
||||
|
||||
private double canvasWidth, canvasHeight, xX2, xY1, yX1, yY2;
|
||||
private double xX2, xY1, yX1, yY2;
|
||||
public double CanvasWidth
|
||||
{
|
||||
get => canvasWidth;
|
||||
set => OnPropertyChanged(value, ref canvasWidth);
|
||||
get => visualProperty.WorkPlainWidth;
|
||||
}
|
||||
|
||||
public double CanvasHeight
|
||||
{
|
||||
get => canvasHeight;
|
||||
set => OnPropertyChanged(value, ref canvasHeight);
|
||||
get => visualProperty.WorkPlainHeight;
|
||||
}
|
||||
|
||||
public string CanvasViewportSize
|
||||
{
|
||||
get
|
||||
{
|
||||
string s = visualProperty.GridSize.ToString();
|
||||
s = s.Replace(',', '.');
|
||||
return $"0,0,{s},{s}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public double GridSize { get => visualProperty.GridSize; }
|
||||
|
||||
public ObservableCollection<IHeadMaterial> HeadMaterials
|
||||
{
|
||||
@@ -168,30 +175,40 @@ namespace StructureHelper.Windows.MainWindow
|
||||
public ICommand ScaleCanvasUp { get; }
|
||||
public ICommand SetPopupCanBeClosedTrue { get; }
|
||||
public ICommand SetPopupCanBeClosedFalse { get; }
|
||||
public RelayCommand ShowVisualProperty
|
||||
{
|
||||
get
|
||||
{
|
||||
return showVisualProperty ??
|
||||
(showVisualProperty = new RelayCommand(o=>
|
||||
{
|
||||
var wnd = new VisualPropertyView(visualProperty);
|
||||
wnd.ShowDialog();
|
||||
OnPropertyChanged(nameof(AxisLineThickness));
|
||||
OnPropertyChanged(nameof(CanvasViewportSize));
|
||||
OnPropertyChanged(nameof(GridSize));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private double delta = 0.0005;
|
||||
private double axisLineThickness;
|
||||
private double gridLineThickness;
|
||||
private ActionsViewModel combinationsLogic;
|
||||
private IPrimitiveViewModelLogic primitiveLogic;
|
||||
private RelayCommand showVisualProperty;
|
||||
|
||||
public MainViewModel(MainModel model)
|
||||
{
|
||||
visualProperty = new CrossSectionViewVisualProperty();
|
||||
Model = model;
|
||||
section = model.Section;
|
||||
combinationsLogic = new ActionsViewModel(repository);
|
||||
calculatorsLogic = new CalculatorsViewModelLogic(repository);
|
||||
CanvasWidth = 2d * scale;
|
||||
CanvasHeight = 1.5d * scale;
|
||||
primitiveLogic = new PrimitiveViewModelLogic(repository) { CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight };
|
||||
XX2 = CanvasWidth;
|
||||
XY1 = CanvasHeight / 2d;
|
||||
YX1 = CanvasWidth / 2d;
|
||||
YY2 = CanvasHeight;
|
||||
scaleValue = 400d / scale;
|
||||
axisLineThickness = ConstAxisLineThickness / scaleValue;
|
||||
gridLineThickness = ConstGridLineThickness / scaleValue;
|
||||
calculationProperty = new CalculationProperty();
|
||||
scaleValue = 400d;
|
||||
|
||||
LeftButtonUp = new RelayCommand(o =>
|
||||
{
|
||||
@@ -266,23 +283,15 @@ namespace StructureHelper.Windows.MainWindow
|
||||
PrimitiveLogic.AddItems(GetSlabCasePrimitives());
|
||||
});
|
||||
|
||||
Calculate = new RelayCommand(o =>
|
||||
{
|
||||
CalculateResult();
|
||||
},
|
||||
o => repository.Primitives.Count() > 0);
|
||||
|
||||
EditCalculationPropertyCommand = new RelayCommand (o => EditCalculationProperty());
|
||||
|
||||
MovePrimitiveToGravityCenterCommand = new RelayCommand(o =>
|
||||
{
|
||||
if (CheckMaterials() == false) { return;}
|
||||
IEnumerable<INdm> ndms = Model.GetNdms(calculationProperty);
|
||||
var ndms = NdmPrimitivesService.GetNdms(repository.Primitives, LimitStates.SLS, CalcTerms.ShortTerm);
|
||||
double[] center = GeometryOperations.GetGravityCenter(ndms);
|
||||
foreach (var primitive in Model.PrimitiveRepository.Primitives)
|
||||
foreach (var item in PrimitiveLogic.Items)
|
||||
{
|
||||
primitive.CenterX -= center[0];
|
||||
primitive.CenterY -= center[1];
|
||||
item.CenterX -= center[0];
|
||||
item.CenterY -= center[1];
|
||||
}
|
||||
},
|
||||
o => repository.Primitives.Count() > 0
|
||||
@@ -312,27 +321,6 @@ namespace StructureHelper.Windows.MainWindow
|
||||
}
|
||||
}
|
||||
|
||||
private void CalculateResult()
|
||||
{
|
||||
bool check = CheckAnalisysOptions();
|
||||
if (check == false)
|
||||
{
|
||||
MessageBox.Show(ErrorStrings.DataIsInCorrect, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
IEnumerable<INdm> ndms = Model.GetNdms(calculationProperty);
|
||||
CalculationService calculationService = new CalculationService(calculationProperty);
|
||||
var loaderResults = calculationService.GetCalculationResults(ndms);
|
||||
var wnd = new CalculationResultView(new CalculationResultViewModel(loaderResults, ndms));
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"{ErrorStrings.UnknownError}: {ex}", "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
private bool CheckAnalisysOptions()
|
||||
{
|
||||
if (CheckMaterials() == false) { return false; }
|
||||
@@ -365,12 +353,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
var template = new RectangleBeamTemplate(1d, 0.2d) { CoverGap = 0.04, WidthCount = 5, HeightCount = 2, TopDiameter = 0.012d, BottomDiameter = 0.012d };
|
||||
return GetCasePrimitives(template);
|
||||
}
|
||||
private void EditCalculationProperty()
|
||||
{
|
||||
CalculationPropertyViewModel viewModel = new CalculationPropertyViewModel(calculationProperty);
|
||||
var view = new CalculationPropertyView(viewModel);
|
||||
view.ShowDialog();
|
||||
}
|
||||
|
||||
private IEnumerable<PrimitiveBase> GetCasePrimitives(RectangleBeamTemplate template)
|
||||
{
|
||||
var wnd = new RectangleBeamView(template);
|
||||
|
||||
24
Windows/MainWindow/VisualPropertyView.xaml
Normal file
24
Windows/MainWindow/VisualPropertyView.xaml
Normal file
@@ -0,0 +1,24 @@
|
||||
<Window x:Class="StructureHelper.Windows.MainWindow.VisualPropertyView"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
Title="Grid properies" Height="200" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="130"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Axis grid thickness"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding AxisLineThickness, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||
<TextBlock Grid.Row="1" Text="Mesh size"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding GridSize, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
29
Windows/MainWindow/VisualPropertyView.xaml.cs
Normal file
29
Windows/MainWindow/VisualPropertyView.xaml.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для VisualPropertyView.xaml
|
||||
/// </summary>
|
||||
public partial class VisualPropertyView : Window
|
||||
{
|
||||
public VisualPropertyView(CrossSectionViewVisualProperty vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = vm;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public class CrossSectionViewVisualProperty
|
||||
{
|
||||
public double AxisLineThickness { get; set; }
|
||||
public double GridLineThickness { get; set; }
|
||||
public double GridSize { get; set; }
|
||||
public double WorkPlainWidth { get; set; }
|
||||
public double WorkPlainHeight { get; set; }
|
||||
|
||||
public CrossSectionViewVisualProperty()
|
||||
{
|
||||
AxisLineThickness = 2d;
|
||||
GridLineThickness = 0.25d;
|
||||
GridSize = 0.05d;
|
||||
WorkPlainWidth = 2d;
|
||||
WorkPlainHeight = 1.6d;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,8 +117,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
get
|
||||
{
|
||||
return editCommand ??
|
||||
(
|
||||
editCommand = new RelayCommand(
|
||||
(editCommand = new RelayCommand(
|
||||
o => EditSelectedItem(),
|
||||
o => SelectedItem != null
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user