diff --git a/App.xaml b/App.xaml
index 92ce395..9d626e4 100644
--- a/App.xaml
+++ b/App.xaml
@@ -5,16 +5,16 @@
+
+
+
+
+
-
-
-
-
-
diff --git a/Infrastructure/UI/DataContexts/PrimitiveBase.cs b/Infrastructure/UI/DataContexts/PrimitiveBase.cs
index f5d1ff0..8ad2a80 100644
--- a/Infrastructure/UI/DataContexts/PrimitiveBase.cs
+++ b/Infrastructure/UI/DataContexts/PrimitiveBase.cs
@@ -254,7 +254,6 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
public virtual void RefreshNdmPrimitive()
{
-
}
public void RefreshColor()
diff --git a/Infrastructure/UI/Resources/DataGridStyles.xaml b/Infrastructure/UI/Resources/DataGridStyles.xaml
index e5fe7dd..073904f 100644
--- a/Infrastructure/UI/Resources/DataGridStyles.xaml
+++ b/Infrastructure/UI/Resources/DataGridStyles.xaml
@@ -11,5 +11,4 @@
-
\ No newline at end of file
diff --git a/Infrastructure/UI/Resources/DataGridTemplates.xaml b/Infrastructure/UI/Resources/DataGridTemplates.xaml
index 8c9d75f..9868d6f 100644
--- a/Infrastructure/UI/Resources/DataGridTemplates.xaml
+++ b/Infrastructure/UI/Resources/DataGridTemplates.xaml
@@ -18,5 +18,4 @@
-
\ No newline at end of file
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index 7fecb95..6d61ae9 100644
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -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")]
diff --git a/StructureHelper.csproj b/StructureHelper.csproj
index 6934552..4d8a953 100644
--- a/StructureHelper.csproj
+++ b/StructureHelper.csproj
@@ -238,6 +238,9 @@
HeadMaterialsView.xaml
+
+ VisualPropertyView.xaml
+
PrimitivePropertiesView.xaml
@@ -259,6 +262,7 @@
+
@@ -407,6 +411,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/Windows/MainWindow/MainModel.cs b/Windows/MainWindow/MainModel.cs
index b80ab2a..b9e8526 100644
--- a/Windows/MainWindow/MainModel.cs
+++ b/Windows/MainWindow/MainModel.cs
@@ -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 GetNdms(ICalculationProperty calculationProperty)
{
var ndmPrimitives = Section.SectionRepository.Primitives;
@@ -69,22 +61,5 @@ namespace StructureHelper.Windows.MainWindow
return ndmCollection;
}
-
- //public ILoaderResults CalculateResult(IEnumerable 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;
- //}
}
}
diff --git a/Windows/MainWindow/MainView.xaml b/Windows/MainWindow/MainView.xaml
index 190da84..647a5c0 100644
--- a/Windows/MainWindow/MainView.xaml
+++ b/Windows/MainWindow/MainView.xaml
@@ -52,9 +52,10 @@
-
@@ -168,10 +169,10 @@
+ Viewport="{Binding CanvasViewportSize}" ViewportUnits="Absolute"
+ Viewbox="{Binding CanvasViewportSize}" ViewboxUnits="Absolute">
-
+
@@ -209,6 +210,12 @@
+
+
+
+
+
+
diff --git a/Windows/MainWindow/MainViewModel.cs b/Windows/MainWindow/MainViewModel.cs
index f3b0d70..0bbc3de 100644
--- a/Windows/MainWindow/MainViewModel.cs
+++ b/Windows/MainWindow/MainViewModel.cs
@@ -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 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 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 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 GetCasePrimitives(RectangleBeamTemplate template)
{
var wnd = new RectangleBeamView(template);
diff --git a/Windows/MainWindow/VisualPropertyView.xaml b/Windows/MainWindow/VisualPropertyView.xaml
new file mode 100644
index 0000000..e5cff22
--- /dev/null
+++ b/Windows/MainWindow/VisualPropertyView.xaml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Windows/MainWindow/VisualPropertyView.xaml.cs b/Windows/MainWindow/VisualPropertyView.xaml.cs
new file mode 100644
index 0000000..4a15149
--- /dev/null
+++ b/Windows/MainWindow/VisualPropertyView.xaml.cs
@@ -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
+{
+ ///
+ /// Логика взаимодействия для VisualPropertyView.xaml
+ ///
+ public partial class VisualPropertyView : Window
+ {
+ public VisualPropertyView(CrossSectionViewVisualProperty vm)
+ {
+ InitializeComponent();
+ DataContext = vm;
+ }
+ }
+}
diff --git a/Windows/ViewModels/NdmCrossSections/CrossSectionViewVisualProperty.cs b/Windows/ViewModels/NdmCrossSections/CrossSectionViewVisualProperty.cs
new file mode 100644
index 0000000..c9e5e4c
--- /dev/null
+++ b/Windows/ViewModels/NdmCrossSections/CrossSectionViewVisualProperty.cs
@@ -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;
+ }
+ }
+}
diff --git a/Windows/ViewModels/NdmCrossSections/PrimitiveViewModelLogic.cs b/Windows/ViewModels/NdmCrossSections/PrimitiveViewModelLogic.cs
index 81efbf7..59477cf 100644
--- a/Windows/ViewModels/NdmCrossSections/PrimitiveViewModelLogic.cs
+++ b/Windows/ViewModels/NdmCrossSections/PrimitiveViewModelLogic.cs
@@ -117,8 +117,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
get
{
return editCommand ??
- (
- editCommand = new RelayCommand(
+ (editCommand = new RelayCommand(
o => EditSelectedItem(),
o => SelectedItem != null
));