diff --git a/FieldVisualizer/Entities/ColorMaps/Factories/ColorMapFactory.cs b/FieldVisualizer/Entities/ColorMaps/Factories/ColorMapFactory.cs
index b5c0010..e259a79 100644
--- a/FieldVisualizer/Entities/ColorMaps/Factories/ColorMapFactory.cs
+++ b/FieldVisualizer/Entities/ColorMaps/Factories/ColorMapFactory.cs
@@ -1,12 +1,18 @@
-using FieldVisualizer.InfraStructures.Enums;
-using FieldVisualizer.InfraStructures.Exceptions;
+using FieldVisualizer.InfraStructures.Exceptions;
using FieldVisualizer.InfraStructures.Strings;
-using System;
using System.Collections.Generic;
using System.Windows.Media;
namespace FieldVisualizer.Entities.ColorMaps.Factories
{
+ public enum ColorMapsTypes
+ {
+ LiraSpectrum = 0, //Lira
+ FullSpectrum = 1, //StaDiCon
+ RedToWhite = 2,
+ RedToBlue = 3,
+ BlueToWhite = 4,
+ }
///
/// Factory for creating of different color maps
///
@@ -18,13 +24,39 @@ namespace FieldVisualizer.Entities.ColorMaps.Factories
if (mapsTypes == ColorMapsTypes.RedToWhite) { return GetRedToWhite(); }
if (mapsTypes == ColorMapsTypes.RedToBlue) { return GetRedToBlue(); }
if (mapsTypes == ColorMapsTypes.BlueToWhite) { return GetBlueToWhite(); }
+ if (mapsTypes == ColorMapsTypes.LiraSpectrum) { return GetLiraSpectrum(); }
else { throw new FieldVisulizerException(ErrorStrings.ColorMapTypeIsUnknown); }
}
+ private static IColorMap GetLiraSpectrum()
+ {
+ ColorMap colorMap = new()
+ {
+ Name = "LiraSpectrumColorMap"
+ };
+ List colors = new();
+ byte Alpha = 0xff;
+ colors.AddRange(new Color[]{
+ Color.FromArgb(Alpha, 0, 0, 128) ,//Dark Blue
+ Color.FromArgb(Alpha, 0, 0, 255) ,//Blue
+ Color.FromArgb(Alpha, 0, 128, 255) ,//Blue
+ Color.FromArgb(Alpha, 0, 200, 255) ,//Blue
+ Color.FromArgb(Alpha, 60, 255, 255) ,//Light Blue
+ Color.FromArgb(Alpha, 255, 255, 128) ,//Light Yellow
+ Color.FromArgb(Alpha, 255, 255, 0) ,//Yellow
+ Color.FromArgb(Alpha, 255, 215, 0) ,//Gold
+ Color.FromArgb(Alpha, 255, 128, 0) ,//Orange Red
+ Color.FromArgb(Alpha, 255, 0, 0) ,//Red
+ });
+ colorMap.Colors = colors;
+ return colorMap;
+ }
private static IColorMap GetFullSpectrum()
{
- ColorMap colorMap = new ColorMap();
- colorMap.Name = "FullSpectrumColorMap";
+ ColorMap colorMap = new()
+ {
+ Name = "FullSpectrumColorMap"
+ };
List colors = new List();
byte Alpha = 0xff;
colors.AddRange(new Color[]{
@@ -43,7 +75,6 @@ namespace FieldVisualizer.Entities.ColorMaps.Factories
colorMap.Colors = colors;
return colorMap;
}
-
private static IColorMap GetRedToWhite()
{
ColorMap colorMap = new ColorMap();
@@ -57,7 +88,6 @@ namespace FieldVisualizer.Entities.ColorMaps.Factories
colorMap.Colors = colors;
return colorMap;
}
-
private static IColorMap GetRedToBlue()
{
ColorMap colorMap = new ColorMap();
@@ -71,7 +101,6 @@ namespace FieldVisualizer.Entities.ColorMaps.Factories
colorMap.Colors = colors;
return colorMap;
}
-
private static IColorMap GetBlueToWhite()
{
ColorMap colorMap = new ColorMap();
diff --git a/FieldVisualizer/Entities/ColorMaps/IValueColorArray.cs b/FieldVisualizer/Entities/ColorMaps/IValueColorArray.cs
new file mode 100644
index 0000000..1bed0b5
--- /dev/null
+++ b/FieldVisualizer/Entities/ColorMaps/IValueColorArray.cs
@@ -0,0 +1,13 @@
+using System.Windows.Media;
+
+namespace FieldVisualizer.Entities.ColorMaps
+{
+ public interface IValueColorArray
+ {
+ double AverageValue { get; set; }
+ Color BottomColor { get; set; }
+ double BottomValue { get; set; }
+ Color TopColor { get; set; }
+ double TopValue { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/FieldVisualizer/Entities/ColorMaps/IValueColorRange.cs b/FieldVisualizer/Entities/ColorMaps/IValueColorRange.cs
index d4da2bc..85063a2 100644
--- a/FieldVisualizer/Entities/ColorMaps/IValueColorRange.cs
+++ b/FieldVisualizer/Entities/ColorMaps/IValueColorRange.cs
@@ -1,19 +1,18 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Media;
+using System.Windows.Media;
namespace FieldVisualizer.Entities.ColorMaps
{
+ ///
+ /// Colored range for building color legend
+ ///
public interface IValueColorRange
{
+ ///
+ /// Flag of activity
+ ///
bool IsActive { get; set; }
- double BottomValue { get; set; }
- double AverageValue { get; set; }
- double TopValue {get;set;}
- Color BottomColor { get; set; }
- Color TopColor { get; set; }
+ IValueColorArray ExactValues { get; }
+ IValueColorArray RoundedValues { get; }
+
}
}
diff --git a/FieldVisualizer/Entities/ColorMaps/ValueColorArray.cs b/FieldVisualizer/Entities/ColorMaps/ValueColorArray.cs
new file mode 100644
index 0000000..66cd001
--- /dev/null
+++ b/FieldVisualizer/Entities/ColorMaps/ValueColorArray.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+
+namespace FieldVisualizer.Entities.ColorMaps
+{
+ public class ValueColorArray : IValueColorArray
+ {
+ ///
+ /// Minimum value of range
+ ///
+ public double BottomValue { get; set; }
+ ///
+ /// Average value of range
+ ///
+ public double AverageValue { get; set; }
+ ///
+ /// Maximum value of range
+ ///
+ public double TopValue { get; set; }
+ ///
+ /// Color correspondent to minimum value
+ ///
+ public Color BottomColor { get; set; }
+ ///
+ /// Color correspondent to maximum value
+ ///
+ public Color TopColor { get; set; }
+ }
+}
diff --git a/FieldVisualizer/Entities/ColorMaps/ValueColorRange.cs b/FieldVisualizer/Entities/ColorMaps/ValueColorRange.cs
index 92eaff5..6813268 100644
--- a/FieldVisualizer/Entities/ColorMaps/ValueColorRange.cs
+++ b/FieldVisualizer/Entities/ColorMaps/ValueColorRange.cs
@@ -1,19 +1,16 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Media;
+using System.Windows.Media;
namespace FieldVisualizer.Entities.ColorMaps
{
+ ///
public class ValueColorRange : IValueColorRange
{
+ ///
public bool IsActive { get; set; }
- public double BottomValue { get; set; }
- public double AverageValue { get; set; }
- public double TopValue { get; set; }
- public Color BottomColor { get; set; }
- public Color TopColor { get; set; }
+
+ public IValueColorArray ExactValues { get; private set; } = new ValueColorArray();
+
+ public IValueColorArray RoundedValues { get; private set; } = new ValueColorArray();
+
}
}
diff --git a/FieldVisualizer/FieldVisualizer.csproj b/FieldVisualizer/FieldVisualizer.csproj
index 0a3b622..dc9183b 100644
--- a/FieldVisualizer/FieldVisualizer.csproj
+++ b/FieldVisualizer/FieldVisualizer.csproj
@@ -8,4 +8,12 @@
7.0
+
+
+
+
+
+
+
+
diff --git a/FieldVisualizer/InfraStructures/Enums/ColorMapsTypes.cs b/FieldVisualizer/InfraStructures/Enums/ColorMapsTypes.cs
deleted file mode 100644
index 5be9d8c..0000000
--- a/FieldVisualizer/InfraStructures/Enums/ColorMapsTypes.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace FieldVisualizer.InfraStructures.Enums
-{
- public enum ColorMapsTypes
- {
- FullSpectrum = 0,
- RedToWhite = 1,
- RedToBlue = 2,
- BlueToWhite = 3
- }
-}
diff --git a/FieldVisualizer/Services/ColorServices/ColorOperations.cs b/FieldVisualizer/Services/ColorServices/ColorOperations.cs
index dd4c7c7..412f247 100644
--- a/FieldVisualizer/Services/ColorServices/ColorOperations.cs
+++ b/FieldVisualizer/Services/ColorServices/ColorOperations.cs
@@ -1,5 +1,7 @@
using FieldVisualizer.Entities.ColorMaps;
using FieldVisualizer.Entities.Values;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Text;
@@ -10,54 +12,132 @@ namespace FieldVisualizer.Services.ColorServices
public static class ColorOperations
{
const byte Alpha = 0xff;
- public static Color GetColorByValue(IValueRange range, IColorMap map, double val)
- {
- if (range.TopValue == range.BottomValue || map.Colors.Count == 0) { return map.Colors[0]; }
- double minVal = range.BottomValue - 1e-15d*(Math.Abs(range.BottomValue));
- double maxVal = range.TopValue + 1e-15d * (Math.Abs(range.TopValue));
- if (val > maxVal || val < minVal) { return Colors.Gray; }
- if (val == minVal) { return map.Colors[0]; }
- if (val == maxVal) { return map.Colors[map.Colors.Count - 1]; }
-
- double valPerc = (val - minVal) / (maxVal - minVal);// value%
- if (valPerc >= 1d)
- { return map.Colors[map.Colors.Count - 1]; }
- double colorPerc = 1d / (map.Colors.Count - 1d); // % of each block of color. the last is the "100% Color"
- double blockOfColor = valPerc / colorPerc;// the integer part repersents how many block to skip
- int blockIdx = (int)Math.Truncate(blockOfColor);// Idx of
- double valPercResidual = valPerc - (blockIdx * colorPerc);//remove the part represented of block
- double percOfColor = valPercResidual / colorPerc;// % of color of this block that will be filled
-
- Color cTarget = map.Colors[blockIdx];
- Color cNext = map.Colors[blockIdx + 1];
-
- var deltaR = cNext.R - cTarget.R;
- var deltaG = cNext.G - cTarget.G;
- var deltaB = cNext.B - cTarget.B;
-
- var R = cTarget.R + (deltaR * percOfColor);
- var G = cTarget.G + (deltaG * percOfColor);
- var B = cTarget.B + (deltaB * percOfColor);
-
- Color c = map.Colors[0];
- c = Color.FromArgb(Alpha, (byte)R, (byte)G, (byte)B);
- return c;
- }
+ static IMathRoundLogic roundLogic = new SmartRoundLogic();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public static IEnumerable GetValueColorRanges(IValueRange fullRange, IEnumerable valueRanges, IColorMap colorMap)
{
var colorRanges = new List();
foreach (var valueRange in valueRanges)
{
- IValueColorRange valueColorRange = new ValueColorRange();
- valueColorRange.IsActive = true;
- valueColorRange.BottomValue = valueRange.BottomValue;
- valueColorRange.AverageValue = (valueRange.BottomValue + valueRange.TopValue) / 2;
- valueColorRange.TopValue = valueRange.TopValue;
- valueColorRange.BottomColor = GetColorByValue(fullRange, colorMap, valueColorRange.BottomValue);
- valueColorRange.TopColor = GetColorByValue(fullRange, colorMap, valueColorRange.TopValue);
+ var valueColorRange = new ValueColorRange
+ {
+ IsActive = true,
+ };
+ valueColorRange.ExactValues.BottomValue = valueRange.BottomValue;
+ valueColorRange.ExactValues.AverageValue = (valueRange.BottomValue + valueRange.TopValue) / 2;
+ valueColorRange.ExactValues.TopValue = valueRange.TopValue;
+ valueColorRange.ExactValues.BottomColor = GetColorByValue(fullRange, colorMap, valueColorRange.ExactValues.BottomValue);
+ valueColorRange.ExactValues.TopColor = GetColorByValue(fullRange, colorMap, valueColorRange.ExactValues.TopValue);
+ valueColorRange.RoundedValues.BottomValue = roundLogic.RoundValue(valueColorRange.ExactValues.BottomValue);
+ valueColorRange.RoundedValues.AverageValue = roundLogic.RoundValue(valueColorRange.ExactValues.AverageValue);
+ valueColorRange.RoundedValues.TopValue = roundLogic.RoundValue(valueColorRange.ExactValues.TopValue);
colorRanges.Add(valueColorRange);
}
return colorRanges;
}
+ ///
+ /// Returns color by value, range of value an color map
+ ///
+ /// Range of valoue
+ /// Color map
+ /// Value
+ ///
+ public static Color GetColorByValue(IValueRange range, IColorMap map, double val)
+ {
+ CheckColorMap(map);
+ if (range.TopValue == range.BottomValue || map.Colors.Count == 1) //if range width is zero or map contain just 1 color
+ {
+ return map.Colors[0];
+ }
+ var valueRange = GetExtendedRange(range);
+ if (val >= valueRange.TopValue || val <= valueRange.BottomValue)
+ {
+ return GetColorValueIsOutOfRange(valueRange, map, val);
+ }
+ return GetColorValueIsInRange(valueRange, map, val);
+ }
+
+ private static Color GetColorValueIsOutOfRange(IValueRange range, IColorMap map, double val)
+ {
+ if (val > range.TopValue || val < range.BottomValue)
+ {
+ return Colors.Gray;
+ }
+ if (val == range.BottomValue)
+ {
+ return map.Colors[0];
+ }
+ if (val == range.TopValue)
+ {
+ return map.Colors[^1];
+ }
+ throw new StructureHelperException(ErrorStrings.DataIsInCorrect);
+ }
+
+ private static Color GetColorValueIsInRange(IValueRange range, IColorMap map, double val)
+ {
+ var deltaVal = val - range.BottomValue;
+ var rangeWidth = range.TopValue - range.BottomValue;
+ var valPerc = deltaVal / rangeWidth; // percent of value on the distance from minValue to maxValue
+ if (valPerc >= 1d)
+ {
+ return map.Colors[^1];
+ }
+ double colorPerc = 1d / (map.Colors.Count - 1d); // % of each block of color. the last is the "100% Color"
+ double blockOfColor = valPerc / colorPerc;// the integer part represents how many block to skip
+ int blockIdx = (int)Math.Truncate(blockOfColor);// Idx of
+ double valPercResidual = valPerc - (blockIdx * colorPerc);//remove the part represented of block
+ double percOfColor = valPercResidual / colorPerc;// % of color of this block that will be filled
+
+ //in some cases due to accuracy of double type percent of color may be less than zero
+ if (percOfColor <= 0d)
+ {
+ return map.Colors[blockIdx];
+ }
+ Color c = GetColorByColorMap(map, blockIdx, percOfColor);
+ return c;
+ }
+
+ private static IValueRange GetExtendedRange(IValueRange range)
+ {
+ var minVal = range.BottomValue - 1e-15d * Math.Abs(range.BottomValue);
+ var maxVal = range.TopValue + 1e-15d * Math.Abs(range.TopValue);
+ return new ValueRange()
+ {
+ BottomValue = minVal,
+ TopValue = maxVal
+ };
+ }
+
+ private static Color GetColorByColorMap(IColorMap map, int blockIdx, double percOfColor)
+ {
+ Color cTarget = map.Colors[blockIdx];
+ Color cNext = map.Colors[blockIdx + 1];
+
+ var deltaRed = cNext.R - cTarget.R;
+ var deltaGreen = cNext.G - cTarget.G;
+ var deltaBlue = cNext.B - cTarget.B;
+
+ var Red = cTarget.R + (deltaRed * percOfColor);
+ var Green = cTarget.G + (deltaGreen * percOfColor);
+ var Blue = cTarget.B + (deltaBlue * percOfColor);
+
+ Color c = Color.FromArgb(Alpha, (byte)Red, (byte)Green, (byte)Blue);
+ return c;
+ }
+
+ private static void CheckColorMap(IColorMap map)
+ {
+ if (map.Colors.Count == 0)
+ {
+ throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Color map is empty");
+ }
+ }
}
}
diff --git a/FieldVisualizer/ViewModels/FieldViewerViewModels/FieldViewerViewModel.cs b/FieldVisualizer/ViewModels/FieldViewerViewModels/FieldViewerViewModel.cs
index 4f16ce6..ca3b3a0 100644
--- a/FieldVisualizer/ViewModels/FieldViewerViewModels/FieldViewerViewModel.cs
+++ b/FieldVisualizer/ViewModels/FieldViewerViewModels/FieldViewerViewModel.cs
@@ -1,32 +1,29 @@
-using FieldVisualizer.Entities.ColorMaps.Factories;
-using FieldVisualizer.Entities.ColorMaps;
-using FieldVisualizer.Entities.Values.Primitives;
+using FieldVisualizer.Entities.ColorMaps;
+using FieldVisualizer.Entities.ColorMaps.Factories;
using FieldVisualizer.Entities.Values;
+using FieldVisualizer.Entities.Values.Primitives;
using FieldVisualizer.Infrastructure.Commands;
-using FieldVisualizer.InfraStructures.Enums;
using FieldVisualizer.InfraStructures.Exceptions;
using FieldVisualizer.InfraStructures.Strings;
using FieldVisualizer.Services.ColorServices;
using FieldVisualizer.Services.PrimitiveServices;
using FieldVisualizer.Services.ValueRanges;
+using FieldVisualizer.Windows.UserControls;
+using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
-using FieldVisualizer.Windows.UserControls;
-using System.ComponentModel;
-using System.Xml.Serialization;
namespace FieldVisualizer.ViewModels.FieldViewerViewModels
{
public class FieldViewerViewModel : ViewModelBase, IDataErrorInfo
{
+ private IMathRoundLogic roundLogic = new SmartRoundLogic() { DigitQuant = 3 };
public ICommand RebuildCommand { get; }
public ICommand ZoomInCommand { get; }
public ICommand ZoomOutCommand { get; }
@@ -164,8 +161,8 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
private ColorMapsTypes _ColorMapType;
private IColorMap _ColorMap;
private IValueRange valueRange;
- private IEnumerable _ValueRanges;
- private IEnumerable _ValueColorRanges;
+ private IEnumerable valueRanges;
+ private IEnumerable valueColorRanges;
private bool setMinValue;
private bool setMaxValue;
private double crossLineX;
@@ -177,7 +174,7 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
public FieldViewerViewModel()
{
- _ColorMapType = ColorMapsTypes.FullSpectrum;
+ _ColorMapType = ColorMapsTypes.LiraSpectrum;
RebuildCommand = new RelayCommand(o => ProcessPrimitives(), o => PrimitiveValidation());
ZoomInCommand = new RelayCommand(o => Zoom(1.2), o => PrimitiveValidation());
ZoomOutCommand = new RelayCommand(o => Zoom(0.8), o => PrimitiveValidation());
@@ -195,7 +192,7 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
if ((PrimitiveSet is null) == false)
{
ProcessPrimitives();
- Legend.ValueColorRanges = _ValueColorRanges;
+ Legend.ValueColorRanges = valueColorRanges;
Legend.Refresh();
}
}
@@ -262,14 +259,14 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
{
SolidColorBrush brush = new SolidColorBrush();
brush.Color = ColorOperations.GetColorByValue(valueRange, _ColorMap, valuePrimitive.Value);
- foreach (var valueRange in _ValueColorRanges)
+ foreach (var valueRange in valueColorRanges)
{
- if (valuePrimitive.Value >= valueRange.BottomValue & valuePrimitive.Value <= valueRange.TopValue & (!valueRange.IsActive))
+ if (valuePrimitive.Value >= valueRange.ExactValues.BottomValue & valuePrimitive.Value <= valueRange.ExactValues.TopValue & (!valueRange.IsActive))
{
brush.Color = Colors.Gray;
}
}
- shape.ToolTip = valuePrimitive.Value;
+ shape.ToolTip = roundLogic.RoundValue(valuePrimitive.Value);
shape.Tag = valuePrimitive;
shape.Fill = brush;
Canvas.SetLeft(shape, valuePrimitive.CenterX - addX - dX);
@@ -306,10 +303,24 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
{
UserValueRange.TopValue = UserValueRange.BottomValue;
}
- if (SetMinValue) { valueRange.BottomValue = UserValueRange.BottomValue; } else { UserValueRange.BottomValue = valueRange.BottomValue; }
- if (SetMaxValue) { valueRange.TopValue = UserValueRange.TopValue; } else { UserValueRange.TopValue = valueRange.TopValue; }
- _ValueRanges = ValueRangeOperations.DivideValueRange(valueRange, RangeNumber);
- _ValueColorRanges = ColorOperations.GetValueColorRanges(valueRange, _ValueRanges, _ColorMap);
+ if (SetMinValue == true)
+ {
+ valueRange.BottomValue = UserValueRange.BottomValue;
+ }
+ else
+ {
+ UserValueRange.BottomValue = valueRange.BottomValue;
+ }
+ if (SetMaxValue == true)
+ {
+ valueRange.TopValue = UserValueRange.TopValue;
+ }
+ else
+ {
+ UserValueRange.TopValue = valueRange.TopValue;
+ }
+ valueRanges = ValueRangeOperations.DivideValueRange(valueRange, RangeNumber);
+ valueColorRanges = ColorOperations.GetValueColorRanges(valueRange, valueRanges, _ColorMap);
}
private void SetCrossLine(object commandParameter)
{
diff --git a/FieldVisualizer/Windows/UserControls/FieldViewer.xaml.cs b/FieldVisualizer/Windows/UserControls/FieldViewer.xaml.cs
index 1166be2..96e6753 100644
--- a/FieldVisualizer/Windows/UserControls/FieldViewer.xaml.cs
+++ b/FieldVisualizer/Windows/UserControls/FieldViewer.xaml.cs
@@ -1,23 +1,7 @@
-using FieldVisualizer.Entities.ColorMaps;
-using FieldVisualizer.Entities.ColorMaps.Factories;
-using FieldVisualizer.Entities.Values;
-using FieldVisualizer.Entities.Values.Primitives;
-using FieldVisualizer.Infrastructure.Commands;
-using FieldVisualizer.InfraStructures.Enums;
-using FieldVisualizer.InfraStructures.Exceptions;
-using FieldVisualizer.InfraStructures.Strings;
-using FieldVisualizer.Services.ColorServices;
-using FieldVisualizer.Services.PrimitiveServices;
-using FieldVisualizer.Services.ValueRanges;
+using FieldVisualizer.Entities.Values.Primitives;
using FieldVisualizer.ViewModels.FieldViewerViewModels;
-using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Windows;
using System.Windows.Controls;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Shapes;
namespace FieldVisualizer.Windows.UserControls
{
@@ -39,17 +23,6 @@ namespace FieldVisualizer.Windows.UserControls
viewModel.Legend = LegendViewer;
}
- //public FieldViewer(FieldViewerViewModel vm)
- //{
- // InitializeComponent();
- // viewModel = vm;
- // this.DataContext = viewModel;
- // PrimitiveSet = viewModel.PrimitiveSet;
- // viewModel.WorkPlaneBox = WorkPlaneBox;
- // viewModel.WorkPlaneCanvas = WorkPlaneCanvas;
- // viewModel.Legend = LegendViewer;
- //}
-
public IPrimitiveSet PrimitiveSet { get => viewModel.PrimitiveSet; set { viewModel.PrimitiveSet = value; } }
internal void Refresh()
diff --git a/FieldVisualizer/Windows/UserControls/VerticalLegend.xaml b/FieldVisualizer/Windows/UserControls/VerticalLegend.xaml
index 5116791..58c8315 100644
--- a/FieldVisualizer/Windows/UserControls/VerticalLegend.xaml
+++ b/FieldVisualizer/Windows/UserControls/VerticalLegend.xaml
@@ -20,23 +20,23 @@
-
+
-
+
-
-
+
+
-
-
+
+
-
+
diff --git a/FieldVisualizer/Windows/WndFieldViewer.xaml b/FieldVisualizer/Windows/WndFieldViewer.xaml
index 7362c15..7a290d6 100644
--- a/FieldVisualizer/Windows/WndFieldViewer.xaml
+++ b/FieldVisualizer/Windows/WndFieldViewer.xaml
@@ -6,7 +6,7 @@
xmlns:FieldViewerControl="clr-namespace:FieldVisualizer.Windows.UserControls"
xmlns:local="clr-namespace:FieldVisualizer.Windows"
mc:Ignorable="d"
- Title="FieldViewer" Height="800" Width="1200" WindowStartupLocation="CenterOwner">
+ Title="FieldViewer" Height="800" Width="1200" MinHeight="400" MinWidth="800" MaxHeight="1000" MaxWidth="1500" WindowStartupLocation="CenterScreen" ShowInTaskbar="False">
diff --git a/StructureHelper.sln b/StructureHelper.sln
index 10d38cf..7bf9930 100644
--- a/StructureHelper.sln
+++ b/StructureHelper.sln
@@ -14,6 +14,9 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureHelperLogics", "StructureHelperLogics\StructureHelperLogics.csproj", "{C9192AE7-EE6D-409C-A05C-3549D78CBB34}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FieldVisualizer", "FieldVisualizer\FieldVisualizer.csproj", "{6CAC5B83-81F3-47C2-92A1-0F94A58491C2}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F1548BD2-7FE8-46C2-9BC4-9BA813A5C59A} = {F1548BD2-7FE8-46C2-9BC4-9BA813A5C59A}
+ EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/StructureHelper/App.xaml b/StructureHelper/App.xaml
index 9d626e4..70db8cc 100644
--- a/StructureHelper/App.xaml
+++ b/StructureHelper/App.xaml
@@ -15,6 +15,11 @@
+
+
+
+
+
diff --git a/StructureHelper/App.xaml.cs b/StructureHelper/App.xaml.cs
index 0f7f3b1..86d7f43 100644
--- a/StructureHelper/App.xaml.cs
+++ b/StructureHelper/App.xaml.cs
@@ -22,15 +22,15 @@ namespace StructureHelper
builder.RegisterType().As().SingleInstance();
builder.RegisterType().AsSelf().SingleInstance();
builder.RegisterType().AsSelf().SingleInstance();
- builder.RegisterType().AsSelf().SingleInstance();
- builder.RegisterType().AsSelf().SingleInstance();
+ builder.RegisterType().AsSelf().SingleInstance();
+ builder.RegisterType().AsSelf().SingleInstance();
- builder.RegisterType().AsSelf();
+ builder.RegisterType().AsSelf();
Container = builder.Build();
Scope = Container.Resolve();
- var window = Scope.Resolve();
+ var window = Scope.Resolve();
window.Show();
}
diff --git a/StructureHelper/Documentation/License.txt b/StructureHelper/Documentation/License.txt
new file mode 100644
index 0000000..31bf5cc
--- /dev/null
+++ b/StructureHelper/Documentation/License.txt
@@ -0,0 +1,7 @@
+Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/StructureHelper/Documentation/LicenseRus.txt b/StructureHelper/Documentation/LicenseRus.txt
new file mode 100644
index 0000000..bdc1a69
--- /dev/null
+++ b/StructureHelper/Documentation/LicenseRus.txt
@@ -0,0 +1,7 @@
+Copyright (c) 2023 , ,
+
+ , ( ), , , , , , , , / , , , :
+
+ .
+
+ ܻ, - , , , , . - , , , , , - .
\ No newline at end of file
diff --git a/StructureHelper/Documentation/Manuals/UserManual.docx b/StructureHelper/Documentation/Manuals/UserManual.docx
new file mode 100644
index 0000000..13c1427
Binary files /dev/null and b/StructureHelper/Documentation/Manuals/UserManual.docx differ
diff --git a/StructureHelper/Documentation/Manuals/UserManual.pdf b/StructureHelper/Documentation/Manuals/UserManual.pdf
new file mode 100644
index 0000000..5dca716
Binary files /dev/null and b/StructureHelper/Documentation/Manuals/UserManual.pdf differ
diff --git a/StructureHelper/Infrastructure/Enums/ActionType.cs b/StructureHelper/Infrastructure/Enums/ActionType.cs
new file mode 100644
index 0000000..3a81918
--- /dev/null
+++ b/StructureHelper/Infrastructure/Enums/ActionType.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Infrastructure.Enums
+{
+ public enum ActionType
+ {
+ ForceCombination,
+ ForceCombinationByFactor
+ }
+}
diff --git a/StructureHelper/Infrastructure/Enums/CalculatorTypes.cs b/StructureHelper/Infrastructure/Enums/CalculatorTypes.cs
new file mode 100644
index 0000000..fd4e157
--- /dev/null
+++ b/StructureHelper/Infrastructure/Enums/CalculatorTypes.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Infrastructure.Enums
+{
+ public enum CalculatorTypes
+ {
+ ForceCalculator,
+ LimitCurveCalculator,
+ CrackCalculator,
+ FireCalculator
+ }
+}
diff --git a/StructureHelper/Infrastructure/Enums/MaterialType.cs b/StructureHelper/Infrastructure/Enums/MaterialType.cs
new file mode 100644
index 0000000..19b6550
--- /dev/null
+++ b/StructureHelper/Infrastructure/Enums/MaterialType.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Infrastructure.Enums
+{
+ internal enum MaterialType
+ {
+ Concrete,
+ Reinforcement,
+ Elastic,
+ CarbonFiber,
+ GlassFiber
+ }
+}
diff --git a/StructureHelper/Infrastructure/Enums/PrimitiveType.cs b/StructureHelper/Infrastructure/Enums/PrimitiveType.cs
index 7cf1ab0..fd86219 100644
--- a/StructureHelper/Infrastructure/Enums/PrimitiveType.cs
+++ b/StructureHelper/Infrastructure/Enums/PrimitiveType.cs
@@ -3,6 +3,8 @@
public enum PrimitiveType
{
Point,
- Rectangle
+ Rectangle,
+ Circle,
+ Reinforcement
}
}
\ No newline at end of file
diff --git a/StructureHelper/Infrastructure/UI/Converters/CommonOperation.cs b/StructureHelper/Infrastructure/UI/Converters/CommonOperation.cs
deleted file mode 100644
index ccad02e..0000000
--- a/StructureHelper/Infrastructure/UI/Converters/CommonOperation.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-using Newtonsoft.Json.Linq;
-using StructureHelper.Infrastructure.UI.Converters.Units;
-using StructureHelperCommon.Infrastructures.Enums;
-using StructureHelperCommon.Infrastructures.Exceptions;
-using StructureHelperCommon.Infrastructures.Strings;
-using StructureHelperCommon.Services.Units;
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
-
-namespace StructureHelper.Infrastructure.UI.Converters
-{
- internal static class CommonOperation
- {
- private static IEnumerable units = UnitsFactory.GetUnitCollection();
-
- public static double ConvertToDoubleChangeComma(string s)
- {
- double result;
- if (!double.TryParse(s, NumberStyles.Any, CultureInfo.CurrentCulture, out result) &&
- !double.TryParse(s, NumberStyles.Any, CultureInfo.GetCultureInfo("en-US"), out result) &&
- !double.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out result))
- {
- throw new StructureHelperException($"{ErrorStrings.IncorrectValue}: {s}");
- }
- return result;
- }
-
- public static IStringDoublePair DivideIntoStringDoublePair(string s)
- {
- s = s.Replace(" ", "");
- string digitPattern = @"^[-]?[+]?\d+(\.?|\,?)\d*";
- string textPattern = @"[0-9]|\.|\,";
- string caracterPattern = "[a-z]+$";
- string target = "";
- Regex regexText = new Regex(textPattern);
- string textString = regexText.Replace(s, target);
- var textMatch = Regex.Match(textString, caracterPattern, RegexOptions.IgnoreCase);
- if (textMatch.Success) {textString = textMatch.Value.ToLower();}
- var match = Regex.Match(s, digitPattern);
- if (match.Success)
- {
- string digitString = match.Value;
- double digit = ConvertToDoubleChangeComma(digitString);
- return new StringDoublePair() { Digit = digit, Text = textString };
- }
- throw new StructureHelperException(ErrorStrings.DataIsInCorrect);
- }
-
- public static IUnit GetUnit(UnitTypes unitType, string unitName)
- {
- return units.Where(u => u.UnitType == unitType & u.Name == unitName).Single();
- }
-
- public static string Convert(IUnit unit, string unitName, object value)
- {
- double val;
- if (value != null) { val = (double)value; }
- else { throw new Exception($"{unitName} value is null"); }
- val *= unit.Multiplyer;
- string strValue = $"{val} {unit.Name}";
- return strValue;
- }
-
- public static double ConvertBack(UnitTypes unitType, IUnit unit, object value)
- {
- double val;
- double multy;
- double coefficient = unit.Multiplyer;
- var strVal = value as string;
- IStringDoublePair pair = DivideIntoStringDoublePair(strVal);
- try
- {
- multy = GetMultiplyer(unitType, pair.Text);
- }
- catch (Exception ex)
- {
- multy = coefficient;
- }
- val = pair.Digit / multy;
- return val;
- }
-
- private static double GetMultiplyer(UnitTypes unitType, string unitName)
- {
- try
- {
- return units.Where(u => u.UnitType == unitType & u.Name == unitName).Single().Multiplyer;
- }
- catch (Exception ex)
- {
- throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ex);
- }
- }
- }
-}
diff --git a/StructureHelper/Infrastructure/UI/Converters/IStringDoublePair.cs b/StructureHelper/Infrastructure/UI/Converters/IStringDoublePair.cs
deleted file mode 100644
index 83de3b6..0000000
--- a/StructureHelper/Infrastructure/UI/Converters/IStringDoublePair.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace StructureHelper.Infrastructure.UI.Converters
-{
- internal interface IStringDoublePair
- {
- double Digit { get; }
- string Text { get; }
- }
-}
diff --git a/StructureHelper/Infrastructure/UI/Converters/Units/Area.cs b/StructureHelper/Infrastructure/UI/Converters/Units/Area.cs
index 383fb7f..74a112d 100644
--- a/StructureHelper/Infrastructure/UI/Converters/Units/Area.cs
+++ b/StructureHelper/Infrastructure/UI/Converters/Units/Area.cs
@@ -14,7 +14,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
internal class Area : UnitBase
{
public override UnitTypes UnitType { get => UnitTypes.Area; }
- public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "mm2"); }
+ public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "mm2"); }
public override string UnitName { get => "Area"; }
}
}
diff --git a/StructureHelper/Infrastructure/UI/Converters/Units/CrackWidth.cs b/StructureHelper/Infrastructure/UI/Converters/Units/CrackWidth.cs
new file mode 100644
index 0000000..e520311
--- /dev/null
+++ b/StructureHelper/Infrastructure/UI/Converters/Units/CrackWidth.cs
@@ -0,0 +1,28 @@
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Services;
+using StructureHelperCommon.Services.Units;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Infrastructure.UI.Converters.Units
+{
+ internal class CrackWidth : UnitBase
+ {
+ public CrackWidth()
+ {
+ OperationLogic = new ConvertUnitLogic()
+ {
+ MathRoundLogic = new FixedRoundLogic()
+ {
+ DigitQuant = 3
+ }
+ };
+ }
+ public override UnitTypes UnitType { get => UnitTypes.Length; }
+ public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "mm"); }
+ public override string UnitName { get => "Length"; }
+ }
+}
diff --git a/StructureHelper/Infrastructure/UI/Converters/Units/Curvature.cs b/StructureHelper/Infrastructure/UI/Converters/Units/Curvature.cs
index ec5a34b..1a34053 100644
--- a/StructureHelper/Infrastructure/UI/Converters/Units/Curvature.cs
+++ b/StructureHelper/Infrastructure/UI/Converters/Units/Curvature.cs
@@ -11,7 +11,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
internal class Curvature : UnitBase
{
public override UnitTypes UnitType { get => UnitTypes.Curvature; }
- public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "1/mm"); }
+ public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "1/mm"); }
public override string UnitName { get => "Curvature"; }
}
}
diff --git a/StructureHelper/Infrastructure/UI/Converters/Units/Force.cs b/StructureHelper/Infrastructure/UI/Converters/Units/Force.cs
index 408660d..941f47d 100644
--- a/StructureHelper/Infrastructure/UI/Converters/Units/Force.cs
+++ b/StructureHelper/Infrastructure/UI/Converters/Units/Force.cs
@@ -13,7 +13,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
internal class Force : UnitBase
{
public override UnitTypes UnitType { get => UnitTypes.Force; }
- public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "kN"); }
+ public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "kN"); }
public override string UnitName { get => "Force"; }
}
}
diff --git a/StructureHelper/Infrastructure/UI/Converters/Units/Length.cs b/StructureHelper/Infrastructure/UI/Converters/Units/Length.cs
index e991a30..e4a01e1 100644
--- a/StructureHelper/Infrastructure/UI/Converters/Units/Length.cs
+++ b/StructureHelper/Infrastructure/UI/Converters/Units/Length.cs
@@ -1,22 +1,13 @@
using StructureHelperCommon.Infrastructures.Enums;
-using StructureHelperCommon.Infrastructures.Exceptions;
-using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Services.Units;
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Data;
namespace StructureHelper.Infrastructure.UI.Converters.Units
{
internal class Length : UnitBase
{
+
public override UnitTypes UnitType { get => UnitTypes.Length; }
- public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "mm"); }
+ public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "mm"); }
public override string UnitName { get => "Length"; }
}
}
diff --git a/StructureHelper/Infrastructure/UI/Converters/Units/Moment.cs b/StructureHelper/Infrastructure/UI/Converters/Units/Moment.cs
index 76f8d6d..f260d7a 100644
--- a/StructureHelper/Infrastructure/UI/Converters/Units/Moment.cs
+++ b/StructureHelper/Infrastructure/UI/Converters/Units/Moment.cs
@@ -11,7 +11,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
internal class Moment : UnitBase
{
public override UnitTypes UnitType { get => UnitTypes.Moment; }
- public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "kNm"); }
+ public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "kNm"); }
public override string UnitName { get => "Moment"; }
}
}
diff --git a/StructureHelper/Infrastructure/UI/Converters/Units/PlainDouble.cs b/StructureHelper/Infrastructure/UI/Converters/Units/PlainDouble.cs
index 6ab470e..48cd0ac 100644
--- a/StructureHelper/Infrastructure/UI/Converters/Units/PlainDouble.cs
+++ b/StructureHelper/Infrastructure/UI/Converters/Units/PlainDouble.cs
@@ -1,5 +1,5 @@
using StructureHelperCommon.Infrastructures.Exceptions;
-using StructureHelperCommon.Infrastructures.Strings;
+using StructureHelperCommon.Services.Units;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -12,6 +12,8 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{
internal class PlainDouble : IValueConverter
{
+ IConvertUnitLogic operationLogic = new ConvertUnitLogic();
+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
try
@@ -28,7 +30,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{
try
{
- return CommonOperation.ConvertToDoubleChangeComma((string)value);
+ return ProcessString.ConvertCommaToCultureSettings((string)value);
}
catch (Exception)
{
diff --git a/StructureHelper/Infrastructure/UI/Converters/Units/Stress.cs b/StructureHelper/Infrastructure/UI/Converters/Units/Stress.cs
index eec20ab..f07de25 100644
--- a/StructureHelper/Infrastructure/UI/Converters/Units/Stress.cs
+++ b/StructureHelper/Infrastructure/UI/Converters/Units/Stress.cs
@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Services;
using StructureHelperCommon.Services.Units;
using System;
using System.Collections.Generic;
@@ -12,8 +13,19 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{
internal class Stress : UnitBase
{
+
public override UnitTypes UnitType { get => UnitTypes.Stress; }
- public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "MPa"); }
+ public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "MPa"); }
public override string UnitName { get => "Stress"; }
+ public Stress()
+ {
+ OperationLogic = new ConvertUnitLogic()
+ {
+ MathRoundLogic = new SmartRoundLogic()
+ {
+ DigitQuant = 3
+ }
+ };
+ }
}
}
diff --git a/StructureHelper/Infrastructure/UI/Converters/Units/UnitBase.cs b/StructureHelper/Infrastructure/UI/Converters/Units/UnitBase.cs
index ef778b0..4955cf1 100644
--- a/StructureHelper/Infrastructure/UI/Converters/Units/UnitBase.cs
+++ b/StructureHelper/Infrastructure/UI/Converters/Units/UnitBase.cs
@@ -1,4 +1,7 @@
using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Models.Calculators;
+using StructureHelperCommon.Models.Parameters;
+using StructureHelperCommon.Services;
using StructureHelperCommon.Services.Units;
using System;
using System.Collections.Generic;
@@ -14,19 +17,61 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{
internal abstract class UnitBase : IValueConverter
{
+ IMathRoundLogic roundLogic = new DirectRoundLogic();
+ public IConvertUnitLogic OperationLogic { get; set; } = new ConvertUnitLogic();
+ public IGetUnitLogic UnitLogic { get; set; } = new GetUnitLogic();
public abstract UnitTypes UnitType { get; }
public abstract IUnit CurrentUnit { get; }
public abstract string UnitName { get;}
+ ///
+ /// From variable to user
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
- return CommonOperation.Convert(CurrentUnit, UnitName, value);
+ var pair = OperationLogic.Convert(CurrentUnit, UnitName, value);
+ var result = pair.Value;
+ if (parameter is not null)
+ {
+ if (parameter is string paramString)
+ {
+ var logic = new ProcessDoublePairLogic() { DigitPlace = DigitPlace.Any };
+ var paramPair = logic.GetValuePairByString(paramString);
+ string paramTextPart = paramPair.Text.ToLower();
+ int paramValuePart = (int)paramPair.Value;
+ if (paramTextPart == "smart")
+ {
+ roundLogic = new SmartRoundLogic() { DigitQuant = paramValuePart };
+ }
+ else if (paramTextPart == "fixed")
+ {
+ roundLogic = new FixedRoundLogic() { DigitQuant = paramValuePart };
+ }
+ result = roundLogic.RoundValue(result);
+ }
+ }
+ string strValue = $"{result} {pair.Text}";
+ return strValue;
}
-
+ ///
+ /// From user to variable
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
try
{
- return CommonOperation.ConvertBack(UnitType, CurrentUnit, value);
+ double result = OperationLogic.ConvertBack(UnitType, CurrentUnit, value);
+
+ return result;
}
catch (Exception)
{
diff --git a/StructureHelper/Infrastructure/UI/Converters/Units/UnitConstatnts.cs b/StructureHelper/Infrastructure/UI/Converters/Units/UnitConstants.cs
similarity index 88%
rename from StructureHelper/Infrastructure/UI/Converters/Units/UnitConstatnts.cs
rename to StructureHelper/Infrastructure/UI/Converters/Units/UnitConstants.cs
index 26e085b..420de44 100644
--- a/StructureHelper/Infrastructure/UI/Converters/Units/UnitConstatnts.cs
+++ b/StructureHelper/Infrastructure/UI/Converters/Units/UnitConstants.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace StructureHelper.Infrastructure.UI.Converters.Units
{
- internal static class UnitConstatnts
+ internal static class UnitConstants
{
public static double Length = 1e3d;
public static double Force = 1e-3d;
diff --git a/StructureHelper/Infrastructure/UI/DataContexts/CircleViewPrimitive.cs b/StructureHelper/Infrastructure/UI/DataContexts/CircleViewPrimitive.cs
new file mode 100644
index 0000000..748b9ed
--- /dev/null
+++ b/StructureHelper/Infrastructure/UI/DataContexts/CircleViewPrimitive.cs
@@ -0,0 +1,64 @@
+using StructureHelper.Infrastructure.UI.Converters.Units;
+using StructureHelper.Windows.ViewModels.NdmCrossSections;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperLogics.NdmCalculations.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Infrastructure.UI.DataContexts
+{
+ public class CircleViewPrimitive : PrimitiveBase, IHasCenter
+ {
+ ICirclePrimitive primitive;
+ public double Diameter
+ {
+ get
+ {
+ return primitive.Diameter;
+ }
+ set
+ {
+ primitive.Diameter = value;
+ RefreshPlacement();
+ }
+ }
+
+ public double PrimitiveLeft => DeltaX - Diameter / 2d;
+ public double PrimitiveTop => DeltaY - Diameter / 2d;
+
+ public CircleViewPrimitive(INdmPrimitive primitive) : base(primitive)
+ {
+ if (primitive is not ICirclePrimitive)
+ {
+ throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $"\nExpected: {nameof(ICirclePrimitive)}, But was: {nameof(primitive)}");
+ }
+ var circle = primitive as ICirclePrimitive;
+ this.primitive = circle;
+ DivisionViewModel = new HasDivisionViewModel(circle);
+ }
+
+ public override INdmPrimitive GetNdmPrimitive()
+ {
+ return primitive;
+ }
+
+ private void RefreshPlacement()
+ {
+ OnPropertyChanged(nameof(Diameter));
+ OnPropertyChanged(nameof(CenterX));
+ OnPropertyChanged(nameof(CenterY));
+ OnPropertyChanged(nameof(PrimitiveLeft));
+ OnPropertyChanged(nameof(PrimitiveTop));
+ }
+ public override void Refresh()
+ {
+ OnPropertyChanged(nameof(Diameter));
+ OnPropertyChanged(nameof(PrimitiveLeft));
+ OnPropertyChanged(nameof(PrimitiveTop));
+ base.Refresh();
+ }
+ }
+}
diff --git a/StructureHelper/Infrastructure/UI/DataContexts/Factories/ViewPrimitiveFactory.cs b/StructureHelper/Infrastructure/UI/DataContexts/Factories/ViewPrimitiveFactory.cs
new file mode 100644
index 0000000..82d9ada
--- /dev/null
+++ b/StructureHelper/Infrastructure/UI/DataContexts/Factories/ViewPrimitiveFactory.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Infrastructure.UI.DataContexts
+{
+ internal static class ViewPrimitiveFactory
+ {
+ // to do public static PrimitiveBase GetViewPrimitive() { }
+ }
+}
diff --git a/StructureHelper/Infrastructure/UI/DataContexts/IHasDivision.cs b/StructureHelper/Infrastructure/UI/DataContexts/IHasDivision.cs
index 463022d..e6353db 100644
--- a/StructureHelper/Infrastructure/UI/DataContexts/IHasDivision.cs
+++ b/StructureHelper/Infrastructure/UI/DataContexts/IHasDivision.cs
@@ -1,4 +1,5 @@
-using System;
+using StructureHelper.Windows.ViewModels.NdmCrossSections;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,7 +9,6 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
{
internal interface IHasDivision
{
- int NdmMinDivision { get; set; }
- double NdmMaxSize { get; set; }
+ HasDivisionViewModel HasDivisionViewModel { get; }
}
}
diff --git a/StructureHelper/Infrastructure/UI/DataContexts/LineViewPrimitive.cs b/StructureHelper/Infrastructure/UI/DataContexts/LineViewPrimitive.cs
deleted file mode 100644
index d9df827..0000000
--- a/StructureHelper/Infrastructure/UI/DataContexts/LineViewPrimitive.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using StructureHelper.Infrastructure.Enums;
-using StructureHelper.Services.Primitives;
-using StructureHelper.UnitSystem.Systems;
-using StructureHelper.Windows.MainWindow;
-using StructureHelperCommon.Models.Shapes;
-using StructureHelperLogics.Models.Primitives;
-using StructureHelperLogics.NdmCalculations.Primitives;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace StructureHelper.Infrastructure.UI.DataContexts
-{
- internal class LineViewPrimitive : PrimitiveBase
- {
- public LineViewPrimitive(ILinePrimitive primitive) : base(primitive)
- {
-
- }
-
- //public LineViewPrimitive(double x, double y, MainViewModel ownerVM) : base(x, y, ownerVM)
- //{
- //}
- }
-}
diff --git a/StructureHelper/Infrastructure/UI/DataContexts/PointViewPrimitive.cs b/StructureHelper/Infrastructure/UI/DataContexts/PointViewPrimitive.cs
index cff5884..bc5d969 100644
--- a/StructureHelper/Infrastructure/UI/DataContexts/PointViewPrimitive.cs
+++ b/StructureHelper/Infrastructure/UI/DataContexts/PointViewPrimitive.cs
@@ -42,7 +42,11 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
{
return primitive;
}
-
+ public override void Refresh()
+ {
+ RefreshPlacement();
+ base.Refresh();
+ }
private void RefreshPlacement()
{
OnPropertyChanged(nameof(Area));
diff --git a/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveBase.cs b/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveBase.cs
index 65f7625..47bfe52 100644
--- a/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveBase.cs
+++ b/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveBase.cs
@@ -1,27 +1,16 @@
-using System;
-using System.Collections.Generic;
-using System.Windows;
-using System.Windows.Documents;
+using StructureHelper.Models.Materials;
+using StructureHelper.Services.Primitives;
+using StructureHelper.Windows.MainWindow;
+using StructureHelper.Windows.ViewModels.NdmCrossSections;
+using StructureHelperCommon.Models.Shapes;
+using StructureHelperLogics.NdmCalculations.Primitives;
+using System;
using System.Windows.Input;
using System.Windows.Media;
-using StructureHelper.Infrastructure.Enums;
-using StructureHelper.Infrastructure.UI.Converters.Units;
-using StructureHelper.Models.Materials;
-using StructureHelper.Services.Primitives;
-using StructureHelper.UnitSystem.Systems;
-using StructureHelper.Windows.MainWindow;
-using StructureHelperCommon.Infrastructures.Enums;
-using StructureHelperCommon.Infrastructures.Exceptions;
-using StructureHelperCommon.Infrastructures.Strings;
-using StructureHelperLogics.Models.Materials;
-using StructureHelperCommon.Services.ColorServices;
-using StructureHelperLogics.Models.Primitives;
-using System.Windows.Controls;
-using StructureHelperLogics.NdmCalculations.Primitives;
namespace StructureHelper.Infrastructure.UI.DataContexts
{
- public abstract class PrimitiveBase : ViewModelBase
+ public abstract class PrimitiveBase : ViewModelBase, IObserver
{
#region Поля
private IPrimitiveRepository primitiveRepository;
@@ -34,6 +23,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
#endregion
#region Свойства
+ public HasDivisionViewModel DivisionViewModel { get; set; }
public INdmPrimitive NdmPrimitive
{
get => primitive;
@@ -51,52 +41,61 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
}
public double CenterX
{
- get => primitive.CenterX;
+ get => primitive.Center.X;
set
{
- primitive.CenterX = value;
+ primitive.Center.X = value;
OnPropertyChanged(nameof(CenterX));
}
}
public double CenterY
{
- get => primitive.CenterY;
+ get => primitive.Center.Y;
set
{
- primitive.CenterY = value;
+ primitive.Center.Y = value;
OnPropertyChanged(nameof(CenterY));
OnPropertyChanged(nameof(InvertedCenterY));
}
}
- public double InvertedCenterY => - CenterY;
- public double PrestrainKx
- { get => primitive.UsersPrestrain.Kx;
+ public bool Triangulate
+ {
+ get => primitive.Triangulate;
set
{
- primitive.UsersPrestrain.Kx = value;
+ primitive.Triangulate = value;
+ OnPropertyChanged(nameof(Triangulate));
+ }
+ }
+ public double InvertedCenterY => - CenterY;
+ public double PrestrainKx
+ { get => primitive.UsersPrestrain.Mx;
+ set
+ {
+ primitive.UsersPrestrain.Mx = value;
OnPropertyChanged(nameof(PrestrainKx));
}
}
public double PrestrainKy
- { get => primitive.UsersPrestrain.Ky;
+ { get => primitive.UsersPrestrain.My;
set
{
- primitive.UsersPrestrain.Ky = value;
+ primitive.UsersPrestrain.My = value;
OnPropertyChanged(nameof(PrestrainKy));
}
}
public double PrestrainEpsZ
- { get => primitive.UsersPrestrain.EpsZ;
+ { get => primitive.UsersPrestrain.Nz;
set
{
- primitive.UsersPrestrain.EpsZ = value;
+ primitive.UsersPrestrain.Nz = value;
OnPropertyChanged(nameof(PrestrainEpsZ));
}
}
- public double AutoPrestrainKx => primitive.AutoPrestrain.Kx;
- public double AutoPrestrainKy => primitive.AutoPrestrain.Ky;
- public double AutoPrestrainEpsZ => primitive.AutoPrestrain.EpsZ;
+ public double AutoPrestrainKx => primitive.AutoPrestrain.Mx;
+ public double AutoPrestrainKy => primitive.AutoPrestrain.My;
+ public double AutoPrestrainEpsZ => primitive.AutoPrestrain.Nz;
public IHeadMaterial HeadMaterial
{
@@ -239,30 +238,45 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
this.primitive = primitive;
}
- public void RegisterDeltas(double dx, double dy)
- {
- DeltaX = dx;
- DeltaY = dy;
- }
-
- public MainViewModel OwnerVM { get; private set; }
+ public CrossSectionViewModel OwnerVM { get; private set; }
public double DeltaX { get; private set; }
public double DeltaY { get; private set; }
public virtual INdmPrimitive GetNdmPrimitive()
{
- RefreshNdmPrimitive();
+ //RefreshNdmPrimitive();
return primitive;
}
- public virtual void RefreshNdmPrimitive()
+ public virtual void Refresh()
{
+ OnPropertyChanged(nameof(Name));
+ OnPropertyChanged(nameof(Color));
+ OnPropertyChanged(nameof(CenterX));
+ OnPropertyChanged(nameof(CenterY));
+ OnPropertyChanged(nameof(InvertedCenterY));
+ OnPropertyChanged(nameof(SetMaterialColor));
+ OnPropertyChanged(nameof(Triangulate));
+ OnPropertyChanged(nameof(PrimitiveWidth));
+ OnPropertyChanged(nameof(PrimitiveHeight));
}
- public void RefreshColor()
+ public void OnCompleted()
{
- OnPropertyChanged(nameof(Color));
+ throw new NotImplementedException();
+ }
+
+ public void OnError(Exception error)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnNext(IRectangleShape value)
+ {
+ DeltaX = value.Width / 2d;
+ DeltaY = value.Height / 2d;
+ Refresh();
}
}
}
diff --git a/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveOperations.cs b/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveOperations.cs
index 7e3c315..1f963a0 100644
--- a/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveOperations.cs
+++ b/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveOperations.cs
@@ -1,5 +1,4 @@
using StructureHelperCommon.Infrastructures.Exceptions;
-using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
@@ -17,21 +16,37 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
public static ObservableCollection ConvertNdmPrimitivesToPrimitiveBase(IEnumerable primitives)
{
ObservableCollection viewItems = new ObservableCollection();
- foreach (var item in primitives)
+ foreach (var primitive in primitives)
{
- if (item is IPointPrimitive)
- {
- var point = item as IPointPrimitive;
- viewItems.Add(new PointViewPrimitive(point));
- }
- else if (item is IRectanglePrimitive)
- {
- var rect = item as IRectanglePrimitive;
- viewItems.Add(new RectangleViewPrimitive(rect));
- }
- else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
+ viewItems.Add(ConvertNdmPrimitiveToPrimitiveBase(primitive));
}
return viewItems;
}
+ public static PrimitiveBase ConvertNdmPrimitiveToPrimitiveBase(INdmPrimitive primitive)
+ {
+ PrimitiveBase viewItem;
+ if (primitive is IRectanglePrimitive)
+ {
+ var rect = primitive as IRectanglePrimitive;
+ viewItem = new RectangleViewPrimitive(rect);
+ }
+ else if (primitive is ICirclePrimitive)
+ {
+ var circle = primitive as ICirclePrimitive;
+ viewItem = new CircleViewPrimitive(circle);
+ }
+ else if (primitive is IPointPrimitive & primitive is not RebarPrimitive)
+ {
+ var point = primitive as IPointPrimitive;
+ viewItem = new PointViewPrimitive(point);
+ }
+ else if (primitive is RebarPrimitive)
+ {
+ var point = primitive as RebarPrimitive;
+ viewItem = new ReinforcementViewPrimitive(point);
+ }
+ else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Actual type: {primitive.GetType()}");
+ return viewItem;
+ }
}
}
diff --git a/StructureHelper/Infrastructure/UI/DataContexts/RectangleViewPrimitive.cs b/StructureHelper/Infrastructure/UI/DataContexts/RectangleViewPrimitive.cs
index 58697f1..f286553 100644
--- a/StructureHelper/Infrastructure/UI/DataContexts/RectangleViewPrimitive.cs
+++ b/StructureHelper/Infrastructure/UI/DataContexts/RectangleViewPrimitive.cs
@@ -1,15 +1,9 @@
-using StructureHelper.Infrastructure.Enums;
-using StructureHelper.UnitSystem.Systems;
-using StructureHelper.Windows.MainWindow;
-using StructureHelperLogics.Models.Materials;
-using StructureHelperCommon.Models.Shapes;
-using System;
-using StructureHelperLogics.Models.Primitives;
+using StructureHelper.Windows.ViewModels.NdmCrossSections;
using StructureHelperLogics.NdmCalculations.Primitives;
namespace StructureHelper.Infrastructure.UI.DataContexts
{
- public class RectangleViewPrimitive : PrimitiveBase, IHasDivision, IHasCenter
+ public class RectangleViewPrimitive : PrimitiveBase, IHasCenter
{
private IRectanglePrimitive primitive;
@@ -42,30 +36,18 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
{
get => DeltaY - primitive.Height / 2d;
}
- public int NdmMinDivision
- {
- get => primitive.NdmMinDivision;
- set
- {
- primitive.NdmMinDivision = value;
- OnPropertyChanged(nameof(NdmMinDivision));
- }
- }
- public double NdmMaxSize
- {
- get => primitive.NdmMaxSize;
- set
- {
- primitive.NdmMaxSize = value;
- OnPropertyChanged(nameof(NdmMaxSize));
- }
- }
public RectangleViewPrimitive(IRectanglePrimitive _primitive) : base(_primitive)
{
primitive = _primitive;
+ DivisionViewModel = new HasDivisionViewModel(primitive);
+ }
+ public override void Refresh()
+ {
+ OnPropertyChanged(nameof(PrimitiveLeft));
+ OnPropertyChanged(nameof(PrimitiveTop));
+ base.Refresh();
}
-
public override INdmPrimitive GetNdmPrimitive()
{
return primitive;
diff --git a/StructureHelper/Infrastructure/UI/DataContexts/ReinforcementViewPrimitive.cs b/StructureHelper/Infrastructure/UI/DataContexts/ReinforcementViewPrimitive.cs
new file mode 100644
index 0000000..e644160
--- /dev/null
+++ b/StructureHelper/Infrastructure/UI/DataContexts/ReinforcementViewPrimitive.cs
@@ -0,0 +1,34 @@
+using StructureHelperLogics.NdmCalculations.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Infrastructure.UI.DataContexts
+{
+ public class ReinforcementViewPrimitive : PointViewPrimitive, IHasHostPrimitive
+ {
+ RebarPrimitive primitive;
+
+ public INdmPrimitive HostPrimitive
+ {
+ get => primitive.HostPrimitive;
+ set
+ {
+ primitive.HostPrimitive = value;
+ OnPropertyChanged(nameof(HostPrimitive));
+ }
+ }
+
+ public ReinforcementViewPrimitive(RebarPrimitive _primitive) : base(_primitive)
+ {
+ primitive = _primitive;
+ }
+ public override void Refresh()
+ {
+ OnPropertyChanged(nameof(HostPrimitive));
+ base.Refresh();
+ }
+ }
+}
diff --git a/StructureHelper/Infrastructure/UI/DataTemplates/EllipseTemplate.xaml b/StructureHelper/Infrastructure/UI/DataTemplates/EllipseTemplate.xaml
index d974201..c4de6d7 100644
--- a/StructureHelper/Infrastructure/UI/DataTemplates/EllipseTemplate.xaml
+++ b/StructureHelper/Infrastructure/UI/DataTemplates/EllipseTemplate.xaml
@@ -7,10 +7,9 @@
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
- xmlns:userControls="clr-namespace:StructureHelper.Infrastructure.UI.UserControls"
mc:Ignorable="d">
-
+
@@ -43,6 +42,5 @@
-
diff --git a/StructureHelper/Infrastructure/UI/DataTemplates/RectangleTemplate.xaml b/StructureHelper/Infrastructure/UI/DataTemplates/RectangleTemplate.xaml
index dc410d2..0985cfe 100644
--- a/StructureHelper/Infrastructure/UI/DataTemplates/RectangleTemplate.xaml
+++ b/StructureHelper/Infrastructure/UI/DataTemplates/RectangleTemplate.xaml
@@ -7,7 +7,6 @@
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:infrastructure="clr-namespace:StructureHelper.Infrastructure"
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
- xmlns:userControls="clr-namespace:StructureHelper.Infrastructure.UI.UserControls"
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance dataContexts:RectangleViewPrimitive}">
@@ -52,6 +51,5 @@
-
diff --git a/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_crack.png b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_crack.png
new file mode 100644
index 0000000..a2b453b
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_crack.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_fire.png b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_fire.png
new file mode 100644
index 0000000..fbfba9c
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_fire.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_graph_1.png b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_graph_1.png
new file mode 100644
index 0000000..568ed9e
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_graph_1.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_graph_2.png b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_graph_2.png
new file mode 100644
index 0000000..bd0a5bc
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_graph_2.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_1_1.png b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_1_1.png
new file mode 100644
index 0000000..0134af1
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_1_1.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_2_1.png b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_2_1.png
new file mode 100644
index 0000000..de1e60f
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_2_1.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_3_1.png b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_3_1.png
new file mode 100644
index 0000000..e3426e2
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Graphs/32px_interpolation_3_1.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/Objects/Beam32.png b/StructureHelper/Infrastructure/UI/Icons/Objects/Beam32.png
new file mode 100644
index 0000000..151fd5f
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Objects/Beam32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/Objects/CircleColumn32.png b/StructureHelper/Infrastructure/UI/Icons/Objects/CircleColumn32.png
new file mode 100644
index 0000000..aab72db
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Objects/CircleColumn32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/Objects/RectangleColumn32.png b/StructureHelper/Infrastructure/UI/Icons/Objects/RectangleColumn32.png
new file mode 100644
index 0000000..cdbd253
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Objects/RectangleColumn32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/Objects/Slab32.png b/StructureHelper/Infrastructure/UI/Icons/Objects/Slab32.png
new file mode 100644
index 0000000..be1aa1e
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/Objects/Slab32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/actions/32px_delete.png b/StructureHelper/Infrastructure/UI/Icons/actions/32px_delete.png
new file mode 100644
index 0000000..3f5bdd7
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/actions/32px_delete.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/actions/32px_edit.png b/StructureHelper/Infrastructure/UI/Icons/actions/32px_edit.png
new file mode 100644
index 0000000..2e582bb
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/actions/32px_edit.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/actions/32px_move to the center.png b/StructureHelper/Infrastructure/UI/Icons/actions/32px_move to the center.png
new file mode 100644
index 0000000..9789578
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/actions/32px_move to the center.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/analysis/Analysis32.png b/StructureHelper/Infrastructure/UI/Icons/analysis/Analysis32.png
new file mode 100644
index 0000000..9d479ae
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/analysis/Analysis32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/analysis/Calculator32.png b/StructureHelper/Infrastructure/UI/Icons/analysis/Calculator32.png
new file mode 100644
index 0000000..ffcb39a
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/analysis/Calculator32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/combination/32px_factored combination.png b/StructureHelper/Infrastructure/UI/Icons/combination/32px_factored combination.png
new file mode 100644
index 0000000..123c4ee
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/combination/32px_factored combination.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/combination/32px_full combination.png b/StructureHelper/Infrastructure/UI/Icons/combination/32px_full combination.png
new file mode 100644
index 0000000..28bcf81
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/combination/32px_full combination.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/geometry/Circle32.png b/StructureHelper/Infrastructure/UI/Icons/geometry/Circle32.png
new file mode 100644
index 0000000..0a5eb2e
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/geometry/Circle32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/geometry/Point32.png b/StructureHelper/Infrastructure/UI/Icons/geometry/Point32.png
new file mode 100644
index 0000000..523a79a
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/geometry/Point32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/geometry/Rebar32.png b/StructureHelper/Infrastructure/UI/Icons/geometry/Rebar32.png
new file mode 100644
index 0000000..fe44fad
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/geometry/Rebar32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/geometry/Rectangle32.png b/StructureHelper/Infrastructure/UI/Icons/geometry/Rectangle32.png
new file mode 100644
index 0000000..f32c3ae
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/geometry/Rectangle32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/materials/ConMaterial32.png b/StructureHelper/Infrastructure/UI/Icons/materials/ConMaterial32.png
new file mode 100644
index 0000000..d5fcce3
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/materials/ConMaterial32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/materials/ElasticMaterial32.png b/StructureHelper/Infrastructure/UI/Icons/materials/ElasticMaterial32.png
new file mode 100644
index 0000000..e32435d
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/materials/ElasticMaterial32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/materials/GlassMaterial32.png b/StructureHelper/Infrastructure/UI/Icons/materials/GlassMaterial32.png
new file mode 100644
index 0000000..70e2773
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/materials/GlassMaterial32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/materials/Materials32.png b/StructureHelper/Infrastructure/UI/Icons/materials/Materials32.png
new file mode 100644
index 0000000..67b64bf
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/materials/Materials32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/materials/RFMaterial32.png b/StructureHelper/Infrastructure/UI/Icons/materials/RFMaterial32.png
new file mode 100644
index 0000000..bd3b7c7
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/materials/RFMaterial32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/materials/СarbonMaterial32.png b/StructureHelper/Infrastructure/UI/Icons/materials/СarbonMaterial32.png
new file mode 100644
index 0000000..726db7c
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/materials/СarbonMaterial32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/settings/32px_tools.png b/StructureHelper/Infrastructure/UI/Icons/settings/32px_tools.png
new file mode 100644
index 0000000..e5dd0d7
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/settings/32px_tools.png differ
diff --git a/StructureHelper/Infrastructure/UI/Icons/settings/32px_visual settings.png b/StructureHelper/Infrastructure/UI/Icons/settings/32px_visual settings.png
new file mode 100644
index 0000000..25a94c5
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Icons/settings/32px_visual settings.png differ
diff --git a/StructureHelper/Infrastructure/UI/Resources/32px_add beam.png b/StructureHelper/Infrastructure/UI/Resources/32px_add beam.png
new file mode 100644
index 0000000..151fd5f
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Resources/32px_add beam.png differ
diff --git a/StructureHelper/Infrastructure/UI/Resources/32px_add circle column.png b/StructureHelper/Infrastructure/UI/Resources/32px_add circle column.png
new file mode 100644
index 0000000..aab72db
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Resources/32px_add circle column.png differ
diff --git a/StructureHelper/Infrastructure/UI/Resources/32px_edit.png b/StructureHelper/Infrastructure/UI/Resources/32px_edit.png
new file mode 100644
index 0000000..2e582bb
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Resources/32px_edit.png differ
diff --git a/StructureHelper/Infrastructure/UI/Resources/Beam32.png b/StructureHelper/Infrastructure/UI/Resources/Beam32.png
new file mode 100644
index 0000000..151fd5f
Binary files /dev/null and b/StructureHelper/Infrastructure/UI/Resources/Beam32.png differ
diff --git a/StructureHelper/Infrastructure/UI/Resources/ButtonStyles.xaml b/StructureHelper/Infrastructure/UI/Resources/ButtonStyles.xaml
index c3744c2..7e48c6e 100644
--- a/StructureHelper/Infrastructure/UI/Resources/ButtonStyles.xaml
+++ b/StructureHelper/Infrastructure/UI/Resources/ButtonStyles.xaml
@@ -1,8 +1,8 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StructureHelper/Infrastructure/UI/Resources/Converters.xaml b/StructureHelper/Infrastructure/UI/Resources/Converters.xaml
index d46f2f9..f02301e 100644
--- a/StructureHelper/Infrastructure/UI/Resources/Converters.xaml
+++ b/StructureHelper/Infrastructure/UI/Resources/Converters.xaml
@@ -12,4 +12,6 @@
+
+
\ No newline at end of file
diff --git a/StructureHelper/Infrastructure/UI/Resources/Cracks.xaml b/StructureHelper/Infrastructure/UI/Resources/Cracks.xaml
new file mode 100644
index 0000000..12f6a73
--- /dev/null
+++ b/StructureHelper/Infrastructure/UI/Resources/Cracks.xaml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StructureHelper/Infrastructure/UI/Resources/ForceTemplates.xaml b/StructureHelper/Infrastructure/UI/Resources/ForceTemplates.xaml
new file mode 100644
index 0000000..39c13cf
--- /dev/null
+++ b/StructureHelper/Infrastructure/UI/Resources/ForceTemplates.xaml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StructureHelper/Infrastructure/UI/Resources/GraphsTemplates.xaml b/StructureHelper/Infrastructure/UI/Resources/GraphsTemplates.xaml
new file mode 100644
index 0000000..af84c25
--- /dev/null
+++ b/StructureHelper/Infrastructure/UI/Resources/GraphsTemplates.xaml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StructureHelper/Infrastructure/UI/Resources/IconDictionary.xaml b/StructureHelper/Infrastructure/UI/Resources/IconDictionary.xaml
new file mode 100644
index 0000000..c82c837
--- /dev/null
+++ b/StructureHelper/Infrastructure/UI/Resources/IconDictionary.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StructureHelper/Infrastructure/UI/Resources/ItemEditPanels.xaml b/StructureHelper/Infrastructure/UI/Resources/ItemEditPanels.xaml
index c41aa47..4324620 100644
--- a/StructureHelper/Infrastructure/UI/Resources/ItemEditPanels.xaml
+++ b/StructureHelper/Infrastructure/UI/Resources/ItemEditPanels.xaml
@@ -1,6 +1,6 @@
-
+
@@ -8,7 +8,13 @@
-
+
+
+
@@ -16,7 +22,49 @@
+ SelectedItem="{Binding SelectedTargetItem}"
+ ItemTemplate="{Binding ItemDataDemplate}"
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StructureHelper/Infrastructure/UI/Resources/LimitCurveTemplates.xaml b/StructureHelper/Infrastructure/UI/Resources/LimitCurveTemplates.xaml
new file mode 100644
index 0000000..ce0d4a3
--- /dev/null
+++ b/StructureHelper/Infrastructure/UI/Resources/LimitCurveTemplates.xaml
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StructureHelper/Infrastructure/UI/Resources/Materials.xaml b/StructureHelper/Infrastructure/UI/Resources/Materials.xaml
new file mode 100644
index 0000000..5cd1ae1
--- /dev/null
+++ b/StructureHelper/Infrastructure/UI/Resources/Materials.xaml
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StructureHelper/Infrastructure/UI/Resources/ServiceColors.xaml b/StructureHelper/Infrastructure/UI/Resources/ServiceColors.xaml
new file mode 100644
index 0000000..782b8b2
--- /dev/null
+++ b/StructureHelper/Infrastructure/UI/Resources/ServiceColors.xaml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StructureHelper/Infrastructure/UI/Resources/ShapeEditTemplates.xaml b/StructureHelper/Infrastructure/UI/Resources/ShapeEditTemplates.xaml
index b660237..c83a468 100644
--- a/StructureHelper/Infrastructure/UI/Resources/ShapeEditTemplates.xaml
+++ b/StructureHelper/Infrastructure/UI/Resources/ShapeEditTemplates.xaml
@@ -18,4 +18,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StructureHelper/Libraries/LoaderCalculator.dll b/StructureHelper/Libraries/LoaderCalculator.dll
index fc4e080..fd7ba77 100644
Binary files a/StructureHelper/Libraries/LoaderCalculator.dll and b/StructureHelper/Libraries/LoaderCalculator.dll differ
diff --git a/StructureHelper/MaterialCatalogWindow/MaterialCatalogModel.cs b/StructureHelper/MaterialCatalogWindow/MaterialCatalogModel.cs
deleted file mode 100644
index efa3910..0000000
--- a/StructureHelper/MaterialCatalogWindow/MaterialCatalogModel.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using System.Collections.Generic;
-using StructureHelper.Infrastructure;
-using StructureHelper.Models.Materials;
-
-namespace StructureHelper.MaterialCatalogWindow
-{
- public class MaterialCatalogModel
- {
- public NamedList ConcreteDefinitions;
- public NamedList RebarDefinitions;
-
- public List> Materials;
-
- public MaterialCatalogModel()
- {
- InitializeMaterialCollections();
- Materials = new List>();
- Materials.Add(ConcreteDefinitions);
- Materials.Add(RebarDefinitions);
- }
-
- public void InitializeMaterialCollections()
- {
- InitializeConcreteDefinitions();
- InitializeRebarDefinitions();
- }
-
- private void InitializeRebarDefinitions()
- {
- RebarDefinitions = new NamedList
- {
- new RebarDefinition("S240", 2, 240, 240, 1.15, 1.15),
- new RebarDefinition("S400", 2, 400, 400, 1.15, 1.15),
- new RebarDefinition("S500", 2, 500, 500, 1.15, 1.15)
- };
- RebarDefinitions.Name = "Арматура";
- }
-
- private void InitializeConcreteDefinitions()
- {
- ConcreteDefinitions = new NamedList
- {
- new ConcreteDefinition("C10", 0, 10, 0, 1.3, 1.5),
- new ConcreteDefinition("C15", 0, 15, 0, 1.3, 1.5),
- new ConcreteDefinition("C20", 0, 20, 0, 1.3, 1.5),
- new ConcreteDefinition("C25", 0, 25, 0, 1.3, 1.5),
- new ConcreteDefinition("C30", 0, 30, 0, 1.3, 1.5),
- new ConcreteDefinition("C35", 0, 35, 0, 1.3, 1.5),
- new ConcreteDefinition("C40", 0, 40, 0, 1.3, 1.5),
- new ConcreteDefinition("C45", 0, 45, 0, 1.3, 1.5),
- new ConcreteDefinition("C50", 0, 50, 0, 1.3, 1.5),
- new ConcreteDefinition("C60", 0, 60, 0, 1.3, 1.5),
- new ConcreteDefinition("C70", 0, 70, 0, 1.3, 1.5),
- new ConcreteDefinition("C80", 0, 80, 0, 1.3, 1.5)
- };
- ConcreteDefinitions.Name = "Бетон";
- }
- }
-}
diff --git a/StructureHelper/MaterialCatalogWindow/MaterialCatalogView.xaml b/StructureHelper/MaterialCatalogWindow/MaterialCatalogView.xaml
deleted file mode 100644
index 47ea9c0..0000000
--- a/StructureHelper/MaterialCatalogWindow/MaterialCatalogView.xaml
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/StructureHelper/MaterialCatalogWindow/MaterialCatalogView.xaml.cs b/StructureHelper/MaterialCatalogWindow/MaterialCatalogView.xaml.cs
deleted file mode 100644
index 64b925a..0000000
--- a/StructureHelper/MaterialCatalogWindow/MaterialCatalogView.xaml.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using StructureHelper.Infrastructure.UI.DataContexts;
-using System.Windows;
-
-namespace StructureHelper.MaterialCatalogWindow
-{
- ///
- /// Логика взаимодействия для MaterialCatalogView.xaml
- ///
- public partial class MaterialCatalogView : Window
- {
- public MaterialCatalogView(bool isMaterialCanBeSelected = false, PrimitiveBase primitive = null)
- {
- var materialCatalogModel = new MaterialCatalogModel();
- var materialCatalogViewModel = new MaterialCatalogViewModel(materialCatalogModel, this, isMaterialCanBeSelected, primitive);
- DataContext = materialCatalogViewModel;
- InitializeComponent();
- }
- }
-}
diff --git a/StructureHelper/MaterialCatalogWindow/MaterialCatalogViewModel.cs b/StructureHelper/MaterialCatalogWindow/MaterialCatalogViewModel.cs
deleted file mode 100644
index 84a5c5d..0000000
--- a/StructureHelper/MaterialCatalogWindow/MaterialCatalogViewModel.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-using System.Collections.ObjectModel;
-using System.ComponentModel;
-using System.IO;
-using System.Runtime.CompilerServices;
-using System.Windows;
-using System.Windows.Forms;
-using System.Windows.Input;
-using Newtonsoft.Json;
-using StructureHelper.Infrastructure;
-using StructureHelper.Infrastructure.UI.DataContexts;
-using StructureHelper.Models.Materials;
-using StructureHelper.Properties;
-using StructureHelper.Windows.AddMaterialWindow;
-using OpenFileDialog = System.Windows.Forms.OpenFileDialog;
-using SaveFileDialog = System.Windows.Forms.SaveFileDialog;
-
-namespace StructureHelper.MaterialCatalogWindow
-{
- [JsonObject(MemberSerialization.OptIn)]
- public class MaterialCatalogViewModel : INotifyPropertyChanged
- {
- private MaterialCatalogModel materialCatalogModel;
- private MaterialCatalogView materialCatalogView;
-
- [JsonProperty]
- public ObservableCollection ConcreteDefinitions { get; set; }
- [JsonProperty]
- public ObservableCollection RebarDefinitions { get; set; }
- public ICommand AddMaterial { get; }
- public ICommand SaveCatalog { get; }
- public ICommand LoadCatalog { get; }
- public ICommand SelectMaterial { get; }
-
- private MaterialDefinitionBase selectedMaterial;
- public MaterialDefinitionBase SelectedMaterial
- {
- get => selectedMaterial;
- set
- {
- selectedMaterial = value;
- OnPropertyChanged();
- }
- }
-
- private bool isMaterialCanBeSelected;
-
- public bool IsMaterialCanBeSelected
- {
- get => isMaterialCanBeSelected;
- set
- {
- isMaterialCanBeSelected = value;
- OnPropertyChanged();
- OnPropertyChanged(nameof(SelectMaterialButtonVisibility));
- }
- }
-
- public Visibility SelectMaterialButtonVisibility => IsMaterialCanBeSelected ? Visibility.Visible : Visibility.Hidden;
- public MaterialCatalogViewModel() { }
-
- public MaterialCatalogViewModel(MaterialCatalogModel materialCatalogModel, MaterialCatalogView materialCatalogView, bool isMaterialCanBeSelected, PrimitiveBase primitive = null)
- {
- this.materialCatalogModel = materialCatalogModel;
- this.materialCatalogView = materialCatalogView;
- IsMaterialCanBeSelected = isMaterialCanBeSelected;
-
- ConcreteDefinitions = new ObservableCollection(materialCatalogModel.ConcreteDefinitions);
- RebarDefinitions = new ObservableCollection(materialCatalogModel.RebarDefinitions);
-
- AddMaterial = new RelayCommand(o =>
- {
- AddMaterialView addMaterialView = new AddMaterialView(this.materialCatalogModel, this);
- addMaterialView.ShowDialog();
- OnPropertyChanged(nameof(ConcreteDefinitions));
- OnPropertyChanged(nameof(RebarDefinitions));
- });
- SaveCatalog = new RelayCommand(o =>
- {
- string json = JsonConvert.SerializeObject(this, Formatting.Indented);
- SaveFileDialog saveDialog = new SaveFileDialog();
- saveDialog.InitialDirectory = @"C:\";
- saveDialog.Filter = "json files (*.json)|*.json|All files(*.*)|*.*";
- string path = null;
- if (saveDialog.ShowDialog() == DialogResult.OK)
- {
- path = saveDialog.FileName;
- File.WriteAllText(path, json);
- }
- });
- LoadCatalog = new RelayCommand(o =>
- {
- OpenFileDialog openFileDialog = new OpenFileDialog();
- openFileDialog.InitialDirectory = @"C:\";
- openFileDialog.Filter = "json files (*.json)|*.json|All files(*.*)|*.*";
- if (openFileDialog.ShowDialog() == DialogResult.OK)
- {
- var path = openFileDialog.FileName;
- var content = File.ReadAllText(path);
- var vm = JsonConvert.DeserializeObject(content);
- ConcreteDefinitions = vm.ConcreteDefinitions;
- OnPropertyChanged(nameof(ConcreteDefinitions));
- RebarDefinitions = vm.RebarDefinitions;
- OnPropertyChanged(nameof(RebarDefinitions));
- }
- });
- }
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- [NotifyPropertyChangedInvocator]
- protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
- }
-}
diff --git a/StructureHelper/Models/Calculators/LimitCurveVisualCalculator.cs b/StructureHelper/Models/Calculators/LimitCurveVisualCalculator.cs
new file mode 100644
index 0000000..c106fc6
--- /dev/null
+++ b/StructureHelper/Models/Calculators/LimitCurveVisualCalculator.cs
@@ -0,0 +1,31 @@
+using StructureHelperCommon.Infrastructures.Interfaces;
+using StructureHelperCommon.Models;
+using StructureHelperCommon.Models.Calculators;
+using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
+using System;
+
+namespace StructureHelper.Models.Calculators
+{
+ internal class LimitCurveVisualCalculator : ISaveable, ICalculator
+ {
+ private LimitCurvesResult result;
+
+ public Guid Id { get; }
+ public string Name { get; set; }
+
+ public IResult Result => result;
+
+ public IShiftTraceLogger? TraceLogger { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
+
+ public void Run()
+ {
+ throw new NotImplementedException();
+ }
+
+ public object Clone()
+ {
+ throw new NotImplementedException();
+ }
+
+ }
+}
diff --git a/StructureHelper/Models/Primitives/Factories/PrimitiveFactory.cs b/StructureHelper/Models/Primitives/Factories/PrimitiveFactory.cs
deleted file mode 100644
index 3f68c55..0000000
--- a/StructureHelper/Models/Primitives/Factories/PrimitiveFactory.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-using StructureHelper.Infrastructure.UI.DataContexts;
-using StructureHelper.Models.Materials;
-using StructureHelperCommon.Infrastructures.Enums;
-using StructureHelperLogics.Models.Primitives;
-using StructureHelperLogics.Models.Templates.RCs;
-using StructureHelperLogics.NdmCalculations.Primitives;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace StructureHelper.Models.Primitives.Factories
-{
- internal static class PrimitiveFactory
- {
- public static IEnumerable GetRectangleRCElement(RectangleBeamTemplate template, IHeadMaterial concrete, IHeadMaterial reinforcement)
- {
- List primitives = new List();
- var rect = template.Shape as StructureHelperCommon.Models.Shapes.RectangleShape;
- var width = rect.Width;
- var height = rect.Height;
- var area1 = Math.PI * template.BottomDiameter * template.BottomDiameter / 4d;
- var area2 = Math.PI * template.TopDiameter * template.TopDiameter / 4d;
- var gap = template.CoverGap;
-
- double[] xs = new double[] { -width / 2 + gap, width / 2 - gap };
- double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
-
- var rectangle = new RectanglePrimitive() { Width = width, Height = height, Name = "Concrete block" };
- primitives.Add(new RectangleViewPrimitive(rectangle) { HeadMaterial = concrete});
- var point = new PointPrimitive() { CenterX = xs[0], CenterY = ys[0], Area = area1};
- var viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Left bottom point" };
- viewPoint.RegisterDeltas(xs[0], ys[0]);
- primitives.Add(viewPoint);
- point = new PointPrimitive() {CenterX = xs[1], CenterY = ys[0], Area = area1 };
- viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Right bottom point" };
- primitives.Add(viewPoint);
- point = new PointPrimitive() { CenterX = xs[0], CenterY = ys[1], Area = area2 };
- viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Left top point" };
- primitives.Add(viewPoint);
- point = new PointPrimitive() { CenterX = xs[1], CenterY = ys[1], Area = area2 };
- viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Right top point" };
- viewPoint.RegisterDeltas(xs[1], ys[1]);
- primitives.Add(viewPoint);
-
- if (template.WidthCount > 2)
- {
- int count = template.WidthCount - 1;
- double dist = (xs[1] - xs[0]) / count;
- for (int i = 1; i < count; i++)
- {
- point = new PointPrimitive() {CenterX = xs[0] + dist * i, CenterY = ys[0], Area = area1 };
- viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Bottom point {i}" };
- primitives.Add(viewPoint);
-
- point = new PointPrimitive() { CenterX = xs[0] + dist * i, CenterY = ys[1], Area = area2 };
- viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Top point {i}" };
- primitives.Add(viewPoint);
- }
- }
- if (template.HeightCount > 2)
- {
- int count = template.HeightCount - 1;
- double dist = (ys[1] - ys[0]) / count;
- for (int i = 1; i < count; i++)
- {
- point = new PointPrimitive() {CenterX = xs[0], CenterY = ys[0] + dist * i, Area = area1 };
- viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Left point {i}" };
- primitives.Add(viewPoint);
-
- point = new PointPrimitive() { CenterX = xs[1], CenterY = ys[0] + dist * i, Area = area1 };
- viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Right point {i}" };
- primitives.Add(viewPoint);
- }
- }
- return primitives;
- }
- }
-}
diff --git a/StructureHelper/Properties/PublishProfiles/FolderProfile.pubxml b/StructureHelper/Properties/PublishProfiles/FolderProfile.pubxml
new file mode 100644
index 0000000..bafcfeb
--- /dev/null
+++ b/StructureHelper/Properties/PublishProfiles/FolderProfile.pubxml
@@ -0,0 +1,18 @@
+
+
+
+
+ Release
+ Any CPU
+ bin\Release\net6.0-windows7.0\win-x64\publish\win-x64\
+ FileSystem
+ <_TargetId>Folder
+ net6.0-windows7.0
+ win-x64
+ true
+ false
+ false
+
+
\ No newline at end of file
diff --git a/StructureHelper/Properties/PublishProfiles/FolderProfile.pubxml.user b/StructureHelper/Properties/PublishProfiles/FolderProfile.pubxml.user
new file mode 100644
index 0000000..7b83bfc
--- /dev/null
+++ b/StructureHelper/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -0,0 +1,10 @@
+
+
+
+
+ True|2024-03-11T15:33:14.1457807Z;True|2024-03-10T19:11:27.6834663+05:00;True|2024-02-02T12:22:50.1454015+05:00;True|2023-02-25T13:37:39.2738786+05:00;False|2023-02-25T13:37:24.0284261+05:00;True|2023-02-25T13:34:01.6858860+05:00;True|2023-02-25T13:31:18.8295711+05:00;False|2023-02-25T13:25:21.5807199+05:00;False|2023-02-25T13:24:41.7164398+05:00;
+
+
+
\ No newline at end of file
diff --git a/StructureHelper/Properties/Resources.Designer.cs b/StructureHelper/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..b74bb6d
--- /dev/null
+++ b/StructureHelper/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace StructureHelper.Properties {
+ using System;
+
+
+ ///
+ /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
+ ///
+ // Этот класс создан автоматически классом StronglyTypedResourceBuilder
+ // с помощью такого средства, как ResGen или Visual Studio.
+ // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
+ // с параметром /str или перестройте свой проект VS.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ public class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("StructureHelper.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Перезаписывает свойство CurrentUICulture текущего потока для всех
+ /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/StructureHelper/Properties/Resources.resx b/StructureHelper/Properties/Resources.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/StructureHelper/Properties/Resources.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/StructureHelper/Services/Exports/ExportToFileInputData.cs b/StructureHelper/Services/Exports/ExportToFileInputData.cs
new file mode 100644
index 0000000..951f612
--- /dev/null
+++ b/StructureHelper/Services/Exports/ExportToFileInputData.cs
@@ -0,0 +1,16 @@
+using StructureHelperLogics.NdmCalculations.Analyses;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Services.Exports
+{
+ internal class ExportToFileInputData : IExportToFileInputData
+ {
+ public string FileName { get; set; }
+ public string Filter { get; set; }
+ public string Title { get; set; }
+ }
+}
diff --git a/StructureHelper/Services/Exports/ExportToFileService.cs b/StructureHelper/Services/Exports/ExportToFileService.cs
new file mode 100644
index 0000000..d2d4e2c
--- /dev/null
+++ b/StructureHelper/Services/Exports/ExportToFileService.cs
@@ -0,0 +1,97 @@
+using StructureHelper.Windows.Errors;
+using StructureHelper.Windows.ViewModels.Errors;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperLogics.NdmCalculations.Analyses;
+using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace StructureHelper.Services.Exports
+{
+ internal class ExportToFileService : IExportService
+ {
+ IExportToFileInputData inputData;
+ IExportResultLogic logic;
+
+ public ExportToFileService(IExportToFileInputData inputData, IExportResultLogic logic)
+ {
+ this.inputData = inputData;
+ this.logic = logic;
+ }
+ public void Export()
+ {
+ SaveFileDialog saveFileDialog = new SaveFileDialog();
+ saveFileDialog.Filter = inputData.Filter;
+ saveFileDialog.Title = inputData.Title;
+ if (saveFileDialog.ShowDialog() == DialogResult.OK)
+ {
+ var filename = saveFileDialog.FileName;
+ // If the file name is not an empty string open it for saving.
+ if (filename != "")
+ {
+ SaveFile(filename);
+ }
+ }
+ }
+ private void SaveFile(string filename)
+ {
+ if (File.Exists(filename))
+ {
+ DeleteFile(filename);
+ }
+
+ try
+ {
+ ExportFile(filename);
+ }
+ catch (Exception ex)
+ {
+ var vm = new ErrorProcessor()
+ {
+ ShortText = ErrorStrings.FileCantBeSaved + ex + filename,
+ DetailText = $"{ex}"
+ };
+ new ErrorMessage(vm).ShowDialog();
+ }
+ }
+ private void DeleteFile(string filename)
+ {
+ try
+ {
+ File.Delete(filename);
+ }
+ catch (Exception ex)
+ {
+ var vm = new ErrorProcessor()
+ {
+ ShortText = ErrorStrings.FileCantBeDeleted + ex + filename,
+ DetailText = $"{ex}"
+ };
+ new ErrorMessage(vm).ShowDialog();
+ }
+ }
+ private void ExportFile(string fileName)
+ {
+ logic.FileName = fileName;
+ logic.Export();
+ try
+ {
+ OpenFile(fileName);
+ }
+ catch (Exception) { }
+ }
+ private void OpenFile(string fileName)
+ {
+ var filopener = new Process();
+ var startInfo = new ProcessStartInfo(fileName) { UseShellExecute = true };
+ filopener.StartInfo = startInfo;
+ filopener.Start();
+ }
+ }
+}
diff --git a/StructureHelper/Services/Exports/IExportService.cs b/StructureHelper/Services/Exports/IExportService.cs
new file mode 100644
index 0000000..0885465
--- /dev/null
+++ b/StructureHelper/Services/Exports/IExportService.cs
@@ -0,0 +1,14 @@
+using StructureHelperLogics.NdmCalculations.Analyses;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Services.Exports
+{
+ internal interface IExportService
+ {
+ void Export();
+ }
+}
diff --git a/StructureHelper/Services/Exports/IExportToFileInputData.cs b/StructureHelper/Services/Exports/IExportToFileInputData.cs
new file mode 100644
index 0000000..4712c74
--- /dev/null
+++ b/StructureHelper/Services/Exports/IExportToFileInputData.cs
@@ -0,0 +1,16 @@
+using StructureHelperLogics.NdmCalculations.Analyses;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Services.Exports
+{
+ internal interface IExportToFileInputData
+ {
+ string FileName { get; set; }
+ string Filter { get; set; }
+ string Title { get; set; }
+ }
+}
diff --git a/StructureHelper/Services/ResultViewers/CrackResultFunc.cs b/StructureHelper/Services/ResultViewers/CrackResultFunc.cs
new file mode 100644
index 0000000..b66aa96
--- /dev/null
+++ b/StructureHelper/Services/ResultViewers/CrackResultFunc.cs
@@ -0,0 +1,20 @@
+using StructureHelperLogics.NdmCalculations.Cracking;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Services.ResultViewers
+{
+ public class CrackResultFunc : IResultFunc>
+ {
+ public string Name { get; set; }
+
+ public Func ResultFunction { get; set; }
+
+ public string UnitName { get; set; }
+
+ public double UnitFactor { get; set; }
+ }
+}
diff --git a/StructureHelper/Services/ResultViewers/CrackResultFuncFactory.cs b/StructureHelper/Services/ResultViewers/CrackResultFuncFactory.cs
new file mode 100644
index 0000000..b44a902
--- /dev/null
+++ b/StructureHelper/Services/ResultViewers/CrackResultFuncFactory.cs
@@ -0,0 +1,99 @@
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Services.Units;
+using StructureHelperLogics.NdmCalculations.Cracking;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Services.ResultViewers
+{
+
+ public static class CrackResultFuncFactory
+ {
+ private static readonly IConvertUnitLogic operationLogic = new ConvertUnitLogic();
+ private static readonly IGetUnitLogic UnitLogic = new GetUnitLogic();
+
+ static IUnit unitStress = UnitLogic.GetUnit(UnitTypes.Stress);
+ static IUnit unitLength = UnitLogic.GetUnit(UnitTypes.Length, "mm");
+
+ public static List GetResultFuncs()
+ {
+ List results = new()
+ {
+ new()
+ {
+ Name = "Long crack width",
+ ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.CrackWidth,
+ UnitFactor = unitLength.Multiplyer,
+ UnitName = unitLength.Name
+ },
+ new()
+ {
+ Name = "Short crack width",
+ ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.CrackWidth,
+ UnitFactor = unitLength.Multiplyer,
+ UnitName = unitLength.Name
+ },
+ new()
+ {
+ Name = "Long softening factor",
+ ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.SofteningFactor,
+ UnitFactor = 1,
+ UnitName = "Dimensionless"
+ },
+ new()
+ {
+ Name = "Short softening factor",
+ ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.SofteningFactor,
+ UnitFactor = 1,
+ UnitName = "Dimensionless"
+ },
+ new()
+ {
+ Name = "Long rebar stress",
+ ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.RebarStressResult.RebarStress,
+ UnitFactor = unitStress.Multiplyer,
+ UnitName = unitStress.Name
+ },
+ new()
+ {
+ Name = "Short rebar stress",
+ ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.RebarStressResult.RebarStress,
+ UnitFactor = unitStress.Multiplyer,
+ UnitName = unitStress.Name
+ },
+ new()
+ {
+ Name = "Long rebar strain",
+ ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.RebarStressResult.RebarStrain,
+ UnitFactor = 1d,
+ UnitName = string.Empty
+ },
+ new()
+ {
+ Name = "Short rebar strain",
+ ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.RebarStressResult.RebarStrain,
+ UnitFactor = 1d,
+ UnitName = string.Empty
+ },
+ new()
+ {
+ Name = "Long concrete strain",
+ ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.RebarStressResult.ConcreteStrain,
+ UnitFactor = 1d,
+ UnitName = string.Empty
+ },
+ new()
+ {
+ Name = "Short concrete strain",
+ ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.RebarStressResult.ConcreteStrain,
+ UnitFactor = 1d,
+ UnitName = string.Empty
+ }
+ };
+ return results;
+ }
+ }
+}
diff --git a/StructureHelper/Services/ResultViewers/ResultFunc.cs b/StructureHelper/Services/ResultViewers/ForceResultFunc.cs
similarity index 74%
rename from StructureHelper/Services/ResultViewers/ResultFunc.cs
rename to StructureHelper/Services/ResultViewers/ForceResultFunc.cs
index d0b624c..724374f 100644
--- a/StructureHelper/Services/ResultViewers/ResultFunc.cs
+++ b/StructureHelper/Services/ResultViewers/ForceResultFunc.cs
@@ -8,13 +8,14 @@ using System.Threading.Tasks;
namespace StructureHelper.Services.ResultViewers
{
- public class ResultFunc : IResultFunc
+ public class ForceResultFunc : IResultFunc>
{
public string Name { get; set; }
public Func ResultFunction { get; set; }
+ public string UnitName { get; set; }
public double UnitFactor { get; set; }
- public ResultFunc()
+ public ForceResultFunc()
{
UnitFactor = 1d;
}
diff --git a/StructureHelper/Services/ResultViewers/ForceResultFuncFactory.cs b/StructureHelper/Services/ResultViewers/ForceResultFuncFactory.cs
new file mode 100644
index 0000000..06d5350
--- /dev/null
+++ b/StructureHelper/Services/ResultViewers/ForceResultFuncFactory.cs
@@ -0,0 +1,84 @@
+using LoaderCalculator.Logics;
+using StructureHelper.Infrastructure.UI.Converters.Units;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Services.Units;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Services.ResultViewers
+{
+ public enum FuncsTypes
+ {
+ Strain,
+ Stress,
+ Forces,
+ Full,
+ }
+ public static class ForceResultFuncFactory
+ {
+ static IGetUnitLogic unitLogic = new GetUnitLogic();
+ static IUnit unitForce = unitLogic.GetUnit(UnitTypes.Force);
+ static IUnit unitStress = unitLogic.GetUnit(UnitTypes.Stress);
+ static IUnit unitMoment = unitLogic.GetUnit(UnitTypes.Moment);
+ static IUnit unitCurvature = unitLogic.GetUnit(UnitTypes.Curvature);
+
+ static readonly IStressLogic stressLogic = new StressLogic();
+ public static List GetResultFuncs(FuncsTypes funcsType = FuncsTypes.Full)
+ {
+ List results = new();
+ if (funcsType == FuncsTypes.Strain)
+ {
+ results.AddRange(GetStrainResultFuncs());
+ }
+ else if (funcsType == FuncsTypes.Stress)
+ {
+ results.AddRange(GetStressResultFuncs());
+ }
+ else if (funcsType == FuncsTypes.Forces)
+ {
+ results.AddRange(GetForcesResultFuncs());
+ }
+ else if (funcsType == FuncsTypes.Full)
+ {
+ results.AddRange(GetStrainResultFuncs());
+ results.AddRange(GetStressResultFuncs());
+ results.AddRange(GetForcesResultFuncs());
+ }
+ else
+ {
+ throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(funcsType));
+ }
+ return results;
+ }
+ private static List GetStrainResultFuncs()
+ {
+ List resultFuncs = new ();
+ resultFuncs.Add(new ForceResultFunc() { Name = "Section Strain", ResultFunction = stressLogic.GetSectionStrain });
+ resultFuncs.Add(new ForceResultFunc() { Name = "Total Strain", ResultFunction = stressLogic.GetTotalStrain });
+ resultFuncs.Add(new ForceResultFunc() { Name = "Prestrain", ResultFunction = stressLogic.GetPrestrain });
+ resultFuncs.Add(new ForceResultFunc() { Name = "Elastic Strain", ResultFunction = stressLogic.GetElasticStrain });
+ resultFuncs.Add(new ForceResultFunc() { Name = "Plastic Strain", ResultFunction = stressLogic.GetPlasticStrain });
+ return resultFuncs;
+ }
+ private static List GetStressResultFuncs()
+ {
+ List resultFuncs = new ();
+ resultFuncs.Add(new ForceResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress, UnitFactor = unitStress.Multiplyer, UnitName = unitStress.Name });
+ resultFuncs.Add(new ForceResultFunc() { Name = "Secant modulus", ResultFunction = stressLogic.GetSecantModulus, UnitFactor = unitStress.Multiplyer, UnitName = unitStress.Name });
+ resultFuncs.Add(new ForceResultFunc() { Name = "Modulus degradation", ResultFunction = stressLogic.GetModulusDegradation });
+ return resultFuncs;
+ }
+ private static List GetForcesResultFuncs()
+ {
+ List resultFuncs = new ();
+ resultFuncs.Add(new ForceResultFunc() { Name = "Force", ResultFunction = stressLogic.GetForce, UnitFactor = unitForce.Multiplyer, UnitName = unitForce.Name });
+ resultFuncs.Add(new ForceResultFunc() { Name = "Moment X", ResultFunction = stressLogic.GetMomentX, UnitFactor = unitMoment.Multiplyer, UnitName = unitMoment.Name });
+ resultFuncs.Add(new ForceResultFunc() { Name = "Moment Y", ResultFunction = stressLogic.GetMomentY, UnitFactor = unitMoment.Multiplyer, UnitName = unitMoment.Name });
+ return resultFuncs;
+ }
+ }
+}
diff --git a/StructureHelper/Services/ResultViewers/IResultFunc.cs b/StructureHelper/Services/ResultViewers/IResultFunc.cs
index 21110f5..6ab3b7a 100644
--- a/StructureHelper/Services/ResultViewers/IResultFunc.cs
+++ b/StructureHelper/Services/ResultViewers/IResultFunc.cs
@@ -8,10 +8,11 @@ using System.Threading.Tasks;
namespace StructureHelper.Services.ResultViewers
{
- public interface IResultFunc
+ public interface IResultFunc
{
string Name { get; }
- Func ResultFunction { get; }
+ T ResultFunction { get; }
+ string UnitName { get; set; }
double UnitFactor { get; }
}
}
diff --git a/StructureHelper/Services/ResultViewers/ResultFuncFactory.cs b/StructureHelper/Services/ResultViewers/ResultFuncFactory.cs
deleted file mode 100644
index dd4a280..0000000
--- a/StructureHelper/Services/ResultViewers/ResultFuncFactory.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using LoaderCalculator.Logics;
-using StructureHelper.Infrastructure.UI.Converters.Units;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace StructureHelper.Services.ResultViewers
-{
- public static class ResultFuncFactory
- {
- public static IEnumerable GetResultFuncs()
- {
- List resultFuncs = new List();
- IStressLogic stressLogic = new StressLogic();
- resultFuncs.Add(new ResultFunc() { Name = "Total Strain", ResultFunction = stressLogic.GetTotalStrain });
- resultFuncs.Add(new ResultFunc() { Name = "Total Strain with prestrain", ResultFunction = stressLogic.GetTotalStrainWithPresrain });
- resultFuncs.Add(new ResultFunc() { Name = "Elastic Strain", ResultFunction = stressLogic.GetElasticStrain });
- resultFuncs.Add(new ResultFunc() { Name = "Plastic Strain", ResultFunction = stressLogic.GetPlasticStrain });
- resultFuncs.Add(new ResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress, UnitFactor = UnitConstatnts.Stress });
- resultFuncs.Add(new ResultFunc() { Name = "Secant modulus", ResultFunction = stressLogic.GetSecantModulus, UnitFactor = UnitConstatnts.Stress });
- resultFuncs.Add(new ResultFunc() { Name = "Modulus degradation", ResultFunction = stressLogic.GetModulusDegradation });
- resultFuncs.Add(new ResultFunc() { Name = "Force", ResultFunction = stressLogic.GetForce, UnitFactor = UnitConstatnts.Force });
- resultFuncs.Add(new ResultFunc() { Name = "Moment X", ResultFunction = stressLogic.GetMomentX, UnitFactor = UnitConstatnts.Force });
- resultFuncs.Add(new ResultFunc() { Name = "Moment Y", ResultFunction = stressLogic.GetMomentY, UnitFactor = UnitConstatnts.Force });
- return resultFuncs;
- }
- }
-}
diff --git a/StructureHelper/Services/ResultViewers/ShowAnchorageResult.cs b/StructureHelper/Services/ResultViewers/ShowAnchorageResult.cs
new file mode 100644
index 0000000..4f90733
--- /dev/null
+++ b/StructureHelper/Services/ResultViewers/ShowAnchorageResult.cs
@@ -0,0 +1,149 @@
+using FieldVisualizer.Entities.Values.Primitives;
+using LoaderCalculator.Data.Matrix;
+using StructureHelper.Infrastructure.UI.Converters.Units;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperLogics.NdmCalculations.Analyses.RC;
+using StructureHelperLogics.NdmCalculations.Primitives;
+using System;
+using System.Collections.Generic;
+
+namespace StructureHelper.Services.ResultViewers
+{
+ public static class ShowAnchorageResult
+ {
+ internal static List GetPrimitiveSets(IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable ndmPrimitives)
+ {
+ var primitiveSets = new List();
+ PrimitiveSet primitiveSet;
+ primitiveSet = GetBaseDevelopmentLength(strainMatrix, limitState, calcTerm, ndmPrimitives);
+ primitiveSets.Add(primitiveSet);
+ primitiveSet = GetDevelopmentLength(strainMatrix, limitState, calcTerm, ndmPrimitives, true);
+ primitiveSet.Name = "Development length full strength";
+ primitiveSets.Add(primitiveSet);
+ primitiveSet = GetDevelopmentLength(strainMatrix, limitState, calcTerm, ndmPrimitives,false);
+ primitiveSet.Name = "Development length actual stress";
+ primitiveSets.Add(primitiveSet);
+ primitiveSet = GetFullStrengthLapLength(strainMatrix, limitState, calcTerm, ndmPrimitives, 0.5d, true);
+ primitiveSet.Name = "Lapping length full strength, r=50%";
+ primitiveSets.Add(primitiveSet);
+ primitiveSet = GetFullStrengthLapLength(strainMatrix, limitState, calcTerm, ndmPrimitives, 1d, true);
+ primitiveSet.Name = "Lapping length full strength, r=100%";
+ primitiveSets.Add(primitiveSet);
+ primitiveSet = GetFullStrengthLapLength(strainMatrix, limitState, calcTerm, ndmPrimitives, 0.5d, false);
+ primitiveSet.Name = "Lapping length actual stress, r=50%";
+ primitiveSets.Add(primitiveSet);
+ primitiveSet = GetFullStrengthLapLength(strainMatrix, limitState, calcTerm, ndmPrimitives, 1d, false);
+ primitiveSet.Name = "Lapping length actual stress, r=100%";
+ primitiveSets.Add(primitiveSet);
+ primitiveSet = GetStrength(strainMatrix, limitState, calcTerm, ndmPrimitives, true);
+ primitiveSet.Name = "Full strength";
+ primitiveSets.Add(primitiveSet);
+ primitiveSet = GetStrength(strainMatrix, limitState, calcTerm, ndmPrimitives, false);
+ primitiveSet.Name = "Actual stress";
+ primitiveSets.Add(primitiveSet);
+ return primitiveSets;
+ }
+
+ private static PrimitiveSet GetStrength(IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable ndmPrimitives, bool fullStrength)
+ {
+ PrimitiveSet primitiveSet = new PrimitiveSet();
+ List primitives = new List();
+ foreach (var item in ndmPrimitives)
+ {
+ if (item is RebarPrimitive)
+ {
+ var primitive = item as RebarPrimitive;
+ var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
+ if (fullStrength == true)
+ {
+ inputData.ReinforcementStress = inputData.ReinforcementStrength * Math.Sign(inputData.ReinforcementStress);
+ }
+ var val = inputData.ReinforcementStress * UnitConstants.Stress;
+ var valuePrimitive = GetValuePrimitive(primitive, val);
+ primitives.Add(valuePrimitive);
+ }
+ }
+ primitiveSet.ValuePrimitives = primitives;
+ return primitiveSet;
+ }
+
+ private static PrimitiveSet GetBaseDevelopmentLength(IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable ndmPrimitives)
+ {
+ PrimitiveSet primitiveSet = new PrimitiveSet() { Name = "Base Development Length"};
+ List primitives = new List();
+ foreach (var item in ndmPrimitives)
+ {
+ if (item is RebarPrimitive)
+ {
+ var primitive = item as RebarPrimitive;
+ var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
+ var calculator = new AnchorageCalculator(inputData);
+ var val = calculator.GetBaseDevLength() * UnitConstants.Length;
+ var valuePrimitive = GetValuePrimitive(primitive, val);
+ primitives.Add(valuePrimitive);
+ }
+ }
+ primitiveSet.ValuePrimitives = primitives;
+ return primitiveSet;
+ }
+ private static PrimitiveSet GetDevelopmentLength(IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable ndmPrimitives, bool fullStrength)
+ {
+ PrimitiveSet primitiveSet = new PrimitiveSet();
+ List primitives = new List();
+ foreach (var item in ndmPrimitives)
+ {
+ if (item is RebarPrimitive)
+ {
+ var primitive = item as RebarPrimitive;
+ var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
+ if (fullStrength == true)
+ {
+ inputData.ReinforcementStress = inputData.ReinforcementStrength * Math.Sign(inputData.ReinforcementStress);
+ }
+ var calculator = new AnchorageCalculator(inputData);
+ var val = calculator.GetDevLength() * UnitConstants.Length;
+ var valuePrimitive = GetValuePrimitive(primitive, val);
+ primitives.Add(valuePrimitive);
+ }
+ }
+ primitiveSet.ValuePrimitives = primitives;
+ return primitiveSet;
+ }
+
+ private static PrimitiveSet GetFullStrengthLapLength(IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable ndmPrimitives, double lapperdCountRate, bool fullStrength)
+ {
+ PrimitiveSet primitiveSet = new PrimitiveSet();
+ List primitives = new List();
+ foreach (var item in ndmPrimitives)
+ {
+ if (item is RebarPrimitive)
+ {
+ var primitive = item as RebarPrimitive;
+ var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, lapperdCountRate);
+ if (fullStrength == true)
+ {
+ inputData.ReinforcementStress = inputData.ReinforcementStrength * Math.Sign(inputData.ReinforcementStress);
+ }
+ var calculator = new AnchorageCalculator(inputData);
+ var val = calculator.GetLapLength() * UnitConstants.Length;
+ var valuePrimitive = GetValuePrimitive(primitive, val);
+ primitives.Add(valuePrimitive);
+ }
+ }
+ primitiveSet.ValuePrimitives = primitives;
+ return primitiveSet;
+ }
+
+ private static FieldVisualizer.Entities.Values.Primitives.CirclePrimitive GetValuePrimitive(IPointPrimitive primitive, double val)
+ {
+ var valuePrimitive = new FieldVisualizer.Entities.Values.Primitives.CirclePrimitive()
+ {
+ CenterX = primitive.Center.X,
+ CenterY = primitive.Center.Y,
+ Diameter = Math.Sqrt(primitive.Area / Math.PI) * 2,
+ Value = val
+ };
+ return valuePrimitive;
+ }
+ }
+}
diff --git a/StructureHelper/Services/ResultViewers/ShowIsoFieldResult.cs b/StructureHelper/Services/ResultViewers/ShowIsoFieldResult.cs
index 035fc76..ef0762a 100644
--- a/StructureHelper/Services/ResultViewers/ShowIsoFieldResult.cs
+++ b/StructureHelper/Services/ResultViewers/ShowIsoFieldResult.cs
@@ -4,6 +4,10 @@ using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.ResultData;
using LoaderCalculator.Logics;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Services;
+using StructureHelperLogics.NdmCalculations.Cracking;
+using StructureHelperLogics.NdmCalculations.Triangulations;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -14,13 +18,14 @@ namespace StructureHelper.Services.ResultViewers
{
public static class ShowIsoFieldResult
{
- public static void ShowResult(IStrainMatrix strainMatrix, IEnumerable ndms, IEnumerable resultFuncs)
+ static IMathRoundLogic roundLogic = new SmartRoundLogic() { DigitQuant = 3 };
+ public static void ShowResult(IStrainMatrix strainMatrix, IEnumerable ndms, IEnumerable resultFuncs)
{
var primitiveSets = GetPrimitiveSets(strainMatrix, ndms, resultFuncs);
FieldViewerOperation.ShowViewer(primitiveSets);
}
- public static List GetPrimitiveSets(IStrainMatrix strainMatrix, IEnumerable ndms, IEnumerable resultFuncs)
+ public static List GetPrimitiveSets(IStrainMatrix strainMatrix, IEnumerable ndms, IEnumerable resultFuncs)
{
List primitiveSets = new List();
foreach (var valDelegate in resultFuncs)
@@ -29,23 +34,85 @@ namespace StructureHelper.Services.ResultViewers
List primitives = new List();
foreach (INdm ndm in ndms)
{
- double val = valDelegate.ResultFunction.Invoke(strainMatrix, ndm) * valDelegate.UnitFactor;
- IValuePrimitive valuePrimitive;
- if (ndm is IRectangleNdm)
- {
- var shapeNdm = ndm as IRectangleNdm;
- valuePrimitive = new RectanglePrimitive() { CenterX = ndm.CenterX, CenterY = ndm.CenterY, Height = shapeNdm.Height, Width = shapeNdm.Width, Value = val };
- }
- else
- {
- valuePrimitive = new CirclePrimitive() { CenterX = ndm.CenterX, CenterY = ndm.CenterY, Diameter = Math.Sqrt(ndm.Area / Math.PI) * 2, Value = val };
- }
- primitives.Add(valuePrimitive);
+ primitives.Add(ProcessNdm(strainMatrix, valDelegate, ndm));
}
primitiveSet.ValuePrimitives = primitives;
primitiveSets.Add(primitiveSet);
}
return primitiveSets;
}
+
+ public static List GetPrimitiveSets(IEnumerable rebarResults, IEnumerable resultFuncs)
+ {
+ List primitiveSets = new List();
+ foreach (var valDelegate in resultFuncs)
+ {
+ PrimitiveSet primitiveSet = new PrimitiveSet() { Name = valDelegate.Name };
+ List primitives = new List();
+ foreach (var rebarResult in rebarResults)
+ {
+ primitives.Add(ProcessNdm(valDelegate, rebarResult));
+ }
+ primitiveSet.ValuePrimitives = primitives;
+ primitiveSets.Add(primitiveSet);
+ }
+ return primitiveSets;
+ }
+
+ private static IValuePrimitive ProcessNdm(CrackResultFunc valDelegate, RebarCrackResult rebarResult)
+ {
+ double delegateResult = valDelegate.ResultFunction.Invoke(rebarResult);
+ var val = delegateResult * valDelegate.UnitFactor;
+ //val = roundLogic.RoundValue(val);
+ IValuePrimitive valuePrimitive;
+ var rebarNdm = rebarResult.RebarPrimitive.GetRebarNdm(new TriangulationOptions()
+ {
+ LimiteState = LimitStates.SLS,
+ CalcTerm = CalcTerms.ShortTerm
+ }
+ );
+ valuePrimitive = ProcessCircle(rebarNdm, val);
+ return valuePrimitive;
+ }
+
+ private static IValuePrimitive ProcessNdm(IStrainMatrix strainMatrix, ForceResultFunc valDelegate, INdm ndm)
+ {
+ double delegateResult = valDelegate.ResultFunction.Invoke(strainMatrix, ndm);
+ double val = delegateResult * valDelegate.UnitFactor;
+ //val = roundLogic.RoundValue(val);
+ IValuePrimitive valuePrimitive;
+ if (ndm is IRectangleNdm shapeNdm)
+ {
+ valuePrimitive = ProcessRectangle(shapeNdm, val);
+ }
+ else
+ {
+ valuePrimitive = ProcessCircle(ndm, val);
+ }
+ return valuePrimitive;
+ }
+
+ private static IValuePrimitive ProcessRectangle(IRectangleNdm shapeNdm, double val)
+ {
+ return new RectanglePrimitive()
+ {
+ CenterX = shapeNdm.CenterX,
+ CenterY = shapeNdm.CenterY,
+ Height = shapeNdm.Height,
+ Width = shapeNdm.Width,
+ Value = val
+ };
+ }
+
+ private static IValuePrimitive ProcessCircle(INdm ndm, double val)
+ {
+ return new CirclePrimitive()
+ {
+ CenterX = ndm.CenterX,
+ CenterY = ndm.CenterY,
+ Diameter = Math.Sqrt(ndm.Area / Math.PI) * 2,
+ Value = val
+ };
+ }
}
}
diff --git a/StructureHelper/Services/Settings/GlobalRepository.cs b/StructureHelper/Services/Settings/GlobalRepository.cs
new file mode 100644
index 0000000..6f4cbdb
--- /dev/null
+++ b/StructureHelper/Services/Settings/GlobalRepository.cs
@@ -0,0 +1,36 @@
+using StructureHelper.Models.Materials;
+using StructureHelperCommon.Infrastructures.Interfaces;
+using StructureHelperCommon.Models.Forces;
+using StructureHelperCommon.Models.Repositories;
+using StructureHelperLogics.Models.Materials;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Services.Settings
+{
+ internal static class GlobalRepository
+ {
+ private static IDataRepository materials;
+ private static IDataRepository actions;
+
+ public static IDataRepository Materials
+ {
+ get
+ {
+ materials ??= new ListRepository(new MaterialUpdateStrategy());
+ return materials;
+ }
+ }
+ public static IDataRepository Actions
+ {
+ get
+ {
+ actions ??= new ListRepository(new ActionUpdateStrategy());
+ return actions;
+ }
+ }
+ }
+}
diff --git a/StructureHelper/StructureHelper.csproj b/StructureHelper/StructureHelper.csproj
index 4f9ef4f..a5adeb8 100644
--- a/StructureHelper/StructureHelper.csproj
+++ b/StructureHelper/StructureHelper.csproj
@@ -3,6 +3,7 @@
WinExe
net6.0-windows7.0
+ true
enable
true
disable
@@ -21,8 +22,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -46,4 +81,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+ PublicResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
diff --git a/StructureHelper/StructureHelper.csproj.bak b/StructureHelper/StructureHelper.csproj.bak
new file mode 100644
index 0000000..4f9ef4f
--- /dev/null
+++ b/StructureHelper/StructureHelper.csproj.bak
@@ -0,0 +1,49 @@
+
+
+
+ WinExe
+ net6.0-windows7.0
+ enable
+ true
+ disable
+ 7.0
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Libraries\LoaderCalculator.dll
+
+
+
+
+
+ PreserveNewest
+
+
+
+
diff --git a/StructureHelper/StructureHelper.csproj.user b/StructureHelper/StructureHelper.csproj.user
index e8da786..c2ddce4 100644
--- a/StructureHelper/StructureHelper.csproj.user
+++ b/StructureHelper/StructureHelper.csproj.user
@@ -1,10 +1,171 @@
-
+
+ <_LastSelectedProfileId>C:\Source\Repos\StructureHelper\StructureHelper\Properties\PublishProfiles\FolderProfile.pubxml
+
Designer
-
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
\ No newline at end of file
diff --git a/StructureHelper/Windows/AddMaterialWindow/AddMaterialView.xaml b/StructureHelper/Windows/AddMaterialWindow/AddMaterialView.xaml
deleted file mode 100644
index e08c9fd..0000000
--- a/StructureHelper/Windows/AddMaterialWindow/AddMaterialView.xaml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/StructureHelper/Windows/AddMaterialWindow/AddMaterialView.xaml.cs b/StructureHelper/Windows/AddMaterialWindow/AddMaterialView.xaml.cs
deleted file mode 100644
index 310dae3..0000000
--- a/StructureHelper/Windows/AddMaterialWindow/AddMaterialView.xaml.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Windows;
-using StructureHelper.MaterialCatalogWindow;
-
-namespace StructureHelper.Windows.AddMaterialWindow
-{
- ///
- /// Логика взаимодействия для AddMaterialView.xaml
- ///
- public partial class AddMaterialView : Window
- {
- public AddMaterialView(MaterialCatalogModel model, MaterialCatalogViewModel materialCatalogViewModel)
- {
- var viewModel = new AddMaterialViewModel(model, this, materialCatalogViewModel);
- DataContext = viewModel;
- InitializeComponent();
- }
- }
-}
diff --git a/StructureHelper/Windows/AddMaterialWindow/AddMaterialViewModel.cs b/StructureHelper/Windows/AddMaterialWindow/AddMaterialViewModel.cs
deleted file mode 100644
index 21dce53..0000000
--- a/StructureHelper/Windows/AddMaterialWindow/AddMaterialViewModel.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Windows.Input;
-using StructureHelper.Infrastructure;
-using StructureHelper.MaterialCatalogWindow;
-using StructureHelper.Models.Materials;
-
-namespace StructureHelper.Windows.AddMaterialWindow
-{
- public class AddMaterialViewModel : ViewModelBase
- {
- private MaterialCatalogModel model;
- private AddMaterialView view;
- private MaterialCatalogViewModel materialCatalogViewModel;
- public ObservableCollection> Materials { get; set; }
- private NamedList materialCollection;
- public NamedList MaterialCollection
- {
- get => materialCollection;
- set
- {
- OnPropertyChanged(value, ref materialCollection);
- OnPropertyChanged(nameof(IsNotConcrete));
- OnPropertyChanged(nameof(RowHeight));
- }
- }
- public bool IsNotConcrete => MaterialCollection.Name != "Бетон";
-
- private string materialClass;
- private double youngModulus, compressiveStrengthCoef, tensileStrengthCoef, materialCoefInCompress, materialCoefInTension;
-
- public string MaterialClass
- {
- get => materialClass;
- set => OnPropertyChanged(value, ref materialClass);
- }
-
- public double YoungModulus
- {
- get => youngModulus;
- set => OnPropertyChanged(value, ref youngModulus);
- }
- public double CompressiveStrengthCoef
- {
- get => compressiveStrengthCoef;
- set => OnPropertyChanged(value, ref compressiveStrengthCoef);
- }
- public double TensileStrengthCoef
- {
- get => tensileStrengthCoef;
- set => OnPropertyChanged(value, ref tensileStrengthCoef);
- }
- public double MaterialCoefInCompress
- {
- get => materialCoefInCompress;
- set => OnPropertyChanged(value, ref materialCoefInCompress);
- }
- public double MaterialCoefInTension
- {
- get => materialCoefInTension;
- set => OnPropertyChanged(value, ref materialCoefInTension);
- }
-
- public int RowHeight => IsNotConcrete ? 40 : 0;
- public ICommand AddMaterial { get; }
- public AddMaterialViewModel() { }
- public AddMaterialViewModel(MaterialCatalogModel model, AddMaterialView view, MaterialCatalogViewModel materialCatalogViewModel)
- {
- this.model = model;
- this.view = view;
- this.materialCatalogViewModel = materialCatalogViewModel;
- Materials = new ObservableCollection>(model.Materials);
- MaterialCollection = Materials.First();
-
- AddMaterial = new RelayCommand(o =>
- {
- if (MaterialCollection.Name == "Бетон")
- this.materialCatalogViewModel.ConcreteDefinitions.Add(new ConcreteDefinition(MaterialClass, 0, CompressiveStrengthCoef, TensileStrengthCoef, MaterialCoefInCompress, MaterialCoefInTension));
- if (MaterialCollection.Name == "Арматура")
- this.materialCatalogViewModel.RebarDefinitions.Add(new RebarDefinition(MaterialClass, YoungModulus, CompressiveStrengthCoef, TensileStrengthCoef, MaterialCoefInCompress, MaterialCoefInTension));
- });
- }
- }
-}
diff --git a/StructureHelper/Windows/Arrays/ArrayView.xaml b/StructureHelper/Windows/Arrays/ArrayView.xaml
new file mode 100644
index 0000000..3a835c6
--- /dev/null
+++ b/StructureHelper/Windows/Arrays/ArrayView.xaml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/StructureHelper/Windows/Arrays/ArrayView.xaml.cs b/StructureHelper/Windows/Arrays/ArrayView.xaml.cs
new file mode 100644
index 0000000..20f3458
--- /dev/null
+++ b/StructureHelper/Windows/Arrays/ArrayView.xaml.cs
@@ -0,0 +1,38 @@
+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.Arrays
+{
+ ///
+ /// Логика взаимодействия для ArrayView.xaml
+ ///
+ public partial class ArrayView : Window
+ {
+ private ArrayViewModel viewModel;
+ public ArrayView(ArrayViewModel vm)
+ {
+ InitializeComponent();
+ viewModel = vm;
+ DataContext = viewModel;
+ }
+
+ private void ArrayTreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs