Merge pull request #6 from RedikultsevEvg/PrimitivePropsEdit
Primitive props edit
This commit is contained in:
@@ -1,12 +1,18 @@
|
|||||||
using FieldVisualizer.InfraStructures.Enums;
|
using FieldVisualizer.InfraStructures.Exceptions;
|
||||||
using FieldVisualizer.InfraStructures.Exceptions;
|
|
||||||
using FieldVisualizer.InfraStructures.Strings;
|
using FieldVisualizer.InfraStructures.Strings;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace FieldVisualizer.Entities.ColorMaps.Factories
|
namespace FieldVisualizer.Entities.ColorMaps.Factories
|
||||||
{
|
{
|
||||||
|
public enum ColorMapsTypes
|
||||||
|
{
|
||||||
|
LiraSpectrum = 0, //Lira
|
||||||
|
FullSpectrum = 1, //StaDiCon
|
||||||
|
RedToWhite = 2,
|
||||||
|
RedToBlue = 3,
|
||||||
|
BlueToWhite = 4,
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Factory for creating of different color maps
|
/// Factory for creating of different color maps
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -18,13 +24,39 @@ namespace FieldVisualizer.Entities.ColorMaps.Factories
|
|||||||
if (mapsTypes == ColorMapsTypes.RedToWhite) { return GetRedToWhite(); }
|
if (mapsTypes == ColorMapsTypes.RedToWhite) { return GetRedToWhite(); }
|
||||||
if (mapsTypes == ColorMapsTypes.RedToBlue) { return GetRedToBlue(); }
|
if (mapsTypes == ColorMapsTypes.RedToBlue) { return GetRedToBlue(); }
|
||||||
if (mapsTypes == ColorMapsTypes.BlueToWhite) { return GetBlueToWhite(); }
|
if (mapsTypes == ColorMapsTypes.BlueToWhite) { return GetBlueToWhite(); }
|
||||||
|
if (mapsTypes == ColorMapsTypes.LiraSpectrum) { return GetLiraSpectrum(); }
|
||||||
else { throw new FieldVisulizerException(ErrorStrings.ColorMapTypeIsUnknown); }
|
else { throw new FieldVisulizerException(ErrorStrings.ColorMapTypeIsUnknown); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static IColorMap GetLiraSpectrum()
|
||||||
|
{
|
||||||
|
ColorMap colorMap = new()
|
||||||
|
{
|
||||||
|
Name = "LiraSpectrumColorMap"
|
||||||
|
};
|
||||||
|
List<Color> 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()
|
private static IColorMap GetFullSpectrum()
|
||||||
{
|
{
|
||||||
ColorMap colorMap = new ColorMap();
|
ColorMap colorMap = new()
|
||||||
colorMap.Name = "FullSpectrumColorMap";
|
{
|
||||||
|
Name = "FullSpectrumColorMap"
|
||||||
|
};
|
||||||
List<Color> colors = new List<Color>();
|
List<Color> colors = new List<Color>();
|
||||||
byte Alpha = 0xff;
|
byte Alpha = 0xff;
|
||||||
colors.AddRange(new Color[]{
|
colors.AddRange(new Color[]{
|
||||||
@@ -43,7 +75,6 @@ namespace FieldVisualizer.Entities.ColorMaps.Factories
|
|||||||
colorMap.Colors = colors;
|
colorMap.Colors = colors;
|
||||||
return colorMap;
|
return colorMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IColorMap GetRedToWhite()
|
private static IColorMap GetRedToWhite()
|
||||||
{
|
{
|
||||||
ColorMap colorMap = new ColorMap();
|
ColorMap colorMap = new ColorMap();
|
||||||
@@ -57,7 +88,6 @@ namespace FieldVisualizer.Entities.ColorMaps.Factories
|
|||||||
colorMap.Colors = colors;
|
colorMap.Colors = colors;
|
||||||
return colorMap;
|
return colorMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IColorMap GetRedToBlue()
|
private static IColorMap GetRedToBlue()
|
||||||
{
|
{
|
||||||
ColorMap colorMap = new ColorMap();
|
ColorMap colorMap = new ColorMap();
|
||||||
@@ -71,7 +101,6 @@ namespace FieldVisualizer.Entities.ColorMaps.Factories
|
|||||||
colorMap.Colors = colors;
|
colorMap.Colors = colors;
|
||||||
return colorMap;
|
return colorMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IColorMap GetBlueToWhite()
|
private static IColorMap GetBlueToWhite()
|
||||||
{
|
{
|
||||||
ColorMap colorMap = new ColorMap();
|
ColorMap colorMap = new ColorMap();
|
||||||
|
|||||||
@@ -1,19 +1,35 @@
|
|||||||
using System;
|
using System.Windows.Media;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Media;
|
|
||||||
|
|
||||||
namespace FieldVisualizer.Entities.ColorMaps
|
namespace FieldVisualizer.Entities.ColorMaps
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Colored range for building color legend
|
||||||
|
/// </summary>
|
||||||
public interface IValueColorRange
|
public interface IValueColorRange
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Flag of activity
|
||||||
|
/// </summary>
|
||||||
bool IsActive { get; set; }
|
bool IsActive { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Minimum value of range
|
||||||
|
/// </summary>
|
||||||
double BottomValue { get; set; }
|
double BottomValue { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Average value of range
|
||||||
|
/// </summary>
|
||||||
double AverageValue { get; set; }
|
double AverageValue { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Maximum value of range
|
||||||
|
/// </summary>
|
||||||
double TopValue {get;set;}
|
double TopValue {get;set;}
|
||||||
|
/// <summary>
|
||||||
|
/// Color correspondent to minimum value
|
||||||
|
/// </summary>
|
||||||
Color BottomColor { get; set; }
|
Color BottomColor { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Color correspondent to maximum value
|
||||||
|
/// </summary>
|
||||||
Color TopColor { get; set; }
|
Color TopColor { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,21 @@
|
|||||||
using System;
|
using System.Windows.Media;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Media;
|
|
||||||
|
|
||||||
namespace FieldVisualizer.Entities.ColorMaps
|
namespace FieldVisualizer.Entities.ColorMaps
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
public class ValueColorRange : IValueColorRange
|
public class ValueColorRange : IValueColorRange
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
public bool IsActive { get; set; }
|
public bool IsActive { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public double BottomValue { get; set; }
|
public double BottomValue { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public double AverageValue { get; set; }
|
public double AverageValue { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public double TopValue { get; set; }
|
public double TopValue { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public Color BottomColor { get; set; }
|
public Color BottomColor { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public Color TopColor { get; set; }
|
public Color TopColor { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,4 +8,12 @@
|
|||||||
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="InfraStructures\Enums\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\StructureHelperCommon\StructureHelperCommon.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using FieldVisualizer.Entities.ColorMaps;
|
using FieldVisualizer.Entities.ColorMaps;
|
||||||
using FieldVisualizer.Entities.Values;
|
using FieldVisualizer.Entities.Values;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -10,54 +11,123 @@ namespace FieldVisualizer.Services.ColorServices
|
|||||||
public static class ColorOperations
|
public static class ColorOperations
|
||||||
{
|
{
|
||||||
const byte Alpha = 0xff;
|
const byte Alpha = 0xff;
|
||||||
public static Color GetColorByValue(IValueRange range, IColorMap map, double val)
|
/// <summary>
|
||||||
{
|
///
|
||||||
if (range.TopValue == range.BottomValue || map.Colors.Count == 0) { return map.Colors[0]; }
|
/// </summary>
|
||||||
double minVal = range.BottomValue - 1e-15d*(Math.Abs(range.BottomValue));
|
/// <param name="fullRange"></param>
|
||||||
double maxVal = range.TopValue + 1e-15d * (Math.Abs(range.TopValue));
|
/// <param name="valueRanges"></param>
|
||||||
if (val > maxVal || val < minVal) { return Colors.Gray; }
|
/// <param name="colorMap"></param>
|
||||||
if (val == minVal) { return map.Colors[0]; }
|
/// <returns></returns>
|
||||||
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;
|
|
||||||
}
|
|
||||||
public static IEnumerable<IValueColorRange> GetValueColorRanges(IValueRange fullRange, IEnumerable<IValueRange> valueRanges, IColorMap colorMap)
|
public static IEnumerable<IValueColorRange> GetValueColorRanges(IValueRange fullRange, IEnumerable<IValueRange> valueRanges, IColorMap colorMap)
|
||||||
{
|
{
|
||||||
var colorRanges = new List<IValueColorRange>();
|
var colorRanges = new List<IValueColorRange>();
|
||||||
foreach (var valueRange in valueRanges)
|
foreach (var valueRange in valueRanges)
|
||||||
{
|
{
|
||||||
IValueColorRange valueColorRange = new ValueColorRange();
|
IValueColorRange valueColorRange = new ValueColorRange
|
||||||
valueColorRange.IsActive = true;
|
{
|
||||||
valueColorRange.BottomValue = valueRange.BottomValue;
|
IsActive = true,
|
||||||
valueColorRange.AverageValue = (valueRange.BottomValue + valueRange.TopValue) / 2;
|
BottomValue = valueRange.BottomValue,
|
||||||
valueColorRange.TopValue = valueRange.TopValue;
|
AverageValue = (valueRange.BottomValue + valueRange.TopValue) / 2,
|
||||||
|
TopValue = valueRange.TopValue
|
||||||
|
};
|
||||||
valueColorRange.BottomColor = GetColorByValue(fullRange, colorMap, valueColorRange.BottomValue);
|
valueColorRange.BottomColor = GetColorByValue(fullRange, colorMap, valueColorRange.BottomValue);
|
||||||
valueColorRange.TopColor = GetColorByValue(fullRange, colorMap, valueColorRange.TopValue);
|
valueColorRange.TopColor = GetColorByValue(fullRange, colorMap, valueColorRange.TopValue);
|
||||||
colorRanges.Add(valueColorRange);
|
colorRanges.Add(valueColorRange);
|
||||||
}
|
}
|
||||||
return colorRanges;
|
return colorRanges;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Returns color by value, range of value an color map
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="range">Range of valoue</param>
|
||||||
|
/// <param name="map">Color map</param>
|
||||||
|
/// <param name="val">Value</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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 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 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,22 @@
|
|||||||
using FieldVisualizer.Entities.ColorMaps.Factories;
|
using FieldVisualizer.Entities.ColorMaps;
|
||||||
using FieldVisualizer.Entities.ColorMaps;
|
using FieldVisualizer.Entities.ColorMaps.Factories;
|
||||||
using FieldVisualizer.Entities.Values.Primitives;
|
|
||||||
using FieldVisualizer.Entities.Values;
|
using FieldVisualizer.Entities.Values;
|
||||||
|
using FieldVisualizer.Entities.Values.Primitives;
|
||||||
using FieldVisualizer.Infrastructure.Commands;
|
using FieldVisualizer.Infrastructure.Commands;
|
||||||
using FieldVisualizer.InfraStructures.Enums;
|
|
||||||
using FieldVisualizer.InfraStructures.Exceptions;
|
using FieldVisualizer.InfraStructures.Exceptions;
|
||||||
using FieldVisualizer.InfraStructures.Strings;
|
using FieldVisualizer.InfraStructures.Strings;
|
||||||
using FieldVisualizer.Services.ColorServices;
|
using FieldVisualizer.Services.ColorServices;
|
||||||
using FieldVisualizer.Services.PrimitiveServices;
|
using FieldVisualizer.Services.PrimitiveServices;
|
||||||
using FieldVisualizer.Services.ValueRanges;
|
using FieldVisualizer.Services.ValueRanges;
|
||||||
|
using FieldVisualizer.Windows.UserControls;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using FieldVisualizer.Windows.UserControls;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
||||||
{
|
{
|
||||||
@@ -177,7 +172,7 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
|||||||
|
|
||||||
public FieldViewerViewModel()
|
public FieldViewerViewModel()
|
||||||
{
|
{
|
||||||
_ColorMapType = ColorMapsTypes.FullSpectrum;
|
_ColorMapType = ColorMapsTypes.LiraSpectrum;
|
||||||
RebuildCommand = new RelayCommand(o => ProcessPrimitives(), o => PrimitiveValidation());
|
RebuildCommand = new RelayCommand(o => ProcessPrimitives(), o => PrimitiveValidation());
|
||||||
ZoomInCommand = new RelayCommand(o => Zoom(1.2), o => PrimitiveValidation());
|
ZoomInCommand = new RelayCommand(o => Zoom(1.2), o => PrimitiveValidation());
|
||||||
ZoomOutCommand = new RelayCommand(o => Zoom(0.8), o => PrimitiveValidation());
|
ZoomOutCommand = new RelayCommand(o => Zoom(0.8), o => PrimitiveValidation());
|
||||||
|
|||||||
@@ -1,23 +1,7 @@
|
|||||||
using FieldVisualizer.Entities.ColorMaps;
|
using FieldVisualizer.Entities.Values.Primitives;
|
||||||
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.ViewModels.FieldViewerViewModels;
|
using FieldVisualizer.ViewModels.FieldViewerViewModels;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace FieldVisualizer.Windows.UserControls
|
namespace FieldVisualizer.Windows.UserControls
|
||||||
{
|
{
|
||||||
@@ -39,17 +23,6 @@ namespace FieldVisualizer.Windows.UserControls
|
|||||||
viewModel.Legend = LegendViewer;
|
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; } }
|
public IPrimitiveSet PrimitiveSet { get => viewModel.PrimitiveSet; set { viewModel.PrimitiveSet = value; } }
|
||||||
|
|
||||||
internal void Refresh()
|
internal void Refresh()
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ EndProject
|
|||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureHelperLogics", "StructureHelperLogics\StructureHelperLogics.csproj", "{C9192AE7-EE6D-409C-A05C-3549D78CBB34}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureHelperLogics", "StructureHelperLogics\StructureHelperLogics.csproj", "{C9192AE7-EE6D-409C-A05C-3549D78CBB34}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FieldVisualizer", "FieldVisualizer\FieldVisualizer.csproj", "{6CAC5B83-81F3-47C2-92A1-0F94A58491C2}"
|
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
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|||||||
@@ -22,15 +22,15 @@ namespace StructureHelper
|
|||||||
builder.RegisterType<PrimitiveRepository>().As<IPrimitiveRepository>().SingleInstance();
|
builder.RegisterType<PrimitiveRepository>().As<IPrimitiveRepository>().SingleInstance();
|
||||||
builder.RegisterType<UnitSystemService>().AsSelf().SingleInstance();
|
builder.RegisterType<UnitSystemService>().AsSelf().SingleInstance();
|
||||||
builder.RegisterType<CalculationService>().AsSelf().SingleInstance();
|
builder.RegisterType<CalculationService>().AsSelf().SingleInstance();
|
||||||
builder.RegisterType<MainModel>().AsSelf().SingleInstance();
|
builder.RegisterType<CrossSectionModel>().AsSelf().SingleInstance();
|
||||||
builder.RegisterType<MainViewModel>().AsSelf().SingleInstance();
|
builder.RegisterType<CrossSectionViewModel>().AsSelf().SingleInstance();
|
||||||
|
|
||||||
builder.RegisterType<MainView>().AsSelf();
|
builder.RegisterType<CrossSectionView>().AsSelf();
|
||||||
|
|
||||||
Container = builder.Build();
|
Container = builder.Build();
|
||||||
Scope = Container.Resolve<ILifetimeScope>();
|
Scope = Container.Resolve<ILifetimeScope>();
|
||||||
|
|
||||||
var window = Scope.Resolve<MainView>();
|
var window = Scope.Resolve<CrossSectionView>();
|
||||||
window.Show();
|
window.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,15 @@
|
|||||||
using StructureHelper.Services.Primitives;
|
using StructureHelper.Services.Primitives;
|
||||||
using StructureHelper.Windows.MainWindow;
|
using StructureHelper.Windows.MainWindow;
|
||||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||||
{
|
{
|
||||||
public abstract class PrimitiveBase : ViewModelBase
|
public abstract class PrimitiveBase : ViewModelBase, IObserver<IRectangleShape>
|
||||||
{
|
{
|
||||||
#region Поля
|
#region Поля
|
||||||
private IPrimitiveRepository primitiveRepository;
|
private IPrimitiveRepository primitiveRepository;
|
||||||
@@ -236,13 +238,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
this.primitive = primitive;
|
this.primitive = primitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterDeltas(double dx, double dy)
|
public CrossSectionViewModel OwnerVM { get; private set; }
|
||||||
{
|
|
||||||
DeltaX = dx;
|
|
||||||
DeltaY = dy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MainViewModel OwnerVM { get; private set; }
|
|
||||||
|
|
||||||
public double DeltaX { get; private set; }
|
public double DeltaX { get; private set; }
|
||||||
public double DeltaY { get; private set; }
|
public double DeltaY { get; private set; }
|
||||||
@@ -253,14 +249,6 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
return primitive;
|
return primitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
//public virtual void RefreshNdmPrimitive()
|
|
||||||
//{
|
|
||||||
//}
|
|
||||||
|
|
||||||
public void RefreshColor()
|
|
||||||
{
|
|
||||||
OnPropertyChanged(nameof(Color));
|
|
||||||
}
|
|
||||||
public virtual void Refresh()
|
public virtual void Refresh()
|
||||||
{
|
{
|
||||||
OnPropertyChanged(nameof(Name));
|
OnPropertyChanged(nameof(Name));
|
||||||
@@ -273,5 +261,22 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
OnPropertyChanged(nameof(PrimitiveWidth));
|
OnPropertyChanged(nameof(PrimitiveWidth));
|
||||||
OnPropertyChanged(nameof(PrimitiveHeight));
|
OnPropertyChanged(nameof(PrimitiveHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnCompleted()
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,20 @@
|
|||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="ToolButton" TargetType="Button">
|
<Style x:Key="ToolButton" TargetType="Button">
|
||||||
|
<Style.Resources>
|
||||||
|
<Style TargetType="Image">
|
||||||
|
<Setter Property="Width" Value="32"/>
|
||||||
|
<Setter Property="Height" Value="32"/>
|
||||||
|
<Setter Property="Margin" Value="0"/>
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Opacity" Value="0.25"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Style.Resources>
|
||||||
<Setter Property="Width" Value="32"/>
|
<Setter Property="Width" Value="32"/>
|
||||||
<Setter Property="Height" Value="32"/>
|
<Setter Property="Height" Value="32"/>
|
||||||
<Setter Property="Margin" Value="2,0,2,0"/>
|
<Setter Property="Margin" Value="2,0,2,0"/>
|
||||||
|
|||||||
@@ -33,10 +33,10 @@
|
|||||||
<DataTemplate x:Key="SelectItems">
|
<DataTemplate x:Key="SelectItems">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="25"/>
|
<RowDefinition Height="auto"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Visibility="{Binding ShowButtons, Converter={StaticResource BooleanToVisibilityConverter}}">
|
<StackPanel Height="25" Orientation="Horizontal" HorizontalAlignment="Right" Visibility="{Binding ShowButtons, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||||
<Button Content="Select All" Command="{Binding SelectAllCommand}"/>
|
<Button Content="Select All" Command="{Binding SelectAllCommand}"/>
|
||||||
<Button Content="Unselect All" Command="{Binding UnSelectAllCommand}"/>
|
<Button Content="Unselect All" Command="{Binding UnSelectAllCommand}"/>
|
||||||
<Button Content="Invert Selection" Command="{Binding InvertSelectionCommand}"/>
|
<Button Content="Invert Selection" Command="{Binding InvertSelectionCommand}"/>
|
||||||
|
|||||||
Binary file not shown.
@@ -1,12 +1,8 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelper.Models.Calculators
|
namespace StructureHelper.Models.Calculators
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
-->
|
-->
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<History>True|2023-02-25T08:37:39.2738786Z;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;</History>
|
<History>True|2024-02-02T07:22:50.1454015Z;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;</History>
|
||||||
<LastFailureDetails />
|
<LastFailureDetails />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using LoaderCalculator.Logics;
|
using LoaderCalculator.Logics;
|
||||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -8,19 +9,63 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelper.Services.ResultViewers
|
namespace StructureHelper.Services.ResultViewers
|
||||||
{
|
{
|
||||||
|
public enum FuncsTypes
|
||||||
|
{
|
||||||
|
Strain,
|
||||||
|
Stress,
|
||||||
|
Forces,
|
||||||
|
Full,
|
||||||
|
}
|
||||||
public static class ResultFuncFactory
|
public static class ResultFuncFactory
|
||||||
{
|
{
|
||||||
public static IEnumerable<IResultFunc> GetResultFuncs()
|
static readonly IStressLogic stressLogic = new StressLogic();
|
||||||
|
public static List<IResultFunc> GetResultFuncs(FuncsTypes funcsType = FuncsTypes.Full)
|
||||||
|
{
|
||||||
|
List<IResultFunc> 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<IResultFunc> GetStrainResultFuncs()
|
||||||
{
|
{
|
||||||
List<IResultFunc> resultFuncs = new List<IResultFunc>();
|
List<IResultFunc> resultFuncs = new List<IResultFunc>();
|
||||||
IStressLogic stressLogic = new StressLogic();
|
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Total Strain", ResultFunction = stressLogic.GetTotalStrain });
|
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 = "Total Strain with prestrain", ResultFunction = stressLogic.GetTotalStrainWithPresrain });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Elastic Strain", ResultFunction = stressLogic.GetElasticStrain });
|
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 = "Plastic Strain", ResultFunction = stressLogic.GetPlasticStrain });
|
||||||
|
return resultFuncs;
|
||||||
|
}
|
||||||
|
private static List<IResultFunc> GetStressResultFuncs()
|
||||||
|
{
|
||||||
|
List<IResultFunc> resultFuncs = new List<IResultFunc>();
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress, UnitFactor = UnitConstants.Stress });
|
resultFuncs.Add(new ResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress, UnitFactor = UnitConstants.Stress });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Secant modulus", ResultFunction = stressLogic.GetSecantModulus, UnitFactor = UnitConstants.Stress });
|
resultFuncs.Add(new ResultFunc() { Name = "Secant modulus", ResultFunction = stressLogic.GetSecantModulus, UnitFactor = UnitConstants.Stress });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Modulus degradation", ResultFunction = stressLogic.GetModulusDegradation });
|
resultFuncs.Add(new ResultFunc() { Name = "Modulus degradation", ResultFunction = stressLogic.GetModulusDegradation });
|
||||||
|
return resultFuncs;
|
||||||
|
}
|
||||||
|
private static List<IResultFunc> GetForcesResultFuncs()
|
||||||
|
{
|
||||||
|
List<IResultFunc> resultFuncs = new List<IResultFunc>();
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Force", ResultFunction = stressLogic.GetForce, UnitFactor = UnitConstants.Force });
|
resultFuncs.Add(new ResultFunc() { Name = "Force", ResultFunction = stressLogic.GetForce, UnitFactor = UnitConstants.Force });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Moment X", ResultFunction = stressLogic.GetMomentX, UnitFactor = UnitConstants.Force });
|
resultFuncs.Add(new ResultFunc() { Name = "Moment X", ResultFunction = stressLogic.GetMomentX, UnitFactor = UnitConstants.Force });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Moment Y", ResultFunction = stressLogic.GetMomentY, UnitFactor = UnitConstants.Force });
|
resultFuncs.Add(new ResultFunc() { Name = "Moment Y", ResultFunction = stressLogic.GetMomentY, UnitFactor = UnitConstants.Force });
|
||||||
|
|||||||
@@ -36,6 +36,15 @@
|
|||||||
<Compile Update="Windows\Forces\ForceCombinationByFactorView.xaml.cs">
|
<Compile Update="Windows\Forces\ForceCombinationByFactorView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Windows\Forces\ForceInterpolationControl.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Windows\Forces\ForceTupleInterpolationControl.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Windows\Forces\ValuePointsInterpolateView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Windows\Graphs\GraphView.xaml.cs">
|
<Compile Update="Windows\Graphs\GraphView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -101,6 +110,15 @@
|
|||||||
<Page Update="Windows\Forces\ForceCombinationByFactorView.xaml">
|
<Page Update="Windows\Forces\ForceCombinationByFactorView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="Windows\Forces\ForceInterpolationControl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Update="Windows\Forces\ForceTupleInterpolationControl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Update="Windows\Forces\ValuePointsInterpolateView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Windows\Graphs\GraphView.xaml">
|
<Page Update="Windows\Graphs\GraphView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using LoaderCalculator;
|
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic;
|
||||||
using StructureHelper.Windows.Graphs;
|
using StructureHelper.Windows.Graphs;
|
||||||
using StructureHelper.Windows.ViewModels.Errors;
|
using StructureHelper.Windows.ViewModels.Errors;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Infrastructures.Settings;
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Parameters;
|
using StructureHelperCommon.Models.Parameters;
|
||||||
using StructureHelperCommon.Services.Units;
|
using StructureHelperCommon.Services.Units;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
@@ -15,8 +15,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||||
@@ -63,21 +61,27 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
|||||||
|
|
||||||
public void ShowCracks()
|
public void ShowCracks()
|
||||||
{
|
{
|
||||||
var unitForce = CommonOperation.GetUnit(UnitTypes.Force, "kN");
|
List<string> labels = GetCrackLabels();
|
||||||
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm");
|
arrayParameter = new ArrayParameter<double>(ValidTupleList.Count(), labels);
|
||||||
var unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature, "1/m");
|
CalculateWithCrack(ValidTupleList,
|
||||||
|
NdmPrimitives,
|
||||||
string[] labels = GetCrackLabels(unitForce, unitMoment, unitCurvature);
|
CommonOperation.GetUnit(UnitTypes.Force),
|
||||||
arrayParameter = new ArrayParameter<double>(ValidTupleList.Count(), labels.Count(), labels);
|
CommonOperation.GetUnit(UnitTypes.Moment),
|
||||||
CalculateWithCrack(ValidTupleList, NdmPrimitives, unitForce, unitMoment, unitCurvature);
|
CommonOperation.GetUnit(UnitTypes.Curvature));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowWindow()
|
public void ShowWindow()
|
||||||
{
|
{
|
||||||
SafetyProcessor.RunSafeProcess(() =>
|
SafetyProcessor.RunSafeProcess(() =>
|
||||||
{
|
{
|
||||||
var series = new Series(arrayParameter) { Name = "Forces and curvatures" };
|
var series = new Series(arrayParameter)
|
||||||
var vm = new GraphViewModel(new List<Series>() { series });
|
{
|
||||||
|
Name = "Forces and curvatures"
|
||||||
|
};
|
||||||
|
var vm = new GraphViewModel(new List<Series>()
|
||||||
|
{
|
||||||
|
series
|
||||||
|
});
|
||||||
var wnd = new GraphView(vm);
|
var wnd = new GraphView(vm);
|
||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
},
|
},
|
||||||
@@ -134,18 +138,14 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string[] GetCrackLabels(IUnit unitForce, IUnit unitMoment, IUnit unitCurvature)
|
private static List<string> GetCrackLabels()
|
||||||
{
|
{
|
||||||
const string crc = "Crc";
|
const string crc = "Crc";
|
||||||
const string crcFactor = "CrcSofteningFactor";
|
const string crcFactor = "CrcSofteningFactor";
|
||||||
return new string[]
|
var labels = LabelsFactory.GetCommonLabels();
|
||||||
|
IUnit unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature);
|
||||||
|
var crclabels = new List<string>
|
||||||
{
|
{
|
||||||
$"{GeometryNames.MomFstName}, {unitMoment.Name}",
|
|
||||||
$"{GeometryNames.MomSndName}, {unitMoment.Name}",
|
|
||||||
$"{GeometryNames.LongForceName}, {unitForce.Name}",
|
|
||||||
$"{GeometryNames.CurvFstName}, {unitCurvature.Name}",
|
|
||||||
$"{GeometryNames.CurvSndName}, {unitCurvature.Name}",
|
|
||||||
$"{GeometryNames.StrainTrdName}",
|
|
||||||
$"{crc}{GeometryNames.CurvFstName}, {unitCurvature.Name}",
|
$"{crc}{GeometryNames.CurvFstName}, {unitCurvature.Name}",
|
||||||
$"{crc}{GeometryNames.CurvSndName}, {unitCurvature.Name}",
|
$"{crc}{GeometryNames.CurvSndName}, {unitCurvature.Name}",
|
||||||
$"{crc}{GeometryNames.StrainTrdName}",
|
$"{crc}{GeometryNames.StrainTrdName}",
|
||||||
@@ -154,6 +154,8 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
|||||||
$"{crcFactor}Az",
|
$"{crcFactor}Az",
|
||||||
$"PsiFactor"
|
$"PsiFactor"
|
||||||
};
|
};
|
||||||
|
labels.AddRange(crclabels);
|
||||||
|
return labels;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,15 +4,11 @@ using StructureHelperCommon.Infrastructures.Enums;
|
|||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Infrastructures.Settings;
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
|
||||||
using StructureHelperCommon.Models.Parameters;
|
using StructureHelperCommon.Models.Parameters;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
|
||||||
using StructureHelperCommon.Services.Units;
|
using StructureHelperCommon.Services.Units;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -94,7 +90,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
|
|
||||||
private ArrayParameter<double> GetParametersByCurveResult(LimitCurveResult curveResult)
|
private ArrayParameter<double> GetParametersByCurveResult(LimitCurveResult curveResult)
|
||||||
{
|
{
|
||||||
string[] labels = GetLabels();
|
var labels = GetLabels();
|
||||||
var items = curveResult.Points;
|
var items = curveResult.Points;
|
||||||
var arrayParameter = new ArrayParameter<double>(items.Count(), labels.Count(), labels);
|
var arrayParameter = new ArrayParameter<double>(items.Count(), labels.Count(), labels);
|
||||||
var data = arrayParameter.Data;
|
var data = arrayParameter.Data;
|
||||||
@@ -125,11 +121,13 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
SetProgress?.Invoke(parameterResult.IterationNumber);
|
SetProgress?.Invoke(parameterResult.IterationNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string[] GetLabels()
|
private List<string> GetLabels()
|
||||||
{
|
{
|
||||||
string[] strings = new string[2];
|
List<string> strings = new()
|
||||||
strings[0] = GetLabel(InputData.SurroundData.ConvertLogicEntity.XForceType);
|
{
|
||||||
strings[1] = GetLabel(InputData.SurroundData.ConvertLogicEntity.YForceType);
|
GetLabel(InputData.SurroundData.ConvertLogicEntity.XForceType),
|
||||||
|
GetLabel(InputData.SurroundData.ConvertLogicEntity.YForceType)
|
||||||
|
};
|
||||||
return strings;
|
return strings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
|
using StructureHelperCommon.Services.Units;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||||
|
{
|
||||||
|
public static class LabelsFactory
|
||||||
|
{
|
||||||
|
private static IUnit unitForce = CommonOperation.GetUnit(UnitTypes.Force);
|
||||||
|
private static IUnit unitMoment = CommonOperation.GetUnit(UnitTypes.Moment);
|
||||||
|
private static IUnit unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature);
|
||||||
|
private static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
||||||
|
public static List<string> GetCommonLabels()
|
||||||
|
{
|
||||||
|
var labels = new List<string>
|
||||||
|
{
|
||||||
|
$"{GeometryNames.MomFstName}, {unitMoment.Name}",
|
||||||
|
$"{GeometryNames.MomSndName}, {unitMoment.Name}",
|
||||||
|
$"{GeometryNames.LongForceName}, {unitForce.Name}",
|
||||||
|
$"{GeometryNames.CurvFstName}, {unitCurvature.Name}",
|
||||||
|
$"{GeometryNames.CurvSndName}, {unitCurvature.Name}",
|
||||||
|
$"{GeometryNames.StrainTrdName}",
|
||||||
|
};
|
||||||
|
return labels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
using StructureHelper.Windows.Errors;
|
using LoaderCalculator;
|
||||||
|
using StructureHelper.Windows.CalculationWindows.ProgressViews;
|
||||||
|
using StructureHelper.Windows.Errors;
|
||||||
using StructureHelper.Windows.Forces;
|
using StructureHelper.Windows.Forces;
|
||||||
using StructureHelper.Windows.ViewModels.Errors;
|
using StructureHelper.Windows.ViewModels.Errors;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Settings;
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
@@ -14,26 +17,29 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
{
|
{
|
||||||
internal class ShowCrackResultLogic
|
internal class ShowCrackResultLogic
|
||||||
{
|
{
|
||||||
|
private CrackForceCalculator calculator;
|
||||||
|
|
||||||
public static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
public static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
||||||
public LimitStates LimitState { get; set; }
|
public LimitStates LimitState { get; set; }
|
||||||
public CalcTerms CalcTerm { get; set; }
|
public CalcTerms CalcTerm { get; set; }
|
||||||
public ForceTuple ForceTuple { get; set; }
|
public IForceTuple ForceTuple { get; set; }
|
||||||
public IEnumerable<INdmPrimitive> ndmPrimitives { get; set; }
|
public IEnumerable<INdmPrimitive> ndmPrimitives { get; set; }
|
||||||
public void Show(IDesignForceTuple finishDesignTuple)
|
public void Show(IDesignForceTuple finishDesignTuple)
|
||||||
{
|
{
|
||||||
var viewModel = new InterpolateTuplesViewModel(finishDesignTuple, null);
|
var viewModel = new InterpolateTuplesViewModel(finishDesignTuple, null);
|
||||||
viewModel.StepCountVisible = false;
|
viewModel.ForceInterpolationViewModel.StepCountVisible = false;
|
||||||
var wndTuples = new InterpolateTuplesView(viewModel);
|
var wndTuples = new InterpolateTuplesView(viewModel);
|
||||||
wndTuples.ShowDialog();
|
wndTuples.ShowDialog();
|
||||||
if (wndTuples.DialogResult != true) return;
|
if (wndTuples.DialogResult != true) return;
|
||||||
var startDesignTuple = viewModel.StartDesignForce.ForceTuple;
|
var startDesignTuple = viewModel.ForceInterpolationViewModel.StartDesignForce.ForceTuple;
|
||||||
var endDesignTuple = viewModel.FinishDesignForce.ForceTuple;
|
var endDesignTuple = viewModel.ForceInterpolationViewModel.FinishDesignForce.ForceTuple;
|
||||||
FindCrackFactor(endDesignTuple, startDesignTuple);
|
FindCrackFactor(endDesignTuple, startDesignTuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FindCrackFactor(ForceTuple finishDesignTuple, ForceTuple startDesignTuple)
|
private void FindCrackFactor(IForceTuple finishDesignTuple, IForceTuple startDesignTuple)
|
||||||
{
|
{
|
||||||
var calculator = new CrackForceCalculator();
|
calculator = new CrackForceCalculator();
|
||||||
|
calculator.TraceLogger = new ShiftTraceLogger();
|
||||||
calculator.StartTuple = startDesignTuple;
|
calculator.StartTuple = startDesignTuple;
|
||||||
calculator.EndTuple = finishDesignTuple;
|
calculator.EndTuple = finishDesignTuple;
|
||||||
calculator.NdmCollection = NdmPrimitivesService.GetNdms(ndmPrimitives, LimitState, CalcTerm);
|
calculator.NdmCollection = NdmPrimitivesService.GetNdms(ndmPrimitives, LimitState, CalcTerm);
|
||||||
@@ -41,7 +47,8 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
var result = (CrackForceResult)calculator.Result;
|
var result = (CrackForceResult)calculator.Result;
|
||||||
if (result.IsValid)
|
if (result.IsValid)
|
||||||
{
|
{
|
||||||
ShowResult(result);
|
ShowTraceResult();
|
||||||
|
//ShowResult(result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -80,5 +87,14 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
MessageBoxButtons.OK,
|
MessageBoxButtons.OK,
|
||||||
MessageBoxIcon.Information);
|
MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ShowTraceResult()
|
||||||
|
{
|
||||||
|
if (calculator.TraceLogger is not null)
|
||||||
|
{
|
||||||
|
var wnd = new TraceDocumentView(calculator.TraceLogger.TraceLoggerEntries);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
public List<INdmPrimitive> ndmPrimitives { get; set; }
|
public List<INdmPrimitive> ndmPrimitives { get; set; }
|
||||||
public LimitStates LimitState { get; set; }
|
public LimitStates LimitState { get; set; }
|
||||||
public CalcTerms CalcTerm { get; set; }
|
public CalcTerms CalcTerm { get; set; }
|
||||||
public ForceTuple ForceTuple { get; set; }
|
public IForceTuple ForceTuple { get; set; }
|
||||||
|
|
||||||
internal void Show()
|
internal void Show()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
using StructureHelper.Windows.Graphs;
|
using StructureHelper.Windows.Graphs;
|
||||||
using StructureHelper.Windows.ViewModels.Errors;
|
using StructureHelper.Windows.ViewModels.Errors;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Infrastructures.Settings;
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Parameters;
|
using StructureHelperCommon.Models.Parameters;
|
||||||
using StructureHelperCommon.Services.Units;
|
using StructureHelperCommon.Services.Units;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
@@ -17,14 +18,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
{
|
{
|
||||||
internal class ShowDiagramLogic : ILongProcessLogic
|
internal class ShowDiagramLogic : ILongProcessLogic
|
||||||
{
|
{
|
||||||
ArrayParameter<double> arrayParameter;
|
private ArrayParameter<double> arrayParameter;
|
||||||
private IEnumerable<IForcesTupleResult> TupleList;
|
private IEnumerable<IForcesTupleResult> tupleList;
|
||||||
private IEnumerable<INdmPrimitive> NdmPrimitives;
|
private IEnumerable<INdmPrimitive> ndmPrimitives;
|
||||||
private List<IForcesTupleResult> ValidTupleList;
|
private List<IForcesTupleResult> validTupleList;
|
||||||
|
|
||||||
private static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
public int StepCount => validTupleList.Count();
|
||||||
|
|
||||||
public int StepCount => ValidTupleList.Count();
|
|
||||||
|
|
||||||
public Action<int> SetProgress { get; set; }
|
public Action<int> SetProgress { get; set; }
|
||||||
public bool Result { get; set; }
|
public bool Result { get; set; }
|
||||||
@@ -50,37 +49,33 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
SafetyProcessor.RunSafeProcess(() =>
|
SafetyProcessor.RunSafeProcess(() =>
|
||||||
{
|
{
|
||||||
var series = new Series(arrayParameter) { Name = "Forces and curvatures" };
|
var series = new Series(arrayParameter) { Name = "Forces and curvatures" };
|
||||||
var vm = new GraphViewModel(new List<Series>() { series});
|
var vm = new GraphViewModel(new List<Series>() { series });
|
||||||
var wnd = new GraphView(vm);
|
var wnd = new GraphView(vm);
|
||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
},
|
}, ErrorStrings.ErrorDuring("building chart"));
|
||||||
"Errors appeared during showing a graph, see detailed information");
|
|
||||||
}
|
}
|
||||||
private void Show()
|
private void Show()
|
||||||
{
|
{
|
||||||
ValidTupleList = TupleList.Where(x => x.IsValid == true).ToList();
|
validTupleList = tupleList.Where(x => x.IsValid == true).ToList();
|
||||||
var unitForce = CommonOperation.GetUnit(UnitTypes.Force, "kN");
|
|
||||||
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm");
|
|
||||||
var unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature, "1/m");
|
|
||||||
|
|
||||||
string[] labels = GetLabels(unitForce, unitMoment, unitCurvature);
|
var labels = LabelsFactory.GetCommonLabels();
|
||||||
arrayParameter = new ArrayParameter<double>(ValidTupleList.Count(), labels.Count(), labels);
|
arrayParameter = new ArrayParameter<double>(validTupleList.Count(), labels);
|
||||||
CalculateWithoutCrack(ValidTupleList, unitForce, unitMoment, unitCurvature);
|
Calculate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShowDiagramLogic(IEnumerable<IForcesTupleResult> tupleList, IEnumerable<INdmPrimitive> ndmPrimitives)
|
public ShowDiagramLogic(IEnumerable<IForcesTupleResult> tupleList, IEnumerable<INdmPrimitive> ndmPrimitives)
|
||||||
{
|
{
|
||||||
TupleList = tupleList;
|
this.tupleList = tupleList;
|
||||||
NdmPrimitives = ndmPrimitives;
|
this.ndmPrimitives = ndmPrimitives;
|
||||||
ValidTupleList = TupleList.Where(x => x.IsValid == true).ToList();
|
validTupleList = tupleList.Where(x => x.IsValid == true).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateWithoutCrack(List<IForcesTupleResult> resultList, IUnit unitForce, IUnit unitMoment, IUnit unitCurvature)
|
private void Calculate()
|
||||||
{
|
{
|
||||||
var data = arrayParameter.Data;
|
var data = arrayParameter.Data;
|
||||||
for (int i = 0; i < resultList.Count(); i++)
|
for (int i = 0; i < validTupleList.Count(); i++)
|
||||||
{
|
{
|
||||||
var valueList = ProcessResultWithouCrack(resultList, unitForce, unitMoment, unitCurvature, i);
|
var valueList = ProcessResult(i);
|
||||||
for (int j = 0; j < valueList.Count; j++)
|
for (int j = 0; j < valueList.Count; j++)
|
||||||
{
|
{
|
||||||
data[i, j] = valueList[j];
|
data[i, j] = valueList[j];
|
||||||
@@ -90,30 +85,21 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static List<double> ProcessResultWithouCrack(List<IForcesTupleResult> resultList, IUnit unitForce, IUnit unitMoment, IUnit unitCurvature, int i)
|
private List<double> ProcessResult(int i)
|
||||||
{
|
{
|
||||||
|
var unitForce = CommonOperation.GetUnit(UnitTypes.Force);
|
||||||
|
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment);
|
||||||
|
var unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature);
|
||||||
|
|
||||||
return new List<double>
|
return new List<double>
|
||||||
{
|
{
|
||||||
resultList[i].DesignForceTuple.ForceTuple.Mx * unitMoment.Multiplyer,
|
validTupleList[i].DesignForceTuple.ForceTuple.Mx * unitMoment.Multiplyer,
|
||||||
resultList[i].DesignForceTuple.ForceTuple.My * unitMoment.Multiplyer,
|
validTupleList[i].DesignForceTuple.ForceTuple.My * unitMoment.Multiplyer,
|
||||||
resultList[i].DesignForceTuple.ForceTuple.Nz * unitForce.Multiplyer,
|
validTupleList[i].DesignForceTuple.ForceTuple.Nz * unitForce.Multiplyer,
|
||||||
resultList[i].LoaderResults.ForceStrainPair.StrainMatrix.Kx * unitCurvature.Multiplyer,
|
validTupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.Kx * unitCurvature.Multiplyer,
|
||||||
resultList[i].LoaderResults.ForceStrainPair.StrainMatrix.Ky * unitCurvature.Multiplyer,
|
validTupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.Ky * unitCurvature.Multiplyer,
|
||||||
resultList[i].LoaderResults.ForceStrainPair.StrainMatrix.EpsZ
|
validTupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.EpsZ
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
private static string[] GetLabels(IUnit unitForce, IUnit unitMoment, IUnit unitCurvature)
|
|
||||||
{
|
|
||||||
return new string[]
|
|
||||||
{
|
|
||||||
$"{GeometryNames.MomFstName}, {unitMoment.Name}",
|
|
||||||
$"{GeometryNames.MomSndName}, {unitMoment.Name}",
|
|
||||||
$"{GeometryNames.LongForceName}, {unitForce.Name}",
|
|
||||||
$"{GeometryNames.CurvFstName}, {unitCurvature.Name}",
|
|
||||||
$"{GeometryNames.CurvSndName}, {unitCurvature.Name}",
|
|
||||||
$"{GeometryNames.StrainTrdName}"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,102 @@
|
|||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelper.Services.ResultViewers;
|
||||||
|
using StructureHelper.Windows.Forces;
|
||||||
|
using StructureHelper.Windows.Graphs;
|
||||||
|
using StructureHelper.Windows.ViewModels.Errors;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Parameters;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||||
|
{
|
||||||
|
public class ShowValuePointDiagramLogic : ILongProcessLogic
|
||||||
|
{
|
||||||
|
private ArrayParameter<double> arrayParameter;
|
||||||
|
private IEnumerable<IForcesTupleResult> tupleList;
|
||||||
|
private IEnumerable<INdmPrimitive> ndmPrimitives;
|
||||||
|
private List<IForcesTupleResult> validTupleList;
|
||||||
|
private List<(PrimitiveBase PrimitiveBase, List<NamedValue<IPoint2D>>)> valuePoints;
|
||||||
|
private List<IResultFunc> resultFuncList;
|
||||||
|
|
||||||
|
public ForceCalculator Calculator { get; set; }
|
||||||
|
public PointPrimitiveLogic PrimitiveLogic { get; set; }
|
||||||
|
public ValueDelegatesLogic ValueDelegatesLogic { get; set; }
|
||||||
|
|
||||||
|
public int StepCount => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public Action<int> SetProgress { get; set; }
|
||||||
|
public bool Result { get; set; }
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
public ShowValuePointDiagramLogic(IEnumerable<IForcesTupleResult> tupleList, IEnumerable<INdmPrimitive> ndmPrimitives)
|
||||||
|
{
|
||||||
|
this.tupleList = tupleList;
|
||||||
|
this.ndmPrimitives = ndmPrimitives;
|
||||||
|
validTupleList = this.tupleList.Where(x => x.IsValid == true).ToList();
|
||||||
|
valuePoints = new List<(PrimitiveBase PrimitiveBase, List<NamedValue<IPoint2D>>)>();
|
||||||
|
foreach (var item in PrimitiveLogic.Collection.CollectionItems)
|
||||||
|
{
|
||||||
|
var pointsCount = item.Item.ValuePoints.SelectedCount;
|
||||||
|
if (pointsCount > 0)
|
||||||
|
{
|
||||||
|
var points = item.Item.ValuePoints.SelectedItems.ToList();
|
||||||
|
var primitive = item.Item.PrimitiveBase;
|
||||||
|
valuePoints.Add((primitive, points));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void ShowWindow()
|
||||||
|
{
|
||||||
|
SafetyProcessor.RunSafeProcess(() =>
|
||||||
|
{
|
||||||
|
var series = new Series(arrayParameter)
|
||||||
|
{
|
||||||
|
Name = "Forces and curvatures"
|
||||||
|
};
|
||||||
|
var vm = new GraphViewModel(new List<Series>()
|
||||||
|
{
|
||||||
|
series
|
||||||
|
});
|
||||||
|
var wnd = new GraphView(vm);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
}, ErrorStrings.ErrorDuring("building chart"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WorkerDoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
Show();
|
||||||
|
Result = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WorkerProgressChanged(object sender, ProgressChangedEventArgs e)
|
||||||
|
{
|
||||||
|
//Nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WorkerRunWorkCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
//Nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Show()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<string> GetColumnNames()
|
||||||
|
{
|
||||||
|
var columnNames = LabelsFactory.GetCommonLabels();
|
||||||
|
|
||||||
|
return columnNames;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,17 +10,20 @@
|
|||||||
<DockPanel>
|
<DockPanel>
|
||||||
<ToolBarTray DockPanel.Dock="Top">
|
<ToolBarTray DockPanel.Dock="Top">
|
||||||
<ToolBar>
|
<ToolBar>
|
||||||
<Button Command="{Binding ShowCrackResultCommand}" ToolTip="Show force of cracking">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding ShowCrackResultCommand}" ToolTip="Show force of cracking">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_crack.png"/>
|
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_crack.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding InterpolateCommand}" ToolTip="Show result step by step">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding InterpolateCommand}" ToolTip="Show result step by step">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_interpolation_1_1.png"/>
|
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_interpolation_1_1.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding ShowGraphsCommand}" ToolTip="Show diagram moment-curvature">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding ShowGraphsCommand}" ToolTip="Show diagram moment-curvature">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png"/>
|
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding ShowInteractionDiagramCommand}" ToolTip="Show interaction diagram">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding GraphValuePointsCommand}" ToolTip="Show diagram by value points">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_1.png"/>
|
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png"/>
|
||||||
|
</Button>
|
||||||
|
<Button Style="{StaticResource ToolButton}" Command="{Binding ShowInteractionDiagramCommand}" ToolTip="Show interaction diagram">
|
||||||
|
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_1.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using LoaderCalculator.Data.Matrix;
|
using LoaderCalculator.Data.Matrix;
|
||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using StructureHelper.Infrastructure;
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
using StructureHelper.Services.Exports;
|
using StructureHelper.Services.Exports;
|
||||||
using StructureHelper.Services.Reports;
|
using StructureHelper.Services.Reports;
|
||||||
using StructureHelper.Services.Reports.CalculationReports;
|
using StructureHelper.Services.Reports.CalculationReports;
|
||||||
@@ -12,7 +13,6 @@ using StructureHelper.Windows.Forces;
|
|||||||
using StructureHelper.Windows.PrimitivePropertiesWindow;
|
using StructureHelper.Windows.PrimitivePropertiesWindow;
|
||||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||||
using StructureHelper.Windows.ViewModels.Errors;
|
using StructureHelper.Windows.ViewModels.Errors;
|
||||||
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
@@ -22,7 +22,6 @@ using StructureHelperCommon.Models.Shapes;
|
|||||||
using StructureHelperCommon.Services.Forces;
|
using StructureHelperCommon.Services.Forces;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.Geometry;
|
using StructureHelperLogics.NdmCalculations.Analyses.Geometry;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
@@ -54,17 +53,18 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
public static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
public static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
||||||
|
|
||||||
public ForcesTupleResult SelectedResult { get; set; }
|
public ForcesTupleResult SelectedResult { get; set; }
|
||||||
private ICommand showIsoFieldCommand;
|
private ICommand? showIsoFieldCommand;
|
||||||
private ICommand exportToCSVCommand;
|
private ICommand? exportToCSVCommand;
|
||||||
private ICommand interpolateCommand;
|
private ICommand? interpolateCommand;
|
||||||
private ICommand setPrestrainCommand;
|
private ICommand? setPrestrainCommand;
|
||||||
private ICommand showAnchorageCommand;
|
private ICommand? showAnchorageCommand;
|
||||||
private ICommand showGeometryResultCommand;
|
private ICommand? showGeometryResultCommand;
|
||||||
private ICommand showGraphsCommand;
|
private ICommand? showGraphsCommand;
|
||||||
private ICommand showCrackResult;
|
private ICommand? showCrackResult;
|
||||||
private ICommand showCrackGraphsCommand;
|
private ICommand? showCrackGraphsCommand;
|
||||||
private RelayCommand showCrackWidthResult;
|
private ICommand? showCrackWidthResult;
|
||||||
private ICommand showInteractionDiagramCommand;
|
private ICommand? showInteractionDiagramCommand;
|
||||||
|
private ICommand? graphValuepointsCommand;
|
||||||
|
|
||||||
public IForcesResults ForcesResults
|
public IForcesResults ForcesResults
|
||||||
{
|
{
|
||||||
@@ -157,7 +157,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
ShowInterpolationWindow(out interploateTuplesViewModel, out wndTuples);
|
ShowInterpolationWindow(out interploateTuplesViewModel, out wndTuples);
|
||||||
if (wndTuples.DialogResult != true) return;
|
if (wndTuples.DialogResult != true) return;
|
||||||
|
|
||||||
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.Result);
|
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.ForceInterpolationViewModel.Result);
|
||||||
showProgressLogic = new(interpolationLogic)
|
showProgressLogic = new(interpolationLogic)
|
||||||
{
|
{
|
||||||
WindowTitle = "Interpolate forces"
|
WindowTitle = "Interpolate forces"
|
||||||
@@ -176,8 +176,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
};
|
};
|
||||||
showProgressLogic.Show();
|
showProgressLogic.Show();
|
||||||
}
|
}
|
||||||
}, o => SelectedResult != null && SelectedResult.IsValid
|
}, o => SelectedResult != null);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
public ICommand ShowCrackGraphsCommand
|
public ICommand ShowCrackGraphsCommand
|
||||||
{
|
{
|
||||||
@@ -188,7 +187,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
ShowInterpolationWindow(out interploateTuplesViewModel, out wndTuples);
|
ShowInterpolationWindow(out interploateTuplesViewModel, out wndTuples);
|
||||||
if (wndTuples.DialogResult != true) return;
|
if (wndTuples.DialogResult != true) return;
|
||||||
|
|
||||||
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.Result);
|
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.ForceInterpolationViewModel.Result);
|
||||||
showProgressLogic = new(interpolationLogic)
|
showProgressLogic = new(interpolationLogic)
|
||||||
{
|
{
|
||||||
WindowTitle = "Interpolate forces"
|
WindowTitle = "Interpolate forces"
|
||||||
@@ -261,13 +260,58 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
ShowInterpolationWindow(out interploateTuplesViewModel, out wndTuples);
|
ShowInterpolationWindow(out interploateTuplesViewModel, out wndTuples);
|
||||||
if (wndTuples.DialogResult != true) return;
|
if (wndTuples.DialogResult != true) return;
|
||||||
|
|
||||||
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.Result);
|
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.ForceInterpolationViewModel.Result);
|
||||||
progressLogic = interpolationLogic;
|
progressLogic = interpolationLogic;
|
||||||
showProgressLogic = new(interpolationLogic);
|
showProgressLogic = new(interpolationLogic);
|
||||||
showProgressLogic.ShowResult = ShowInterpolationProgressDialog;
|
showProgressLogic.ShowResult = ShowInterpolationProgressDialog;
|
||||||
showProgressLogic.Show();
|
showProgressLogic.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ICommand GraphValuePointsCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return graphValuepointsCommand ??
|
||||||
|
(graphValuepointsCommand = new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
InterpolateValuePoints();
|
||||||
|
}, o => SelectedResult != null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InterpolateValuePoints()
|
||||||
|
{
|
||||||
|
if (SelectedResult is null)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.NullReference + ": Nothing is selected");
|
||||||
|
}
|
||||||
|
var tuple = SelectedResult.DesignForceTuple ?? throw new StructureHelperException(ErrorStrings.NullReference + ": Design force combination");
|
||||||
|
var inputData = new ValuePointsInterpolationInputData()
|
||||||
|
{
|
||||||
|
FinishDesignForce = tuple.Clone() as IDesignForceTuple,
|
||||||
|
LimitState = tuple.LimitState,
|
||||||
|
CalcTerm = tuple.CalcTerm,
|
||||||
|
};
|
||||||
|
inputData.PrimitiveBases.AddRange(PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(ndmPrimitives));
|
||||||
|
var viewModel = new ValuePointsInterpolateViewModel(inputData);
|
||||||
|
var wnd = new ValuePointsInterpolateView(viewModel);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
if (wnd.DialogResult != true) { return; }
|
||||||
|
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, viewModel.ForceInterpolationViewModel.Result);
|
||||||
|
ShowValuePointDiagramLogic pointGraphLogic = new(ForcesResults.ForcesResultList, ndmPrimitives)
|
||||||
|
{
|
||||||
|
Calculator = interpolationLogic.InterpolateCalculator,
|
||||||
|
PrimitiveLogic = viewModel.PrimitiveLogic,
|
||||||
|
ValueDelegatesLogic = viewModel.ValueDelegatesLogic
|
||||||
|
};
|
||||||
|
progressLogic = interpolationLogic;
|
||||||
|
showProgressLogic = new(interpolationLogic)
|
||||||
|
{
|
||||||
|
ShowResult = pointGraphLogic.ShowWindow
|
||||||
|
};
|
||||||
|
showProgressLogic.Show();
|
||||||
|
}
|
||||||
|
|
||||||
private void ShowInterpolationWindow(out InterpolateTuplesViewModel interploateTuplesViewModel, out InterpolateTuplesView wndTuples)
|
private void ShowInterpolationWindow(out InterpolateTuplesViewModel interploateTuplesViewModel, out InterpolateTuplesView wndTuples)
|
||||||
{
|
{
|
||||||
IDesignForceTuple finishDesignTuple = SelectedResult.DesignForceTuple.Clone() as IDesignForceTuple;
|
IDesignForceTuple finishDesignTuple = SelectedResult.DesignForceTuple.Clone() as IDesignForceTuple;
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
{
|
{
|
||||||
var factor = GetFactor(SurroundData.ConvertLogicEntity.ZForceType);
|
var factor = GetFactor(SurroundData.ConvertLogicEntity.ZForceType);
|
||||||
SurroundData.ConstZ = value / factor;
|
SurroundData.ConstZ = value / factor;
|
||||||
|
SurroundData.ConvertLogicEntity.ConstDirectionValue = SurroundData.ConstZ;
|
||||||
OnPropertyChanged(nameof(ConstZ));
|
OnPropertyChanged(nameof(ConstZ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,11 @@
|
|||||||
using StructureHelper.Infrastructure;
|
using StructureHelper.Infrastructure;
|
||||||
using StructureHelper.Windows.AddMaterialWindow;
|
|
||||||
using StructureHelper.Windows.ViewModels.Errors;
|
using StructureHelper.Windows.ViewModels.Errors;
|
||||||
using StructureHelper.Windows.ViewModels.Materials;
|
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Tables;
|
using StructureHelperCommon.Models.Tables;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.ConstrainedExecution;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
@@ -21,31 +16,35 @@ namespace StructureHelper.Windows.CalculationWindows.ProgressViews
|
|||||||
{
|
{
|
||||||
public class TraceDocumentVM : ViewModelBase
|
public class TraceDocumentVM : ViewModelBase
|
||||||
{
|
{
|
||||||
IEnumerable<ITraceLoggerEntry> loggerEntries;
|
const double tabFactor = 500d;
|
||||||
IEnumerable<ITraceLoggerEntry> selectedLoggerEntries;
|
private readonly IEnumerable<ITraceLoggerEntry> loggerEntries;
|
||||||
FlowDocument document;
|
private IEnumerable<ITraceLoggerEntry> selectedLoggerEntries;
|
||||||
|
private FlowDocument document;
|
||||||
private ICommand rebuildCommand;
|
private ICommand rebuildCommand;
|
||||||
private ICommand printDocumentCommand;
|
private ICommand printDocumentCommand;
|
||||||
private int maxPriority;
|
private int priorityLimit;
|
||||||
private int tabGap;
|
private int tabGap;
|
||||||
|
|
||||||
public FlowDocumentReader DocumentReader { get; set; }
|
public FlowDocumentReader DocumentReader { get; set; }
|
||||||
public int MaxPriority
|
public int PriorityLimit
|
||||||
{
|
{
|
||||||
get => maxPriority; set
|
get => priorityLimit; set
|
||||||
{
|
{
|
||||||
var oldValue = maxPriority;
|
var oldValue = priorityLimit;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
maxPriority = Math.Max(value, 0);
|
priorityLimit = Math.Max(value, 0);
|
||||||
OnPropertyChanged(nameof(MaxPriority));
|
OnPropertyChanged(nameof(PriorityLimit));
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
maxPriority = oldValue;
|
priorityLimit = oldValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int MaxPriority => loggerEntries.Max(x => x.Priority);
|
||||||
|
|
||||||
public int TabGap
|
public int TabGap
|
||||||
{
|
{
|
||||||
get => tabGap; set
|
get => tabGap; set
|
||||||
@@ -65,8 +64,8 @@ namespace StructureHelper.Windows.CalculationWindows.ProgressViews
|
|||||||
public TraceDocumentVM(IEnumerable<ITraceLoggerEntry> loggerEntries)
|
public TraceDocumentVM(IEnumerable<ITraceLoggerEntry> loggerEntries)
|
||||||
{
|
{
|
||||||
this.loggerEntries = loggerEntries;
|
this.loggerEntries = loggerEntries;
|
||||||
maxPriority = 350;
|
priorityLimit = 350;
|
||||||
tabGap = 50;
|
tabGap = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICommand RebuildCommand =>
|
public ICommand RebuildCommand =>
|
||||||
@@ -81,40 +80,82 @@ namespace StructureHelper.Windows.CalculationWindows.ProgressViews
|
|||||||
SafetyProcessor.RunSafeProcess(DocumentReader.Print, "Error of printing document");
|
SafetyProcessor.RunSafeProcess(DocumentReader.Print, "Error of printing document");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
public void Prepare()
|
||||||
|
{
|
||||||
|
document = new();
|
||||||
|
selectedLoggerEntries = loggerEntries.Where(x => x.Priority <= PriorityLimit);
|
||||||
|
var blocks = selectedLoggerEntries.Select(x => GetBlockByEntry(x));
|
||||||
|
document.Blocks.AddRange(blocks);
|
||||||
|
}
|
||||||
|
public void ShowPrepared()
|
||||||
|
{
|
||||||
|
DocumentReader.Document = document;
|
||||||
|
}
|
||||||
public void Show()
|
public void Show()
|
||||||
{
|
{
|
||||||
Prepare();
|
Prepare();
|
||||||
ShowPrepared();
|
ShowPrepared();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Prepare()
|
private Block GetBlockByEntry(ITraceLoggerEntry traceEntry)
|
||||||
{
|
{
|
||||||
document = new();
|
Block block;
|
||||||
selectedLoggerEntries = loggerEntries.Where(x => x.Priority <= MaxPriority);
|
if (traceEntry is StringLogEntry stringEntry)
|
||||||
foreach (var item in selectedLoggerEntries)
|
|
||||||
{
|
{
|
||||||
ProcessLoggerEntries(item);
|
block = GetBlockByStringEntry(stringEntry);
|
||||||
}
|
}
|
||||||
}
|
else if (traceEntry is TableLogEntry tableEntry)
|
||||||
|
|
||||||
private void ProcessLoggerEntries(ITraceLoggerEntry item)
|
|
||||||
{
|
{
|
||||||
if (item is StringLoggerEntry stringEntry)
|
block = GetBlockByTableEntry(tableEntry);
|
||||||
{
|
|
||||||
ProcessStringEntry(stringEntry);
|
|
||||||
}
|
|
||||||
else if (item is TableLoggerEntry tableEntry)
|
|
||||||
{
|
|
||||||
ProcessTableEntry(tableEntry);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(item));
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(traceEntry));
|
||||||
}
|
}
|
||||||
|
block.Margin = new Thickness(traceEntry.Priority / tabFactor * tabGap, 7, 0, 7);
|
||||||
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessTableEntry(TableLoggerEntry tableEntry)
|
private Block GetBlockByStringEntry(StringLogEntry stringEntry)
|
||||||
{
|
{
|
||||||
|
var paragraph = new Paragraph(new Run(stringEntry.Message));
|
||||||
|
if (stringEntry.Priority <= LoggerService.GetPriorityByStatus(TraceLogStatuses.Fatal))
|
||||||
|
{
|
||||||
|
paragraph.FontSize = 14;
|
||||||
|
paragraph.Background = Brushes.Red;
|
||||||
|
paragraph.Foreground = Brushes.Black;
|
||||||
|
paragraph.FontStyle = FontStyles.Italic;
|
||||||
|
}
|
||||||
|
else if (stringEntry.Priority <= LoggerService.GetPriorityByStatus(TraceLogStatuses.Error))
|
||||||
|
{
|
||||||
|
paragraph.FontSize = 14;
|
||||||
|
paragraph.Background = Brushes.Pink;
|
||||||
|
paragraph.Foreground = Brushes.Black;
|
||||||
|
}
|
||||||
|
else if (stringEntry.Priority <= LoggerService.GetPriorityByStatus(TraceLogStatuses.Warning))
|
||||||
|
{
|
||||||
|
paragraph.FontSize = 14;
|
||||||
|
paragraph.Background = Brushes.Yellow;
|
||||||
|
paragraph.Foreground = Brushes.Black;
|
||||||
|
}
|
||||||
|
else if (stringEntry.Priority <= LoggerService.GetPriorityByStatus(TraceLogStatuses.Debug))
|
||||||
|
{
|
||||||
|
paragraph.FontSize = 12;
|
||||||
|
paragraph.Foreground = Brushes.Black;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
paragraph.FontSize = 10;
|
||||||
|
paragraph.Foreground = Brushes.Gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
return paragraph;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Table GetBlockByTableEntry(TableLogEntry tableEntry)
|
||||||
|
{
|
||||||
|
const int columnWidth = 150;
|
||||||
var rows = tableEntry.Table.GetAllRows();
|
var rows = tableEntry.Table.GetAllRows();
|
||||||
int rowCount = rows.Count();
|
int rowCount = rows.Count();
|
||||||
int columnCount = tableEntry.Table.RowSize;
|
int columnCount = tableEntry.Table.RowSize;
|
||||||
@@ -122,10 +163,19 @@ namespace StructureHelper.Windows.CalculationWindows.ProgressViews
|
|||||||
for (int x = 0; x < columnCount; x++)
|
for (int x = 0; x < columnCount; x++)
|
||||||
{
|
{
|
||||||
var tableColumn = new TableColumn();
|
var tableColumn = new TableColumn();
|
||||||
tableColumn.Width = new GridLength(150);
|
tableColumn.Width = new GridLength(columnWidth);
|
||||||
table.Columns.Add(tableColumn);
|
table.Columns.Add(tableColumn);
|
||||||
}
|
}
|
||||||
foreach (var row in rows)
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
TableRow newRow = GetTableRow(row);
|
||||||
|
table.RowGroups.Add(new TableRowGroup());
|
||||||
|
table.RowGroups[0].Rows.Add(newRow);
|
||||||
|
}
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TableRow GetTableRow(IShTableRow<ITraceLoggerEntry> row)
|
||||||
{
|
{
|
||||||
var newRow = new TableRow();
|
var newRow = new TableRow();
|
||||||
foreach (var cell in row.Elements)
|
foreach (var cell in row.Elements)
|
||||||
@@ -137,9 +187,18 @@ namespace StructureHelper.Windows.CalculationWindows.ProgressViews
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (cell.Value is StringLoggerEntry stringEntry)
|
var cellvalue = GetBlockByEntry(cell.Value);
|
||||||
|
tableCell = new TableCell(cellvalue);
|
||||||
|
AdjustTableCell(cell, tableCell);
|
||||||
|
}
|
||||||
|
newRow.Cells.Add(tableCell);
|
||||||
|
}
|
||||||
|
|
||||||
|
return newRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AdjustTableCell(IShTableCell<ITraceLoggerEntry>? cell, TableCell tableCell)
|
||||||
{
|
{
|
||||||
tableCell = new TableCell(GetParagraphByStringEntry(stringEntry));
|
|
||||||
tableCell.ColumnSpan = cell.ColumnSpan;
|
tableCell.ColumnSpan = cell.ColumnSpan;
|
||||||
if (cell.Role == CellRole.Regular)
|
if (cell.Role == CellRole.Regular)
|
||||||
{
|
{
|
||||||
@@ -152,66 +211,5 @@ namespace StructureHelper.Windows.CalculationWindows.ProgressViews
|
|||||||
tableCell.Background = Brushes.AliceBlue;
|
tableCell.Background = Brushes.AliceBlue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(cell));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
newRow.Cells.Add(tableCell);
|
|
||||||
}
|
|
||||||
table.RowGroups.Add(new TableRowGroup());
|
|
||||||
table.RowGroups[0].Rows.Add(newRow);
|
|
||||||
}
|
|
||||||
document.Blocks.Add(table);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ProcessStringEntry(StringLoggerEntry stringEntry)
|
|
||||||
{
|
|
||||||
var paragraph = GetParagraphByStringEntry(stringEntry);
|
|
||||||
document.Blocks.Add(paragraph);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Paragraph GetParagraphByStringEntry(StringLoggerEntry stringEntry)
|
|
||||||
{
|
|
||||||
var paragraph = new Paragraph(new Run(stringEntry.Message));
|
|
||||||
paragraph.Margin = new Thickness(stringEntry.Priority / tabGap);
|
|
||||||
if (stringEntry.Priority <= LoggerService.GetPriorityByStatus(TraceLoggerStatuses.Fatal))
|
|
||||||
{
|
|
||||||
paragraph.FontSize = 14;
|
|
||||||
paragraph.Background = Brushes.Red;
|
|
||||||
paragraph.Foreground = Brushes.Black;
|
|
||||||
paragraph.FontStyle = FontStyles.Italic;
|
|
||||||
}
|
|
||||||
else if (stringEntry.Priority <= LoggerService.GetPriorityByStatus(TraceLoggerStatuses.Error))
|
|
||||||
{
|
|
||||||
paragraph.FontSize = 14;
|
|
||||||
paragraph.Background = Brushes.Pink;
|
|
||||||
paragraph.Foreground = Brushes.Black;
|
|
||||||
}
|
|
||||||
else if (stringEntry.Priority <= LoggerService.GetPriorityByStatus(TraceLoggerStatuses.Warning))
|
|
||||||
{
|
|
||||||
paragraph.FontSize = 14;
|
|
||||||
paragraph.Background = Brushes.Yellow;
|
|
||||||
paragraph.Foreground = Brushes.Black;
|
|
||||||
}
|
|
||||||
else if (stringEntry.Priority <= LoggerService.GetPriorityByStatus(TraceLoggerStatuses.Debug))
|
|
||||||
{
|
|
||||||
paragraph.FontSize = 12;
|
|
||||||
paragraph.Foreground = Brushes.Black;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
paragraph.FontSize = 8;
|
|
||||||
paragraph.Foreground = Brushes.Gray;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return paragraph;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ShowPrepared()
|
|
||||||
{
|
|
||||||
DocumentReader.Document = document;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<ColumnDefinition Width="90"/>
|
<ColumnDefinition Width="120"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<FlowDocumentReader Name="DocumentReader" ViewingMode="Scroll"/>
|
<FlowDocumentReader Name="DocumentReader" ViewingMode="Scroll"/>
|
||||||
<StackPanel Grid.Column="1">
|
<StackPanel Grid.Column="1">
|
||||||
@@ -18,7 +18,13 @@
|
|||||||
<TextBox Text="{Binding TabGap, ValidatesOnExceptions=True}" />
|
<TextBox Text="{Binding TabGap, ValidatesOnExceptions=True}" />
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
<GroupBox Header="Max priority">
|
<GroupBox Header="Max priority">
|
||||||
<TextBox Text="{Binding MaxPriority, ValidatesOnExceptions=True}" />
|
<StackPanel>
|
||||||
|
<TextBox Text="{Binding PriorityLimit, ValidatesOnExceptions=True}" />
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Slider Width="88" Value="{Binding PriorityLimit}" Maximum="{Binding MaxPriority}" Minimum="0"/>
|
||||||
|
<TextBlock Width="20" FontSize="8" Text="{Binding MaxPriority}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
<Button Margin="3" Content="Rebuild" ToolTip="Rebuild document" Command="{Binding RebuildCommand}"/>
|
<Button Margin="3" Content="Rebuild" ToolTip="Rebuild document" Command="{Binding RebuildCommand}"/>
|
||||||
<Button Margin="3" Content="Print" ToolTip="Print document" Command="{Binding PrintDocumentCommand}"/>
|
<Button Margin="3" Content="Print" ToolTip="Print document" Command="{Binding PrintDocumentCommand}"/>
|
||||||
|
|||||||
@@ -1,17 +1,6 @@
|
|||||||
using StructureHelperCommon.Models.Loggers;
|
using StructureHelperCommon.Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace StructureHelper.Windows.CalculationWindows.ProgressViews
|
namespace StructureHelper.Windows.CalculationWindows.ProgressViews
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<UserControl x:Class="StructureHelper.Windows.Forces.ForceInterpolationControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||||
|
xmlns:local="clr-namespace:StructureHelper.Windows.Forces"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="200" d:DesignWidth="460">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="110"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition Width="120"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="1" Text="Moment Mx" HorizontalAlignment="Center"/>
|
||||||
|
<TextBlock Grid.Column="2" Text="Moment My" HorizontalAlignment="Center"/>
|
||||||
|
<TextBlock Grid.Column="3" Text="Force Nz" HorizontalAlignment="Center"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Start Combination"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding StartMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding StartMy, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding StartNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<Button Grid.Row="2" Grid.Column="1" Command="{Binding CopyToStartCommand}">
|
||||||
|
<Viewbox>
|
||||||
|
<Canvas Width="24" Height="24">
|
||||||
|
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
|
||||||
|
</Canvas>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
<Button Grid.Row="2" Grid.Column="2" Command="{Binding InvertForcesCommand}">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Viewbox>
|
||||||
|
<Canvas Width="24" Height="24">
|
||||||
|
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
|
||||||
|
</Canvas>
|
||||||
|
</Viewbox>
|
||||||
|
<Viewbox RenderTransformOrigin="0.5,0.5">
|
||||||
|
<Viewbox.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<ScaleTransform/>
|
||||||
|
<SkewTransform/>
|
||||||
|
<RotateTransform Angle="180"/>
|
||||||
|
<TranslateTransform/>
|
||||||
|
</TransformGroup>
|
||||||
|
</Viewbox.RenderTransform>
|
||||||
|
<Canvas Width="24" Height="24">
|
||||||
|
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
|
||||||
|
</Canvas>
|
||||||
|
</Viewbox>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button Grid.Row="2" Grid.Column="3" Command="{Binding CopyToFinishCommand}">
|
||||||
|
<Viewbox RenderTransformOrigin="0.5,0.5">
|
||||||
|
<Viewbox.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<ScaleTransform/>
|
||||||
|
<SkewTransform/>
|
||||||
|
<RotateTransform Angle="180"/>
|
||||||
|
<TranslateTransform/>
|
||||||
|
</TransformGroup>
|
||||||
|
</Viewbox.RenderTransform>
|
||||||
|
<Canvas Width="24" Height="24">
|
||||||
|
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
|
||||||
|
</Canvas>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
<TextBlock Grid.Row="3" Text="Finish Combination"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding FinishMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="2" Text="{Binding FinishMy, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="3" Text="{Binding FinishNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBlock Grid.Row="4" Text="Step count" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||||
|
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding StepCount, ValidatesOnExceptions=True}" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||||
|
<uc:MultiplyDouble Grid.Column="4" Grid.Row="1" DoubleFactor="{Binding StartFactor}" ValueChanged="StartValueChanged"/>
|
||||||
|
<uc:MultiplyDouble Grid.Column="4" Grid.Row="3" DoubleFactor="{Binding FinishFactor}" ValueChanged="FinishValueChanged"/>
|
||||||
|
<uc:MultiplyDouble Grid.Column="4" Grid.Row="4" DoubleFactor="{Binding FinishFactor}" ValueChanged="StepCountValueChanged" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
using StructureHelper.Windows.UserControls;
|
||||||
|
using StructureHelper.Windows.ViewModels.Materials;
|
||||||
|
using StructureHelperCommon.Services.Forces;
|
||||||
|
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.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.Forces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для ForceInterpolationControl.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ForceInterpolationControl : UserControl
|
||||||
|
{
|
||||||
|
private ForceTupleInterpolationViewModel? properties;
|
||||||
|
|
||||||
|
public ForceTupleInterpolationViewModel? Properties
|
||||||
|
{
|
||||||
|
get => properties; set
|
||||||
|
{
|
||||||
|
properties = value;
|
||||||
|
DataContext = Properties;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ForceInterpolationControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StartValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var obj = (MultiplyDouble)sender;
|
||||||
|
var tmpTuple = ForceTupleService.MultiplyTuples(Properties.StartDesignForce.ForceTuple, obj.DoubleFactor);
|
||||||
|
ForceTupleService.CopyProperties(tmpTuple, Properties.StartDesignForce.ForceTuple, 1d);
|
||||||
|
Properties.RefreshStartTuple();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FinishValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var obj = (MultiplyDouble)sender;
|
||||||
|
var tmpTuple = ForceTupleService.MultiplyTuples(Properties.FinishDesignForce.ForceTuple, obj.DoubleFactor);
|
||||||
|
ForceTupleService.CopyProperties(tmpTuple, Properties.FinishDesignForce.ForceTuple, 1d);
|
||||||
|
Properties.RefreshFinishTuple();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StepCountValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var obj = (MultiplyDouble)sender;
|
||||||
|
var factor = obj.DoubleFactor;
|
||||||
|
if (factor > 0d)
|
||||||
|
{
|
||||||
|
Properties.StepCount = Convert.ToInt32(Properties.StepCount * factor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<UserControl x:Class="StructureHelper.Windows.Forces.ForceTupleControl"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:local="clr-namespace:StructureHelper.Windows.Forces"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="Auto" MinWidth="70"/>
|
|
||||||
<ColumnDefinition Width="Auto" MinWidth="70"/>
|
|
||||||
<ColumnDefinition Width="Auto" MinWidth="70"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="Auto" MinHeight="20"/>
|
|
||||||
<RowDefinition Height="Auto" MinHeight="20"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<TextBlock HorizontalAlignment="Center" Text="Mx"/>
|
|
||||||
<TextBlock HorizontalAlignment="Center" Grid.Column="1" Text="My"/>
|
|
||||||
<TextBlock HorizontalAlignment="Center" Grid.Column="2" Text="Nz"/>
|
|
||||||
<TextBox Grid.Row="1" Text=""/>
|
|
||||||
<TextBox Grid.Row="1" Grid.Column="1" Text=""/>
|
|
||||||
<TextBox Grid.Row="1" Grid.Column="2" Text=""/>
|
|
||||||
</Grid>
|
|
||||||
</UserControl>
|
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
<UserControl x:Class="StructureHelper.Windows.Forces.ForceTupleInterpolationControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||||
|
xmlns:local="clr-namespace:StructureHelper.Windows.Forces"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="200" d:DesignWidth="460">
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="110"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition Width="120"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="1" Text="Moment Mx" HorizontalAlignment="Center"/>
|
||||||
|
<TextBlock Grid.Column="2" Text="Moment My" HorizontalAlignment="Center"/>
|
||||||
|
<TextBlock Grid.Column="3" Text="Force Nz" HorizontalAlignment="Center"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Start Combination"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding StartMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding StartMy, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding StartNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<Button Grid.Row="2" Grid.Column="1" Command="{Binding CopyToStartCommand}">
|
||||||
|
<Viewbox>
|
||||||
|
<Canvas Width="24" Height="24">
|
||||||
|
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
|
||||||
|
</Canvas>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
<Button Grid.Row="2" Grid.Column="2" Command="{Binding InvertForcesCommand}">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Viewbox>
|
||||||
|
<Canvas Width="24" Height="24">
|
||||||
|
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
|
||||||
|
</Canvas>
|
||||||
|
</Viewbox>
|
||||||
|
<Viewbox RenderTransformOrigin="0.5,0.5">
|
||||||
|
<Viewbox.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<ScaleTransform/>
|
||||||
|
<SkewTransform/>
|
||||||
|
<RotateTransform Angle="180"/>
|
||||||
|
<TranslateTransform/>
|
||||||
|
</TransformGroup>
|
||||||
|
</Viewbox.RenderTransform>
|
||||||
|
<Canvas Width="24" Height="24">
|
||||||
|
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
|
||||||
|
</Canvas>
|
||||||
|
</Viewbox>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button Grid.Row="2" Grid.Column="3" Command="{Binding CopyToFinishCommand}">
|
||||||
|
<Viewbox RenderTransformOrigin="0.5,0.5">
|
||||||
|
<Viewbox.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<ScaleTransform/>
|
||||||
|
<SkewTransform/>
|
||||||
|
<RotateTransform Angle="180"/>
|
||||||
|
<TranslateTransform/>
|
||||||
|
</TransformGroup>
|
||||||
|
</Viewbox.RenderTransform>
|
||||||
|
<Canvas Width="24" Height="24">
|
||||||
|
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
|
||||||
|
</Canvas>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
<TextBlock Grid.Row="3" Text="Finish Combination"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding FinishMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="2" Text="{Binding FinishMy, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="3" Text="{Binding FinishNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBlock Grid.Row="4" Text="Step count" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||||
|
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding StepCount, ValidatesOnExceptions=True}" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||||
|
<uc:MultiplyDouble Grid.Column="4" Grid.Row="1" DoubleFactor="{Binding StartFactor}" ValueChanged="StartValueChanged"/>
|
||||||
|
<uc:MultiplyDouble Grid.Column="4" Grid.Row="3" DoubleFactor="{Binding FinishFactor}" ValueChanged="FinishValueChanged"/>
|
||||||
|
<uc:MultiplyDouble Grid.Column="4" Grid.Row="4" DoubleFactor="{Binding FinishFactor}" ValueChanged="StepCountValueChanged" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -18,9 +18,10 @@ namespace StructureHelper.Windows.Forces
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Логика взаимодействия для ForceTupleControl.xaml
|
/// Логика взаимодействия для ForceTupleControl.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ForceTupleControl : UserControl
|
public partial class ForceTupleInterpolationControl : UserControl
|
||||||
{
|
{
|
||||||
public ForceTupleControl()
|
public ForceTupleInterpolationViewModel? Properties { get; set; }
|
||||||
|
public ForceTupleInterpolationControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,212 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.Forces
|
||||||
|
{
|
||||||
|
public class ForceTupleInterpolationViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
private RelayCommand invertForcesCommand;
|
||||||
|
private RelayCommand copyToStartCommand;
|
||||||
|
private RelayCommand copyToFinishCommand;
|
||||||
|
private int stepCount;
|
||||||
|
private IDesignForceTuple startDesignForce;
|
||||||
|
private IDesignForceTuple finishDesignForce;
|
||||||
|
|
||||||
|
public IDesignForceTuple StartDesignForce
|
||||||
|
{
|
||||||
|
get => startDesignForce; set
|
||||||
|
{
|
||||||
|
startDesignForce = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public IDesignForceTuple FinishDesignForce
|
||||||
|
{
|
||||||
|
get => finishDesignForce; set
|
||||||
|
{
|
||||||
|
finishDesignForce = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double StartFactor { get; set; }
|
||||||
|
public double FinishFactor { get; set; }
|
||||||
|
public double StepCountFactor { get; set; }
|
||||||
|
|
||||||
|
public bool StepCountVisible { get; set; }
|
||||||
|
public double StartMx
|
||||||
|
{
|
||||||
|
get => StartDesignForce.ForceTuple.Mx;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
StartDesignForce.ForceTuple.Mx = value;
|
||||||
|
OnPropertyChanged(nameof(StartMx));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double StartMy
|
||||||
|
{
|
||||||
|
get => StartDesignForce.ForceTuple.My;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
StartDesignForce.ForceTuple.My = value;
|
||||||
|
OnPropertyChanged(nameof(StartMy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double StartNz
|
||||||
|
{
|
||||||
|
get => StartDesignForce.ForceTuple.Nz;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
StartDesignForce.ForceTuple.Nz = value;
|
||||||
|
OnPropertyChanged(nameof(StartNz));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double FinishMx
|
||||||
|
{
|
||||||
|
get => FinishDesignForce.ForceTuple.Mx;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
FinishDesignForce.ForceTuple.Mx = value;
|
||||||
|
OnPropertyChanged(nameof(FinishMx));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double FinishMy
|
||||||
|
{
|
||||||
|
get => FinishDesignForce.ForceTuple.My;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
FinishDesignForce.ForceTuple.My = value;
|
||||||
|
OnPropertyChanged(nameof(FinishMy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double FinishNz
|
||||||
|
{
|
||||||
|
get => FinishDesignForce.ForceTuple.Nz;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
FinishDesignForce.ForceTuple.Nz = value;
|
||||||
|
OnPropertyChanged(nameof(FinishNz));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int StepCount
|
||||||
|
{
|
||||||
|
get => stepCount; set
|
||||||
|
{
|
||||||
|
stepCount = value;
|
||||||
|
OnPropertyChanged(nameof(StepCount));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand InvertForcesCommand
|
||||||
|
{
|
||||||
|
get => invertForcesCommand ??= new RelayCommand(o => InvertForces());
|
||||||
|
}
|
||||||
|
public ICommand CopyToStartCommand
|
||||||
|
{
|
||||||
|
get => copyToStartCommand ??= new RelayCommand(o => CopyFinishToStart());
|
||||||
|
}
|
||||||
|
public ICommand CopyToFinishCommand
|
||||||
|
{
|
||||||
|
get => copyToFinishCommand ??= new RelayCommand(o => CopyStartToFinish());
|
||||||
|
}
|
||||||
|
public InterpolateTuplesResult Result
|
||||||
|
{
|
||||||
|
get => new()
|
||||||
|
{
|
||||||
|
StartTuple = StartDesignForce,
|
||||||
|
FinishTuple = FinishDesignForce,
|
||||||
|
StepCount = StepCount
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InvertForces()
|
||||||
|
{
|
||||||
|
var tmpForce = StartDesignForce.Clone() as IDesignForceTuple;
|
||||||
|
StartDesignForce = FinishDesignForce;
|
||||||
|
FinishDesignForce = tmpForce;
|
||||||
|
StepCountVisible = true;
|
||||||
|
RefreshStartTuple();
|
||||||
|
RefreshFinishTuple();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CopyStartToFinish()
|
||||||
|
{
|
||||||
|
FinishDesignForce = StartDesignForce.Clone() as IDesignForceTuple;
|
||||||
|
RefreshFinishTuple();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CopyFinishToStart()
|
||||||
|
{
|
||||||
|
StartDesignForce = FinishDesignForce.Clone() as IDesignForceTuple;
|
||||||
|
RefreshStartTuple();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RefreshFinishTuple()
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(FinishDesignForce));
|
||||||
|
OnPropertyChanged(nameof(FinishMx));
|
||||||
|
OnPropertyChanged(nameof(FinishMy));
|
||||||
|
OnPropertyChanged(nameof(FinishNz));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RefreshStartTuple()
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(StartDesignForce));
|
||||||
|
OnPropertyChanged(nameof(StartMx));
|
||||||
|
OnPropertyChanged(nameof(StartMy));
|
||||||
|
OnPropertyChanged(nameof(StartNz));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceTupleInterpolationViewModel(IDesignForceTuple finishDesignForce, IDesignForceTuple startDesignForce = null, int stepCount = 100)
|
||||||
|
{
|
||||||
|
if (startDesignForce != null)
|
||||||
|
{
|
||||||
|
CheckDesignForces(finishDesignForce, startDesignForce);
|
||||||
|
StartDesignForce = startDesignForce;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetNewDesignForce(finishDesignForce);
|
||||||
|
}
|
||||||
|
FinishDesignForce = finishDesignForce;
|
||||||
|
StepCount = stepCount;
|
||||||
|
StepCountVisible = true;
|
||||||
|
}
|
||||||
|
public ForceTupleInterpolationViewModel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CheckDesignForces(IDesignForceTuple finishDesignForce, IDesignForceTuple startDesignForce)
|
||||||
|
{
|
||||||
|
if (startDesignForce.LimitState != finishDesignForce.LimitState)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid);
|
||||||
|
}
|
||||||
|
if (startDesignForce.CalcTerm != finishDesignForce.CalcTerm)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetNewDesignForce(IDesignForceTuple finishDesignForce)
|
||||||
|
{
|
||||||
|
StartDesignForce = new DesignForceTuple()
|
||||||
|
{
|
||||||
|
CalcTerm = finishDesignForce.CalcTerm,
|
||||||
|
LimitState = finishDesignForce.LimitState,
|
||||||
|
ForceTuple = new ForceTuple()
|
||||||
|
{
|
||||||
|
Mx = 0,
|
||||||
|
My = 0,
|
||||||
|
Nz = 0
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||||
d:DataContext="{d:DesignInstance local:InterpolateTuplesViewModel}"
|
d:DataContext="{d:DesignInstance local:InterpolateTuplesViewModel}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Interpolate Combinations" Height="200" Width="460" MinHeight="180" MinWidth="460" WindowStartupLocation="CenterScreen">
|
Title="Interpolate Combinations" Height="250" Width="460" MinHeight="250" MinWidth="460" WindowStartupLocation="CenterScreen">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||||
<Style TargetType="Button">
|
<Style TargetType="Button">
|
||||||
@@ -20,94 +20,7 @@
|
|||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition Height="40"/>
|
<RowDefinition Height="40"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid>
|
<local:ForceInterpolationControl x:Name="InterpolationControl"/>
|
||||||
<Grid.ColumnDefinitions>
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||||
<ColumnDefinition/>
|
|
||||||
<ColumnDefinition Width="0"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="25"/>
|
|
||||||
<RowDefinition Height="25"/>
|
|
||||||
<RowDefinition Height="25"/>
|
|
||||||
<RowDefinition Height="25"/>
|
|
||||||
<RowDefinition Height="25"/>
|
|
||||||
<RowDefinition Height="40"/>
|
|
||||||
<RowDefinition/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="110"/>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
<ColumnDefinition Width="120"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<TextBlock Grid.Column="1" Text="Moment Mx" HorizontalAlignment="Center"/>
|
|
||||||
<TextBlock Grid.Column="2" Text="Moment My" HorizontalAlignment="Center"/>
|
|
||||||
<TextBlock Grid.Column="3" Text="Force Nz" HorizontalAlignment="Center"/>
|
|
||||||
<TextBlock Grid.Row="1" Text="Start Combination"/>
|
|
||||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding StartMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding StartMy, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding StartNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
<Button Grid.Row="2" Grid.Column="1" Command="{Binding CopyToStartCommand}">
|
|
||||||
<Viewbox>
|
|
||||||
<Canvas Width="24" Height="24">
|
|
||||||
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
|
|
||||||
</Canvas>
|
|
||||||
</Viewbox>
|
|
||||||
</Button>
|
|
||||||
<Button Grid.Row="2" Grid.Column="2" Command="{Binding InvertForcesCommand}">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<Viewbox>
|
|
||||||
<Canvas Width="24" Height="24">
|
|
||||||
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
|
|
||||||
</Canvas>
|
|
||||||
</Viewbox>
|
|
||||||
<Viewbox RenderTransformOrigin="0.5,0.5">
|
|
||||||
<Viewbox.RenderTransform>
|
|
||||||
<TransformGroup>
|
|
||||||
<ScaleTransform/>
|
|
||||||
<SkewTransform/>
|
|
||||||
<RotateTransform Angle="180"/>
|
|
||||||
<TranslateTransform/>
|
|
||||||
</TransformGroup>
|
|
||||||
</Viewbox.RenderTransform>
|
|
||||||
<Canvas Width="24" Height="24">
|
|
||||||
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
|
|
||||||
</Canvas>
|
|
||||||
</Viewbox>
|
|
||||||
</StackPanel>
|
|
||||||
</Button>
|
|
||||||
<Button Grid.Row="2" Grid.Column="3" Command="{Binding CopyToFinishCommand}">
|
|
||||||
<Viewbox RenderTransformOrigin="0.5,0.5">
|
|
||||||
<Viewbox.RenderTransform>
|
|
||||||
<TransformGroup>
|
|
||||||
<ScaleTransform/>
|
|
||||||
<SkewTransform/>
|
|
||||||
<RotateTransform Angle="180"/>
|
|
||||||
<TranslateTransform/>
|
|
||||||
</TransformGroup>
|
|
||||||
</Viewbox.RenderTransform>
|
|
||||||
<Canvas Width="24" Height="24">
|
|
||||||
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
|
|
||||||
</Canvas>
|
|
||||||
</Viewbox>
|
|
||||||
</Button>
|
|
||||||
<TextBlock Grid.Row="3" Text="Finish Combination"/>
|
|
||||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding FinishMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
<TextBox Grid.Row="3" Grid.Column="2" Text="{Binding FinishMy, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
<TextBox Grid.Row="3" Grid.Column="3" Text="{Binding FinishNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
<TextBlock Grid.Row="4" Text="Step count" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
|
||||||
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding StepCount, ValidatesOnExceptions=True}" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
|
||||||
<uc:MultiplyDouble Grid.Column="4" Grid.Row="1" DoubleFactor="{Binding StartFactor}" ValueChanged="StartValueChanged"/>
|
|
||||||
<uc:MultiplyDouble Grid.Column="4" Grid.Row="3" DoubleFactor="{Binding FinishFactor}" ValueChanged="FinishValueChanged"/>
|
|
||||||
<uc:MultiplyDouble Grid.Column="4" Grid.Row="4" DoubleFactor="{Binding FinishFactor}" ValueChanged="StepCountValueChanged"/>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
|
||||||
<Button Style="{StaticResource CancelButton}"/>
|
|
||||||
<Button Style="{StaticResource OkButton}" Click="Button_Click"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -27,9 +27,11 @@ namespace StructureHelper.Windows.Forces
|
|||||||
InterpolateTuplesViewModel viewModel;
|
InterpolateTuplesViewModel viewModel;
|
||||||
public InterpolateTuplesView(InterpolateTuplesViewModel viewModel)
|
public InterpolateTuplesView(InterpolateTuplesViewModel viewModel)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
|
||||||
this.viewModel = viewModel;
|
this.viewModel = viewModel;
|
||||||
|
this.viewModel.ParentWindow = this;
|
||||||
DataContext = this.viewModel;
|
DataContext = this.viewModel;
|
||||||
|
InitializeComponent();
|
||||||
|
InterpolationControl.Properties = viewModel.ForceInterpolationViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
@@ -37,31 +39,5 @@ namespace StructureHelper.Windows.Forces
|
|||||||
DialogResult = true;
|
DialogResult = true;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartValueChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var obj = (MultiplyDouble)sender;
|
|
||||||
var tmpTuple = ForceTupleService.MultiplyTuples(viewModel.StartDesignForce.ForceTuple, obj.DoubleFactor);
|
|
||||||
ForceTupleService.CopyProperties(tmpTuple, viewModel.StartDesignForce.ForceTuple, 1d);
|
|
||||||
viewModel.RefreshStartTuple();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FinishValueChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var obj = (MultiplyDouble)sender;
|
|
||||||
var tmpTuple = ForceTupleService.MultiplyTuples(viewModel.FinishDesignForce.ForceTuple, obj.DoubleFactor);
|
|
||||||
ForceTupleService.CopyProperties(tmpTuple, viewModel.FinishDesignForce.ForceTuple, 1d);
|
|
||||||
viewModel.RefreshFinishTuple();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void StepCountValueChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var obj = (MultiplyDouble)sender;
|
|
||||||
var factor = obj.DoubleFactor;
|
|
||||||
if (factor > 0d)
|
|
||||||
{
|
|
||||||
viewModel.StepCount = Convert.ToInt32(viewModel.StepCount * factor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,162 +8,11 @@ namespace StructureHelper.Windows.Forces
|
|||||||
{
|
{
|
||||||
public class InterpolateTuplesViewModel : OkCancelViewModelBase
|
public class InterpolateTuplesViewModel : OkCancelViewModelBase
|
||||||
{
|
{
|
||||||
private RelayCommand invertForcesCommand;
|
public ForceTupleInterpolationViewModel ForceInterpolationViewModel { get; set; }
|
||||||
private RelayCommand copyToStartCommand;
|
|
||||||
private RelayCommand copyToFinishCommand;
|
|
||||||
private int stepCount;
|
|
||||||
|
|
||||||
public IDesignForceTuple StartDesignForce { get; set; }
|
|
||||||
public IDesignForceTuple FinishDesignForce { get; set; }
|
|
||||||
|
|
||||||
public double StartFactor { get; set; }
|
|
||||||
public double FinishFactor { get; set; }
|
|
||||||
public double StepCountFactor { get; set; }
|
|
||||||
|
|
||||||
public bool StepCountVisible { get; set; }
|
|
||||||
public double StartMx
|
|
||||||
{
|
|
||||||
get => StartDesignForce.ForceTuple.Mx;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
StartDesignForce.ForceTuple.Mx = value;
|
|
||||||
OnPropertyChanged(nameof(StartMx));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public double StartMy
|
|
||||||
{
|
|
||||||
get => StartDesignForce.ForceTuple.My;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
StartDesignForce.ForceTuple.My = value;
|
|
||||||
OnPropertyChanged(nameof(StartMy));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public double StartNz
|
|
||||||
{
|
|
||||||
get => StartDesignForce.ForceTuple.Nz;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
StartDesignForce.ForceTuple.Nz = value;
|
|
||||||
OnPropertyChanged(nameof(StartNz));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public double FinishMx
|
|
||||||
{
|
|
||||||
get => FinishDesignForce.ForceTuple.Mx;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
FinishDesignForce.ForceTuple.Mx = value;
|
|
||||||
OnPropertyChanged(nameof(FinishMx));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public double FinishMy
|
|
||||||
{
|
|
||||||
get => FinishDesignForce.ForceTuple.My;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
FinishDesignForce.ForceTuple.My = value;
|
|
||||||
OnPropertyChanged(nameof(FinishMy));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public double FinishNz
|
|
||||||
{
|
|
||||||
get => FinishDesignForce.ForceTuple.Nz;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
FinishDesignForce.ForceTuple.Nz = value;
|
|
||||||
OnPropertyChanged(nameof(FinishNz));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public int StepCount
|
|
||||||
{
|
|
||||||
get => stepCount; set
|
|
||||||
{
|
|
||||||
stepCount = value;
|
|
||||||
OnPropertyChanged(nameof(StepCount));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICommand InvertForcesCommand
|
|
||||||
{
|
|
||||||
get => invertForcesCommand ??= new RelayCommand(o => InvertForces());
|
|
||||||
}
|
|
||||||
public ICommand CopyToStartCommand
|
|
||||||
{
|
|
||||||
get => copyToStartCommand ??= new RelayCommand(o => CopyFinishToStart());
|
|
||||||
}
|
|
||||||
public ICommand CopyToFinishCommand
|
|
||||||
{
|
|
||||||
get => copyToFinishCommand ??= new RelayCommand(o => CopyStartToFinish());
|
|
||||||
}
|
|
||||||
public InterpolateTuplesResult Result
|
|
||||||
{
|
|
||||||
get => new()
|
|
||||||
{
|
|
||||||
StartTuple = StartDesignForce,
|
|
||||||
FinishTuple = FinishDesignForce,
|
|
||||||
StepCount = StepCount
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InvertForces()
|
|
||||||
{
|
|
||||||
var tmpForce = StartDesignForce.Clone() as IDesignForceTuple;
|
|
||||||
StartDesignForce = FinishDesignForce;
|
|
||||||
FinishDesignForce = tmpForce;
|
|
||||||
StepCountVisible = true;
|
|
||||||
RefreshStartTuple();
|
|
||||||
RefreshFinishTuple();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CopyStartToFinish()
|
|
||||||
{
|
|
||||||
FinishDesignForce = StartDesignForce.Clone() as IDesignForceTuple;
|
|
||||||
RefreshFinishTuple();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CopyFinishToStart()
|
|
||||||
{
|
|
||||||
StartDesignForce = FinishDesignForce.Clone() as IDesignForceTuple;
|
|
||||||
RefreshStartTuple();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RefreshFinishTuple()
|
|
||||||
{
|
|
||||||
OnPropertyChanged(nameof(FinishDesignForce));
|
|
||||||
OnPropertyChanged(nameof(FinishMx));
|
|
||||||
OnPropertyChanged(nameof(FinishMy));
|
|
||||||
OnPropertyChanged(nameof(FinishNz));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RefreshStartTuple()
|
|
||||||
{
|
|
||||||
OnPropertyChanged(nameof(StartDesignForce));
|
|
||||||
OnPropertyChanged(nameof(StartMx));
|
|
||||||
OnPropertyChanged(nameof(StartMy));
|
|
||||||
OnPropertyChanged(nameof(StartNz));
|
|
||||||
}
|
|
||||||
|
|
||||||
public InterpolateTuplesViewModel(IDesignForceTuple finishDesignForce, IDesignForceTuple startDesignForce=null, int stepCount = 100)
|
public InterpolateTuplesViewModel(IDesignForceTuple finishDesignForce, IDesignForceTuple startDesignForce=null, int stepCount = 100)
|
||||||
{
|
{
|
||||||
if (startDesignForce !=null)
|
ForceInterpolationViewModel = new(finishDesignForce, startDesignForce, stepCount);
|
||||||
{
|
|
||||||
if (startDesignForce.LimitState != finishDesignForce.LimitState) throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid);
|
|
||||||
if (startDesignForce.CalcTerm != finishDesignForce.CalcTerm) throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid);
|
|
||||||
StartDesignForce = startDesignForce;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
StartDesignForce = new DesignForceTuple()
|
|
||||||
{
|
|
||||||
CalcTerm = finishDesignForce.CalcTerm,
|
|
||||||
LimitState = finishDesignForce.LimitState,
|
|
||||||
ForceTuple = new ForceTuple() { Mx = 0, My = 0, Nz = 0 },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
FinishDesignForce = finishDesignForce;
|
|
||||||
StepCount = stepCount;
|
|
||||||
StepCountVisible = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
31
StructureHelper/Windows/Forces/PointPrimitiveLogic.cs
Normal file
31
StructureHelper/Windows/Forces/PointPrimitiveLogic.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelper.Windows.ViewModels;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.Forces
|
||||||
|
{
|
||||||
|
public class PointPrimitiveLogic : ViewModelBase
|
||||||
|
{
|
||||||
|
public SelectItemsVM<PrimitiveValuePoints> Collection { get; private set; }
|
||||||
|
public PointPrimitiveLogic(IEnumerable<PrimitiveBase> primitiveBases)
|
||||||
|
{
|
||||||
|
List<PrimitiveValuePoints> collection = new();
|
||||||
|
foreach (var item in primitiveBases)
|
||||||
|
{
|
||||||
|
var primitiveValuePoint = new PrimitiveValuePoints(item)
|
||||||
|
{
|
||||||
|
PrimitiveBase = item
|
||||||
|
};
|
||||||
|
collection.Add(primitiveValuePoint);
|
||||||
|
}
|
||||||
|
Collection = new SelectItemsVM<PrimitiveValuePoints>(collection);
|
||||||
|
Collection.InvertSelection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
28
StructureHelper/Windows/Forces/PrimitiveValuePoints.cs
Normal file
28
StructureHelper/Windows/Forces/PrimitiveValuePoints.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelper.Windows.ViewModels;
|
||||||
|
using StructureHelperCommon.Models.Parameters;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.Forces
|
||||||
|
{
|
||||||
|
public class PrimitiveValuePoints
|
||||||
|
{
|
||||||
|
public PrimitiveBase PrimitiveBase {get;set;}
|
||||||
|
public SelectItemsVM<NamedValue<IPoint2D>> ValuePoints { get; set; }
|
||||||
|
|
||||||
|
public PrimitiveValuePoints(PrimitiveBase primitiveBase)
|
||||||
|
{
|
||||||
|
var ndmPrimitive = primitiveBase.GetNdmPrimitive();
|
||||||
|
var pointCollection = ndmPrimitive.GetValuePoints();
|
||||||
|
ValuePoints = new SelectItemsVM<NamedValue<IPoint2D>>(pointCollection)
|
||||||
|
{
|
||||||
|
ShowButtons = false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
28
StructureHelper/Windows/Forces/ValueDelegatesLogic.cs
Normal file
28
StructureHelper/Windows/Forces/ValueDelegatesLogic.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Services.ResultViewers;
|
||||||
|
using StructureHelper.Windows.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.Forces
|
||||||
|
{
|
||||||
|
public class ValueDelegatesLogic : ViewModelBase
|
||||||
|
{
|
||||||
|
private readonly List<IResultFunc> resultFuncs;
|
||||||
|
public SelectItemsVM<IResultFunc> ResultFuncs { get; }
|
||||||
|
public ValueDelegatesLogic()
|
||||||
|
{
|
||||||
|
resultFuncs = new List<IResultFunc>();
|
||||||
|
resultFuncs.AddRange(ResultFuncFactory.GetResultFuncs(FuncsTypes.Strain));
|
||||||
|
resultFuncs.AddRange(ResultFuncFactory.GetResultFuncs(FuncsTypes.Stress));
|
||||||
|
ResultFuncs = new SelectItemsVM<IResultFunc>(resultFuncs)
|
||||||
|
{
|
||||||
|
ShowButtons = true
|
||||||
|
};
|
||||||
|
ResultFuncs.InvertSelection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.Forces.ValuePointsInterpolateView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:StructureHelper.Windows.Forces"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DataContext="{d:DesignInstance local:ValuePointsInterpolateViewModel}"
|
||||||
|
Title="Value Poits Interpolation" Height="250" Width="460" MinHeight="250" MinWidth="460" MaxHeight="450" MaxWidth="460" WindowStartupLocation="CenterScreen">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TabControl>
|
||||||
|
<TabItem Header="Forces">
|
||||||
|
<local:ForceInterpolationControl x:Name="InterpolationControl"/>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Points" DataContext="{Binding PrimitiveLogic}">
|
||||||
|
<ListBox DataContext="{Binding Collection}" ItemsSource="{Binding CollectionItems}">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Expander IsExpanded="True">
|
||||||
|
<Expander.Header>
|
||||||
|
<ContentControl ContentTemplate="{StaticResource ResourceKey=ColoredItemTemplate}" Content="{Binding Item.PrimitiveBase}"/>
|
||||||
|
</Expander.Header>
|
||||||
|
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding Item.ValuePoints}"/>
|
||||||
|
</Expander>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem DataContext="{Binding ValueDelegatesLogic}" Header="Values">
|
||||||
|
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding ResultFuncs}"/>
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
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.Forces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для ValuePoitsInterpolateView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ValuePointsInterpolateView : Window
|
||||||
|
{
|
||||||
|
private ValuePointsInterpolateViewModel viewModel;
|
||||||
|
public ValuePointsInterpolateView(ValuePointsInterpolateViewModel viewModel)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.viewModel = viewModel;
|
||||||
|
this.viewModel.ParentWindow = this;
|
||||||
|
this.DataContext = this.viewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using StructureHelper.Windows.ViewModels;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.Forces
|
||||||
|
{
|
||||||
|
public class ValuePointsInterpolateViewModel : OkCancelViewModelBase
|
||||||
|
{
|
||||||
|
private readonly ValuePointsInterpolationInputData inputData;
|
||||||
|
|
||||||
|
public ForceTupleInterpolationViewModel ForceInterpolationViewModel { get; private set; }
|
||||||
|
public PointPrimitiveLogic PrimitiveLogic { get; private set; }
|
||||||
|
public ValueDelegatesLogic ValueDelegatesLogic { get; set; }
|
||||||
|
public ValuePointsInterpolateViewModel(ValuePointsInterpolationInputData inputData)
|
||||||
|
{
|
||||||
|
this.inputData = inputData;
|
||||||
|
ForceInterpolationViewModel = new(this.inputData.FinishDesignForce, this.inputData.StartDesignForce, this.inputData.StepCount);
|
||||||
|
PrimitiveLogic = new PointPrimitiveLogic(inputData.PrimitiveBases);
|
||||||
|
ValueDelegatesLogic = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.Forces
|
||||||
|
{
|
||||||
|
public class ValuePointsInterpolationInputData
|
||||||
|
{
|
||||||
|
public IDesignForceTuple FinishDesignForce { get; set; }
|
||||||
|
public IDesignForceTuple StartDesignForce { get; set; }
|
||||||
|
public int StepCount { get; set; }
|
||||||
|
public List<PrimitiveBase> PrimitiveBases { get; private set; }
|
||||||
|
public LimitStates LimitState { get; set; }
|
||||||
|
public CalcTerms CalcTerm { get; set; }
|
||||||
|
|
||||||
|
public ValuePointsInterpolationInputData()
|
||||||
|
{
|
||||||
|
PrimitiveBases = new List<PrimitiveBase>();
|
||||||
|
StepCount = 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
123
StructureHelper/Windows/MainWindow/AxisCanvases/AxisCanvasVM.cs
Normal file
123
StructureHelper/Windows/MainWindow/AxisCanvases/AxisCanvasVM.cs
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Windows.ViewModels;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.MainWindow
|
||||||
|
{
|
||||||
|
public class AxisCanvasVM : OkCancelViewModelBase, IRectangleShape
|
||||||
|
{
|
||||||
|
private double axisLineThickness;
|
||||||
|
private double gridLineThickness;
|
||||||
|
private double gridSize;
|
||||||
|
private double width;
|
||||||
|
private double height;
|
||||||
|
private Color xAxisColor;
|
||||||
|
private Color yAxisColor;
|
||||||
|
private Color gridColor;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Thickness of x-, and y- axis line
|
||||||
|
/// </summary>
|
||||||
|
public double AxisLineThickness
|
||||||
|
{
|
||||||
|
get => axisLineThickness;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
axisLineThickness = value;
|
||||||
|
OnPropertyChanged(nameof(AxisLineThickness));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Thickness of lines of coordinate mesh
|
||||||
|
/// </summary>
|
||||||
|
public double GridLineThickness
|
||||||
|
{
|
||||||
|
get => gridLineThickness;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
gridLineThickness = value;
|
||||||
|
OnPropertyChanged(nameof(GridLineThickness));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Size of coordinate mesh
|
||||||
|
/// </summary>
|
||||||
|
public double GridSize
|
||||||
|
{
|
||||||
|
get => gridSize; set
|
||||||
|
{
|
||||||
|
gridSize = value;
|
||||||
|
OnPropertyChanged(nameof(GridSize));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Width of work plane
|
||||||
|
/// </summary>
|
||||||
|
public double Width
|
||||||
|
{
|
||||||
|
get => width; set
|
||||||
|
{
|
||||||
|
width = value;
|
||||||
|
OnPropertyChanged(nameof(Width));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Height of work plane
|
||||||
|
/// </summary>
|
||||||
|
public double Height
|
||||||
|
{
|
||||||
|
get => height; set
|
||||||
|
{
|
||||||
|
height = value;
|
||||||
|
OnPropertyChanged(nameof(Height));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double Angle { get; set; }
|
||||||
|
|
||||||
|
public Color XAxisColor
|
||||||
|
{
|
||||||
|
get => xAxisColor; set
|
||||||
|
{
|
||||||
|
xAxisColor = value;
|
||||||
|
OnPropertyChanged(nameof(XAxisColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public Color YAxisColor
|
||||||
|
{
|
||||||
|
get => yAxisColor; set
|
||||||
|
{
|
||||||
|
yAxisColor = value;
|
||||||
|
OnPropertyChanged(nameof(YAxisColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color GridColor
|
||||||
|
{
|
||||||
|
get => gridColor; set
|
||||||
|
{
|
||||||
|
gridColor = value;
|
||||||
|
OnPropertyChanged(nameof(GridColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public AxisCanvasVM()
|
||||||
|
{
|
||||||
|
AxisLineThickness = 2d;
|
||||||
|
GridLineThickness = 0.25d;
|
||||||
|
GridSize = 0.05d;
|
||||||
|
Width = 1.2d;
|
||||||
|
Height = 1.2d;
|
||||||
|
XAxisColor = Colors.Red;
|
||||||
|
YAxisColor = Colors.ForestGreen;
|
||||||
|
GridColor = Colors.DarkGray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.MainWindow.AxisCanvasView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow"
|
||||||
|
d:DataContext="{d:DesignInstance local:AxisCanvasVM}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Grid properies" Height="200" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="35"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="130"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="Axis grid thickness"/>
|
||||||
|
<TextBox Grid.Column="1" Text="{Binding AxisLineThickness, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Grid size"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding GridSize, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBlock Grid.Row="2" Text="Grid line thickness"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding GridLineThickness, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBlock Grid.Row="3" Text="Work plane width"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Width, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
<TextBlock Grid.Row="4" Text="Work plane height"/>
|
||||||
|
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Height, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||||
|
</Grid>
|
||||||
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -18,11 +17,12 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Логика взаимодействия для VisualPropertyView.xaml
|
/// Логика взаимодействия для VisualPropertyView.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class VisualPropertyView : Window
|
public partial class AxisCanvasView : Window
|
||||||
{
|
{
|
||||||
public VisualPropertyView(CrossSectionViewVisualProperty vm)
|
public AxisCanvasView(AxisCanvasVM vm)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
vm.ParentWindow = this;
|
||||||
DataContext = vm;
|
DataContext = vm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
using Autofac.Features.Metadata;
|
||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.MainWindow
|
||||||
|
{
|
||||||
|
public class CrossSectionVisualPropertyVM : ViewModelBase
|
||||||
|
{
|
||||||
|
private double scaleValue;
|
||||||
|
private ICommand previewMouseMove;
|
||||||
|
private double delta = 0.0005;
|
||||||
|
private readonly double scaleRate = 1.1d;
|
||||||
|
|
||||||
|
public AxisCanvasVM AxisCanvasVM { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Thickness of x-, and y- axis line
|
||||||
|
/// </summary>
|
||||||
|
public double AxisLineThickness => AxisCanvasVM.AxisLineThickness / scaleValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Thickness of lines of coordinate mesh
|
||||||
|
/// </summary>
|
||||||
|
public double GridLineThickness => AxisCanvasVM.GridLineThickness / scaleValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Size of coordinate mesh
|
||||||
|
/// </summary>
|
||||||
|
public double GridSize => AxisCanvasVM.GridSize;
|
||||||
|
/// <summary>
|
||||||
|
/// Width of work plane
|
||||||
|
/// </summary>
|
||||||
|
public double Width => AxisCanvasVM.Width;
|
||||||
|
/// <summary>
|
||||||
|
/// Height of work plane
|
||||||
|
/// </summary>
|
||||||
|
public double Height => AxisCanvasVM.Height;
|
||||||
|
public double HalfOfWidth => AxisCanvasVM.Width / 2d;
|
||||||
|
public double HalfOfHeight => AxisCanvasVM.Height / 2d;
|
||||||
|
|
||||||
|
public string CanvasViewportSize
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string s = GridSize.ToString();
|
||||||
|
s = s.Replace(',', '.');
|
||||||
|
return $"0,0,{s},{s}";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public double ScaleValue
|
||||||
|
{
|
||||||
|
get => Math.Round(scaleValue);
|
||||||
|
set
|
||||||
|
{
|
||||||
|
OnPropertyChanged(value, ref scaleValue);
|
||||||
|
OnPropertyChanged(nameof(AxisLineThickness));
|
||||||
|
OnPropertyChanged(nameof(GridLineThickness));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand PreviewMouseMove
|
||||||
|
{
|
||||||
|
get => previewMouseMove ??= new RelayCommand(o => PreviewMouseMoveMethod(o));
|
||||||
|
}
|
||||||
|
private void PreviewMouseMoveMethod(object o)
|
||||||
|
{
|
||||||
|
if (o is RectangleViewPrimitive rect && rect.BorderCaptured && !rect.ElementLock)
|
||||||
|
{
|
||||||
|
if (rect.PrimitiveWidth % 10d < delta || rect.PrimitiveWidth % 10d >= delta)
|
||||||
|
rect.PrimitiveWidth = Math.Round(PanelX / 10d) * 10d - rect.PrimitiveLeft + 10d;
|
||||||
|
else
|
||||||
|
rect.PrimitiveWidth = PanelX - rect.PrimitiveLeft + 10d;
|
||||||
|
|
||||||
|
if (rect.PrimitiveHeight % 10d < delta || rect.PrimitiveHeight % 10d >= delta)
|
||||||
|
rect.PrimitiveHeight = Math.Round(PanelY / 10d) * 10d - rect.PrimitiveTop + 10d;
|
||||||
|
else
|
||||||
|
rect.PrimitiveHeight = PanelY - rect.PrimitiveTop + 10d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Brush XAxisColorBrush => new SolidColorBrush(AxisCanvasVM.XAxisColor);
|
||||||
|
public Brush YAxisColorBrush => new SolidColorBrush(AxisCanvasVM.YAxisColor);
|
||||||
|
public Brush GridColorBrush => new SolidColorBrush(AxisCanvasVM.GridColor);
|
||||||
|
|
||||||
|
internal void Refresh()
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(Width));
|
||||||
|
OnPropertyChanged(nameof(Height));
|
||||||
|
OnPropertyChanged(nameof(HalfOfWidth));
|
||||||
|
OnPropertyChanged(nameof(HalfOfHeight));
|
||||||
|
OnPropertyChanged(nameof(GridSize));
|
||||||
|
OnPropertyChanged(nameof(AxisLineThickness));
|
||||||
|
OnPropertyChanged(nameof(GridLineThickness));
|
||||||
|
OnPropertyChanged(nameof(CanvasViewportSize));
|
||||||
|
OnPropertyChanged(nameof(XAxisColorBrush));
|
||||||
|
OnPropertyChanged(nameof(YAxisColorBrush));
|
||||||
|
OnPropertyChanged(nameof(GridColorBrush));
|
||||||
|
}
|
||||||
|
|
||||||
|
private double panelX, panelY, scrollPanelX, scrollPanelY;
|
||||||
|
private ICommand scaleCanvasDown;
|
||||||
|
private ICommand scaleCanvasUp;
|
||||||
|
|
||||||
|
public double PanelX
|
||||||
|
{
|
||||||
|
get => panelX;
|
||||||
|
set => OnPropertyChanged(value, ref panelX);
|
||||||
|
}
|
||||||
|
public double PanelY
|
||||||
|
{
|
||||||
|
get => panelY;
|
||||||
|
set => OnPropertyChanged(value, ref panelY);
|
||||||
|
}
|
||||||
|
public double ScrollPanelX
|
||||||
|
{
|
||||||
|
get => scrollPanelX;
|
||||||
|
set => OnPropertyChanged(value, ref scrollPanelX);
|
||||||
|
}
|
||||||
|
public double ScrollPanelY
|
||||||
|
{
|
||||||
|
get => scrollPanelY;
|
||||||
|
set => OnPropertyChanged(value, ref scrollPanelY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand ScaleCanvasDown => scaleCanvasDown ??= new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
ScrollPanelX = PanelX;
|
||||||
|
ScrollPanelY = PanelY;
|
||||||
|
ScaleValue *= scaleRate;
|
||||||
|
});
|
||||||
|
public ICommand ScaleCanvasUp => scaleCanvasUp ??= new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
ScrollPanelX = PanelX;
|
||||||
|
ScrollPanelY = PanelY;
|
||||||
|
ScaleValue /= scaleRate;
|
||||||
|
});
|
||||||
|
|
||||||
|
public CrossSectionViewModel ParentViewModel { get; set; }
|
||||||
|
|
||||||
|
public CrossSectionVisualPropertyVM()
|
||||||
|
{
|
||||||
|
AxisCanvasVM = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,7 +24,7 @@ using System.Threading;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.MainWindow
|
namespace StructureHelper.Windows.MainWindow
|
||||||
{
|
{
|
||||||
public class MainModel
|
public class CrossSectionModel
|
||||||
{
|
{
|
||||||
public ICrossSection Section { get; private set; }
|
public ICrossSection Section { get; private set; }
|
||||||
private IPrimitiveRepository primitiveRepository;
|
private IPrimitiveRepository primitiveRepository;
|
||||||
@@ -37,7 +37,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
|
|
||||||
public ICalculationProperty CalculationProperty { get; private set; }
|
public ICalculationProperty CalculationProperty { get; private set; }
|
||||||
|
|
||||||
public MainModel(IPrimitiveRepository primitiveRepository, CalculationService calculationService, UnitSystemService unitSystemService)
|
public CrossSectionModel(IPrimitiveRepository primitiveRepository, CalculationService calculationService, UnitSystemService unitSystemService)
|
||||||
{
|
{
|
||||||
this.primitiveRepository = primitiveRepository;
|
this.primitiveRepository = primitiveRepository;
|
||||||
this.calculationService = calculationService;
|
this.calculationService = calculationService;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<Window x:Class="StructureHelper.Windows.MainWindow.MainView"
|
<Window x:Class="StructureHelper.Windows.MainWindow.CrossSectionView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance local:MainViewModel}"
|
d:DataContext="{d:DesignInstance local:CrossSectionViewModel}"
|
||||||
Title="StructureHelper" Height="700" Width="1000" MinHeight="400" MinWidth="600">
|
Title="StructureHelper" Height="700" Width="1000" MinHeight="400" MinWidth="600">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<DataTemplate DataType="{x:Type dataContexts:RectangleViewPrimitive}">
|
<DataTemplate DataType="{x:Type dataContexts:RectangleViewPrimitive}">
|
||||||
@@ -54,6 +54,11 @@
|
|||||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Copy.png" />
|
<Image Width="16" Height="16" Source="/Windows/MainWindow/Copy.png" />
|
||||||
</MenuItem.Icon>
|
</MenuItem.Icon>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem Header="Copy To" Command="{Binding CopyTo}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<Image Width="16" Height="16" Source="/Windows/MainWindow/Copy.png" />
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
<MenuItem Header="Delete" Command="{Binding Delete}">
|
<MenuItem Header="Delete" Command="{Binding Delete}">
|
||||||
<MenuItem.Icon>
|
<MenuItem.Icon>
|
||||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Delete.png" />
|
<Image Width="16" Height="16" Source="/Windows/MainWindow/Delete.png" />
|
||||||
@@ -357,11 +362,17 @@
|
|||||||
<i:InvokeCommandAction Command="{Binding ClearSelection}" CommandParameter="{Binding}"/>
|
<i:InvokeCommandAction Command="{Binding ClearSelection}" CommandParameter="{Binding}"/>
|
||||||
</i:EventTrigger>
|
</i:EventTrigger>
|
||||||
</i:Interaction.Triggers>
|
</i:Interaction.Triggers>
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible">
|
<ScrollViewer
|
||||||
<Canvas Name="WorkPlane" ClipToBounds="True" Width="{Binding CanvasWidth}" Height="{Binding CanvasHeight}">
|
DataContext="{Binding VisualProperty}"
|
||||||
|
VerticalScrollBarVisibility="Visible"
|
||||||
|
HorizontalScrollBarVisibility="Visible">
|
||||||
|
<Canvas Name="WorkPlane"
|
||||||
|
ClipToBounds="True"
|
||||||
|
Width="{Binding Width}"
|
||||||
|
Height="{Binding Height}">
|
||||||
<Canvas.ContextMenu>
|
<Canvas.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<MenuItem Header="Add" DataContext="{Binding PrimitiveLogic}">
|
<MenuItem Header="Add" DataContext="{Binding ParentViewModel.PrimitiveLogic}">
|
||||||
<MenuItem Header="Rectangle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}">
|
<MenuItem Header="Rectangle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}">
|
||||||
<MenuItem.Icon>
|
<MenuItem.Icon>
|
||||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Rectangle32.png" />
|
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Rectangle32.png" />
|
||||||
@@ -383,7 +394,7 @@
|
|||||||
</MenuItem.Icon>
|
</MenuItem.Icon>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="Templates" DataContext="{Binding}">
|
<MenuItem Header="Templates" DataContext="{Binding ParentViewModel}">
|
||||||
<MenuItem Header="Add Rectangle RC Column" Command="{Binding AddColumnCase}">
|
<MenuItem Header="Add Rectangle RC Column" Command="{Binding AddColumnCase}">
|
||||||
<MenuItem.Icon>
|
<MenuItem.Icon>
|
||||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/RectangleColumn32.png" />
|
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/RectangleColumn32.png" />
|
||||||
@@ -429,13 +440,30 @@
|
|||||||
Viewport="{Binding CanvasViewportSize}" ViewportUnits="Absolute"
|
Viewport="{Binding CanvasViewportSize}" ViewportUnits="Absolute"
|
||||||
Viewbox="{Binding CanvasViewportSize}" ViewboxUnits="Absolute">
|
Viewbox="{Binding CanvasViewportSize}" ViewboxUnits="Absolute">
|
||||||
<VisualBrush.Visual>
|
<VisualBrush.Visual>
|
||||||
<Rectangle StrokeThickness="{Binding GridLineThickness}" Height="{Binding GridSize}" Width="{Binding GridSize}" Stroke="Darkgray"/>
|
<Rectangle
|
||||||
|
Height="{Binding GridSize}"
|
||||||
|
Width="{Binding GridSize}"
|
||||||
|
Stroke="{Binding GridColorBrush}"
|
||||||
|
StrokeThickness="{Binding GridLineThickness}"/>
|
||||||
</VisualBrush.Visual>
|
</VisualBrush.Visual>
|
||||||
</VisualBrush>
|
</VisualBrush>
|
||||||
</Canvas.Background>
|
</Canvas.Background>
|
||||||
<Line X1="0" X2="{Binding XX2}" Y1="{Binding XY1}" Y2="{Binding XY1}" Stroke="Red" StrokeThickness="{Binding AxisLineThickness}"/>
|
<!--Horizontal axis line-->
|
||||||
<Line X1="{Binding YX1}" X2="{Binding YX1}" Y1="0" Y2="{Binding YY2}" Stroke="ForestGreen" StrokeThickness="{Binding AxisLineThickness}"/>
|
<Line
|
||||||
<ItemsControl DataContext="{Binding PrimitiveLogic}" ItemsSource="{Binding Items}" ContextMenu="{StaticResource PrimitiveCRUD}">
|
X1="0" X2="{Binding Width}"
|
||||||
|
Y1="{Binding HalfOfHeight}" Y2="{Binding HalfOfHeight}"
|
||||||
|
Stroke="{Binding XAxisColorBrush}"
|
||||||
|
StrokeThickness="{Binding AxisLineThickness}"/>
|
||||||
|
<!--Vertical axis line-->
|
||||||
|
<Line
|
||||||
|
X1="{Binding HalfOfWidth}" X2="{Binding HalfOfWidth}"
|
||||||
|
Y1="0" Y2="{Binding Height}"
|
||||||
|
Stroke="{Binding YAxisColorBrush}"
|
||||||
|
StrokeThickness="{Binding AxisLineThickness}"/>
|
||||||
|
<ItemsControl
|
||||||
|
DataContext="{Binding ParentViewModel.PrimitiveLogic}"
|
||||||
|
ItemsSource="{Binding Items}"
|
||||||
|
ContextMenu="{StaticResource PrimitiveCRUD}">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<Canvas/>
|
<Canvas/>
|
||||||
@@ -459,7 +487,7 @@
|
|||||||
<StatusBarItem>
|
<StatusBarItem>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock Text="Zoom: "/>
|
<TextBlock Text="Zoom: "/>
|
||||||
<TextBlock Text="{Binding ScaleValue}"/>
|
<TextBlock Text="{Binding VisualProperty.ScaleValue}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StatusBarItem>
|
</StatusBarItem>
|
||||||
<StatusBarItem>
|
<StatusBarItem>
|
||||||
@@ -471,7 +499,7 @@
|
|||||||
<StatusBarItem>
|
<StatusBarItem>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock Text="Grid size: "/>
|
<TextBlock Text="Grid size: "/>
|
||||||
<TextBlock Text="{Binding GridSize, Converter={StaticResource LengthConverter}}"/>
|
<TextBlock Text="{Binding VisualProperty.GridSize, Converter={StaticResource LengthConverter}}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StatusBarItem>
|
</StatusBarItem>
|
||||||
</StatusBar>
|
</StatusBar>
|
||||||
@@ -6,12 +6,12 @@ using StructureHelper.Services.Primitives;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.MainWindow
|
namespace StructureHelper.Windows.MainWindow
|
||||||
{
|
{
|
||||||
public partial class MainView : Window
|
public partial class CrossSectionView : Window
|
||||||
{
|
{
|
||||||
private MainViewModel viewModel;
|
private CrossSectionViewModel viewModel;
|
||||||
public IPrimitiveRepository PrimitiveRepository { get; }
|
public IPrimitiveRepository PrimitiveRepository { get; }
|
||||||
|
|
||||||
public MainView(IPrimitiveRepository primitiveRepository, MainViewModel viewModel)
|
public CrossSectionView(IPrimitiveRepository primitiveRepository, CrossSectionViewModel viewModel)
|
||||||
{
|
{
|
||||||
PrimitiveRepository = primitiveRepository;
|
PrimitiveRepository = primitiveRepository;
|
||||||
this.viewModel = viewModel;
|
this.viewModel = viewModel;
|
||||||
@@ -25,96 +25,24 @@ using System.Windows.Input;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.MainWindow
|
namespace StructureHelper.Windows.MainWindow
|
||||||
{
|
{
|
||||||
public class MainViewModel : ViewModelBase
|
public class CrossSectionViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
ICrossSection section;
|
private ICrossSection section;
|
||||||
ICrossSectionRepository repository => section.SectionRepository;
|
private ICrossSectionRepository repository => section.SectionRepository;
|
||||||
|
|
||||||
private CrossSectionViewVisualProperty visualProperty;
|
public CrossSectionVisualPropertyVM VisualProperty { get; private set; }
|
||||||
|
|
||||||
private readonly double scaleRate = 1.1d;
|
|
||||||
|
|
||||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||||
//public IForceCombinationList SelectedForceCombinationList { get; set; }
|
|
||||||
|
|
||||||
private readonly AnalysisVewModelLogic calculatorsLogic;
|
public AnalysisViewModelLogic CalculatorsLogic { get; private set; }
|
||||||
public AnalysisVewModelLogic CalculatorsLogic { get => calculatorsLogic;}
|
public ActionsViewModel CombinationsLogic { get; }
|
||||||
public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
|
public MaterialsViewModel MaterialsLogic { get; }
|
||||||
public MaterialsViewModel MaterialsLogic { get => materialsLogic; }
|
public PrimitiveViewModelLogic PrimitiveLogic { get; }
|
||||||
public PrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
|
|
||||||
public HelpLogic HelpLogic => new HelpLogic();
|
public HelpLogic HelpLogic => new HelpLogic();
|
||||||
|
|
||||||
private MainModel Model { get; }
|
private CrossSectionModel Model { get; }
|
||||||
|
|
||||||
private double panelX, panelY, scrollPanelX, scrollPanelY;
|
|
||||||
|
|
||||||
public double PanelX
|
|
||||||
{
|
|
||||||
get => panelX;
|
|
||||||
set => OnPropertyChanged(value, ref panelX);
|
|
||||||
}
|
|
||||||
public double PanelY
|
|
||||||
{
|
|
||||||
get => panelY;
|
|
||||||
set => OnPropertyChanged(value, ref panelY);
|
|
||||||
}
|
|
||||||
public double ScrollPanelX
|
|
||||||
{
|
|
||||||
get => scrollPanelX;
|
|
||||||
set => OnPropertyChanged(value, ref scrollPanelX);
|
|
||||||
}
|
|
||||||
public double ScrollPanelY
|
|
||||||
{
|
|
||||||
get => scrollPanelY;
|
|
||||||
set => OnPropertyChanged(value, ref scrollPanelY);
|
|
||||||
}
|
|
||||||
|
|
||||||
private double scaleValue;
|
|
||||||
|
|
||||||
public double ScaleValue
|
|
||||||
{
|
|
||||||
get => Math.Round(scaleValue);
|
|
||||||
set
|
|
||||||
{
|
|
||||||
OnPropertyChanged(value, ref scaleValue);
|
|
||||||
OnPropertyChanged(nameof(AxisLineThickness));
|
|
||||||
OnPropertyChanged(nameof(GridLineThickness));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public double AxisLineThickness
|
|
||||||
{
|
|
||||||
get => visualProperty.AxisLineThickness / scaleValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double GridLineThickness
|
|
||||||
{
|
|
||||||
get => visualProperty.GridLineThickness / scaleValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double xX2, xY1, yX1, yY2;
|
|
||||||
public double CanvasWidth
|
|
||||||
{
|
|
||||||
get => visualProperty.WorkPlainWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double CanvasHeight
|
|
||||||
{
|
|
||||||
get => visualProperty.WorkPlainHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string CanvasViewportSize
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
string s = visualProperty.GridSize.ToString();
|
|
||||||
s = s.Replace(',', '.');
|
|
||||||
return $"0,0,{s},{s}";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public double GridSize { get => visualProperty.GridSize; }
|
|
||||||
|
|
||||||
public ObservableCollection<IHeadMaterial> HeadMaterials
|
public ObservableCollection<IHeadMaterial> HeadMaterials
|
||||||
{
|
{
|
||||||
@@ -129,27 +57,6 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double XX2
|
|
||||||
{
|
|
||||||
get => xX2;
|
|
||||||
set => OnPropertyChanged(value, ref xX2);
|
|
||||||
}
|
|
||||||
public double XY1
|
|
||||||
{
|
|
||||||
get => xY1;
|
|
||||||
set => OnPropertyChanged(value, ref xY1);
|
|
||||||
}
|
|
||||||
public double YX1
|
|
||||||
{
|
|
||||||
get => yX1;
|
|
||||||
set => OnPropertyChanged(value, ref yX1);
|
|
||||||
}
|
|
||||||
public double YY2
|
|
||||||
{
|
|
||||||
get => yY2;
|
|
||||||
set => OnPropertyChanged(value, ref yY2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICommand Calculate { get; }
|
public ICommand Calculate { get; }
|
||||||
public ICommand EditCalculationPropertyCommand { get; }
|
public ICommand EditCalculationPropertyCommand { get; }
|
||||||
public ICommand EditHeadMaterialsCommand { get; }
|
public ICommand EditHeadMaterialsCommand { get; }
|
||||||
@@ -160,7 +67,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
return new RelayCommand(o =>
|
return new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
PrimitiveLogic.AddItems(GetRCCirclePrimitives());
|
PrimitiveLogic.AddItems(GetRCCirclePrimitives());
|
||||||
materialsLogic.Refresh();
|
MaterialsLogic.Refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,7 +77,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
public ICommand LeftButtonDown { get; }
|
public ICommand LeftButtonDown { get; }
|
||||||
public ICommand LeftButtonUp { get; }
|
public ICommand LeftButtonUp { get; }
|
||||||
public ICommand MovePrimitiveToGravityCenterCommand { get; }
|
public ICommand MovePrimitiveToGravityCenterCommand { get; }
|
||||||
public ICommand PreviewMouseMove { get; }
|
|
||||||
public ICommand ClearSelection { get; }
|
public ICommand ClearSelection { get; }
|
||||||
public ICommand OpenMaterialCatalog { get; }
|
public ICommand OpenMaterialCatalog { get; }
|
||||||
public ICommand OpenMaterialCatalogWithSelection { get; }
|
public ICommand OpenMaterialCatalogWithSelection { get; }
|
||||||
@@ -178,8 +85,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
public ICommand SetColor { get; }
|
public ICommand SetColor { get; }
|
||||||
public ICommand SetInFrontOfAll { get; }
|
public ICommand SetInFrontOfAll { get; }
|
||||||
public ICommand SetInBackOfAll { get; }
|
public ICommand SetInBackOfAll { get; }
|
||||||
public ICommand ScaleCanvasDown { get; }
|
|
||||||
public ICommand ScaleCanvasUp { get; }
|
|
||||||
public ICommand SetPopupCanBeClosedTrue { get; }
|
public ICommand SetPopupCanBeClosedTrue { get; }
|
||||||
public ICommand SetPopupCanBeClosedFalse { get; }
|
public ICommand SetPopupCanBeClosedFalse { get; }
|
||||||
public RelayCommand ShowVisualProperty
|
public RelayCommand ShowVisualProperty
|
||||||
@@ -189,11 +95,13 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
return showVisualProperty ??
|
return showVisualProperty ??
|
||||||
(showVisualProperty = new RelayCommand(o=>
|
(showVisualProperty = new RelayCommand(o=>
|
||||||
{
|
{
|
||||||
var wnd = new VisualPropertyView(visualProperty);
|
var wnd = new AxisCanvasView(VisualProperty.AxisCanvasVM);
|
||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
OnPropertyChanged(nameof(AxisLineThickness));
|
if (wnd.DialogResult == false) { return; }
|
||||||
OnPropertyChanged(nameof(CanvasViewportSize));
|
VisualProperty.Refresh();
|
||||||
OnPropertyChanged(nameof(GridSize));
|
PrimitiveLogic.Width = VisualProperty.Width;
|
||||||
|
PrimitiveLogic.Height = VisualProperty.Height;
|
||||||
|
PrimitiveLogic.Refresh();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,39 +110,37 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return selectPrimitive ??
|
return selectPrimitive ??= new RelayCommand(obj=>
|
||||||
(selectPrimitive = new RelayCommand(obj=>
|
|
||||||
{
|
{
|
||||||
if (obj is PrimitiveBase)
|
if (obj is PrimitiveBase)
|
||||||
{
|
{
|
||||||
SelectedPrimitive = obj as PrimitiveBase;
|
SelectedPrimitive = obj as PrimitiveBase;
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private double delta = 0.0005;
|
|
||||||
private ActionsViewModel combinationsLogic;
|
|
||||||
private PrimitiveViewModelLogic primitiveLogic;
|
|
||||||
private RelayCommand showVisualProperty;
|
private RelayCommand showVisualProperty;
|
||||||
private RelayCommand selectPrimitive;
|
private RelayCommand selectPrimitive;
|
||||||
private MaterialsViewModel materialsLogic;
|
|
||||||
|
|
||||||
public MainViewModel(MainModel model)
|
public CrossSectionViewModel(CrossSectionModel model)
|
||||||
{
|
{
|
||||||
visualProperty = new CrossSectionViewVisualProperty();
|
VisualProperty = new CrossSectionVisualPropertyVM()
|
||||||
|
{
|
||||||
|
ScaleValue = 500d,
|
||||||
|
ParentViewModel = this
|
||||||
|
};
|
||||||
Model = model;
|
Model = model;
|
||||||
section = model.Section;
|
section = model.Section;
|
||||||
combinationsLogic = new ActionsViewModel(repository);
|
CombinationsLogic = new ActionsViewModel(repository);
|
||||||
materialsLogic = new MaterialsViewModel(repository);
|
MaterialsLogic = new MaterialsViewModel(repository);
|
||||||
materialsLogic.AfterItemsEdit += afterMaterialEdit;
|
MaterialsLogic.AfterItemsEdit += AfterMaterialEdit;
|
||||||
calculatorsLogic = new AnalysisVewModelLogic(repository);
|
CalculatorsLogic = new AnalysisViewModelLogic(repository);
|
||||||
primitiveLogic = new PrimitiveViewModelLogic(section) { CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight };
|
PrimitiveLogic = new PrimitiveViewModelLogic(section)
|
||||||
XX2 = CanvasWidth;
|
{
|
||||||
XY1 = CanvasHeight / 2d;
|
Width = VisualProperty.Width,
|
||||||
YX1 = CanvasWidth / 2d;
|
Height = VisualProperty.Height
|
||||||
YY2 = CanvasHeight;
|
};
|
||||||
scaleValue = 300d;
|
|
||||||
|
|
||||||
LeftButtonUp = new RelayCommand(o =>
|
LeftButtonUp = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
@@ -244,59 +150,23 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
{
|
{
|
||||||
if (o is RectangleViewPrimitive rect) rect.BorderCaptured = true;
|
if (o is RectangleViewPrimitive rect) rect.BorderCaptured = true;
|
||||||
});
|
});
|
||||||
PreviewMouseMove = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
if (o is RectangleViewPrimitive rect && rect.BorderCaptured && !rect.ElementLock)
|
|
||||||
{
|
|
||||||
if (rect.PrimitiveWidth % 10d < delta || rect.PrimitiveWidth % 10d >= delta)
|
|
||||||
rect.PrimitiveWidth = Math.Round(PanelX / 10d) * 10d - rect.PrimitiveLeft + 10d;
|
|
||||||
else
|
|
||||||
rect.PrimitiveWidth = PanelX - rect.PrimitiveLeft + 10d;
|
|
||||||
|
|
||||||
if (rect.PrimitiveHeight % 10d < delta || rect.PrimitiveHeight % 10d >= delta)
|
|
||||||
rect.PrimitiveHeight = Math.Round(PanelY / 10d) * 10d - rect.PrimitiveTop + 10d;
|
|
||||||
else
|
|
||||||
rect.PrimitiveHeight = PanelY - rect.PrimitiveTop + 10d;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//SetColor = new RelayCommand(o =>
|
|
||||||
//{
|
|
||||||
// var primitive = o as PrimitiveBase;
|
|
||||||
// var colorPickerView = new ColorPickerView(primitive);
|
|
||||||
// colorPickerView.ShowDialog();
|
|
||||||
//});
|
|
||||||
|
|
||||||
ScaleCanvasDown = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
ScrollPanelX = PanelX;
|
|
||||||
ScrollPanelY = PanelY;
|
|
||||||
ScaleValue *= scaleRate;
|
|
||||||
});
|
|
||||||
|
|
||||||
ScaleCanvasUp = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
ScrollPanelX = PanelX;
|
|
||||||
ScrollPanelY = PanelY;
|
|
||||||
ScaleValue /= scaleRate;
|
|
||||||
});
|
|
||||||
|
|
||||||
AddBeamCase = new RelayCommand(o =>
|
AddBeamCase = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
PrimitiveLogic.AddItems(GetBeamCasePrimitives());
|
PrimitiveLogic.AddItems(GetBeamCasePrimitives());
|
||||||
materialsLogic.Refresh();
|
MaterialsLogic.Refresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
AddColumnCase = new RelayCommand(o =>
|
AddColumnCase = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
PrimitiveLogic.AddItems(GetColumnCasePrimitives());
|
PrimitiveLogic.AddItems(GetColumnCasePrimitives());
|
||||||
materialsLogic.Refresh();
|
MaterialsLogic.Refresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
AddSlabCase = new RelayCommand(o =>
|
AddSlabCase = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
PrimitiveLogic.AddItems(GetSlabCasePrimitives());
|
PrimitiveLogic.AddItems(GetSlabCasePrimitives());
|
||||||
materialsLogic.Refresh();
|
MaterialsLogic.Refresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
MovePrimitiveToGravityCenterCommand = new RelayCommand(o =>
|
MovePrimitiveToGravityCenterCommand = new RelayCommand(o =>
|
||||||
@@ -321,22 +191,19 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
|
|
||||||
SetPopupCanBeClosedFalse = new RelayCommand(o =>
|
SetPopupCanBeClosedFalse = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
if (!(o is PrimitiveBase primitive)) return;
|
if (o is not PrimitiveBase primitive) return;
|
||||||
primitive.PopupCanBeClosed = false;
|
primitive.PopupCanBeClosed = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void afterMaterialEdit(SelectItemVM<IHeadMaterial> sender, CRUDVMEventArgs e)
|
private void AfterMaterialEdit(SelectItemVM<IHeadMaterial> sender, CRUDVMEventArgs e)
|
||||||
{
|
{
|
||||||
foreach (var primitive in primitiveLogic.Items)
|
PrimitiveLogic.Refresh();
|
||||||
{
|
|
||||||
primitive.RefreshColor();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckMaterials()
|
private bool CheckMaterials()
|
||||||
{
|
{
|
||||||
foreach (var item in primitiveLogic.Items)
|
foreach (var item in PrimitiveLogic.Items)
|
||||||
{
|
{
|
||||||
if (item.HeadMaterial == null)
|
if (item.HeadMaterial == null)
|
||||||
{
|
{
|
||||||
@@ -358,12 +225,26 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
}
|
}
|
||||||
private IEnumerable<PrimitiveBase> GetColumnCasePrimitives()
|
private IEnumerable<PrimitiveBase> GetColumnCasePrimitives()
|
||||||
{
|
{
|
||||||
var template = new RectangleBeamTemplate(0.5d, 0.5d) { CoverGap = 0.05, WidthCount = 3, HeightCount = 3, TopDiameter = 0.025d, BottomDiameter = 0.025d };
|
var template = new RectangleBeamTemplate(0.5d, 0.5d)
|
||||||
|
{
|
||||||
|
CoverGap = 0.05,
|
||||||
|
WidthCount = 3,
|
||||||
|
HeightCount = 3,
|
||||||
|
TopDiameter = 0.025d,
|
||||||
|
BottomDiameter = 0.025d
|
||||||
|
};
|
||||||
return GetCasePrimitives(template);
|
return GetCasePrimitives(template);
|
||||||
}
|
}
|
||||||
private IEnumerable<PrimitiveBase> GetSlabCasePrimitives()
|
private IEnumerable<PrimitiveBase> GetSlabCasePrimitives()
|
||||||
{
|
{
|
||||||
var template = new RectangleBeamTemplate(1d, 0.2d) { CoverGap = 0.04, WidthCount = 5, HeightCount = 2, TopDiameter = 0.012d, BottomDiameter = 0.012d };
|
var template = new RectangleBeamTemplate(1d, 0.2d)
|
||||||
|
{
|
||||||
|
CoverGap = 0.04,
|
||||||
|
WidthCount = 5,
|
||||||
|
HeightCount = 2,
|
||||||
|
TopDiameter = 0.012d,
|
||||||
|
BottomDiameter = 0.012d
|
||||||
|
};
|
||||||
return GetCasePrimitives(template);
|
return GetCasePrimitives(template);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,11 +264,15 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
geometryLogic = new CircleGeometryLogic(circleTemplate);
|
geometryLogic = new CircleGeometryLogic(circleTemplate);
|
||||||
wnd = new CircleView(circleTemplate);
|
wnd = new CircleView(circleTemplate);
|
||||||
}
|
}
|
||||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $"Was: {nameof(template)}"); }
|
else
|
||||||
wnd.ShowDialog();
|
|
||||||
if (wnd.DialogResult == true)
|
|
||||||
{
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(template));
|
||||||
|
}
|
||||||
|
wnd.ShowDialog();
|
||||||
|
if (wnd.DialogResult == false)
|
||||||
|
{
|
||||||
|
return new List<PrimitiveBase>();
|
||||||
|
}
|
||||||
var newSection = new SectionTemplate(geometryLogic).GetCrossSection();
|
var newSection = new SectionTemplate(geometryLogic).GetCrossSection();
|
||||||
var newRepository = newSection.SectionRepository;
|
var newRepository = newSection.SectionRepository;
|
||||||
repository.HeadMaterials.AddRange(newRepository.HeadMaterials);
|
repository.HeadMaterials.AddRange(newRepository.HeadMaterials);
|
||||||
@@ -398,10 +283,6 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
CombinationsLogic.AddItems(newRepository.ForceActions);
|
CombinationsLogic.AddItems(newRepository.ForceActions);
|
||||||
CalculatorsLogic.AddItems(newRepository.CalculatorsList);
|
CalculatorsLogic.AddItems(newRepository.CalculatorsList);
|
||||||
var primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(newRepository.Primitives);
|
var primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(newRepository.Primitives);
|
||||||
foreach (var item in primitives)
|
|
||||||
{
|
|
||||||
item.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
|
||||||
}
|
|
||||||
PrimitiveLogic.Refresh();
|
PrimitiveLogic.Refresh();
|
||||||
foreach (var item in newRepository.HeadMaterials)
|
foreach (var item in newRepository.HeadMaterials)
|
||||||
{
|
{
|
||||||
@@ -412,8 +293,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
GlobalRepository.Actions.Create(item);
|
GlobalRepository.Actions.Create(item);
|
||||||
}
|
}
|
||||||
return primitives;
|
return primitives;
|
||||||
}
|
|
||||||
return new List<PrimitiveBase>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
<Window x:Class="StructureHelper.Windows.MainWindow.VisualPropertyView"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="Grid properies" Height="200" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="22"/>
|
|
||||||
<RowDefinition Height="22"/>
|
|
||||||
<RowDefinition/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="130"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<TextBlock Text="Axis grid thickness"/>
|
|
||||||
<TextBox Grid.Column="1" Text="{Binding AxisLineThickness, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
|
||||||
<TextBlock Grid.Row="1" Text="Mesh size"/>
|
|
||||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding GridSize, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
xmlns:local="clr-namespace:StructureHelper.Windows.Services"
|
xmlns:local="clr-namespace:StructureHelper.Windows.Services"
|
||||||
d:DataContext ="{d:DesignInstance local:CopyByParameterViewModel}"
|
d:DataContext ="{d:DesignInstance local:CopyByParameterViewModel}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Copy To" Height="260" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterOwner">
|
Title="Copy To" Height="300" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<Style TargetType="TextBox">
|
<Style TargetType="TextBox">
|
||||||
<Setter Property="Margin" Value="2"/>
|
<Setter Property="Margin" Value="2"/>
|
||||||
@@ -35,11 +35,11 @@
|
|||||||
<TextBlock Grid.Row="1" Text="Delta Y"/>
|
<TextBlock Grid.Row="1" Text="Delta Y"/>
|
||||||
<TextBlock Grid.Row="2" Text="Angle"/>
|
<TextBlock Grid.Row="2" Text="Angle"/>
|
||||||
<TextBlock Grid.Row="3" Text="Distance"/>
|
<TextBlock Grid.Row="3" Text="Distance"/>
|
||||||
<TextBox Grid.Column="1" Text=""/>
|
<TextBox Grid.Column="1" Text="{Binding DeltaX, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
||||||
<TextBox Grid.Column="1" Grid.Row="1" Text=""/>
|
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding DeltaY, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
||||||
<TextBox Grid.Column="1" Grid.Row="2" Text="" IsEnabled="False"/>
|
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding Angle}" IsEnabled="False"/>
|
||||||
<TextBox Grid.Column="1" Grid.Row="3" Text="" IsEnabled="False"/>
|
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding Distance, Converter={StaticResource LengthConverter}}" IsEnabled="False"/>
|
||||||
<CheckBox Grid.Row="4" Content="Relative coordinates"/>
|
<CheckBox Grid.Row="4" Content="Relative coordinates" Visibility="Hidden"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
<GroupBox Header="Copy count">
|
<GroupBox Header="Copy count">
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
<RowDefinition Height="27"/>
|
<RowDefinition Height="27"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBox Grid.Column="1" Text=""/>
|
<TextBox Grid.Column="1" Text="{Binding CopyCount, ValidatesOnDataErrors=True}"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
|
|||||||
@@ -19,9 +19,13 @@ namespace StructureHelper.Windows.Services
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class CopyByParameterView : Window
|
public partial class CopyByParameterView : Window
|
||||||
{
|
{
|
||||||
public CopyByParameterView()
|
private CopyByParameterViewModel viewModel;
|
||||||
|
public CopyByParameterView(CopyByParameterViewModel viewModel)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
this.viewModel = viewModel;
|
||||||
|
DataContext = this.viewModel;
|
||||||
|
this.viewModel.ParentWindow = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelper.Windows.ViewModels;
|
using StructureHelper.Windows.ViewModels;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -7,7 +8,85 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.Services
|
namespace StructureHelper.Windows.Services
|
||||||
{
|
{
|
||||||
internal class CopyByParameterViewModel : OkCancelViewModelBase
|
public class CopyByParameterViewModel : OkCancelViewModelBase
|
||||||
{
|
{
|
||||||
|
private double deltaX;
|
||||||
|
private double deltaY;
|
||||||
|
private int copyCount;
|
||||||
|
|
||||||
|
public double DeltaX
|
||||||
|
{
|
||||||
|
get => deltaX; set
|
||||||
|
{
|
||||||
|
deltaX = value;
|
||||||
|
RefreshAngle();
|
||||||
|
OnPropertyChanged(nameof(deltaX));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public double DeltaY
|
||||||
|
{
|
||||||
|
get => deltaY; set
|
||||||
|
{
|
||||||
|
deltaY = value;
|
||||||
|
RefreshAngle();
|
||||||
|
OnPropertyChanged(nameof(deltaY));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double Angle { get; set; }
|
||||||
|
public double Distance { get; set; }
|
||||||
|
public int CopyCount
|
||||||
|
{
|
||||||
|
get => copyCount; set
|
||||||
|
{
|
||||||
|
int newValue;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
newValue = value;
|
||||||
|
copyCount = newValue;
|
||||||
|
OnPropertyChanged(nameof(CopyCount));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IPoint2D originalCenter;
|
||||||
|
|
||||||
|
public CopyByParameterViewModel(IPoint2D originalCenter)
|
||||||
|
{
|
||||||
|
deltaX = 0.2d;
|
||||||
|
deltaY = 0d;
|
||||||
|
copyCount = 1;
|
||||||
|
this.originalCenter = originalCenter;
|
||||||
|
RefreshAngle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IPoint2D> GetNewItemCenters()
|
||||||
|
{
|
||||||
|
var result = new List<IPoint2D>();
|
||||||
|
for (int i = 1; i <= CopyCount; i++)
|
||||||
|
{
|
||||||
|
var newPoint = new Point2D()
|
||||||
|
{
|
||||||
|
X = originalCenter.X + deltaX * i,
|
||||||
|
Y = originalCenter.Y + deltaY * i,
|
||||||
|
};
|
||||||
|
result.Add(newPoint);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
private void RefreshAngle()
|
||||||
|
{
|
||||||
|
Angle = Math.Atan2(deltaX, deltaY * (-1)) * 180d / Math.PI - 90d;
|
||||||
|
Angle = Math.Round(Angle, 1);
|
||||||
|
Distance = Math.Sqrt(deltaX * deltaX + deltaY * deltaY);
|
||||||
|
Distance = Math.Round(Distance, 3);
|
||||||
|
OnPropertyChanged(nameof(Angle));
|
||||||
|
OnPropertyChanged(nameof(Distance));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,27 @@
|
|||||||
xmlns:local="clr-namespace:StructureHelper.Windows.UserControls"
|
xmlns:local="clr-namespace:StructureHelper.Windows.UserControls"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="25" d:DesignWidth="120">
|
d:DesignHeight="25" d:DesignWidth="120">
|
||||||
<Grid>
|
<Grid x:Name="ButtonGrid" Opacity="0.1">
|
||||||
|
<Grid.Triggers>
|
||||||
|
<EventTrigger RoutedEvent="UIElement.MouseEnter" SourceName="ButtonGrid">
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="ButtonGrid"
|
||||||
|
Storyboard.TargetProperty="Opacity"
|
||||||
|
To="1.0" Duration="0:0:0.5" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</EventTrigger>
|
||||||
|
<EventTrigger RoutedEvent="UIElement.MouseLeave" SourceName="ButtonGrid">
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="ButtonGrid"
|
||||||
|
Storyboard.TargetProperty="Opacity"
|
||||||
|
To="0.1" Duration="0:0:5.0" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</EventTrigger>
|
||||||
|
</Grid.Triggers>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
|
|||||||
@@ -1,26 +1,22 @@
|
|||||||
using StructureHelper.Infrastructure;
|
using StructureHelper.Infrastructure;
|
||||||
using StructureHelper.Infrastructure.Enums;
|
using StructureHelper.Infrastructure.Enums;
|
||||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic;
|
|
||||||
using StructureHelper.Windows.CalculationWindows.ProgressViews;
|
using StructureHelper.Windows.CalculationWindows.ProgressViews;
|
||||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||||
using StructureHelper.Windows.ViewModels.Errors;
|
using StructureHelper.Windows.ViewModels.Errors;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.Logics;
|
using StructureHelperLogics.NdmCalculations.Analyses.Logics;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
|
||||||
using System;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using MessageBox = System.Windows.Forms.MessageBox;
|
using MessageBox = System.Windows.Forms.MessageBox;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||||
{
|
{
|
||||||
public class AnalysisVewModelLogic : SelectItemVM<ICalculator>
|
public class AnalysisViewModelLogic : SelectItemVM<ICalculator>
|
||||||
{
|
{
|
||||||
private ICrossSectionRepository repository;
|
private ICrossSectionRepository repository;
|
||||||
private RelayCommand runCommand;
|
private RelayCommand runCommand;
|
||||||
@@ -92,7 +88,6 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
|
|
||||||
var calculatorCopy = (ICalculator)calculator.Clone();
|
var calculatorCopy = (ICalculator)calculator.Clone();
|
||||||
var vm = new ForceCalculatorViewModel(repository.Primitives, repository.ForceActions, calculator);
|
var vm = new ForceCalculatorViewModel(repository.Primitives, repository.ForceActions, calculator);
|
||||||
|
|
||||||
var wnd = new ForceCalculatorView(vm);
|
var wnd = new ForceCalculatorView(vm);
|
||||||
ShowWindow(calculator, calculatorCopy, wnd);
|
ShowWindow(calculator, calculatorCopy, wnd);
|
||||||
}
|
}
|
||||||
@@ -133,16 +128,14 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
|
|
||||||
private void RunCalculator()
|
private void RunCalculator()
|
||||||
{
|
{
|
||||||
|
if (SelectedItem.TraceLogger is not null)
|
||||||
|
{
|
||||||
|
SelectedItem.TraceLogger.TraceLoggerEntries.Clear();
|
||||||
|
}
|
||||||
if (SelectedItem is LimitCurvesCalculator calculator)
|
if (SelectedItem is LimitCurvesCalculator calculator)
|
||||||
{
|
{
|
||||||
if (calculator.TraceLogger is not null) { calculator.TraceLogger.TraceLoggerEntries.Clear(); }
|
|
||||||
var inputData = calculator.InputData;
|
var inputData = calculator.InputData;
|
||||||
ShowInteractionDiagramByInputData(calculator);
|
ShowInteractionDiagramByInputData(calculator);
|
||||||
if (calculator.TraceLogger is not null)
|
|
||||||
{
|
|
||||||
var wnd = new TraceDocumentView(calculator.TraceLogger.TraceLoggerEntries);
|
|
||||||
wnd.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -151,13 +144,17 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
if (result.IsValid == false)
|
if (result.IsValid == false)
|
||||||
{
|
{
|
||||||
MessageBox.Show(result.Description, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
MessageBox.Show(result.Description, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProcessResult();
|
ProcessResult();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (SelectedItem.TraceLogger is not null)
|
||||||
|
{
|
||||||
|
var wnd = new TraceDocumentView(SelectedItem.TraceLogger.TraceLoggerEntries);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowInteractionDiagramByInputData(LimitCurvesCalculator calculator)
|
private void ShowInteractionDiagramByInputData(LimitCurvesCalculator calculator)
|
||||||
@@ -187,7 +184,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AnalysisVewModelLogic(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
|
public AnalysisViewModelLogic(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
|
||||||
{
|
{
|
||||||
repository = sectionRepository;
|
repository = sectionRepository;
|
||||||
}
|
}
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|
||||||
{
|
|
||||||
public class CrossSectionViewVisualProperty
|
|
||||||
{
|
|
||||||
public double AxisLineThickness { get; set; }
|
|
||||||
public double GridLineThickness { get; set; }
|
|
||||||
public double GridSize { get; set; }
|
|
||||||
public double WorkPlainWidth { get; set; }
|
|
||||||
public double WorkPlainHeight { get; set; }
|
|
||||||
|
|
||||||
public CrossSectionViewVisualProperty()
|
|
||||||
{
|
|
||||||
AxisLineThickness = 2d;
|
|
||||||
GridLineThickness = 0.25d;
|
|
||||||
GridSize = 0.05d;
|
|
||||||
WorkPlainWidth = 2.4d;
|
|
||||||
WorkPlainHeight = 2.0d;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +1,33 @@
|
|||||||
using FieldVisualizer.ViewModels;
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Infrastructure.Enums;
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelper.Services.Settings;
|
||||||
|
using StructureHelper.Windows.PrimitiveProperiesWindow;
|
||||||
|
using StructureHelper.Windows.PrimitiveTemplates.RCs.Beams;
|
||||||
|
using StructureHelper.Windows.PrimitiveTemplates.RCs.RectangleBeam;
|
||||||
|
using StructureHelper.Windows.Services;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Models.Materials;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
||||||
|
using StructureHelperLogics.Models.Templates.RCs;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using StructureHelper.Services.Primitives;
|
|
||||||
using StructureHelper.Infrastructure;
|
|
||||||
using StructureHelper.Infrastructure.Enums;
|
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
|
||||||
using StructureHelperLogics.Models.Primitives;
|
|
||||||
using ViewModelBase = StructureHelper.Infrastructure.ViewModelBase;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Windows.Documents;
|
|
||||||
using StructureHelper.Windows.PrimitiveProperiesWindow;
|
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||||
{
|
{
|
||||||
public class PrimitiveViewModelLogic : ViewModelBase, ICRUDViewModel<PrimitiveBase>
|
public class PrimitiveViewModelLogic : ViewModelBase, ICRUDViewModel<PrimitiveBase>, IRectangleShape, IObservable<PrimitiveBase>
|
||||||
{
|
{
|
||||||
private ICrossSection section;
|
private ICrossSection section;
|
||||||
private ICrossSectionRepository repository => section.SectionRepository;
|
private ICrossSectionRepository repository => section.SectionRepository;
|
||||||
@@ -32,9 +37,11 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
private ICommand copyCommand;
|
private ICommand copyCommand;
|
||||||
private ICommand setToFront;
|
private ICommand setToFront;
|
||||||
private ICommand setToBack;
|
private ICommand setToBack;
|
||||||
|
private ICommand copyToCommand;
|
||||||
|
|
||||||
public double CanvasWidth { get; set; }
|
|
||||||
public double CanvasHeight { get; set; }
|
public double Width { get; set; }
|
||||||
|
public double Height { get; set; }
|
||||||
|
|
||||||
public PrimitiveBase SelectedItem { get; set; }
|
public PrimitiveBase SelectedItem { get; set; }
|
||||||
|
|
||||||
@@ -44,14 +51,12 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return addCommand ??
|
return addCommand ??= new RelayCommand(o =>
|
||||||
(
|
|
||||||
addCommand = new RelayCommand(o =>
|
|
||||||
{
|
{
|
||||||
if (!(o is PrimitiveType primitiveType)) return;
|
if (o is not PrimitiveType primitiveType) return;
|
||||||
AddPrimitive(primitiveType);
|
AddPrimitive(primitiveType);
|
||||||
}
|
}
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +103,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
viewPrimitive = new CircleViewPrimitive(primitive);
|
viewPrimitive = new CircleViewPrimitive(primitive);
|
||||||
}
|
}
|
||||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(primitiveType)); }
|
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(primitiveType)); }
|
||||||
viewPrimitive.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
viewPrimitive.OnNext(this);
|
||||||
repository.Primitives.Add(ndmPrimitive);
|
repository.Primitives.Add(ndmPrimitive);
|
||||||
ndmPrimitive.CrossSection = section;
|
ndmPrimitive.CrossSection = section;
|
||||||
Items.Add(viewPrimitive);
|
Items.Add(viewPrimitive);
|
||||||
@@ -183,24 +188,55 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return copyCommand ??
|
return copyCommand ??= new RelayCommand(
|
||||||
|
o => CopySelectedItem(SelectedItem.GetNdmPrimitive()),
|
||||||
|
o => SelectedItem != null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand CopyTo
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return copyToCommand ??
|
||||||
(
|
(
|
||||||
copyCommand = new RelayCommand(
|
copyToCommand = new RelayCommand(
|
||||||
o => CopySelectedItem(),
|
o => CopyToSelectedItem(SelectedItem.GetNdmPrimitive()),
|
||||||
o => SelectedItem != null
|
o => SelectedItem != null
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CopySelectedItem()
|
private void CopyToSelectedItem(INdmPrimitive ndmPrimitive)
|
||||||
|
{
|
||||||
|
var copyByParameterVM = new CopyByParameterViewModel(ndmPrimitive.Center);
|
||||||
|
var wnd = new CopyByParameterView(copyByParameterVM);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
if (wnd.DialogResult != true) { return;}
|
||||||
|
var points = copyByParameterVM.GetNewItemCenters();
|
||||||
|
foreach (var item in points)
|
||||||
|
{
|
||||||
|
var newPrimitive = CopySelectedItem(ndmPrimitive);
|
||||||
|
newPrimitive.CenterX = item.X;
|
||||||
|
newPrimitive.CenterY = item.Y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PrimitiveBase CopySelectedItem(INdmPrimitive oldPrimitive)
|
||||||
{
|
{
|
||||||
var oldPrimitive = SelectedItem.GetNdmPrimitive();
|
|
||||||
var newPrimitive = oldPrimitive.Clone() as INdmPrimitive;
|
var newPrimitive = oldPrimitive.Clone() as INdmPrimitive;
|
||||||
newPrimitive.Name += " copy";
|
newPrimitive.Name += " copy";
|
||||||
repository.Primitives.Add(newPrimitive);
|
repository.Primitives.Add(newPrimitive);
|
||||||
PrimitiveBase primitiveBase;
|
PrimitiveBase primitiveBase;
|
||||||
if (newPrimitive is IRectanglePrimitive) { primitiveBase = new RectangleViewPrimitive(newPrimitive as IRectanglePrimitive); }
|
if (newPrimitive is IRectanglePrimitive)
|
||||||
else if (newPrimitive is ICirclePrimitive) { primitiveBase = new CircleViewPrimitive(newPrimitive as ICirclePrimitive); }
|
{
|
||||||
|
primitiveBase = new RectangleViewPrimitive(newPrimitive as IRectanglePrimitive);
|
||||||
|
}
|
||||||
|
else if (newPrimitive is ICirclePrimitive)
|
||||||
|
{
|
||||||
|
primitiveBase = new CircleViewPrimitive(newPrimitive as ICirclePrimitive);
|
||||||
|
}
|
||||||
else if (newPrimitive is IPointPrimitive)
|
else if (newPrimitive is IPointPrimitive)
|
||||||
{
|
{
|
||||||
if (newPrimitive is RebarPrimitive)
|
if (newPrimitive is RebarPrimitive)
|
||||||
@@ -213,11 +249,15 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
|
else
|
||||||
primitiveBase.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
|
||||||
|
}
|
||||||
|
primitiveBase.OnNext(this);
|
||||||
Items.Add(primitiveBase);
|
Items.Add(primitiveBase);
|
||||||
OnPropertyChanged(nameof(Items));
|
OnPropertyChanged(nameof(Items));
|
||||||
OnPropertyChanged(nameof(PrimitivesCount));
|
OnPropertyChanged(nameof(PrimitivesCount));
|
||||||
|
return primitiveBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int PrimitivesCount => repository.Primitives.Count();
|
public int PrimitivesCount => repository.Primitives.Count();
|
||||||
@@ -226,13 +266,12 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return setToFront ??
|
return setToFront ??= new RelayCommand(o=>
|
||||||
(setToFront = new RelayCommand(o=>
|
|
||||||
{
|
{
|
||||||
int maxZIndex = Items.Select(x => x.GetNdmPrimitive().VisualProperty.ZIndex).Max();
|
int maxZIndex = Items.Select(x => x.GetNdmPrimitive().VisualProperty.ZIndex).Max();
|
||||||
SelectedItem.ZIndex = maxZIndex + 1;
|
SelectedItem.ZIndex = maxZIndex + 1;
|
||||||
},o => CheckMaxIndex()
|
},o => CheckMaxIndex()
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private bool CheckMaxIndex()
|
private bool CheckMaxIndex()
|
||||||
@@ -255,16 +294,17 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return setToBack ??
|
return setToBack ??= new RelayCommand(o =>
|
||||||
(setToBack = new RelayCommand(o =>
|
|
||||||
{
|
{
|
||||||
int minZIndex = Items.Select(x => x.GetNdmPrimitive().VisualProperty.ZIndex).Min();
|
int minZIndex = Items.Select(x => x.GetNdmPrimitive().VisualProperty.ZIndex).Min();
|
||||||
SelectedItem.ZIndex = minZIndex - 1;
|
SelectedItem.ZIndex = minZIndex - 1;
|
||||||
}, o => CheckMinIndex()
|
}, o => CheckMinIndex()
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double Angle { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||||
|
|
||||||
public void AddItems(IEnumerable<PrimitiveBase> items)
|
public void AddItems(IEnumerable<PrimitiveBase> items)
|
||||||
{
|
{
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
@@ -275,14 +315,29 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
|
|
||||||
public void Refresh()
|
public void Refresh()
|
||||||
{
|
{
|
||||||
|
NotifyObservers();
|
||||||
OnPropertyChanged(nameof(PrimitivesCount));
|
OnPropertyChanged(nameof(PrimitivesCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void NotifyObservers()
|
||||||
|
{
|
||||||
|
foreach (var item in Items)
|
||||||
|
{
|
||||||
|
item.OnNext(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDisposable Subscribe(IObserver<PrimitiveBase> observer)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public PrimitiveViewModelLogic(ICrossSection section)
|
public PrimitiveViewModelLogic(ICrossSection section)
|
||||||
{
|
{
|
||||||
this.section = section;
|
this.section = section;
|
||||||
Items = new ObservableCollection<PrimitiveBase>();
|
Items = new ObservableCollection<PrimitiveBase>();
|
||||||
AddItems(PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(this.repository.Primitives));
|
AddItems(PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(this.repository.Primitives));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
using StructureHelper.Infrastructure;
|
using LoaderCalculator;
|
||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
@@ -98,6 +101,13 @@ namespace StructureHelper.Windows.ViewModels
|
|||||||
{
|
{
|
||||||
NewItem = (SelectedItem as ICloneable).Clone() as TItem;
|
NewItem = (SelectedItem as ICloneable).Clone() as TItem;
|
||||||
}
|
}
|
||||||
|
if (SelectedItem is ILogic logic)
|
||||||
|
{
|
||||||
|
if (logic.TraceLogger is not null)
|
||||||
|
{
|
||||||
|
(NewItem as ILogic).TraceLogger = logic.TraceLogger.GetSimilarTraceLogger();
|
||||||
|
}
|
||||||
|
}
|
||||||
Collection.Add(NewItem);
|
Collection.Add(NewItem);
|
||||||
Items.Add(NewItem);
|
Items.Add(NewItem);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,5 +25,7 @@
|
|||||||
public static string ExpectedWas(System.Type expected, object obj) => ExpectedWas(expected, obj.GetType());
|
public static string ExpectedWas(System.Type expected, object obj) => ExpectedWas(expected, obj.GetType());
|
||||||
public static string NullReference => "#0018: Null reference";
|
public static string NullReference => "#0018: Null reference";
|
||||||
public static string ObjectNotFound => "#0018: Object not found";
|
public static string ObjectNotFound => "#0018: Object not found";
|
||||||
|
public static string ErrorDuring(string operation) => string.Format("Errors appeared during {0}, see detailed information", operation);
|
||||||
|
public static string CalculationError => "#0019: Error of calculation";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
StructureHelperCommon/Infrastructures/Interfaces/ILogic.cs
Normal file
15
StructureHelperCommon/Infrastructures/Interfaces/ILogic.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using StructureHelperCommon.Models;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Base interface for logic
|
||||||
|
/// </summary>
|
||||||
|
public interface ILogic
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Logger for tracing of actions
|
||||||
|
/// </summary>
|
||||||
|
IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
using StructureHelperCommon.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -10,14 +10,12 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||||
{
|
{
|
||||||
public interface ILongProcessLogic
|
public interface ILongProcessLogic : ILogic
|
||||||
{
|
{
|
||||||
int StepCount { get; }
|
int StepCount { get; }
|
||||||
Action<int> SetProgress { get; set; }
|
Action<int> SetProgress { get; set; }
|
||||||
bool Result { get; set; }
|
bool Result { get; set; }
|
||||||
|
|
||||||
IShiftTraceLogger? TraceLogger { get; set; }
|
|
||||||
|
|
||||||
void WorkerDoWork(object sender, DoWorkEventArgs e);
|
void WorkerDoWork(object sender, DoWorkEventArgs e);
|
||||||
void WorkerProgressChanged(object sender, ProgressChangedEventArgs e);
|
void WorkerProgressChanged(object sender, ProgressChangedEventArgs e);
|
||||||
void WorkerRunWorkCompleted(object sender, RunWorkerCompletedEventArgs e);
|
void WorkerRunWorkCompleted(object sender, RunWorkerCompletedEventArgs e);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -51,31 +52,31 @@ namespace StructureHelperCommon.Models.Calculators
|
|||||||
TraceLogger?.AddMessage($"Calculating parameter by iterations is started,\nrequired precision {Accuracy.IterationAccuracy}");
|
TraceLogger?.AddMessage($"Calculating parameter by iterations is started,\nrequired precision {Accuracy.IterationAccuracy}");
|
||||||
if (predicate(end) == false)
|
if (predicate(end) == false)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage($"Predicate for end value must be true", TraceLoggerStatuses.Error);
|
TraceLogger?.AddMessage($"Predicate for end value must be true", TraceLogStatuses.Error);
|
||||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": predicate for end value must be true");
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": predicate for end value must be true");
|
||||||
}
|
}
|
||||||
double precision = Accuracy.IterationAccuracy;
|
double precision = Accuracy.IterationAccuracy;
|
||||||
int maxIterationCount = Accuracy.MaxIterationCount;
|
int maxIterationCount = Accuracy.MaxIterationCount;
|
||||||
double current = start;
|
double current = start;
|
||||||
double step = (end - start) / 2;
|
double step = (end - start) / 2d;
|
||||||
int iterationNum = 0;
|
int iterationNum = 0;
|
||||||
while (step > precision)
|
while (step > precision)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage($"Iteration number {iterationNum} is started", TraceLoggerStatuses.Debug);
|
TraceLogger?.AddMessage($"Iteration number {iterationNum} is started", TraceLogStatuses.Debug);
|
||||||
if (predicate(current) == true)
|
if (predicate(current) == true)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage($"Predicate value in {current} is true", TraceLoggerStatuses.Debug, 50);
|
TraceLogger?.AddMessage($"Predicate value in {current} is true", TraceLogStatuses.Debug, 50);
|
||||||
end = current;
|
end = current;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage($"Predicate value in {current} is false", TraceLoggerStatuses.Debug, 50);
|
TraceLogger?.AddMessage($"Predicate value in {current} is false", TraceLogStatuses.Debug, 50);
|
||||||
start = current;
|
start = current;
|
||||||
}
|
}
|
||||||
TraceLogger?.AddMessage($"New current value Cur=({start}+{end})/2={current}", TraceLoggerStatuses.Debug);
|
|
||||||
current = (start + end) / 2d;
|
current = (start + end) / 2d;
|
||||||
|
TraceLogger?.AddMessage($"New current value Cur=({start}+{end})/2={current}", TraceLogStatuses.Debug);
|
||||||
step = (end - start) / 2d;
|
step = (end - start) / 2d;
|
||||||
TraceLogger?.AddMessage($"New step S={current}", TraceLoggerStatuses.Debug, 50);
|
TraceLogger?.AddMessage($"New step S={current}", TraceLogStatuses.Debug, 50);
|
||||||
iterationNum++;
|
iterationNum++;
|
||||||
|
|
||||||
result.IsValid = false;
|
result.IsValid = false;
|
||||||
@@ -85,7 +86,7 @@ namespace StructureHelperCommon.Models.Calculators
|
|||||||
|
|
||||||
if (iterationNum > maxIterationCount)
|
if (iterationNum > maxIterationCount)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage($"Recuired precision was not achieved, current step {step}, required precision {precision}", TraceLoggerStatuses.Error);
|
TraceLogger?.AddMessage($"Recuired precision was not achieved, current step {step}, required precision {precision}", TraceLogStatuses.Error);
|
||||||
result.Description = "Parameter was not found succefully: \n";
|
result.Description = "Parameter was not found succefully: \n";
|
||||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": violation of iteration count");
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": violation of iteration count");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,10 @@
|
|||||||
using LoaderCalculator.Data.ResultData;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using TaskManager;
|
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Calculators
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
{
|
{
|
||||||
public interface ICalculator : ICloneable
|
public interface ICalculator : ILogic, ICloneable
|
||||||
{
|
{
|
||||||
IShiftTraceLogger? TraceLogger { get; set; }
|
|
||||||
string Name { get; set; }
|
string Name { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Method for calculating
|
/// Method for calculating
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
{
|
{
|
||||||
public LimitStates LimitState { get; set; }
|
public LimitStates LimitState { get; set; }
|
||||||
public CalcTerms CalcTerm { get; set; }
|
public CalcTerms CalcTerm { get; set; }
|
||||||
public ForceTuple ForceTuple { get; set; }
|
public IForceTuple ForceTuple { get; set; }
|
||||||
|
|
||||||
public DesignForceTuple(LimitStates limitState, CalcTerms calcTerm) : this()
|
public DesignForceTuple(LimitStates limitState, CalcTerms calcTerm) : this()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
{
|
{
|
||||||
LimitStates LimitState { get; set; }
|
LimitStates LimitState { get; set; }
|
||||||
CalcTerms CalcTerm { get; set; }
|
CalcTerms CalcTerm { get; set; }
|
||||||
ForceTuple ForceTuple { get; set; }
|
IForceTuple ForceTuple { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Models.Tables;
|
using StructureHelperCommon.Models.Tables;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -6,76 +7,224 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Loggers
|
namespace StructureHelperCommon.Models
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Factory for creating trace table entries
|
||||||
|
/// </summary>
|
||||||
public class TraceTablesFactory
|
public class TraceTablesFactory
|
||||||
{
|
{
|
||||||
public int Priority { get; set; }
|
public int Priority { get; set; }
|
||||||
public TraceTablesFactory(TraceLoggerStatuses status = TraceLoggerStatuses.Info, int priorityShift = 0)
|
/// <summary>
|
||||||
|
/// Generates table entry for Point2D (2 columns, 2 rows)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="point2D">Point fo creating a table</param>
|
||||||
|
/// <returns>Table entry</returns>
|
||||||
|
public TableLogEntry GetByPoint2D(IPoint2D point2D)
|
||||||
{
|
{
|
||||||
Priority = LoggerService.GetPriorityByStatus(status) + priorityShift;
|
var table = new TableLogEntry(2);
|
||||||
}
|
|
||||||
public TableLoggerEntry GetTableByPoint2D(IPoint2D point2D)
|
|
||||||
{
|
|
||||||
var table = new TableLoggerEntry(2);
|
|
||||||
table.Priority = Priority;
|
table.Priority = Priority;
|
||||||
table.Table.AddRow(GetHeaderRow());
|
table.Table.AddRow(GetPoint2DHeaderRow());
|
||||||
table.Table.AddRow(GetPointRow(point2D));
|
table.Table.AddRow(GetPoint2DRow(point2D));
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
public TableLoggerEntry GetTableByPoint2D(IEnumerable<IPoint2D> points)
|
/// <summary>
|
||||||
|
/// Generates a table representation for the provided force tuple
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="forceTuple">Force tuple to create the table for</param>
|
||||||
|
/// <returns>Table entry</returns>
|
||||||
|
public TableLogEntry GetByForceTuple(IForceTuple forceTuple)
|
||||||
{
|
{
|
||||||
var table = new TableLoggerEntry(2);
|
var table = new TableLogEntry(6);
|
||||||
table.Priority = Priority;
|
table.Priority = Priority;
|
||||||
table.Table.AddRow(GetHeaderRow());
|
table.Table.AddRow(GetForceTupleHeaderRow(forceTuple));
|
||||||
|
table.Table.AddRow(GetForceTupleRow(forceTuple));
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Generates table entry for Point2D (2 columns, (number of poins + 1) rows)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="points">Collection of points for creating a table</param>
|
||||||
|
/// <returns>Table entry</returns>
|
||||||
|
public TableLogEntry GetByPoint2D(IEnumerable<IPoint2D> points)
|
||||||
|
{
|
||||||
|
var table = new TableLogEntry(2);
|
||||||
|
table.Priority = Priority;
|
||||||
|
table.Table.AddRow(GetPoint2DHeaderRow());
|
||||||
foreach (var item in points)
|
foreach (var item in points)
|
||||||
{
|
{
|
||||||
table.Table.AddRow(GetPointRow(item));
|
table.Table.AddRow(GetPoint2DRow(item));
|
||||||
}
|
}
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
private ShTableRow<ITraceLoggerEntry> GetHeaderRow()
|
/// Generates a table representation for the provided force tuple collection
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="forceTuples">Force tuple collection to create the table for</param>
|
||||||
|
/// <returns>Table entry</returns>
|
||||||
|
public TableLogEntry GetByForceTuple(IEnumerable<IForceTuple> forceTuples)
|
||||||
{
|
{
|
||||||
|
var table = new TableLogEntry(6);
|
||||||
|
table.Priority = Priority;
|
||||||
|
//type of force tuple for creating a header is taken by first member
|
||||||
|
var firstMember = forceTuples.First();
|
||||||
|
table.Table.AddRow(GetForceTupleHeaderRow(firstMember));
|
||||||
|
foreach (var forceTuple in forceTuples)
|
||||||
|
{
|
||||||
|
table.Table.AddRow(GetForceTupleRow(forceTuple));
|
||||||
|
}
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Generates new trace table entry
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="status">Default status = info</param>
|
||||||
|
public TraceTablesFactory(TraceLogStatuses status = TraceLogStatuses.Info)
|
||||||
|
{
|
||||||
|
Priority = LoggerService.GetPriorityByStatus(status);
|
||||||
|
}
|
||||||
|
private ShTableRow<ITraceLoggerEntry> GetForceTupleHeaderRow(IForceTuple forceTuple)
|
||||||
|
{
|
||||||
|
const CellRole cellRole = CellRole.Header;
|
||||||
|
string[] ColumnList = new string[] { "Mx", "My", "Nz", "Qx", "Qy", "Mz" };
|
||||||
|
if (forceTuple is StrainTuple)
|
||||||
|
{
|
||||||
|
ColumnList = new string[] { "Kx", "Ky", "EpsZ", "GammaX", "GammaY", "Kz" };
|
||||||
|
}
|
||||||
|
|
||||||
|
var forceTupleRow = new ShTableRow<ITraceLoggerEntry>(6);
|
||||||
|
foreach (var item in forceTupleRow.Elements)
|
||||||
|
{
|
||||||
|
item.Role = cellRole;
|
||||||
|
}
|
||||||
|
|
||||||
|
forceTupleRow.Elements[0].Value = new StringLogEntry()
|
||||||
|
{
|
||||||
|
Message = ColumnList[0],
|
||||||
|
Priority = Priority
|
||||||
|
};
|
||||||
|
|
||||||
|
forceTupleRow.Elements[1].Value = new StringLogEntry()
|
||||||
|
{
|
||||||
|
Message = ColumnList[1],
|
||||||
|
Priority = Priority
|
||||||
|
};
|
||||||
|
|
||||||
|
forceTupleRow.Elements[2].Value = new StringLogEntry()
|
||||||
|
{
|
||||||
|
Message = ColumnList[2],
|
||||||
|
Priority = Priority
|
||||||
|
};
|
||||||
|
|
||||||
|
forceTupleRow.Elements[3].Value = new StringLogEntry()
|
||||||
|
{
|
||||||
|
Message = ColumnList[3],
|
||||||
|
Priority = Priority
|
||||||
|
};
|
||||||
|
|
||||||
|
forceTupleRow.Elements[4].Value = new StringLogEntry()
|
||||||
|
{
|
||||||
|
Message = ColumnList[4],
|
||||||
|
Priority = Priority
|
||||||
|
};
|
||||||
|
|
||||||
|
forceTupleRow.Elements[5].Value = new StringLogEntry()
|
||||||
|
{
|
||||||
|
Message = ColumnList[5],
|
||||||
|
Priority = Priority
|
||||||
|
};
|
||||||
|
|
||||||
|
return forceTupleRow;
|
||||||
|
}
|
||||||
|
private ShTableRow<ITraceLoggerEntry> GetForceTupleRow(IForceTuple forceTuple)
|
||||||
|
{
|
||||||
|
var forceTupleRow = new ShTableRow<ITraceLoggerEntry>(6);
|
||||||
|
|
||||||
|
forceTupleRow.Elements[0].Value = new StringLogEntry()
|
||||||
|
{
|
||||||
|
Message = forceTuple.Mx.ToString(),
|
||||||
|
Priority = Priority
|
||||||
|
};
|
||||||
|
|
||||||
|
forceTupleRow.Elements[1].Value = new StringLogEntry()
|
||||||
|
{
|
||||||
|
Message = forceTuple.My.ToString(),
|
||||||
|
Priority = Priority
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
forceTupleRow.Elements[2].Value = new StringLogEntry()
|
||||||
|
{
|
||||||
|
Message = forceTuple.Nz.ToString(),
|
||||||
|
Priority = Priority
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
forceTupleRow.Elements[3].Value = new StringLogEntry()
|
||||||
|
{
|
||||||
|
Message = forceTuple.Qx.ToString(),
|
||||||
|
Priority = Priority
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
forceTupleRow.Elements[4].Value = new StringLogEntry()
|
||||||
|
{
|
||||||
|
Message = forceTuple.Qy.ToString(),
|
||||||
|
Priority = Priority
|
||||||
|
};
|
||||||
|
|
||||||
|
forceTupleRow.Elements[5].Value = new StringLogEntry()
|
||||||
|
{
|
||||||
|
Message = forceTuple.Mz.ToString(),
|
||||||
|
Priority = Priority
|
||||||
|
};
|
||||||
|
|
||||||
|
return forceTupleRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ShTableRow<ITraceLoggerEntry> GetPoint2DHeaderRow()
|
||||||
|
{
|
||||||
|
const CellRole cellRole = CellRole.Header;
|
||||||
|
|
||||||
var headerRow = new ShTableRow<ITraceLoggerEntry>(2);
|
var headerRow = new ShTableRow<ITraceLoggerEntry>(2);
|
||||||
IShTableCell<ITraceLoggerEntry> tableCell;
|
IShTableCell<ITraceLoggerEntry> tableCell;
|
||||||
ITraceLoggerEntry loggerEntry;
|
ITraceLoggerEntry loggerEntry;
|
||||||
loggerEntry = new StringLoggerEntry()
|
loggerEntry = new StringLogEntry()
|
||||||
{
|
{
|
||||||
Message = "X",
|
Message = "X",
|
||||||
Priority = LoggerService.GetPriorityByStatus(TraceLoggerStatuses.Info)
|
Priority = Priority
|
||||||
};
|
};
|
||||||
tableCell = new ShTableCell<ITraceLoggerEntry>()
|
tableCell = new ShTableCell<ITraceLoggerEntry>()
|
||||||
{
|
{
|
||||||
Value = loggerEntry,
|
Value = loggerEntry,
|
||||||
Role = CellRole.Header,
|
Role = cellRole,
|
||||||
};
|
};
|
||||||
headerRow.Elements[0] = tableCell;
|
headerRow.Elements[0] = tableCell;
|
||||||
loggerEntry = new StringLoggerEntry()
|
loggerEntry = new StringLogEntry()
|
||||||
{
|
{
|
||||||
Message = "Y",
|
Message = "Y",
|
||||||
Priority = LoggerService.GetPriorityByStatus(TraceLoggerStatuses.Info)
|
Priority = Priority
|
||||||
};
|
};
|
||||||
tableCell = new ShTableCell<ITraceLoggerEntry>()
|
tableCell = new ShTableCell<ITraceLoggerEntry>()
|
||||||
{
|
{
|
||||||
Value = loggerEntry,
|
Value = loggerEntry,
|
||||||
Role = CellRole.Header,
|
Role = cellRole,
|
||||||
};
|
};
|
||||||
headerRow.Elements[1] = tableCell;
|
headerRow.Elements[1] = tableCell;
|
||||||
return headerRow;
|
return headerRow;
|
||||||
}
|
}
|
||||||
private ShTableRow<ITraceLoggerEntry> GetPointRow(IPoint2D point2D)
|
private ShTableRow<ITraceLoggerEntry> GetPoint2DRow(IPoint2D point2D)
|
||||||
{
|
{
|
||||||
var pointRow = new ShTableRow<ITraceLoggerEntry>(2);
|
var pointRow = new ShTableRow<ITraceLoggerEntry>(2);
|
||||||
pointRow.Elements[0].Value = new StringLoggerEntry()
|
pointRow.Elements[0].Value = new StringLogEntry()
|
||||||
{
|
{
|
||||||
Message = Convert.ToString(point2D.X),
|
Message = Convert.ToString(point2D.X),
|
||||||
Priority = LoggerService.GetPriorityByStatus(TraceLoggerStatuses.Info)
|
Priority = LoggerService.GetPriorityByStatus(TraceLogStatuses.Info)
|
||||||
};
|
};
|
||||||
pointRow.Elements[1].Value = new StringLoggerEntry()
|
pointRow.Elements[1].Value = new StringLogEntry()
|
||||||
{
|
{
|
||||||
Message = Convert.ToString(point2D.Y),
|
Message = Convert.ToString(point2D.Y),
|
||||||
Priority = LoggerService.GetPriorityByStatus(TraceLoggerStatuses.Info)
|
Priority = LoggerService.GetPriorityByStatus(TraceLogStatuses.Info)
|
||||||
};
|
};
|
||||||
return pointRow;
|
return pointRow;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Loggers
|
namespace StructureHelperCommon.Models
|
||||||
{
|
{
|
||||||
public interface ILogger
|
public interface ILogger
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Loggers
|
namespace StructureHelperCommon.Models
|
||||||
{
|
{
|
||||||
public interface IShiftTraceLogger : ITraceLogger
|
public interface IShiftTraceLogger : ITraceLogger
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Loggers
|
namespace StructureHelperCommon.Models
|
||||||
{
|
{
|
||||||
public interface ITraceLogger
|
public interface ITraceLogger
|
||||||
{
|
{
|
||||||
List<ITraceLoggerEntry> TraceLoggerEntries { get; }
|
List<ITraceLoggerEntry> TraceLoggerEntries { get; }
|
||||||
void AddMessage(string message, TraceLoggerStatuses status = TraceLoggerStatuses.Info, int shiftPriority = 0);
|
void AddMessage(string message, TraceLogStatuses status = TraceLogStatuses.Info, int shiftPriority = 0);
|
||||||
void AddMessage(string message, int priority);
|
void AddMessage(string message, int priority);
|
||||||
|
bool KeepErrorStatus { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Loggers
|
namespace StructureHelperCommon.Models
|
||||||
{
|
{
|
||||||
public interface ITraceLoggerEntry
|
public interface ITraceLoggerEntry
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Loggers
|
namespace StructureHelperCommon.Models
|
||||||
{
|
{
|
||||||
public static class LoggerService
|
public static class LoggerService
|
||||||
{
|
{
|
||||||
@@ -16,14 +16,14 @@ namespace StructureHelperCommon.Models.Loggers
|
|||||||
const int info = 300;
|
const int info = 300;
|
||||||
const int service = 400;
|
const int service = 400;
|
||||||
const int debug = 500;
|
const int debug = 500;
|
||||||
public static int GetPriorityByStatus(TraceLoggerStatuses status)
|
public static int GetPriorityByStatus(TraceLogStatuses status)
|
||||||
{
|
{
|
||||||
if (status == TraceLoggerStatuses.Fatal) { return fatal; }
|
if (status == TraceLogStatuses.Fatal) { return fatal; }
|
||||||
else if (status == TraceLoggerStatuses.Error) { return error; }
|
else if (status == TraceLogStatuses.Error) { return error; }
|
||||||
else if (status == TraceLoggerStatuses.Warning) { return warning; }
|
else if (status == TraceLogStatuses.Warning) { return warning; }
|
||||||
else if (status == TraceLoggerStatuses.Info) { return info; }
|
else if (status == TraceLogStatuses.Info) { return info; }
|
||||||
else if (status == TraceLoggerStatuses.Service) { return service; }
|
else if (status == TraceLogStatuses.Service) { return service; }
|
||||||
else if (status == TraceLoggerStatuses.Debug) { return debug; }
|
else if (status == TraceLogStatuses.Debug) { return debug; }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(status));
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(status));
|
||||||
|
|||||||
19
StructureHelperCommon/Models/Loggers/LoggerStrings.cs
Normal file
19
StructureHelperCommon/Models/Loggers/LoggerStrings.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Loggers
|
||||||
|
{
|
||||||
|
public static class LoggerStrings
|
||||||
|
{
|
||||||
|
public static string DimensionLess => "(dimensionless)";
|
||||||
|
public static string MethodBasedOn => "Method of calculation based on ";
|
||||||
|
public static string CalculationHasDone => "Calculation has done succesfully";
|
||||||
|
public static string Summary => "Summary";
|
||||||
|
public static string Maximum => "Maximum";
|
||||||
|
public static string Minimum => "Minimum";
|
||||||
|
public static string CalculatorType(object obj) => string.Format("Calculator type: {0}", obj.GetType());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Loggers
|
namespace StructureHelperCommon.Models
|
||||||
{
|
{
|
||||||
public class ShiftTraceLogger : IShiftTraceLogger
|
public class ShiftTraceLogger : IShiftTraceLogger
|
||||||
{
|
{
|
||||||
@@ -12,15 +12,18 @@ namespace StructureHelperCommon.Models.Loggers
|
|||||||
public int ShiftPriority { get; set; }
|
public int ShiftPriority { get; set; }
|
||||||
|
|
||||||
public List<ITraceLoggerEntry> TraceLoggerEntries => Logger.TraceLoggerEntries;
|
public List<ITraceLoggerEntry> TraceLoggerEntries => Logger.TraceLoggerEntries;
|
||||||
|
public bool KeepErrorStatus { get => Logger.KeepErrorStatus; set => Logger.KeepErrorStatus = value; }
|
||||||
|
|
||||||
public ShiftTraceLogger(ITraceLogger logger)
|
public ShiftTraceLogger(ITraceLogger logger)
|
||||||
{
|
{
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
|
KeepErrorStatus = true;
|
||||||
}
|
}
|
||||||
public ShiftTraceLogger() : this(new TraceLogger()) { }
|
public ShiftTraceLogger() : this(new TraceLogger()) { }
|
||||||
public void AddMessage(string message, TraceLoggerStatuses status = TraceLoggerStatuses.Info, int shiftPrioriry = 0)
|
public void AddMessage(string message, TraceLogStatuses status = TraceLogStatuses.Info, int shiftPrioriry = 0)
|
||||||
{
|
{
|
||||||
// if status in (fatal, error, warning) they must be kept as they are
|
// if status in (fatal, error, warning) they must be kept as they are
|
||||||
if (status <= TraceLoggerStatuses.Warning)
|
if (status <= TraceLogStatuses.Warning & KeepErrorStatus == true)
|
||||||
{
|
{
|
||||||
Logger.AddMessage(message, status);
|
Logger.AddMessage(message, status);
|
||||||
}
|
}
|
||||||
@@ -41,14 +44,17 @@ namespace StructureHelperCommon.Models.Loggers
|
|||||||
{
|
{
|
||||||
var newLogger = new ShiftTraceLogger(Logger)
|
var newLogger = new ShiftTraceLogger(Logger)
|
||||||
{
|
{
|
||||||
ShiftPriority = shiftPriority
|
ShiftPriority = ShiftPriority + shiftPriority
|
||||||
};
|
};
|
||||||
return newLogger;
|
return newLogger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddEntry(ITraceLoggerEntry loggerEntry)
|
public void AddEntry(ITraceLoggerEntry loggerEntry)
|
||||||
|
{
|
||||||
|
if (loggerEntry.Priority >= LoggerService.GetPriorityByStatus(TraceLogStatuses.Warning))
|
||||||
{
|
{
|
||||||
loggerEntry.Priority += ShiftPriority;
|
loggerEntry.Priority += ShiftPriority;
|
||||||
|
}
|
||||||
Logger.TraceLoggerEntries.Add(loggerEntry);
|
Logger.TraceLoggerEntries.Add(loggerEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Loggers
|
namespace StructureHelperCommon.Models
|
||||||
{
|
{
|
||||||
public class StringLoggerEntry : ITraceLoggerEntry
|
public class StringLogEntry : ITraceLoggerEntry
|
||||||
{
|
{
|
||||||
public DateTime TimeStamp { get;}
|
public DateTime TimeStamp { get;}
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
public int Priority { get; set; }
|
public int Priority { get; set; }
|
||||||
|
|
||||||
public StringLoggerEntry()
|
public StringLogEntry()
|
||||||
{
|
{
|
||||||
TimeStamp = DateTime.Now;
|
TimeStamp = DateTime.Now;
|
||||||
}
|
}
|
||||||
@@ -5,16 +5,16 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Loggers
|
namespace StructureHelperCommon.Models
|
||||||
{
|
{
|
||||||
public class TableLoggerEntry : ITraceLoggerEntry
|
public class TableLogEntry : ITraceLoggerEntry
|
||||||
{
|
{
|
||||||
private ShTable<ITraceLoggerEntry> table;
|
private ShTable<ITraceLoggerEntry> table;
|
||||||
public ShTable<ITraceLoggerEntry> Table {get => table;}
|
public ShTable<ITraceLoggerEntry> Table {get => table;}
|
||||||
public DateTime TimeStamp { get; }
|
public DateTime TimeStamp { get; }
|
||||||
|
|
||||||
public int Priority { get; set; }
|
public int Priority { get; set; }
|
||||||
public TableLoggerEntry(int rowSize)
|
public TableLogEntry(int rowSize)
|
||||||
{
|
{
|
||||||
if (rowSize <= 0)
|
if (rowSize <= 0)
|
||||||
{
|
{
|
||||||
@@ -4,9 +4,9 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Loggers
|
namespace StructureHelperCommon.Models
|
||||||
{
|
{
|
||||||
public enum TraceLoggerStatuses
|
public enum TraceLogStatuses
|
||||||
{
|
{
|
||||||
Fatal,
|
Fatal,
|
||||||
Error,
|
Error,
|
||||||
@@ -6,23 +6,25 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Loggers
|
namespace StructureHelperCommon.Models
|
||||||
{
|
{
|
||||||
public class TraceLogger : ITraceLogger
|
public class TraceLogger : ITraceLogger
|
||||||
{
|
{
|
||||||
public List<ITraceLoggerEntry> TraceLoggerEntries { get; }
|
public List<ITraceLoggerEntry> TraceLoggerEntries { get; }
|
||||||
|
public bool KeepErrorStatus { get; set; }
|
||||||
|
|
||||||
public TraceLogger()
|
public TraceLogger()
|
||||||
{
|
{
|
||||||
TraceLoggerEntries = new();
|
TraceLoggerEntries = new();
|
||||||
|
KeepErrorStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddMessage(string message, TraceLoggerStatuses status = TraceLoggerStatuses.Info, int shiftPrioriry = 0)
|
public void AddMessage(string message, TraceLogStatuses status = TraceLogStatuses.Info, int shiftPrioriry = 0)
|
||||||
{
|
{
|
||||||
if (status == TraceLoggerStatuses.Fatal) { message = $"Fatal error! {message}"; }
|
if (status == TraceLogStatuses.Fatal) { message = $"Fatal error! {message}"; }
|
||||||
if (status == TraceLoggerStatuses.Error) { message = $"Error! {message}"; }
|
if (status == TraceLogStatuses.Error) { message = $"Error! {message}"; }
|
||||||
if (status == TraceLoggerStatuses.Warning) { message = $"Warning! {message}"; }
|
if (status == TraceLogStatuses.Warning) { message = $"Warning! {message}"; }
|
||||||
TraceLoggerEntries.Add(new StringLoggerEntry()
|
TraceLoggerEntries.Add(new StringLogEntry()
|
||||||
{
|
{
|
||||||
Message = message,
|
Message = message,
|
||||||
Priority = LoggerService.GetPriorityByStatus(status)
|
Priority = LoggerService.GetPriorityByStatus(status)
|
||||||
@@ -30,7 +32,7 @@ namespace StructureHelperCommon.Models.Loggers
|
|||||||
}
|
}
|
||||||
public void AddMessage(string message, int priority)
|
public void AddMessage(string message, int priority)
|
||||||
{
|
{
|
||||||
TraceLoggerEntries.Add(new StringLoggerEntry()
|
TraceLoggerEntries.Add(new StringLogEntry()
|
||||||
{
|
{
|
||||||
Message = message,
|
Message = message,
|
||||||
Priority = priority
|
Priority = priority
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace StructureHelperCommon.Models.Materials
|
|||||||
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
|
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
|
||||||
public LimitStates LimitState { get; set; }
|
public LimitStates LimitState { get; set; }
|
||||||
public CalcTerms CalcTerm { get; set; }
|
public CalcTerms CalcTerm { get; set; }
|
||||||
|
public double Age { get; set; }
|
||||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||||
public bool WorkInCompression { get; set; }
|
public bool WorkInCompression { get; set; }
|
||||||
public bool WorkInTension { get; set; }
|
public bool WorkInTension { get; set; }
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ namespace StructureHelperCommon.Models.Materials
|
|||||||
concreteOptions.ExternalFactor.Tensile = strength.Tensile;
|
concreteOptions.ExternalFactor.Tensile = strength.Tensile;
|
||||||
concreteOptions.WorkInTension = options.WorkInTension;
|
concreteOptions.WorkInTension = options.WorkInTension;
|
||||||
concreteOptions.RelativeHumidity = options.RelativeHumidity;
|
concreteOptions.RelativeHumidity = options.RelativeHumidity;
|
||||||
|
concreteOptions.Age = options.Age;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Models.Parameters
|
namespace StructureHelperCommon.Models.Parameters
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
public class ArrayParameter<T> : IArrayParameter<T>
|
public class ArrayParameter<T> : IArrayParameter<T>
|
||||||
{
|
{
|
||||||
private string[] columnLabels;
|
private List<string> columnLabels;
|
||||||
public string[] ColumnLabels
|
/// <inheritdoc/>
|
||||||
|
public List<string> ColumnLabels
|
||||||
{
|
{
|
||||||
get { return columnLabels; }
|
get { return columnLabels; }
|
||||||
set
|
set
|
||||||
@@ -25,12 +27,21 @@ namespace StructureHelperCommon.Models.Parameters
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public T[,] Data { get; private set; }
|
public T[,] Data { get; private set; }
|
||||||
|
|
||||||
public ArrayParameter(int rowCount, int columnCount, string[] columnLabels = null)
|
public ArrayParameter(int rowCount, int columnCount, List<string> columnLabels = null)
|
||||||
{
|
{
|
||||||
Data = new T[rowCount, columnCount];
|
Data = new T[rowCount, columnCount];
|
||||||
if (columnLabels is not null) { ColumnLabels = columnLabels; }
|
if (columnLabels is not null)
|
||||||
|
{
|
||||||
|
if (columnLabels.Count > columnCount)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Count of column labels is greater than count of columns");
|
||||||
}
|
}
|
||||||
|
ColumnLabels = columnLabels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ArrayParameter(int rowCount, List<string> columnLabels) : this(rowCount, columnLabels.Count, columnLabels) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,19 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Models.Parameters
|
namespace StructureHelperCommon.Models.Parameters
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Rectangle table of parameters
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
public interface IArrayParameter<T>
|
public interface IArrayParameter<T>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Data of rectangle table
|
||||||
|
/// </summary>
|
||||||
T[,] Data { get; }
|
T[,] Data { get; }
|
||||||
string[] ColumnLabels { get; set; }
|
/// <summary>
|
||||||
|
/// Collection of headers of table
|
||||||
|
/// </summary>
|
||||||
|
List<string> ColumnLabels { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,24 @@
|
|||||||
namespace StructureHelperCommon.Models.Sections
|
namespace StructureHelperCommon.Models.Sections
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public class CompressedMember : ICompressedMember
|
public class CompressedMember : ICompressedMember
|
||||||
{
|
{
|
||||||
static readonly CompressedMemberUpdateStrategy updateStrategy = new();
|
static readonly CompressedMemberUpdateStrategy updateStrategy = new();
|
||||||
|
/// <inheritdoc/>
|
||||||
public bool Buckling { get; set; }
|
public bool Buckling { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public double GeometryLength { get; set; }
|
public double GeometryLength { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public double LengthFactorX { get; set; }
|
public double LengthFactorX { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public double DiagramFactorX { get; set; }
|
public double DiagramFactorX { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public double LengthFactorY { get; set; }
|
public double LengthFactorY { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public double DiagramFactorY { get; set; }
|
public double DiagramFactorY { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,31 @@
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Models.Sections
|
namespace StructureHelperCommon.Models.Sections
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interface of properties for compressed strucrue members
|
||||||
|
/// </summary>
|
||||||
public interface ICompressedMember : ICloneable
|
public interface ICompressedMember : ICloneable
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Flag of considering of buckling
|
||||||
|
/// </summary>
|
||||||
bool Buckling { get; set; }
|
bool Buckling { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Geometry length of structure member, m
|
||||||
|
/// </summary>
|
||||||
double GeometryLength { get; set; }
|
double GeometryLength { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Factor of design length in plane XOZ
|
||||||
|
/// </summary>
|
||||||
double LengthFactorX { get; set; }
|
double LengthFactorX { get; set; }
|
||||||
double DiagramFactorX { get; set; }
|
double DiagramFactorX { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Factor of design length in plane YOZ
|
||||||
|
/// </summary>
|
||||||
double LengthFactorY { get; set; }
|
double LengthFactorY { get; set; }
|
||||||
double DiagramFactorY { get; set; }
|
double DiagramFactorY { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Sections
|
||||||
|
{
|
||||||
|
public class AccidentalEccentricityLogic : IAccidentalEccentricityLogic
|
||||||
|
{
|
||||||
|
private double lengthFactor;
|
||||||
|
private double sizeFactor;
|
||||||
|
private double minEccentricity;
|
||||||
|
|
||||||
|
public double Length { get; set; }
|
||||||
|
public double SizeX { get; set; }
|
||||||
|
public double SizeY { get; set; }
|
||||||
|
public IForceTuple InitialForceTuple { get; set; }
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
public AccidentalEccentricityLogic()
|
||||||
|
{
|
||||||
|
lengthFactor = 600d;
|
||||||
|
sizeFactor = 30d;
|
||||||
|
minEccentricity = 0.01d;
|
||||||
|
}
|
||||||
|
public ForceTuple GetForceTuple()
|
||||||
|
{
|
||||||
|
var lengthEccetricity = Length / lengthFactor;
|
||||||
|
TraceLogger?.AddMessage(string.Format("Accidental eccentricity by length ea = {0} / {1} = {2}", Length, lengthFactor, lengthEccetricity));
|
||||||
|
var sizeXEccetricity = SizeX / sizeFactor;
|
||||||
|
TraceLogger?.AddMessage(string.Format("Accidental eccentricity by SizeX ea ={0} / {1} = {2}", SizeX, sizeFactor, sizeXEccetricity));
|
||||||
|
var sizeYEccetricity = SizeY / sizeFactor;
|
||||||
|
TraceLogger?.AddMessage(string.Format("Accidental eccentricity by SizeY ea ={0} / {1} = {2}", SizeY, sizeFactor, sizeYEccetricity));
|
||||||
|
TraceLogger?.AddMessage(string.Format("Minimum accidental eccentricity ea = {0}", minEccentricity));
|
||||||
|
var xEccentricity = Math.Abs(InitialForceTuple.My / InitialForceTuple.Nz);
|
||||||
|
TraceLogger?.AddMessage(string.Format("Actual eccentricity e0,x = {0}", xEccentricity));
|
||||||
|
var yEccentricity = Math.Abs(InitialForceTuple.Mx / InitialForceTuple.Nz);
|
||||||
|
TraceLogger?.AddMessage(string.Format("Actual eccentricity e0,y = {0}", yEccentricity));
|
||||||
|
|
||||||
|
var xFullEccentricity = new List<double>()
|
||||||
|
{
|
||||||
|
lengthEccetricity,
|
||||||
|
sizeXEccetricity,
|
||||||
|
minEccentricity,
|
||||||
|
xEccentricity
|
||||||
|
}
|
||||||
|
.Max();
|
||||||
|
string mesEx = string.Format("Eccentricity e,x = max({0}; {1}; {2}; {3}) = {4}",
|
||||||
|
lengthEccetricity, sizeXEccetricity,
|
||||||
|
minEccentricity, xEccentricity,
|
||||||
|
xFullEccentricity);
|
||||||
|
TraceLogger?.AddMessage(mesEx);
|
||||||
|
var yFullEccentricity = new List<double>()
|
||||||
|
{
|
||||||
|
lengthEccetricity,
|
||||||
|
sizeYEccetricity,
|
||||||
|
minEccentricity,
|
||||||
|
yEccentricity
|
||||||
|
}
|
||||||
|
.Max();
|
||||||
|
string mesEy = string.Format("Eccentricity e,y = max({0}; {1}; {2}; {3}) = {4}",
|
||||||
|
lengthEccetricity, sizeYEccetricity,
|
||||||
|
minEccentricity, yEccentricity,
|
||||||
|
yFullEccentricity);
|
||||||
|
TraceLogger?.AddMessage(mesEy);
|
||||||
|
var xSign = InitialForceTuple.Mx == 0d ? -1d : Math.Sign(InitialForceTuple.Mx);
|
||||||
|
var ySign = InitialForceTuple.My == 0d ? -1d : Math.Sign(InitialForceTuple.My);
|
||||||
|
var mx = (-1d) * InitialForceTuple.Nz * yFullEccentricity * xSign;
|
||||||
|
var my = (-1d) * InitialForceTuple.Nz * xFullEccentricity * ySign;
|
||||||
|
TraceLogger?.AddMessage(string.Format("Bending moment arbitrary X-axis Mx = {0} * {1} = {2}", InitialForceTuple.Nz, yFullEccentricity, mx), TraceLogStatuses.Debug);
|
||||||
|
TraceLogger?.AddMessage(string.Format("Bending moment arbitrary Y-axis My = {0} * {1} = {2}", InitialForceTuple.Nz, xFullEccentricity, my), TraceLogStatuses.Debug);
|
||||||
|
|
||||||
|
var newTuple = new ForceTuple()
|
||||||
|
{
|
||||||
|
Mx = mx,
|
||||||
|
My = my,
|
||||||
|
Nz = InitialForceTuple.Nz,
|
||||||
|
Qx = InitialForceTuple.Qx,
|
||||||
|
Qy = InitialForceTuple.Qy,
|
||||||
|
Mz = InitialForceTuple.Mz,
|
||||||
|
};
|
||||||
|
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(newTuple));
|
||||||
|
return newTuple;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Sections
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Logic for calculating of value of accidental eccentricity
|
||||||
|
/// </summary>
|
||||||
|
public interface IAccidentalEccentricityLogic : ILogic
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Properties of compressed member
|
||||||
|
/// </summary>
|
||||||
|
double Length { get;set;}
|
||||||
|
/// <summary>
|
||||||
|
/// Size of cross-section along X-axis, m
|
||||||
|
/// </summary>
|
||||||
|
double SizeX { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Size of cross-section along Y-axis, m
|
||||||
|
/// </summary>
|
||||||
|
double SizeY { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Initial tuple of force
|
||||||
|
/// </summary>
|
||||||
|
IForceTuple InitialForceTuple { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Returns new force tuple with accidental eccentricity
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
ForceTuple GetForceTuple();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ namespace StructureHelperCommon.Models.Shapes
|
|||||||
{
|
{
|
||||||
private Directions constDirections;
|
private Directions constDirections;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Direction, for which canstant value is assigned
|
/// Direction, for which constant value is assigned
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Directions ConstDirections
|
public Directions ConstDirections
|
||||||
{
|
{
|
||||||
@@ -31,6 +31,8 @@ namespace StructureHelperCommon.Models.Shapes
|
|||||||
/// Constant value for assigned direction
|
/// Constant value for assigned direction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double ConstDirectionValue { get; set; }
|
public double ConstDirectionValue { get; set; }
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
public ConstOneDirectionLogic(Directions constDirection, double constValue)
|
public ConstOneDirectionLogic(Directions constDirection, double constValue)
|
||||||
{
|
{
|
||||||
ConstDirections = constDirection;
|
ConstDirections = constDirection;
|
||||||
@@ -39,18 +41,46 @@ namespace StructureHelperCommon.Models.Shapes
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IPoint3D GetPoint3D(IPoint2D point2D)
|
public IPoint3D GetPoint3D(IPoint2D point2D)
|
||||||
{
|
{
|
||||||
|
TraceLogger?.AddMessage($"Logic convert point from 2D-space to 3D-space");
|
||||||
IPoint3D point;
|
IPoint3D point;
|
||||||
if (ConstDirections == Directions.X)
|
if (ConstDirections == Directions.X)
|
||||||
{
|
{
|
||||||
point = new Point3D() { X = ConstDirectionValue, Y = - point2D.X, Z = point2D.Y };
|
point = new Point3D()
|
||||||
|
{
|
||||||
|
X = ConstDirectionValue,
|
||||||
|
Y = - point2D.X,
|
||||||
|
Z = point2D.Y
|
||||||
|
};
|
||||||
|
TraceLogger?.AddMessage($"Constant direction is x-direction, so X = {point.X}");
|
||||||
|
TraceLogger?.AddMessage($"X = ConstantValue = {point.X}");
|
||||||
|
TraceLogger?.AddMessage($"Y = - point2D.X = {point.Y}");
|
||||||
|
TraceLogger?.AddMessage($"Z = point2D.Y = {point.Z}");
|
||||||
}
|
}
|
||||||
else if (ConstDirections == Directions.Y)
|
else if (ConstDirections == Directions.Y)
|
||||||
{
|
{
|
||||||
point = new Point3D() { X = point2D.X, Y = ConstDirectionValue, Z = point2D.Y };
|
point = new Point3D()
|
||||||
|
{
|
||||||
|
X = point2D.X,
|
||||||
|
Y = ConstDirectionValue,
|
||||||
|
Z = point2D.Y
|
||||||
|
};
|
||||||
|
TraceLogger?.AddMessage($"Constant direction is Y-direction");
|
||||||
|
TraceLogger?.AddMessage($"X = point2D.X = {point.X}");
|
||||||
|
TraceLogger?.AddMessage($"Y = ConstantValue = {point.Y}");
|
||||||
|
TraceLogger?.AddMessage($"Z = point2D.Y = {point.Z}");
|
||||||
}
|
}
|
||||||
else if (ConstDirections == Directions.Z)
|
else if (ConstDirections == Directions.Z)
|
||||||
{
|
{
|
||||||
point = new Point3D() { X = point2D.Y, Y = point2D.X, Z = ConstDirectionValue };
|
point = new Point3D()
|
||||||
|
{
|
||||||
|
X = point2D.Y,
|
||||||
|
Y = point2D.X,
|
||||||
|
Z = ConstDirectionValue
|
||||||
|
};
|
||||||
|
TraceLogger?.AddMessage($"Constant direction is Z-direction");
|
||||||
|
TraceLogger?.AddMessage($"X = point2D.Y = {point.X}");
|
||||||
|
TraceLogger?.AddMessage($"Y = point2D.X = {point.Y}");
|
||||||
|
TraceLogger?.AddMessage($"Z = ConstantValue = {point.Z}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -13,7 +14,7 @@ namespace StructureHelperCommon.Models.Shapes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logic for convert 2DPoint of some plane to point of 3DSpace
|
/// Logic for convert 2DPoint of some plane to point of 3DSpace
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IConvert2DPointTo3DPointLogic
|
public interface IConvert2DPointTo3DPointLogic : ILogic
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns point in 3D-space by 2D point in some workplane
|
/// Returns point in 3D-space by 2D point in some workplane
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
using StructureHelperCommon.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@@ -54,6 +54,14 @@ namespace StructureHelperCommon.Models.Tables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int RowCount => GetAllRows().Count();
|
||||||
|
public IShTableCell<T> GetCell(int rowIndex, int columnIndex)
|
||||||
|
{
|
||||||
|
var row = GetElementsFromRow(rowIndex);
|
||||||
|
var cell = row[columnIndex];
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set a value at the specified column and row index
|
/// Set a value at the specified column and row index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Services.Units
|
namespace StructureHelperCommon.Services.Units
|
||||||
{
|
{
|
||||||
@@ -47,11 +48,30 @@ namespace StructureHelperCommon.Services.Units
|
|||||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect);
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IUnit GetUnit(UnitTypes unitType, string unitName)
|
public static IUnit GetUnit(UnitTypes unitType, string unitName = null)
|
||||||
{
|
{
|
||||||
|
if (unitName is null)
|
||||||
|
{
|
||||||
|
var boolResult = DefaultUnitNames.TryGetValue(unitType, out unitName);
|
||||||
|
if (boolResult == false)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": unit type{unitType} is unknown");
|
||||||
|
}
|
||||||
|
}
|
||||||
return units.Where(u => u.UnitType == unitType & u.Name == unitName).Single();
|
return units.Where(u => u.UnitType == unitType & u.Name == unitName).Single();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Dictionary<UnitTypes, string> DefaultUnitNames => new()
|
||||||
|
{
|
||||||
|
{ UnitTypes.Length, "m"},
|
||||||
|
{ UnitTypes.Area, "m2"},
|
||||||
|
{ UnitTypes.Force, "kN" },
|
||||||
|
{ UnitTypes.Moment, "kNm"},
|
||||||
|
{ UnitTypes.Stress, "MPa"},
|
||||||
|
{ UnitTypes.Curvature, "1/m"},
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
public static string Convert(IUnit unit, string unitName, object value)
|
public static string Convert(IUnit unit, string unitName, object value)
|
||||||
{
|
{
|
||||||
double val;
|
double val;
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Settings;
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
|
using StructureHelperCommon.Models.Materials;
|
||||||
using StructureHelperCommon.Models.Materials.Libraries;
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
using LMBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
|
using LMBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
using LMLogic = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
|
using LMLogic = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
|
||||||
using LM = LoaderCalculator.Data.Materials;
|
|
||||||
using LoaderCalculator.Data.Materials;
|
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
|
||||||
using StructureHelperCommon.Models.Materials;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Materials
|
namespace StructureHelperLogics.Models.Materials
|
||||||
{
|
{
|
||||||
public class ConcreteLibMaterial : IConcreteLibMaterial
|
public class ConcreteLibMaterial : IConcreteLibMaterial
|
||||||
{
|
{
|
||||||
|
const double maxAge = 70d * 365 * 24 * 60 * 60;
|
||||||
const MaterialTypes materialType = MaterialTypes.Concrete;
|
const MaterialTypes materialType = MaterialTypes.Concrete;
|
||||||
private readonly List<IMaterialLogic> materialLogics;
|
private readonly List<IMaterialLogic> materialLogics;
|
||||||
private LMBuilders.ConcreteOptions lmOptions;
|
private LMBuilders.ConcreteOptions lmOptions;
|
||||||
@@ -26,14 +26,18 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
public bool TensionForULS { get ; set; }
|
public bool TensionForULS { get ; set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public bool TensionForSLS { get; set; }
|
public bool TensionForSLS { get; set; }
|
||||||
/// <summary>
|
/// <inheritdoc/>
|
||||||
/// Humidity of concrete
|
|
||||||
/// </summary>
|
|
||||||
public double RelativeHumidity { get; set; }
|
public double RelativeHumidity { get; set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IMaterialLogic MaterialLogic { get; set; }
|
public IMaterialLogic MaterialLogic { get; set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
public double MinAge { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public double MaxAge { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public List<IMaterialLogic> MaterialLogics => materialLogics;
|
public List<IMaterialLogic> MaterialLogics => materialLogics;
|
||||||
|
|
||||||
|
|
||||||
public ConcreteLibMaterial()
|
public ConcreteLibMaterial()
|
||||||
{
|
{
|
||||||
materialLogics = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList();
|
materialLogics = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList();
|
||||||
@@ -44,6 +48,8 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
TensionForULS = false;
|
TensionForULS = false;
|
||||||
TensionForSLS = true;
|
TensionForSLS = true;
|
||||||
RelativeHumidity = 0.55d;
|
RelativeHumidity = 0.55d;
|
||||||
|
MinAge = 0d;
|
||||||
|
MaxAge = maxAge;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
@@ -107,6 +113,7 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
{
|
{
|
||||||
options.WorkInTension = false;
|
options.WorkInTension = false;
|
||||||
}
|
}
|
||||||
|
options.Age = MinAge;
|
||||||
}
|
}
|
||||||
else if (limitState == LimitStates.SLS)
|
else if (limitState == LimitStates.SLS)
|
||||||
{
|
{
|
||||||
@@ -118,6 +125,14 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
{
|
{
|
||||||
options.WorkInTension = false;
|
options.WorkInTension = false;
|
||||||
}
|
}
|
||||||
|
if (calcTerm == CalcTerms.LongTerm)
|
||||||
|
{
|
||||||
|
options.Age = MaxAge;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
options.Age = MinAge;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
{
|
{
|
||||||
bool TensionForULS { get; set; }
|
bool TensionForULS { get; set; }
|
||||||
bool TensionForSLS { get; set; }
|
bool TensionForSLS { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Humidity of concrete
|
||||||
|
/// </summary>
|
||||||
double RelativeHumidity { get; set; }
|
double RelativeHumidity { get; set; }
|
||||||
|
double MinAge { get; set; }
|
||||||
|
double MaxAge { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||||
{
|
{
|
||||||
@@ -13,8 +8,14 @@ namespace StructureHelperLogics.Models.Templates.CrossSections
|
|||||||
{
|
{
|
||||||
public IEnumerable<ICalculator> GetNdmCalculators()
|
public IEnumerable<ICalculator> GetNdmCalculators()
|
||||||
{
|
{
|
||||||
var calculators = new List<ICalculator>();
|
var calculators = new List<ICalculator>
|
||||||
calculators.Add(new ForceCalculator() { Name = "New Force Calculator"});
|
{
|
||||||
|
new ForceCalculator()
|
||||||
|
{
|
||||||
|
Name = "New Force Calculator",
|
||||||
|
TraceLogger = new ShiftTraceLogger()
|
||||||
|
}
|
||||||
|
};
|
||||||
return calculators;
|
return calculators;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
|
||||||
using StructureHelperCommon.Models.Sections;
|
using StructureHelperCommon.Models.Sections;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Services.Forces;
|
using StructureHelperCommon.Services.Forces;
|
||||||
@@ -16,13 +17,16 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
public class ForceCalculator : IForceCalculator, IHasActionByResult
|
public class ForceCalculator : IForceCalculator, IHasActionByResult
|
||||||
{
|
{
|
||||||
static readonly ForceCalculatorUpdateStrategy updateStrategy = new();
|
static readonly ForceCalculatorUpdateStrategy updateStrategy = new();
|
||||||
|
private readonly IForceTupleCalculator forceTupleCalculator;
|
||||||
|
private ForcesResults result;
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public List<LimitStates> LimitStatesList { get; }
|
public List<LimitStates> LimitStatesList { get; private set; }
|
||||||
public List<CalcTerms> CalcTermsList { get; }
|
public List<CalcTerms> CalcTermsList { get; private set; }
|
||||||
public List<IForceAction> ForceActions { get; }
|
public List<IForceAction> ForceActions { get; private set; }
|
||||||
public List<INdmPrimitive> Primitives { get; }
|
public List<INdmPrimitive> Primitives { get; private set; }
|
||||||
public IResult Result { get; private set; }
|
public IResult Result { get; private set; }
|
||||||
public ICompressedMember CompressedMember { get; }
|
public ICompressedMember CompressedMember { get; private set; }
|
||||||
public IAccuracy Accuracy { get; set; }
|
public IAccuracy Accuracy { get; set; }
|
||||||
public List<IForceCombinationList> ForceCombinationLists { get; private set; }
|
public List<IForceCombinationList> ForceCombinationLists { get; private set; }
|
||||||
public Action<IResult> ActionToOutputResults { get; set; }
|
public Action<IResult> ActionToOutputResults { get; set; }
|
||||||
@@ -33,7 +37,11 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
var checkResult = CheckInputData();
|
var checkResult = CheckInputData();
|
||||||
if (checkResult != "")
|
if (checkResult != "")
|
||||||
{
|
{
|
||||||
Result = new ForcesResults() { IsValid = false, Description = checkResult };
|
Result = new ForcesResults()
|
||||||
|
{
|
||||||
|
IsValid = false,
|
||||||
|
Description = checkResult
|
||||||
|
};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -45,7 +53,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
|
|
||||||
private void CalculateResult()
|
private void CalculateResult()
|
||||||
{
|
{
|
||||||
var ndmResult = new ForcesResults() { IsValid = true };
|
result = new ForcesResults()
|
||||||
|
{
|
||||||
|
IsValid = true
|
||||||
|
};
|
||||||
foreach (var combination in ForceCombinationLists)
|
foreach (var combination in ForceCombinationLists)
|
||||||
{
|
{
|
||||||
foreach (var tuple in combination.DesignForces)
|
foreach (var tuple in combination.DesignForces)
|
||||||
@@ -54,66 +65,163 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
var calcTerm = tuple.CalcTerm;
|
var calcTerm = tuple.CalcTerm;
|
||||||
if (LimitStatesList.Contains(limitState) & CalcTermsList.Contains(calcTerm))
|
if (LimitStatesList.Contains(limitState) & CalcTermsList.Contains(calcTerm))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
IForcesTupleResult tupleResult;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tupleResult = ProcessNdmResult(combination, tuple);
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
tupleResult = new ForcesTupleResult()
|
||||||
|
{
|
||||||
|
IsValid = false,
|
||||||
|
Description = string.Empty + ex,
|
||||||
|
DesignForceTuple = tuple
|
||||||
|
};
|
||||||
|
}
|
||||||
|
result.ForcesResultList.Add(tupleResult);
|
||||||
|
ActionToOutputResults?.Invoke(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Result = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IForcesTupleResult ProcessNdmResult(IForceCombinationList combination, IDesignForceTuple tuple)
|
||||||
|
{
|
||||||
|
IForcesTupleResult tupleResult;
|
||||||
|
LimitStates limitState = tuple.LimitState;
|
||||||
|
CalcTerms calcTerm = tuple.CalcTerm;
|
||||||
var ndms = NdmPrimitivesService.GetNdms(Primitives, limitState, calcTerm);
|
var ndms = NdmPrimitivesService.GetNdms(Primitives, limitState, calcTerm);
|
||||||
IPoint2D point2D;
|
IPoint2D point2D;
|
||||||
if (combination.SetInGravityCenter == true)
|
if (combination.SetInGravityCenter == true)
|
||||||
{
|
{
|
||||||
var loaderPoint = LoaderCalculator.Logics.Geometry.GeometryOperations.GetGravityCenter(ndms);
|
var (Cx, Cy) = LoaderCalculator.Logics.Geometry.GeometryOperations.GetGravityCenter(ndms);
|
||||||
point2D = new Point2D() { X = loaderPoint.Cx, Y = loaderPoint.Cy };
|
point2D = new Point2D(){ X = Cx, Y = Cy };
|
||||||
}
|
}
|
||||||
else point2D = combination.ForcePoint;
|
else point2D = combination.ForcePoint;
|
||||||
var newTuple = ForceTupleService.MoveTupleIntoPoint(tuple.ForceTuple, point2D) as ForceTuple;
|
var newTuple = ForceTupleService.MoveTupleIntoPoint(tuple.ForceTuple, point2D);
|
||||||
IForcesTupleResult result = GetPrimitiveStrainMatrix(ndms, newTuple);
|
TraceLogger?.AddMessage($"Input force combination");
|
||||||
|
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(newTuple));
|
||||||
if (CompressedMember.Buckling == true)
|
if (CompressedMember.Buckling == true)
|
||||||
{
|
{
|
||||||
IForceTuple longTuple;
|
if (newTuple.Nz >= 0d)
|
||||||
if (calcTerm == CalcTerms.LongTerm)
|
|
||||||
{
|
{
|
||||||
longTuple = newTuple;
|
TraceLogger?.AddMessage(string.Format("Second order effect is not considered as Nz={0} >= 0", newTuple.Nz));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
longTuple = GetLongTuple(combination.DesignForces, limitState);
|
TraceLogger?.AddMessage("Get eccentricity for full load");
|
||||||
}
|
newTuple = ProcessAccEccentricity(ndms, newTuple);
|
||||||
var bucklingCalculator = GetBucklingCalculator(CompressedMember, limitState, calcTerm, newTuple, longTuple);
|
var buckResult = GetForceTupleByBuckling(combination, limitState, calcTerm, ndms, newTuple);
|
||||||
try
|
if (buckResult.isValid == true)
|
||||||
{
|
{
|
||||||
bucklingCalculator.Run();
|
newTuple = buckResult.tuple;
|
||||||
var bucklingResult = bucklingCalculator.Result as IConcreteBucklingResult;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new ForcesTupleResult()
|
||||||
|
{
|
||||||
|
IsValid = false,
|
||||||
|
DesignForceTuple = tuple,
|
||||||
|
Description = buckResult.description,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tupleResult = GetForceResult(limitState, calcTerm, ndms, newTuple);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (newTuple.Nz < 0d)
|
||||||
|
{
|
||||||
|
string message = string.Format("Second order effect is not considered, despite force Nz={0}", newTuple.Nz);
|
||||||
|
TraceLogger?.AddMessage(message, TraceLogStatuses.Warning);
|
||||||
|
}
|
||||||
|
tupleResult = GetForceResult(limitState, calcTerm, ndms, newTuple);
|
||||||
|
}
|
||||||
|
return tupleResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
private (bool isValid, IForceTuple tuple, string description) GetForceTupleByBuckling(IForceCombinationList combination, LimitStates limitState, CalcTerms calcTerm, List<INdm> ndms, IForceTuple newTuple)
|
||||||
|
{
|
||||||
|
var tuple = newTuple.Clone() as IForceTuple;
|
||||||
|
var inputData = new BucklingInputData()
|
||||||
|
{
|
||||||
|
Combination = combination,
|
||||||
|
LimitState = limitState,
|
||||||
|
CalcTerm = calcTerm,
|
||||||
|
Ndms = ndms,
|
||||||
|
ForceTuple = newTuple
|
||||||
|
};
|
||||||
|
var bucklingResult = ProcessBuckling(inputData);
|
||||||
|
|
||||||
if (bucklingResult.IsValid != true)
|
if (bucklingResult.IsValid != true)
|
||||||
{
|
{
|
||||||
result.IsValid = false;
|
TraceLogger?.AddMessage(bucklingResult.Description, TraceLogStatuses.Error);
|
||||||
result.Description += $"Buckling result:\n{bucklingResult.Description}\n";
|
return (false, tuple, $"Buckling result:\n{bucklingResult.Description}");
|
||||||
}
|
}
|
||||||
newTuple = CalculateBuckling(newTuple, bucklingResult);
|
else
|
||||||
result = GetPrimitiveStrainMatrix(ndms, newTuple);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
{
|
||||||
result.IsValid = false;
|
tuple = CalculateBuckling(tuple, bucklingResult);
|
||||||
result.Description = $"Buckling error:\n{ex}\n";
|
TraceLogger?.AddMessage(string.Intern("Force combination with considering of second order effects"));
|
||||||
}
|
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(tuple));
|
||||||
}
|
|
||||||
result.DesignForceTuple.LimitState = limitState;
|
|
||||||
result.DesignForceTuple.CalcTerm = calcTerm;
|
|
||||||
result.DesignForceTuple.ForceTuple = newTuple;
|
|
||||||
ndmResult.ForcesResultList.Add(result);
|
|
||||||
ActionToOutputResults?.Invoke(ndmResult);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Result = ndmResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (true, tuple, string.Empty);
|
||||||
private void GetCombinations()
|
|
||||||
{
|
|
||||||
ForceCombinationLists = new List<IForceCombinationList>();
|
|
||||||
foreach (var item in ForceActions)
|
|
||||||
{
|
|
||||||
ForceCombinationLists.Add(item.GetCombinations());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IForcesTupleResult GetForceResult(LimitStates limitState, CalcTerms calcTerm, List<INdm> ndms, IForceTuple newTuple)
|
||||||
|
{
|
||||||
|
var tupleResult = GetPrimitiveStrainMatrix(ndms, newTuple, Accuracy);
|
||||||
|
tupleResult.DesignForceTuple.LimitState = limitState;
|
||||||
|
tupleResult.DesignForceTuple.CalcTerm = calcTerm;
|
||||||
|
tupleResult.DesignForceTuple.ForceTuple = newTuple;
|
||||||
|
return tupleResult;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private IForceTuple ProcessAccEccentricity(List<INdm> ndms, IForceTuple tuple)
|
||||||
|
{
|
||||||
|
var newTuple = tuple.Clone() as IForceTuple;
|
||||||
|
var accLogic = new AccidentalEccentricityLogic()
|
||||||
|
{
|
||||||
|
Length = CompressedMember.GeometryLength,
|
||||||
|
SizeX = ndms.Max(x => x.CenterX) - ndms.Min(x => x.CenterX),
|
||||||
|
SizeY = ndms.Max(x => x.CenterY) - ndms.Min(x => x.CenterY),
|
||||||
|
InitialForceTuple = newTuple,
|
||||||
|
};
|
||||||
|
if (TraceLogger is not null)
|
||||||
|
{
|
||||||
|
accLogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
|
||||||
|
}
|
||||||
|
newTuple = accLogic.GetForceTuple();
|
||||||
|
return newTuple;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IConcreteBucklingResult ProcessBuckling(BucklingInputData inputData)
|
||||||
|
{
|
||||||
|
IForceTuple resultTuple;
|
||||||
|
IForceTuple longTuple;
|
||||||
|
if (inputData.CalcTerm == CalcTerms.LongTerm)
|
||||||
|
{
|
||||||
|
longTuple = inputData.ForceTuple;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
longTuple = GetLongTuple(inputData.Combination.DesignForces, inputData.LimitState);
|
||||||
|
}
|
||||||
|
TraceLogger?.AddMessage("Get eccentricity for long term load");
|
||||||
|
longTuple = ProcessAccEccentricity(inputData.Ndms, longTuple);
|
||||||
|
var bucklingCalculator = GetBucklingCalculator(CompressedMember, inputData.LimitState, inputData.CalcTerm, inputData.ForceTuple, longTuple);
|
||||||
|
if (TraceLogger is not null)
|
||||||
|
{
|
||||||
|
bucklingCalculator.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
|
||||||
|
}
|
||||||
|
bucklingCalculator.Run();
|
||||||
|
var bucklingResult = bucklingCalculator.Result as IConcreteBucklingResult;
|
||||||
|
|
||||||
|
return bucklingResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IForceTuple GetLongTuple(List<IDesignForceTuple> designForces, LimitStates limitState)
|
private IForceTuple GetLongTuple(List<IDesignForceTuple> designForces, LimitStates limitState)
|
||||||
@@ -121,7 +229,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
IForceTuple longTuple;
|
IForceTuple longTuple;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
longTuple = designForces.Where(x => x.LimitState == limitState & x.CalcTerm == CalcTerms.LongTerm).First().ForceTuple;
|
longTuple = designForces
|
||||||
|
.Where(x => x.LimitState == limitState & x.CalcTerm == CalcTerms.LongTerm)
|
||||||
|
.Single()
|
||||||
|
.ForceTuple;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@@ -132,18 +243,20 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
|
|
||||||
private IConcreteBucklingCalculator GetBucklingCalculator(ICompressedMember compressedMember, LimitStates limitStates, CalcTerms calcTerms, IForceTuple calcTuple, IForceTuple longTuple)
|
private IConcreteBucklingCalculator GetBucklingCalculator(ICompressedMember compressedMember, LimitStates limitStates, CalcTerms calcTerms, IForceTuple calcTuple, IForceTuple longTuple)
|
||||||
{
|
{
|
||||||
IConcreteBucklingOptions options = new ConcreteBucklingOptions()
|
var options = new ConcreteBucklingOptions()
|
||||||
{ CompressedMember = compressedMember,
|
{
|
||||||
|
CompressedMember = compressedMember,
|
||||||
LimitState = limitStates,
|
LimitState = limitStates,
|
||||||
CalcTerm = calcTerms,
|
CalcTerm = calcTerms,
|
||||||
CalcForceTuple = calcTuple,
|
CalcForceTuple = calcTuple,
|
||||||
LongTermTuple = longTuple,
|
LongTermTuple = longTuple,
|
||||||
Primitives = Primitives };
|
Primitives = Primitives
|
||||||
IConcreteBucklingCalculator bucklingCalculator = new ConcreteBucklingCalculator(options, Accuracy);
|
};
|
||||||
|
var bucklingCalculator = new ConcreteBucklingCalculator(options, Accuracy);
|
||||||
return bucklingCalculator;
|
return bucklingCalculator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ForceTuple CalculateBuckling(ForceTuple calcTuple, IConcreteBucklingResult bucklingResult)
|
private ForceTuple CalculateBuckling(IForceTuple calcTuple, IConcreteBucklingResult bucklingResult)
|
||||||
{
|
{
|
||||||
var newTuple = calcTuple.Clone() as ForceTuple;
|
var newTuple = calcTuple.Clone() as ForceTuple;
|
||||||
newTuple.Mx *= bucklingResult.EtaFactorAlongY;
|
newTuple.Mx *= bucklingResult.EtaFactorAlongY;
|
||||||
@@ -155,27 +268,86 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
private string CheckInputData()
|
private string CheckInputData()
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
try
|
||||||
|
{
|
||||||
NdmPrimitivesService.CheckPrimitives(Primitives);
|
NdmPrimitivesService.CheckPrimitives(Primitives);
|
||||||
if (ForceActions.Count == 0) { result += "Calculator does not contain any forces \n"; }
|
}
|
||||||
if (LimitStatesList.Count == 0) { result += "Calculator does not contain any limit states \n"; }
|
catch (Exception ex)
|
||||||
if (CalcTermsList.Count == 0) { result += "Calculator does not contain any duration \n"; }
|
{
|
||||||
|
result += ex;
|
||||||
|
}
|
||||||
|
if (ForceActions.Count == 0)
|
||||||
|
{
|
||||||
|
result += "Calculator does not contain any forces \n";
|
||||||
|
}
|
||||||
|
if (LimitStatesList.Count == 0)
|
||||||
|
{
|
||||||
|
result += "Calculator does not contain any limit states \n";
|
||||||
|
}
|
||||||
|
if (CalcTermsList.Count == 0)
|
||||||
|
{
|
||||||
|
result += "Calculator does not contain any duration \n";
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForceCalculator()
|
public ForceCalculator(IForceTupleCalculator forceTupleCalculator)
|
||||||
|
{
|
||||||
|
this.forceTupleCalculator = forceTupleCalculator;
|
||||||
|
SetDefaultProperties();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceCalculator() : this(new ForceTupleCalculator())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetDefaultProperties()
|
||||||
{
|
{
|
||||||
ForceActions = new List<IForceAction>();
|
ForceActions = new List<IForceAction>();
|
||||||
Primitives = new List<INdmPrimitive>();
|
Primitives = new List<INdmPrimitive>();
|
||||||
CompressedMember = new CompressedMember() { Buckling = false };
|
CompressedMember = new CompressedMember()
|
||||||
Accuracy = new Accuracy() { IterationAccuracy = 0.001d, MaxIterationCount = 1000 };
|
{
|
||||||
LimitStatesList = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS };
|
Buckling = false
|
||||||
CalcTermsList = new List<CalcTerms>() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
};
|
||||||
|
Accuracy = new Accuracy()
|
||||||
|
{
|
||||||
|
IterationAccuracy = 0.001d,
|
||||||
|
MaxIterationCount = 1000
|
||||||
|
};
|
||||||
|
LimitStatesList = new List<LimitStates>()
|
||||||
|
{
|
||||||
|
LimitStates.ULS,
|
||||||
|
LimitStates.SLS
|
||||||
|
};
|
||||||
|
CalcTermsList = new List<CalcTerms>()
|
||||||
|
{
|
||||||
|
CalcTerms.ShortTerm,
|
||||||
|
CalcTerms.LongTerm
|
||||||
|
};
|
||||||
|
}
|
||||||
|
private void GetCombinations()
|
||||||
|
{
|
||||||
|
ForceCombinationLists = new List<IForceCombinationList>();
|
||||||
|
foreach (var item in ForceActions)
|
||||||
|
{
|
||||||
|
ForceCombinationLists.Add(item.GetCombinations());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IForcesTupleResult GetPrimitiveStrainMatrix(IEnumerable<INdm> ndmCollection, IForceTuple tuple)
|
private IForcesTupleResult GetPrimitiveStrainMatrix(IEnumerable<INdm> ndmCollection, IForceTuple tuple, IAccuracy accuracy)
|
||||||
{
|
{
|
||||||
IForceTupleInputData inputData = new ForceTupleInputData() { NdmCollection = ndmCollection, Tuple = tuple, Accuracy = Accuracy };
|
var inputData = new ForceTupleInputData()
|
||||||
IForceTupleCalculator calculator = new ForceTupleCalculator(inputData);
|
{
|
||||||
|
NdmCollection = ndmCollection,
|
||||||
|
Tuple = tuple,
|
||||||
|
Accuracy = accuracy
|
||||||
|
};
|
||||||
|
var calculator = forceTupleCalculator.Clone() as IForceTupleCalculator;
|
||||||
|
calculator.InputData = inputData;
|
||||||
|
if (TraceLogger is not null)
|
||||||
|
{
|
||||||
|
calculator.TraceLogger = TraceLogger.GetSimilarTraceLogger();
|
||||||
|
}
|
||||||
calculator.Run();
|
calculator.Run();
|
||||||
return calculator.Result as IForcesTupleResult;
|
return calculator.Result as IForcesTupleResult;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user