Compare commits
29 Commits
Localizati
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0319fe1a51 | ||
|
|
31d668b996 | ||
|
|
99d5aa3608 | ||
|
|
63463662fe | ||
|
|
0913ca85b7 | ||
|
|
d13304fe06 | ||
|
|
16cef8e98e | ||
|
|
52c5d35dda | ||
|
|
ed2846dc8c | ||
|
|
845929406e | ||
|
|
b32a7ce7df | ||
|
|
027d9a7666 | ||
|
|
08d36dfbd5 | ||
|
|
871355e07b | ||
|
|
e75521dc20 | ||
|
|
f158ba3336 | ||
|
|
f11b97de38 | ||
|
|
f2f6840ffb | ||
|
|
b81b7a0929 | ||
|
|
0a453c5a95 | ||
|
|
4359b2c49b | ||
|
|
2e8ebccc13 | ||
|
|
9469d53614 | ||
|
|
24c791c78f | ||
|
|
716c3764c1 | ||
|
|
bf72f6d347 | ||
|
|
541f23c0a8 | ||
|
|
8572e1f93d | ||
|
|
d650924628 |
@@ -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();
|
||||||
|
|||||||
13
FieldVisualizer/Entities/ColorMaps/IValueColorArray.cs
Normal file
13
FieldVisualizer/Entities/ColorMaps/IValueColorArray.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace FieldVisualizer.Entities.ColorMaps
|
||||||
|
{
|
||||||
|
public interface IValueColorArray
|
||||||
|
{
|
||||||
|
double AverageValue { get; set; }
|
||||||
|
Color BottomColor { get; set; }
|
||||||
|
double BottomValue { get; set; }
|
||||||
|
Color TopColor { get; set; }
|
||||||
|
double TopValue { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,19 +1,18 @@
|
|||||||
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; }
|
||||||
double BottomValue { get; set; }
|
IValueColorArray ExactValues { get; }
|
||||||
double AverageValue { get; set; }
|
IValueColorArray RoundedValues { get; }
|
||||||
double TopValue {get;set;}
|
|
||||||
Color BottomColor { get; set; }
|
|
||||||
Color TopColor { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
33
FieldVisualizer/Entities/ColorMaps/ValueColorArray.cs
Normal file
33
FieldVisualizer/Entities/ColorMaps/ValueColorArray.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace FieldVisualizer.Entities.ColorMaps
|
||||||
|
{
|
||||||
|
public class ValueColorArray : IValueColorArray
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Minimum value of range
|
||||||
|
/// </summary>
|
||||||
|
public double BottomValue { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Average value of range
|
||||||
|
/// </summary>
|
||||||
|
public double AverageValue { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Maximum value of range
|
||||||
|
/// </summary>
|
||||||
|
public double TopValue { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Color correspondent to minimum value
|
||||||
|
/// </summary>
|
||||||
|
public Color BottomColor { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Color correspondent to maximum value
|
||||||
|
/// </summary>
|
||||||
|
public Color TopColor { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,19 +1,16 @@
|
|||||||
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; }
|
||||||
public double BottomValue { get; set; }
|
|
||||||
public double AverageValue { get; set; }
|
public IValueColorArray ExactValues { get; private set; } = new ValueColorArray();
|
||||||
public double TopValue { get; set; }
|
|
||||||
public Color BottomColor { get; set; }
|
public IValueColorArray RoundedValues { get; private set; } = new ValueColorArray();
|
||||||
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,7 @@
|
|||||||
using FieldVisualizer.Entities.ColorMaps;
|
using FieldVisualizer.Entities.ColorMaps;
|
||||||
using FieldVisualizer.Entities.Values;
|
using FieldVisualizer.Entities.Values;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -10,54 +12,132 @@ 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)
|
static IMathRoundLogic roundLogic = new SmartRoundLogic();
|
||||||
{
|
/// <summary>
|
||||||
if (range.TopValue == range.BottomValue || map.Colors.Count == 0) { return map.Colors[0]; }
|
///
|
||||||
double minVal = range.BottomValue - 1e-15d*(Math.Abs(range.BottomValue));
|
/// </summary>
|
||||||
double maxVal = range.TopValue + 1e-15d * (Math.Abs(range.TopValue));
|
/// <param name="fullRange"></param>
|
||||||
if (val > maxVal || val < minVal) { return Colors.Gray; }
|
/// <param name="valueRanges"></param>
|
||||||
if (val == minVal) { return map.Colors[0]; }
|
/// <param name="colorMap"></param>
|
||||||
if (val == maxVal) { return map.Colors[map.Colors.Count - 1]; }
|
/// <returns></returns>
|
||||||
|
|
||||||
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();
|
var valueColorRange = new ValueColorRange
|
||||||
valueColorRange.IsActive = true;
|
{
|
||||||
valueColorRange.BottomValue = valueRange.BottomValue;
|
IsActive = true,
|
||||||
valueColorRange.AverageValue = (valueRange.BottomValue + valueRange.TopValue) / 2;
|
};
|
||||||
valueColorRange.TopValue = valueRange.TopValue;
|
valueColorRange.ExactValues.BottomValue = valueRange.BottomValue;
|
||||||
valueColorRange.BottomColor = GetColorByValue(fullRange, colorMap, valueColorRange.BottomValue);
|
valueColorRange.ExactValues.AverageValue = (valueRange.BottomValue + valueRange.TopValue) / 2;
|
||||||
valueColorRange.TopColor = GetColorByValue(fullRange, colorMap, valueColorRange.TopValue);
|
valueColorRange.ExactValues.TopValue = valueRange.TopValue;
|
||||||
|
valueColorRange.ExactValues.BottomColor = GetColorByValue(fullRange, colorMap, valueColorRange.ExactValues.BottomValue);
|
||||||
|
valueColorRange.ExactValues.TopColor = GetColorByValue(fullRange, colorMap, valueColorRange.ExactValues.TopValue);
|
||||||
|
valueColorRange.RoundedValues.BottomValue = roundLogic.RoundValue(valueColorRange.ExactValues.BottomValue);
|
||||||
|
valueColorRange.RoundedValues.AverageValue = roundLogic.RoundValue(valueColorRange.ExactValues.AverageValue);
|
||||||
|
valueColorRange.RoundedValues.TopValue = roundLogic.RoundValue(valueColorRange.ExactValues.TopValue);
|
||||||
colorRanges.Add(valueColorRange);
|
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 represents how many block to skip
|
||||||
|
int blockIdx = (int)Math.Truncate(blockOfColor);// Idx of
|
||||||
|
double valPercResidual = valPerc - (blockIdx * colorPerc);//remove the part represented of block
|
||||||
|
double percOfColor = valPercResidual / colorPerc;// % of color of this block that will be filled
|
||||||
|
|
||||||
|
//in some cases due to accuracy of double type percent of color may be less than zero
|
||||||
|
if (percOfColor <= 0d)
|
||||||
|
{
|
||||||
|
return map.Colors[blockIdx];
|
||||||
|
}
|
||||||
|
Color c = GetColorByColorMap(map, blockIdx, percOfColor);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IValueRange GetExtendedRange(IValueRange range)
|
||||||
|
{
|
||||||
|
var minVal = range.BottomValue - 1e-15d * Math.Abs(range.BottomValue);
|
||||||
|
var maxVal = range.TopValue + 1e-15d * Math.Abs(range.TopValue);
|
||||||
|
return new ValueRange()
|
||||||
|
{
|
||||||
|
BottomValue = minVal,
|
||||||
|
TopValue = maxVal
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Color GetColorByColorMap(IColorMap map, int blockIdx, double percOfColor)
|
||||||
|
{
|
||||||
|
Color cTarget = map.Colors[blockIdx];
|
||||||
|
Color cNext = map.Colors[blockIdx + 1];
|
||||||
|
|
||||||
|
var deltaRed = cNext.R - cTarget.R;
|
||||||
|
var deltaGreen = cNext.G - cTarget.G;
|
||||||
|
var deltaBlue = cNext.B - cTarget.B;
|
||||||
|
|
||||||
|
var Red = cTarget.R + (deltaRed * percOfColor);
|
||||||
|
var Green = cTarget.G + (deltaGreen * percOfColor);
|
||||||
|
var Blue = cTarget.B + (deltaBlue * percOfColor);
|
||||||
|
|
||||||
|
Color c = Color.FromArgb(Alpha, (byte)Red, (byte)Green, (byte)Blue);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CheckColorMap(IColorMap map)
|
||||||
|
{
|
||||||
|
if (map.Colors.Count == 0)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Color map is empty");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +1,29 @@
|
|||||||
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 StructureHelperCommon.Services;
|
||||||
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
|
||||||
{
|
{
|
||||||
public class FieldViewerViewModel : ViewModelBase, IDataErrorInfo
|
public class FieldViewerViewModel : ViewModelBase, IDataErrorInfo
|
||||||
{
|
{
|
||||||
|
private IMathRoundLogic roundLogic = new SmartRoundLogic() { DigitQuant = 3 };
|
||||||
public ICommand RebuildCommand { get; }
|
public ICommand RebuildCommand { get; }
|
||||||
public ICommand ZoomInCommand { get; }
|
public ICommand ZoomInCommand { get; }
|
||||||
public ICommand ZoomOutCommand { get; }
|
public ICommand ZoomOutCommand { get; }
|
||||||
@@ -164,8 +161,8 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
|||||||
private ColorMapsTypes _ColorMapType;
|
private ColorMapsTypes _ColorMapType;
|
||||||
private IColorMap _ColorMap;
|
private IColorMap _ColorMap;
|
||||||
private IValueRange valueRange;
|
private IValueRange valueRange;
|
||||||
private IEnumerable<IValueRange> _ValueRanges;
|
private IEnumerable<IValueRange> valueRanges;
|
||||||
private IEnumerable<IValueColorRange> _ValueColorRanges;
|
private IEnumerable<IValueColorRange> valueColorRanges;
|
||||||
private bool setMinValue;
|
private bool setMinValue;
|
||||||
private bool setMaxValue;
|
private bool setMaxValue;
|
||||||
private double crossLineX;
|
private double crossLineX;
|
||||||
@@ -177,7 +174,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());
|
||||||
@@ -195,7 +192,7 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
|||||||
if ((PrimitiveSet is null) == false)
|
if ((PrimitiveSet is null) == false)
|
||||||
{
|
{
|
||||||
ProcessPrimitives();
|
ProcessPrimitives();
|
||||||
Legend.ValueColorRanges = _ValueColorRanges;
|
Legend.ValueColorRanges = valueColorRanges;
|
||||||
Legend.Refresh();
|
Legend.Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -262,14 +259,14 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
|||||||
{
|
{
|
||||||
SolidColorBrush brush = new SolidColorBrush();
|
SolidColorBrush brush = new SolidColorBrush();
|
||||||
brush.Color = ColorOperations.GetColorByValue(valueRange, _ColorMap, valuePrimitive.Value);
|
brush.Color = ColorOperations.GetColorByValue(valueRange, _ColorMap, valuePrimitive.Value);
|
||||||
foreach (var valueRange in _ValueColorRanges)
|
foreach (var valueRange in valueColorRanges)
|
||||||
{
|
{
|
||||||
if (valuePrimitive.Value >= valueRange.BottomValue & valuePrimitive.Value <= valueRange.TopValue & (!valueRange.IsActive))
|
if (valuePrimitive.Value >= valueRange.ExactValues.BottomValue & valuePrimitive.Value <= valueRange.ExactValues.TopValue & (!valueRange.IsActive))
|
||||||
{
|
{
|
||||||
brush.Color = Colors.Gray;
|
brush.Color = Colors.Gray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shape.ToolTip = valuePrimitive.Value;
|
shape.ToolTip = roundLogic.RoundValue(valuePrimitive.Value);
|
||||||
shape.Tag = valuePrimitive;
|
shape.Tag = valuePrimitive;
|
||||||
shape.Fill = brush;
|
shape.Fill = brush;
|
||||||
Canvas.SetLeft(shape, valuePrimitive.CenterX - addX - dX);
|
Canvas.SetLeft(shape, valuePrimitive.CenterX - addX - dX);
|
||||||
@@ -306,10 +303,24 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
|||||||
{
|
{
|
||||||
UserValueRange.TopValue = UserValueRange.BottomValue;
|
UserValueRange.TopValue = UserValueRange.BottomValue;
|
||||||
}
|
}
|
||||||
if (SetMinValue) { valueRange.BottomValue = UserValueRange.BottomValue; } else { UserValueRange.BottomValue = valueRange.BottomValue; }
|
if (SetMinValue == true)
|
||||||
if (SetMaxValue) { valueRange.TopValue = UserValueRange.TopValue; } else { UserValueRange.TopValue = valueRange.TopValue; }
|
{
|
||||||
_ValueRanges = ValueRangeOperations.DivideValueRange(valueRange, RangeNumber);
|
valueRange.BottomValue = UserValueRange.BottomValue;
|
||||||
_ValueColorRanges = ColorOperations.GetValueColorRanges(valueRange, _ValueRanges, _ColorMap);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UserValueRange.BottomValue = valueRange.BottomValue;
|
||||||
|
}
|
||||||
|
if (SetMaxValue == true)
|
||||||
|
{
|
||||||
|
valueRange.TopValue = UserValueRange.TopValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UserValueRange.TopValue = valueRange.TopValue;
|
||||||
|
}
|
||||||
|
valueRanges = ValueRangeOperations.DivideValueRange(valueRange, RangeNumber);
|
||||||
|
valueColorRanges = ColorOperations.GetValueColorRanges(valueRange, valueRanges, _ColorMap);
|
||||||
}
|
}
|
||||||
private void SetCrossLine(object commandParameter)
|
private void SetCrossLine(object commandParameter)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -20,23 +20,23 @@
|
|||||||
<ColumnDefinition Width="10"/>
|
<ColumnDefinition Width="10"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<CheckBox Name="ActiveCheckBox" Grid.Column="0" IsChecked="{Binding Path=IsActive}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<CheckBox Name="ActiveCheckBox" Grid.Column="0" IsChecked="{Binding Path=IsActive}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
<Rectangle Grid.Column="1" Margin="0,2,0,2" ToolTip="{Binding Path=BottomValue}">
|
<Rectangle Grid.Column="1" Margin="0,2,0,2" ToolTip="{Binding Path=RoundedValues.BottomValue}">
|
||||||
<Rectangle.Fill>
|
<Rectangle.Fill>
|
||||||
<SolidColorBrush Color="{Binding Path=BottomColor}"/>
|
<SolidColorBrush Color="{Binding Path=ExactValues.BottomColor}"/>
|
||||||
</Rectangle.Fill>
|
</Rectangle.Fill>
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
<Rectangle Grid.Column="2" Margin="0,2,0,2">
|
<Rectangle Grid.Column="2" Margin="0,2,0,2">
|
||||||
<Rectangle.Fill>
|
<Rectangle.Fill>
|
||||||
<LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
|
||||||
<GradientStop Color="{Binding Path=BottomColor}"/>
|
<GradientStop Color="{Binding Path=ExactValues.BottomColor}"/>
|
||||||
<GradientStop Color="{Binding Path=TopColor}" Offset="1"/>
|
<GradientStop Color="{Binding Path=ExactValues.TopColor}" Offset="1"/>
|
||||||
</LinearGradientBrush>
|
</LinearGradientBrush>
|
||||||
</Rectangle.Fill>
|
</Rectangle.Fill>
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
<TextBlock Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="#FF868686" Text="{Binding AverageValue}"/>
|
<TextBlock Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="#FF868686" Text="{Binding RoundedValues.AverageValue}"/>
|
||||||
<Rectangle Grid.Column="3" Margin="0,2,0,2" ToolTip="{Binding Path=TopValue}">
|
<Rectangle Grid.Column="3" Margin="0,2,0,2" ToolTip="{Binding Path=RoundedValues.TopValue}">
|
||||||
<Rectangle.Fill>
|
<Rectangle.Fill>
|
||||||
<SolidColorBrush Color="{Binding Path=TopColor}"/>
|
<SolidColorBrush Color="{Binding Path=ExactValues.TopColor}"/>
|
||||||
</Rectangle.Fill>
|
</Rectangle.Fill>
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
xmlns:FieldViewerControl="clr-namespace:FieldVisualizer.Windows.UserControls"
|
xmlns:FieldViewerControl="clr-namespace:FieldVisualizer.Windows.UserControls"
|
||||||
xmlns:local="clr-namespace:FieldVisualizer.Windows"
|
xmlns:local="clr-namespace:FieldVisualizer.Windows"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="FieldViewer" Height="800" Width="1200" WindowStartupLocation="CenterOwner">
|
Title="FieldViewer" Height="800" Width="1200" MinHeight="400" MinWidth="800" MaxHeight="1000" MaxWidth="1500" WindowStartupLocation="CenterScreen" ShowInTaskbar="False">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="300"/>
|
<ColumnDefinition Width="300"/>
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<ResourceDictionary Source="Infrastructure/UI/Resources/IconDictionary.xaml"/>
|
<ResourceDictionary Source="Infrastructure/UI/Resources/IconDictionary.xaml"/>
|
||||||
<ResourceDictionary Source="Infrastructure/UI/Resources/GraphsTemplates.xaml"/>
|
<ResourceDictionary Source="Infrastructure/UI/Resources/GraphsTemplates.xaml"/>
|
||||||
<ResourceDictionary Source="Infrastructure/UI/Resources/LimitCurveTemplates.xaml"/>
|
<ResourceDictionary Source="Infrastructure/UI/Resources/LimitCurveTemplates.xaml"/>
|
||||||
|
<ResourceDictionary Source="Infrastructure/UI/Resources/ServiceColors.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace StructureHelper.Infrastructure.Enums
|
|||||||
{
|
{
|
||||||
ForceCalculator,
|
ForceCalculator,
|
||||||
LimitCurveCalculator,
|
LimitCurveCalculator,
|
||||||
|
CrackCalculator,
|
||||||
FireCalculator
|
FireCalculator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
|
|||||||
internal class Area : UnitBase
|
internal class Area : UnitBase
|
||||||
{
|
{
|
||||||
public override UnitTypes UnitType { get => UnitTypes.Area; }
|
public override UnitTypes UnitType { get => UnitTypes.Area; }
|
||||||
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "mm2"); }
|
public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "mm2"); }
|
||||||
public override string UnitName { get => "Area"; }
|
public override string UnitName { get => "Area"; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
|
using StructureHelperCommon.Services.Units;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Infrastructure.UI.Converters.Units
|
||||||
|
{
|
||||||
|
internal class CrackWidth : UnitBase
|
||||||
|
{
|
||||||
|
public CrackWidth()
|
||||||
|
{
|
||||||
|
OperationLogic = new ConvertUnitLogic()
|
||||||
|
{
|
||||||
|
MathRoundLogic = new FixedRoundLogic()
|
||||||
|
{
|
||||||
|
DigitQuant = 3
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public override UnitTypes UnitType { get => UnitTypes.Length; }
|
||||||
|
public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "mm"); }
|
||||||
|
public override string UnitName { get => "Length"; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
|
|||||||
internal class Curvature : UnitBase
|
internal class Curvature : UnitBase
|
||||||
{
|
{
|
||||||
public override UnitTypes UnitType { get => UnitTypes.Curvature; }
|
public override UnitTypes UnitType { get => UnitTypes.Curvature; }
|
||||||
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "1/mm"); }
|
public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "1/mm"); }
|
||||||
public override string UnitName { get => "Curvature"; }
|
public override string UnitName { get => "Curvature"; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
|
|||||||
internal class Force : UnitBase
|
internal class Force : UnitBase
|
||||||
{
|
{
|
||||||
public override UnitTypes UnitType { get => UnitTypes.Force; }
|
public override UnitTypes UnitType { get => UnitTypes.Force; }
|
||||||
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "kN"); }
|
public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "kN"); }
|
||||||
public override string UnitName { get => "Force"; }
|
public override string UnitName { get => "Force"; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
|
|||||||
{
|
{
|
||||||
internal class Length : UnitBase
|
internal class Length : UnitBase
|
||||||
{
|
{
|
||||||
|
|
||||||
public override UnitTypes UnitType { get => UnitTypes.Length; }
|
public override UnitTypes UnitType { get => UnitTypes.Length; }
|
||||||
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "mm"); }
|
public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "mm"); }
|
||||||
public override string UnitName { get => "Length"; }
|
public override string UnitName { get => "Length"; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
|
|||||||
internal class Moment : UnitBase
|
internal class Moment : UnitBase
|
||||||
{
|
{
|
||||||
public override UnitTypes UnitType { get => UnitTypes.Moment; }
|
public override UnitTypes UnitType { get => UnitTypes.Moment; }
|
||||||
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "kNm"); }
|
public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "kNm"); }
|
||||||
public override string UnitName { get => "Moment"; }
|
public override string UnitName { get => "Moment"; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
|
|||||||
{
|
{
|
||||||
internal class PlainDouble : IValueConverter
|
internal class PlainDouble : IValueConverter
|
||||||
{
|
{
|
||||||
|
IConvertUnitLogic operationLogic = new ConvertUnitLogic();
|
||||||
|
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -28,7 +30,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return CommonOperation.ConvertToDoubleChangeComma((string)value);
|
return ProcessString.ConvertCommaToCultureSettings((string)value);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
using StructureHelperCommon.Services.Units;
|
using StructureHelperCommon.Services.Units;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -12,8 +13,19 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
|
|||||||
{
|
{
|
||||||
internal class Stress : UnitBase
|
internal class Stress : UnitBase
|
||||||
{
|
{
|
||||||
|
|
||||||
public override UnitTypes UnitType { get => UnitTypes.Stress; }
|
public override UnitTypes UnitType { get => UnitTypes.Stress; }
|
||||||
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "MPa"); }
|
public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "MPa"); }
|
||||||
public override string UnitName { get => "Stress"; }
|
public override string UnitName { get => "Stress"; }
|
||||||
|
public Stress()
|
||||||
|
{
|
||||||
|
OperationLogic = new ConvertUnitLogic()
|
||||||
|
{
|
||||||
|
MathRoundLogic = new SmartRoundLogic()
|
||||||
|
{
|
||||||
|
DigitQuant = 3
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Parameters;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
using StructureHelperCommon.Services.Units;
|
using StructureHelperCommon.Services.Units;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -14,19 +17,61 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
|
|||||||
{
|
{
|
||||||
internal abstract class UnitBase : IValueConverter
|
internal abstract class UnitBase : IValueConverter
|
||||||
{
|
{
|
||||||
|
IMathRoundLogic roundLogic = new DirectRoundLogic();
|
||||||
|
public IConvertUnitLogic OperationLogic { get; set; } = new ConvertUnitLogic();
|
||||||
|
public IGetUnitLogic UnitLogic { get; set; } = new GetUnitLogic();
|
||||||
public abstract UnitTypes UnitType { get; }
|
public abstract UnitTypes UnitType { get; }
|
||||||
public abstract IUnit CurrentUnit { get; }
|
public abstract IUnit CurrentUnit { get; }
|
||||||
public abstract string UnitName { get;}
|
public abstract string UnitName { get;}
|
||||||
|
/// <summary>
|
||||||
|
/// From variable to user
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <param name="targetType"></param>
|
||||||
|
/// <param name="parameter"></param>
|
||||||
|
/// <param name="culture"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
return CommonOperation.Convert(CurrentUnit, UnitName, value);
|
var pair = OperationLogic.Convert(CurrentUnit, UnitName, value);
|
||||||
|
var result = pair.Value;
|
||||||
|
if (parameter is not null)
|
||||||
|
{
|
||||||
|
if (parameter is string paramString)
|
||||||
|
{
|
||||||
|
var logic = new ProcessDoublePairLogic() { DigitPlace = DigitPlace.Any };
|
||||||
|
var paramPair = logic.GetValuePairByString(paramString);
|
||||||
|
string paramTextPart = paramPair.Text.ToLower();
|
||||||
|
int paramValuePart = (int)paramPair.Value;
|
||||||
|
if (paramTextPart == "smart")
|
||||||
|
{
|
||||||
|
roundLogic = new SmartRoundLogic() { DigitQuant = paramValuePart };
|
||||||
}
|
}
|
||||||
|
else if (paramTextPart == "fixed")
|
||||||
|
{
|
||||||
|
roundLogic = new FixedRoundLogic() { DigitQuant = paramValuePart };
|
||||||
|
}
|
||||||
|
result = roundLogic.RoundValue(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string strValue = $"{result} {pair.Text}";
|
||||||
|
return strValue;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// From user to variable
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <param name="targetType"></param>
|
||||||
|
/// <param name="parameter"></param>
|
||||||
|
/// <param name="culture"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return CommonOperation.ConvertBack(UnitType, CurrentUnit, value);
|
double result = OperationLogic.ConvertBack(UnitType, CurrentUnit, value);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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,12 +238,6 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
this.primitive = primitive;
|
this.primitive = primitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterDeltas(double dx, double dy)
|
|
||||||
{
|
|
||||||
DeltaX = dx;
|
|
||||||
DeltaY = dy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CrossSectionViewModel OwnerVM { get; private set; }
|
public CrossSectionViewModel OwnerVM { get; private set; }
|
||||||
|
|
||||||
public double DeltaX { get; private set; }
|
public double DeltaX { 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,11 +51,38 @@
|
|||||||
</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="-2"/>
|
||||||
|
<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 TargetType="Viewbox">
|
||||||
|
<Setter Property="Margin" Value="-2"/>
|
||||||
|
<Setter Property="Width" Value="32"/>
|
||||||
|
<Setter Property="Height" Value="32"/>
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
|
<Setter Property="Stretch" Value="UniformToFill"/>
|
||||||
|
<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"/>
|
||||||
<Setter Property="Background" Value="#FFA19BC3"/>
|
<Setter Property="Background" Value="#FFA19BC3"/>
|
||||||
<Setter Property="BorderBrush" Value="#FF857AB9"/>
|
<Setter Property="BorderBrush" Value="Black"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="ButtonImage16" TargetType="Image">
|
<Style x:Key="ButtonImage16" TargetType="Image">
|
||||||
@@ -67,6 +94,41 @@
|
|||||||
<Setter Property="Width" Value="32"/>
|
<Setter Property="Width" Value="32"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Color x:Key="ButtonLight" A="255" B="255" G="255" R="255"/>
|
||||||
|
<Color x:Key="CalculatorColor" A="255" B="149" G="149" R="211"/>
|
||||||
|
<Color x:Key="CalculatorFrameColor" A="255" B="109" G="109" R="166"/>
|
||||||
|
<Color x:Key="ResultColor" A="255" B="200" G="200" R="200"/>
|
||||||
|
<Color x:Key="ResultFrameColor" A="255" B="100" G="100" R="100"/>
|
||||||
|
<SolidColorBrush x:Key="CalculatorCanvas" Color="{DynamicResource CalculatorColor}"/>
|
||||||
|
<SolidColorBrush x:Key="CalculatorFrame" Color="{DynamicResource CalculatorFrameColor}"/>
|
||||||
|
<SolidColorBrush x:Key="ResultCanvas" Color="{DynamicResource ResultColor}"/>
|
||||||
|
<SolidColorBrush x:Key="ResultFrame" Color="{DynamicResource ResultFrameColor}"/>
|
||||||
|
|
||||||
|
<Style x:Key="ButtonCanvas" TargetType="Canvas">
|
||||||
|
<Setter Property="Width" Value="32"/>
|
||||||
|
<Setter Property="Height" Value="32"/>
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="ButtonCalculatorCanvas" TargetType="Canvas" BasedOn="{StaticResource ButtonCanvas}">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource CalculatorCanvas}"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="ButtonResultCanvas" TargetType="Canvas" BasedOn="{StaticResource ButtonCanvas}">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource ResultCanvas}"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="ButtonRect" TargetType="Rectangle">
|
||||||
|
<Setter Property="Margin" Value="3"/>
|
||||||
|
<Setter Property="Width" Value="26"/>
|
||||||
|
<Setter Property="Height" Value="26"/>
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
|
<Setter Property="StrokeThickness" Value="1"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
|
||||||
<DataTemplate x:Key="OkCancelButtons">
|
<DataTemplate x:Key="OkCancelButtons">
|
||||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<Button Style="{StaticResource CancelButton}" Command="{Binding CancelCommand}"/>
|
<Button Style="{StaticResource CancelButton}" Command="{Binding CancelCommand}"/>
|
||||||
@@ -74,5 +136,86 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="ButtonCalculatorRectangle">
|
||||||
|
<Rectangle Style="{DynamicResource ButtonRect}" Stroke="{DynamicResource CalculatorFrame}">
|
||||||
|
<Rectangle.Fill>
|
||||||
|
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
|
||||||
|
<GradientStop Color="{DynamicResource ButtonLight}" Offset="0.2"/>
|
||||||
|
<GradientStop Color="{DynamicResource CalculatorColor}" Offset="1"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</Rectangle.Fill>
|
||||||
|
</Rectangle>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="ButtonResultRectangle">
|
||||||
|
<Rectangle Style="{DynamicResource ButtonRect}" Stroke="{DynamicResource ResultFrame}">
|
||||||
|
<Rectangle.Fill>
|
||||||
|
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
|
||||||
|
<GradientStop Color="{DynamicResource ButtonLight}" Offset="0.2"/>
|
||||||
|
<GradientStop Color="{DynamicResource ResultColor}" Offset="1"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</Rectangle.Fill>
|
||||||
|
</Rectangle>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="DiagramCalculator">
|
||||||
|
<Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
|
||||||
|
<Canvas.Children>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
|
||||||
|
<Line Margin="4" X1="0" Y1="20" X2="25" Y2="20" StrokeThickness="1.5" Stroke="{DynamicResource CalculatorFrame}"/>
|
||||||
|
<Line Margin="4" X1="4" Y1="0" X2="4" Y2="25" StrokeThickness="1.5" Stroke="{DynamicResource CalculatorFrame}"/>
|
||||||
|
<Path Margin="4" Data="M 0 5 l 4 -4 l 7 4 l 7 6 l 2 4 l -2 7 l -2 2 " Stroke="{DynamicResource CalculatorFrame}"/>
|
||||||
|
<TextBlock Margin="4,2,0,0" Text="M-N" Foreground="Black" FontSize="10" HorizontalAlignment="Stretch" FontWeight="Bold" />
|
||||||
|
</Canvas.Children>
|
||||||
|
</Canvas>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="CrackCalculator">
|
||||||
|
<Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
|
||||||
|
<Canvas.Children>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
|
||||||
|
<Path Margin="4" Data="M 0 0 l 25 0 l 0 20
|
||||||
|
l -4 0
|
||||||
|
l -1 -5 l 1 -5 l -2 5 l -2 5
|
||||||
|
l -3 0
|
||||||
|
l 0 -5 l 0 -10 l -2 10 l -2 5
|
||||||
|
l -3 0
|
||||||
|
l -1 -5 l 1 -5 l -2 5 l -2 5
|
||||||
|
l -4 0" Fill="{DynamicResource CalculatorFrame}"/>
|
||||||
|
<TextBlock Margin="4,2,0,0" Text="Crc" Foreground="White" FontSize="10" HorizontalAlignment="Stretch" FontWeight="Bold" />
|
||||||
|
</Canvas.Children>
|
||||||
|
</Canvas>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="CalculatorRun">
|
||||||
|
<Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
|
||||||
|
<Canvas.Children>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
|
||||||
|
<Path Margin="4" Data="M 4 2 l 12 10 l -12 10 l 0 -20" Fill="{DynamicResource CalculatorFrame}"/>
|
||||||
|
</Canvas.Children>
|
||||||
|
</Canvas>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="IsoFieldResult">
|
||||||
|
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||||
|
<Canvas.Children>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource ButtonResultRectangle}"/>
|
||||||
|
<Path Margin="4" Data="M 0 0 h 20 A 20 20 90 0 1 0 24 z" Fill="Gray"/>
|
||||||
|
<Path Margin="4" Data="M 0 0 h 16 A 16 16 90 0 1 0 18 z" Fill="DarkGray"/>
|
||||||
|
<Path Margin="4" Data="M 0 0 h 10 A 10 10 90 0 1 0 10 z" Fill="LightGray"/>
|
||||||
|
</Canvas.Children>
|
||||||
|
</Canvas>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="ShowRebarsResult">
|
||||||
|
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||||
|
<Canvas.Children>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource ButtonResultRectangle}"/>
|
||||||
|
<Rectangle Canvas.Left="8" Canvas.Top="6" Width="16" Height="21" Fill="LightGray" Stroke ="Black"/>
|
||||||
|
<Ellipse Canvas.Left="10" Canvas.Top="21" Width="4" Height="4" Fill="DarkGray" Stroke ="Black"/>
|
||||||
|
<Ellipse Canvas.Left="18" Canvas.Top="21" Width="4" Height="4" Fill="DarkGray" Stroke ="Black"/>
|
||||||
|
</Canvas.Children>
|
||||||
|
</Canvas>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -12,5 +12,6 @@
|
|||||||
<convertersUnits:Moment x:Key="MomentConverter"/>
|
<convertersUnits:Moment x:Key="MomentConverter"/>
|
||||||
<convertersUnits:Stress x:Key="StressConverter"/>
|
<convertersUnits:Stress x:Key="StressConverter"/>
|
||||||
<convertersUnits:Curvature x:Key="Curvature"/>
|
<convertersUnits:Curvature x:Key="Curvature"/>
|
||||||
|
<convertersUnits:CrackWidth x:Key="CrackWidth"/>
|
||||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
27
StructureHelper/Infrastructure/UI/Resources/Cracks.xaml
Normal file
27
StructureHelper/Infrastructure/UI/Resources/Cracks.xaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<DataTemplate x:Key="CrackTextBox">
|
||||||
|
<TextBlock Grid.Row="0" Text="{Binding CrackWidth, Converter={StaticResource LengthConverter}}" HorizontalAlignment="Right">
|
||||||
|
<TextBlock.Style>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsCrackLessThanUltimate}" Value="false">
|
||||||
|
<Setter Property="Background" Value="{StaticResource WarningColorBrush}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</TextBlock.Style>
|
||||||
|
</TextBlock>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="CrackGrid">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<ContentControl ContentTemplate="{StaticResource CrackTextBox}" Content="{Binding LongTermResult}"/>
|
||||||
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource CrackTextBox}" Content="{Binding ShortTermResult}"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -23,7 +23,8 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
<ListBox Grid.Column="2" ItemsSource="{Binding TargetItems}"
|
<ListBox Grid.Column="2" ItemsSource="{Binding TargetItems}"
|
||||||
SelectedItem="{Binding SelectedTargetItem}"
|
SelectedItem="{Binding SelectedTargetItem}"
|
||||||
ItemTemplate="{Binding ItemDataDemplate}">
|
ItemTemplate="{Binding ItemDataDemplate}"
|
||||||
|
>
|
||||||
<!--<InputBindingCollection>
|
<!--<InputBindingCollection>
|
||||||
<MouseBinding Gesture="LeftDoubleClick" Command="{Binding RemoveSelected}"/>
|
<MouseBinding Gesture="LeftDoubleClick" Command="{Binding RemoveSelected}"/>
|
||||||
</InputBindingCollection>-->
|
</InputBindingCollection>-->
|
||||||
@@ -33,15 +34,23 @@
|
|||||||
<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}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<ListBox Grid.Row="1" ItemsSource="{Binding CollectionItems}" SelectedItem="SelectedItem">
|
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Visible">
|
||||||
|
<ListBox ItemsSource="{Binding CollectionItems}" SelectedItem="SelectedItem" HorizontalAlignment="Stretch">
|
||||||
|
<ListBox.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Header="Select All" Command="{Binding SelectAllCommand}"/>
|
||||||
|
<MenuItem Header="UnSelect All" Command="{Binding UnSelectAllCommand}"/>
|
||||||
|
<MenuItem Header="Unvert Selection" Command="{Binding InvertSelectionCommand}"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</ListBox.ContextMenu>
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -55,6 +64,7 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
</ScrollViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<Color x:Key="ErrorColor" R="255" G="192" B="203" A="100" />
|
||||||
|
<Color x:Key="WarningColor" R="255" G="255" B="0" A="100" />
|
||||||
|
<SolidColorBrush x:Key="ErrorColorBrush" Color="{DynamicResource ErrorColor}"/>
|
||||||
|
<SolidColorBrush x:Key="WarningColorBrush" Color="{DynamicResource WarningColor}"/>
|
||||||
|
</ResourceDictionary>
|
||||||
Binary file not shown.
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
-->
|
-->
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<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>
|
<History>True|2024-03-11T15:33:14.1457807Z;True|2024-03-10T19:11:27.6834663+05:00;True|2024-02-02T12:22:50.1454015+05:00;True|2023-02-25T13:37:39.2738786+05:00;False|2023-02-25T13:37:24.0284261+05:00;True|2023-02-25T13:34:01.6858860+05:00;True|2023-02-25T13:31:18.8295711+05:00;False|2023-02-25T13:25:21.5807199+05:00;False|2023-02-25T13:24:41.7164398+05:00;</History>
|
||||||
<LastFailureDetails />
|
<LastFailureDetails />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
20
StructureHelper/Services/ResultViewers/CrackResultFunc.cs
Normal file
20
StructureHelper/Services/ResultViewers/CrackResultFunc.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Services.ResultViewers
|
||||||
|
{
|
||||||
|
public class CrackResultFunc : IResultFunc<Func<RebarCrackResult, double>>
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public Func<RebarCrackResult, double> ResultFunction { get; set; }
|
||||||
|
|
||||||
|
public string UnitName { get; set; }
|
||||||
|
|
||||||
|
public double UnitFactor { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Services.Units;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Services.ResultViewers
|
||||||
|
{
|
||||||
|
|
||||||
|
public static class CrackResultFuncFactory
|
||||||
|
{
|
||||||
|
private static readonly IConvertUnitLogic operationLogic = new ConvertUnitLogic();
|
||||||
|
private static readonly IGetUnitLogic UnitLogic = new GetUnitLogic();
|
||||||
|
|
||||||
|
static IUnit unitStress = UnitLogic.GetUnit(UnitTypes.Stress);
|
||||||
|
static IUnit unitLength = UnitLogic.GetUnit(UnitTypes.Length, "mm");
|
||||||
|
|
||||||
|
public static List<CrackResultFunc> GetResultFuncs()
|
||||||
|
{
|
||||||
|
List<CrackResultFunc> results = new()
|
||||||
|
{
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "Long crack width",
|
||||||
|
ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.CrackWidth,
|
||||||
|
UnitFactor = unitLength.Multiplyer,
|
||||||
|
UnitName = unitLength.Name
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "Short crack width",
|
||||||
|
ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.CrackWidth,
|
||||||
|
UnitFactor = unitLength.Multiplyer,
|
||||||
|
UnitName = unitLength.Name
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "Long softening factor",
|
||||||
|
ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.SofteningFactor,
|
||||||
|
UnitFactor = 1,
|
||||||
|
UnitName = "Dimensionless"
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "Short softening factor",
|
||||||
|
ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.SofteningFactor,
|
||||||
|
UnitFactor = 1,
|
||||||
|
UnitName = "Dimensionless"
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "Long rebar stress",
|
||||||
|
ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.RebarStressResult.RebarStress,
|
||||||
|
UnitFactor = unitStress.Multiplyer,
|
||||||
|
UnitName = unitStress.Name
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "Short rebar stress",
|
||||||
|
ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.RebarStressResult.RebarStress,
|
||||||
|
UnitFactor = unitStress.Multiplyer,
|
||||||
|
UnitName = unitStress.Name
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "Long rebar strain",
|
||||||
|
ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.RebarStressResult.RebarStrain,
|
||||||
|
UnitFactor = 1d,
|
||||||
|
UnitName = string.Empty
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "Short rebar strain",
|
||||||
|
ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.RebarStressResult.RebarStrain,
|
||||||
|
UnitFactor = 1d,
|
||||||
|
UnitName = string.Empty
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "Long concrete strain",
|
||||||
|
ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.RebarStressResult.ConcreteStrain,
|
||||||
|
UnitFactor = 1d,
|
||||||
|
UnitName = string.Empty
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "Short concrete strain",
|
||||||
|
ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.RebarStressResult.ConcreteStrain,
|
||||||
|
UnitFactor = 1d,
|
||||||
|
UnitName = string.Empty
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,13 +8,14 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelper.Services.ResultViewers
|
namespace StructureHelper.Services.ResultViewers
|
||||||
{
|
{
|
||||||
public class ResultFunc : IResultFunc
|
public class ForceResultFunc : IResultFunc<Func<IStrainMatrix, INdm, double>>
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public Func<IStrainMatrix, INdm, double> ResultFunction { get; set; }
|
public Func<IStrainMatrix, INdm, double> ResultFunction { get; set; }
|
||||||
|
public string UnitName { get; set; }
|
||||||
public double UnitFactor { get; set; }
|
public double UnitFactor { get; set; }
|
||||||
|
|
||||||
public ResultFunc()
|
public ForceResultFunc()
|
||||||
{
|
{
|
||||||
UnitFactor = 1d;
|
UnitFactor = 1d;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
using LoaderCalculator.Logics;
|
||||||
|
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Services.Units;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Services.ResultViewers
|
||||||
|
{
|
||||||
|
public enum FuncsTypes
|
||||||
|
{
|
||||||
|
Strain,
|
||||||
|
Stress,
|
||||||
|
Forces,
|
||||||
|
Full,
|
||||||
|
}
|
||||||
|
public static class ForceResultFuncFactory
|
||||||
|
{
|
||||||
|
static IGetUnitLogic unitLogic = new GetUnitLogic();
|
||||||
|
static IUnit unitForce = unitLogic.GetUnit(UnitTypes.Force);
|
||||||
|
static IUnit unitStress = unitLogic.GetUnit(UnitTypes.Stress);
|
||||||
|
static IUnit unitMoment = unitLogic.GetUnit(UnitTypes.Moment);
|
||||||
|
static IUnit unitCurvature = unitLogic.GetUnit(UnitTypes.Curvature);
|
||||||
|
|
||||||
|
static readonly IStressLogic stressLogic = new StressLogic();
|
||||||
|
public static List<ForceResultFunc> GetResultFuncs(FuncsTypes funcsType = FuncsTypes.Full)
|
||||||
|
{
|
||||||
|
List<ForceResultFunc> 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<ForceResultFunc> GetStrainResultFuncs()
|
||||||
|
{
|
||||||
|
List<ForceResultFunc> resultFuncs = new ();
|
||||||
|
resultFuncs.Add(new ForceResultFunc() { Name = "Section Strain", ResultFunction = stressLogic.GetSectionStrain });
|
||||||
|
resultFuncs.Add(new ForceResultFunc() { Name = "Total Strain", ResultFunction = stressLogic.GetTotalStrain });
|
||||||
|
resultFuncs.Add(new ForceResultFunc() { Name = "Prestrain", ResultFunction = stressLogic.GetPrestrain });
|
||||||
|
resultFuncs.Add(new ForceResultFunc() { Name = "Elastic Strain", ResultFunction = stressLogic.GetElasticStrain });
|
||||||
|
resultFuncs.Add(new ForceResultFunc() { Name = "Plastic Strain", ResultFunction = stressLogic.GetPlasticStrain });
|
||||||
|
return resultFuncs;
|
||||||
|
}
|
||||||
|
private static List<ForceResultFunc> GetStressResultFuncs()
|
||||||
|
{
|
||||||
|
List<ForceResultFunc> resultFuncs = new ();
|
||||||
|
resultFuncs.Add(new ForceResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress, UnitFactor = unitStress.Multiplyer, UnitName = unitStress.Name });
|
||||||
|
resultFuncs.Add(new ForceResultFunc() { Name = "Secant modulus", ResultFunction = stressLogic.GetSecantModulus, UnitFactor = unitStress.Multiplyer, UnitName = unitStress.Name });
|
||||||
|
resultFuncs.Add(new ForceResultFunc() { Name = "Modulus degradation", ResultFunction = stressLogic.GetModulusDegradation });
|
||||||
|
return resultFuncs;
|
||||||
|
}
|
||||||
|
private static List<ForceResultFunc> GetForcesResultFuncs()
|
||||||
|
{
|
||||||
|
List<ForceResultFunc> resultFuncs = new ();
|
||||||
|
resultFuncs.Add(new ForceResultFunc() { Name = "Force", ResultFunction = stressLogic.GetForce, UnitFactor = unitForce.Multiplyer, UnitName = unitForce.Name });
|
||||||
|
resultFuncs.Add(new ForceResultFunc() { Name = "Moment X", ResultFunction = stressLogic.GetMomentX, UnitFactor = unitMoment.Multiplyer, UnitName = unitMoment.Name });
|
||||||
|
resultFuncs.Add(new ForceResultFunc() { Name = "Moment Y", ResultFunction = stressLogic.GetMomentY, UnitFactor = unitMoment.Multiplyer, UnitName = unitMoment.Name });
|
||||||
|
return resultFuncs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,10 +8,11 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelper.Services.ResultViewers
|
namespace StructureHelper.Services.ResultViewers
|
||||||
{
|
{
|
||||||
public interface IResultFunc
|
public interface IResultFunc <T>
|
||||||
{
|
{
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
Func<IStrainMatrix, INdm, double> ResultFunction { get; }
|
T ResultFunction { get; }
|
||||||
|
string UnitName { get; set; }
|
||||||
double UnitFactor { get; }
|
double UnitFactor { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
using LoaderCalculator.Logics;
|
|
||||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelper.Services.ResultViewers
|
|
||||||
{
|
|
||||||
public static class ResultFuncFactory
|
|
||||||
{
|
|
||||||
public static IEnumerable<IResultFunc> GetResultFuncs()
|
|
||||||
{
|
|
||||||
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 with prestrain", ResultFunction = stressLogic.GetTotalStrainWithPresrain });
|
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Elastic Strain", ResultFunction = stressLogic.GetElasticStrain });
|
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Plastic Strain", ResultFunction = stressLogic.GetPlasticStrain });
|
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress, UnitFactor = 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 = "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 Y", ResultFunction = stressLogic.GetMomentY, UnitFactor = UnitConstants.Force });
|
|
||||||
return resultFuncs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,10 @@ using LoaderCalculator.Data.Matrix;
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Data.ResultData;
|
using LoaderCalculator.Data.ResultData;
|
||||||
using LoaderCalculator.Logics;
|
using LoaderCalculator.Logics;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -14,13 +18,14 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
{
|
{
|
||||||
public static class ShowIsoFieldResult
|
public static class ShowIsoFieldResult
|
||||||
{
|
{
|
||||||
public static void ShowResult(IStrainMatrix strainMatrix, IEnumerable<INdm> ndms, IEnumerable<IResultFunc> resultFuncs)
|
static IMathRoundLogic roundLogic = new SmartRoundLogic() { DigitQuant = 3 };
|
||||||
|
public static void ShowResult(IStrainMatrix strainMatrix, IEnumerable<INdm> ndms, IEnumerable<ForceResultFunc> resultFuncs)
|
||||||
{
|
{
|
||||||
var primitiveSets = GetPrimitiveSets(strainMatrix, ndms, resultFuncs);
|
var primitiveSets = GetPrimitiveSets(strainMatrix, ndms, resultFuncs);
|
||||||
FieldViewerOperation.ShowViewer(primitiveSets);
|
FieldViewerOperation.ShowViewer(primitiveSets);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<IPrimitiveSet> GetPrimitiveSets(IStrainMatrix strainMatrix, IEnumerable<INdm> ndms, IEnumerable<IResultFunc> resultFuncs)
|
public static List<IPrimitiveSet> GetPrimitiveSets(IStrainMatrix strainMatrix, IEnumerable<INdm> ndms, IEnumerable<ForceResultFunc> resultFuncs)
|
||||||
{
|
{
|
||||||
List<IPrimitiveSet> primitiveSets = new List<IPrimitiveSet>();
|
List<IPrimitiveSet> primitiveSets = new List<IPrimitiveSet>();
|
||||||
foreach (var valDelegate in resultFuncs)
|
foreach (var valDelegate in resultFuncs)
|
||||||
@@ -29,23 +34,85 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||||
foreach (INdm ndm in ndms)
|
foreach (INdm ndm in ndms)
|
||||||
{
|
{
|
||||||
double val = valDelegate.ResultFunction.Invoke(strainMatrix, ndm) * valDelegate.UnitFactor;
|
primitives.Add(ProcessNdm(strainMatrix, valDelegate, ndm));
|
||||||
IValuePrimitive valuePrimitive;
|
|
||||||
if (ndm is IRectangleNdm)
|
|
||||||
{
|
|
||||||
var shapeNdm = ndm as IRectangleNdm;
|
|
||||||
valuePrimitive = new RectanglePrimitive() { CenterX = ndm.CenterX, CenterY = ndm.CenterY, Height = shapeNdm.Height, Width = shapeNdm.Width, Value = val };
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
valuePrimitive = new CirclePrimitive() { CenterX = ndm.CenterX, CenterY = ndm.CenterY, Diameter = Math.Sqrt(ndm.Area / Math.PI) * 2, Value = val };
|
|
||||||
}
|
|
||||||
primitives.Add(valuePrimitive);
|
|
||||||
}
|
}
|
||||||
primitiveSet.ValuePrimitives = primitives;
|
primitiveSet.ValuePrimitives = primitives;
|
||||||
primitiveSets.Add(primitiveSet);
|
primitiveSets.Add(primitiveSet);
|
||||||
}
|
}
|
||||||
return primitiveSets;
|
return primitiveSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<IPrimitiveSet> GetPrimitiveSets(IEnumerable<RebarCrackResult> rebarResults, IEnumerable<CrackResultFunc> resultFuncs)
|
||||||
|
{
|
||||||
|
List<IPrimitiveSet> primitiveSets = new List<IPrimitiveSet>();
|
||||||
|
foreach (var valDelegate in resultFuncs)
|
||||||
|
{
|
||||||
|
PrimitiveSet primitiveSet = new PrimitiveSet() { Name = valDelegate.Name };
|
||||||
|
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||||
|
foreach (var rebarResult in rebarResults)
|
||||||
|
{
|
||||||
|
primitives.Add(ProcessNdm(valDelegate, rebarResult));
|
||||||
|
}
|
||||||
|
primitiveSet.ValuePrimitives = primitives;
|
||||||
|
primitiveSets.Add(primitiveSet);
|
||||||
|
}
|
||||||
|
return primitiveSets;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IValuePrimitive ProcessNdm(CrackResultFunc valDelegate, RebarCrackResult rebarResult)
|
||||||
|
{
|
||||||
|
double delegateResult = valDelegate.ResultFunction.Invoke(rebarResult);
|
||||||
|
var val = delegateResult * valDelegate.UnitFactor;
|
||||||
|
//val = roundLogic.RoundValue(val);
|
||||||
|
IValuePrimitive valuePrimitive;
|
||||||
|
var rebarNdm = rebarResult.RebarPrimitive.GetRebarNdm(new TriangulationOptions()
|
||||||
|
{
|
||||||
|
LimiteState = LimitStates.SLS,
|
||||||
|
CalcTerm = CalcTerms.ShortTerm
|
||||||
|
}
|
||||||
|
);
|
||||||
|
valuePrimitive = ProcessCircle(rebarNdm, val);
|
||||||
|
return valuePrimitive;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IValuePrimitive ProcessNdm(IStrainMatrix strainMatrix, ForceResultFunc valDelegate, INdm ndm)
|
||||||
|
{
|
||||||
|
double delegateResult = valDelegate.ResultFunction.Invoke(strainMatrix, ndm);
|
||||||
|
double val = delegateResult * valDelegate.UnitFactor;
|
||||||
|
//val = roundLogic.RoundValue(val);
|
||||||
|
IValuePrimitive valuePrimitive;
|
||||||
|
if (ndm is IRectangleNdm shapeNdm)
|
||||||
|
{
|
||||||
|
valuePrimitive = ProcessRectangle(shapeNdm, val);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
valuePrimitive = ProcessCircle(ndm, val);
|
||||||
|
}
|
||||||
|
return valuePrimitive;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IValuePrimitive ProcessRectangle(IRectangleNdm shapeNdm, double val)
|
||||||
|
{
|
||||||
|
return new RectanglePrimitive()
|
||||||
|
{
|
||||||
|
CenterX = shapeNdm.CenterX,
|
||||||
|
CenterY = shapeNdm.CenterY,
|
||||||
|
Height = shapeNdm.Height,
|
||||||
|
Width = shapeNdm.Width,
|
||||||
|
Value = val
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IValuePrimitive ProcessCircle(INdm ndm, double val)
|
||||||
|
{
|
||||||
|
return new CirclePrimitive()
|
||||||
|
{
|
||||||
|
CenterX = ndm.CenterX,
|
||||||
|
CenterY = ndm.CenterY,
|
||||||
|
Diameter = Math.Sqrt(ndm.Area / Math.PI) * 2,
|
||||||
|
Value = val
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,15 @@
|
|||||||
<Compile Update="Windows\Arrays\ArrayView.xaml.cs">
|
<Compile Update="Windows\Arrays\ArrayView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Windows\CalculationWindows\CalculatorsViews\Cracks\CrackCalculatorInputDataView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Windows\CalculationWindows\CalculatorsViews\Cracks\CrackResultView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Windows\CalculationWindows\CalculatorsViews\Cracks\TupleCrackResultView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\LimitCurveDataView.xaml.cs">
|
<Compile Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\LimitCurveDataView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -36,6 +45,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>
|
||||||
@@ -59,6 +77,9 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Page Update="Infrastructure\UI\Resources\Cracks.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Infrastructure\UI\Resources\ForceTemplates.xaml">
|
<Page Update="Infrastructure\UI\Resources\ForceTemplates.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
@@ -74,9 +95,24 @@
|
|||||||
<Page Update="Infrastructure\UI\Resources\Materials.xaml">
|
<Page Update="Infrastructure\UI\Resources\Materials.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="Infrastructure\UI\Resources\ServiceColors.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Windows\Arrays\ArrayView.xaml">
|
<Page Update="Windows\Arrays\ArrayView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="Windows\CalculationWindows\CalculatorsViews\Cracks\CrackCalculatorInputDataView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Update="Windows\CalculationWindows\CalculatorsViews\Cracks\CrackResultView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Update="Windows\CalculationWindows\CalculatorsViews\Cracks\Cracks.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Update="Windows\CalculationWindows\CalculatorsViews\Cracks\TupleCrackResultView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\LimitCurveDataView.xaml">
|
<Page Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\LimitCurveDataView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
@@ -101,6 +137,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,4 +1,5 @@
|
|||||||
using StructureHelper.Windows.Graphs;
|
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic;
|
||||||
|
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;
|
||||||
@@ -20,7 +21,11 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
|||||||
{
|
{
|
||||||
internal class CrackDiagramLogic : ILongProcessLogic
|
internal class CrackDiagramLogic : ILongProcessLogic
|
||||||
{
|
{
|
||||||
|
static IConvertUnitLogic operationLogic = new ConvertUnitLogic();
|
||||||
|
static IGetUnitLogic unitLogic = new GetUnitLogic();
|
||||||
static readonly CrackForceCalculator calculator = new();
|
static readonly CrackForceCalculator calculator = new();
|
||||||
|
private ITriangulatePrimitiveLogic triangulateLogic;
|
||||||
|
|
||||||
private List<IForcesTupleResult> ValidTupleList { get; set; }
|
private List<IForcesTupleResult> ValidTupleList { get; set; }
|
||||||
ArrayParameter<double> arrayParameter;
|
ArrayParameter<double> arrayParameter;
|
||||||
private IEnumerable<IForcesTupleResult> TupleList { get; set; }
|
private IEnumerable<IForcesTupleResult> TupleList { get; set; }
|
||||||
@@ -60,21 +65,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);
|
unitLogic.GetUnit(UnitTypes.Force),
|
||||||
arrayParameter = new ArrayParameter<double>(ValidTupleList.Count(), labels.Count(), labels);
|
unitLogic.GetUnit(UnitTypes.Moment),
|
||||||
CalculateWithCrack(ValidTupleList, NdmPrimitives, unitForce, unitMoment, unitCurvature);
|
unitLogic.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();
|
||||||
},
|
},
|
||||||
@@ -95,7 +106,14 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
|||||||
calculator.EndTuple = validTupleList[i].DesignForceTuple.ForceTuple;
|
calculator.EndTuple = validTupleList[i].DesignForceTuple.ForceTuple;
|
||||||
var limitState = validTupleList[i].DesignForceTuple.LimitState;
|
var limitState = validTupleList[i].DesignForceTuple.LimitState;
|
||||||
var calcTerm = validTupleList[i].DesignForceTuple.CalcTerm;
|
var calcTerm = validTupleList[i].DesignForceTuple.CalcTerm;
|
||||||
var ndms = NdmPrimitivesService.GetNdms(ndmPrimitives, limitState, calcTerm);
|
triangulateLogic = new TriangulatePrimitiveLogic()
|
||||||
|
{
|
||||||
|
Primitives = ndmPrimitives,
|
||||||
|
LimitState = limitState,
|
||||||
|
CalcTerm = calcTerm,
|
||||||
|
TraceLogger = TraceLogger
|
||||||
|
};
|
||||||
|
var ndms = triangulateLogic.GetNdms();
|
||||||
calculator.NdmCollection = ndms;
|
calculator.NdmCollection = ndms;
|
||||||
calculator.Run();
|
calculator.Run();
|
||||||
var result = (CrackForceResult)calculator.Result;
|
var result = (CrackForceResult)calculator.Result;
|
||||||
@@ -131,18 +149,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 = unitLogic.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}",
|
||||||
@@ -151,6 +165,8 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
|||||||
$"{crcFactor}Az",
|
$"{crcFactor}Az",
|
||||||
$"PsiFactor"
|
$"PsiFactor"
|
||||||
};
|
};
|
||||||
|
labels.AddRange(crclabels);
|
||||||
|
return labels;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.CrackCalculatorInputDataView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews"
|
||||||
|
d:DataContext="{d:DesignInstance local:CrackCalculatorInputDataViewModel}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="{Binding WindowTitle}" Height="390" Width="400" MinHeight="300" MinWidth="400"
|
||||||
|
ResizeMode="NoResize" WindowStartupLocation="CenterScreen"
|
||||||
|
Closing="Window_Closing" ShowInTaskbar="False" Icon="{Binding Mode=OneWay, Source={StaticResource CrackCalculator}}"
|
||||||
|
>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition Height="35"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TabControl>
|
||||||
|
<TabItem Header="General">
|
||||||
|
<StackPanel>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="100"/>
|
||||||
|
<ColumnDefinition Width="300"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="Name"/>
|
||||||
|
<TextBox Grid.Column="1" Text="{Binding Name}"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Forces">
|
||||||
|
<ContentControl ContentTemplate="{StaticResource SourceToTarget}" Content="{Binding CombinationViewModel}"/>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Primitives">
|
||||||
|
<ContentControl ContentTemplate="{StaticResource SourceToTarget}" Content="{Binding PrimitivesViewModel}"/>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Settings">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<CheckBox x:Name="SetSoftFactorFlag" Grid.ColumnSpan="2" Content="Set user value of softening factor (PsiS)" IsChecked="{Binding SetSofteningFactor}"/>
|
||||||
|
<TextBox Grid.Row="1" Text="{Binding SofteningFactor, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"
|
||||||
|
IsEnabled="{Binding IsChecked, ElementName=SetSoftFactorFlag}" Margin="0,0,0,3"/>
|
||||||
|
<CheckBox x:Name="SetLengthFlag" Grid.ColumnSpan="2" Grid.Row="2" Content="Set user value of length between cracks (Lcrc)" IsChecked="{Binding SetLengthBetweenCracks}"/>
|
||||||
|
<TextBox Grid.Row="3" Text="{Binding LengthBetweenCracks, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"
|
||||||
|
IsEnabled="{Binding IsChecked, ElementName=SetLengthFlag}" Margin="0,0,0,3"/>
|
||||||
|
<TextBlock Grid.Row="4" Text="Ultimate limit crack width"/>
|
||||||
|
<TextBlock Grid.Row="5" Text="Long-term"/>
|
||||||
|
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding UltLongTermCrackWidth, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"
|
||||||
|
Margin="3"/>
|
||||||
|
<TextBlock Grid.Row="6" Text="Short-term"/>
|
||||||
|
<TextBox Grid.Row="6" Grid.Column="1" Text="{Binding UltShortTermCrackWidth, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"
|
||||||
|
Margin="3"/>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||||
|
using StructureHelper.Windows.ViewModels.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для CrackCalculatorInputDataView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class CrackCalculatorInputDataView : Window
|
||||||
|
{
|
||||||
|
private CrackCalculatorInputDataViewModel viewModel;
|
||||||
|
|
||||||
|
public CrackCalculatorInputDataView(CrackCalculatorInputDataViewModel viewModel)
|
||||||
|
{
|
||||||
|
this.viewModel = viewModel;
|
||||||
|
viewModel.ParentWindow = this;
|
||||||
|
DataContext = viewModel;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||||
|
{
|
||||||
|
viewModel.Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelper.Windows.ViewModels;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||||
|
{
|
||||||
|
public class CrackCalculatorInputDataViewModel : OkCancelViewModelBase
|
||||||
|
{
|
||||||
|
private CrackCalculator calculator;
|
||||||
|
CrackInputData crackInputData;
|
||||||
|
private bool setUserValueSofteningFactor;
|
||||||
|
private double softeningFactor;
|
||||||
|
private string name;
|
||||||
|
|
||||||
|
public SourceTargetVM<IForceAction> CombinationViewModel { get; }
|
||||||
|
public SourceTargetVM<PrimitiveBase> PrimitivesViewModel { get; private set; }
|
||||||
|
public string WindowTitle => "Crack calculator: " + Name;
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get => calculator.Name;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
calculator.Name = value;
|
||||||
|
OnPropertyChanged(nameof(Name));
|
||||||
|
OnPropertyChanged(nameof(WindowTitle));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool SetSofteningFactor
|
||||||
|
{
|
||||||
|
get => crackInputData.UserCrackInputData.SetSofteningFactor;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
crackInputData.UserCrackInputData.SetSofteningFactor = value;
|
||||||
|
OnPropertyChanged(nameof(SetSofteningFactor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double SofteningFactor
|
||||||
|
{
|
||||||
|
get => crackInputData.UserCrackInputData.SofteningFactor; set
|
||||||
|
{
|
||||||
|
if (value > 1d || value < 0d) { return; }
|
||||||
|
crackInputData.UserCrackInputData.SofteningFactor = value;
|
||||||
|
OnPropertyChanged(nameof(SetSofteningFactor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool SetLengthBetweenCracks
|
||||||
|
{
|
||||||
|
get => crackInputData.UserCrackInputData.SetLengthBetweenCracks;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
crackInputData.UserCrackInputData.SetLengthBetweenCracks = value;
|
||||||
|
OnPropertyChanged(nameof(SetLengthBetweenCracks));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double LengthBetweenCracks
|
||||||
|
{
|
||||||
|
get => crackInputData.UserCrackInputData.LengthBetweenCracks; set
|
||||||
|
{
|
||||||
|
if (value <= 0d) { return; }
|
||||||
|
crackInputData.UserCrackInputData.LengthBetweenCracks = value;
|
||||||
|
OnPropertyChanged(nameof(SetLengthBetweenCracks));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double UltLongTermCrackWidth
|
||||||
|
{
|
||||||
|
get => crackInputData.UserCrackInputData.UltimateLongCrackWidth; set
|
||||||
|
{
|
||||||
|
if (value <= 0d) { return; }
|
||||||
|
crackInputData.UserCrackInputData.UltimateLongCrackWidth = value;
|
||||||
|
OnPropertyChanged(nameof(UltLongTermCrackWidth));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double UltShortTermCrackWidth
|
||||||
|
{
|
||||||
|
get => crackInputData.UserCrackInputData.UltimateShortCrackWidth; set
|
||||||
|
{
|
||||||
|
if (value <= 0d) { return; }
|
||||||
|
crackInputData.UserCrackInputData.UltimateShortCrackWidth = value;
|
||||||
|
OnPropertyChanged(nameof(UltShortTermCrackWidth));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CrackCalculatorInputDataViewModel(IEnumerable<INdmPrimitive> allowedPrimitives, IEnumerable<IForceAction> allowedCombinations, CrackCalculator crackCalculator)
|
||||||
|
{
|
||||||
|
calculator = crackCalculator;
|
||||||
|
crackInputData = calculator.InputData;
|
||||||
|
CombinationViewModel = SourceTargetFactory.GetSourceTargetVM(allowedCombinations, crackInputData.ForceActions);
|
||||||
|
PrimitivesViewModel = SourceTargetFactory.GetSourceTargetVM(allowedPrimitives, crackInputData.Primitives);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Refresh()
|
||||||
|
{
|
||||||
|
var combinations = CombinationViewModel.GetTargetItems();
|
||||||
|
crackInputData.ForceActions.Clear();
|
||||||
|
foreach (var item in combinations)
|
||||||
|
{
|
||||||
|
crackInputData.ForceActions.Add(item);
|
||||||
|
}
|
||||||
|
crackInputData.Primitives.Clear();
|
||||||
|
foreach (var item in PrimitivesViewModel.GetTargetItems())
|
||||||
|
{
|
||||||
|
crackInputData.Primitives.Add(item.GetNdmPrimitive());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.CrackResultView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews"
|
||||||
|
d:DataContext="{d:DesignInstance local:CrackResultViewModel}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Result of calculations of crack" Height="450" Width="800" MinHeight="300" MinWidth="600" MaxHeight="800" MaxWidth="1000" WindowStartupLocation="CenterScreen" ShowInTaskbar="False">
|
||||||
|
<Window.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="/Windows/CalculationWindows/CalculatorsViews/Cracks/Cracks.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Window.Resources>
|
||||||
|
<DockPanel>
|
||||||
|
<ToolBarTray DockPanel.Dock="Top">
|
||||||
|
<ToolBar>
|
||||||
|
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowRebarsCommand}" ToolTip="Show results by rebars">
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource ShowRebarsResult}"/>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowIsoFieldCommand}" ToolTip="Show isofield results">
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource IsoFieldResult}"/>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
</ToolBar>
|
||||||
|
</ToolBarTray>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<DataGrid IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding TupleResults}" SelectedItem="{Binding SelectedResult}">
|
||||||
|
<DataGrid.RowStyle>
|
||||||
|
<Style TargetType="DataGridRow">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsValid}" Value="false">
|
||||||
|
<Setter Property="Background" Value="{StaticResource ErrorColorBrush}"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridCheckBoxColumn Header="Valid" Binding="{Binding Path=IsValid}"/>
|
||||||
|
<DataGridTextColumn Header="Action name" Binding="{Binding InputData.TupleName}" Width="120"/>
|
||||||
|
<DataGridTemplateColumn Header="Combination term" Width="120">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Text="Long-term"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Short-term"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Header="Moment Mx" Width="90">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Text="{Binding InputData.LongTermTuple.Mx, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right" />
|
||||||
|
<TextBlock Grid.Row="1" Text="{Binding InputData.ShortTermTuple.Mx, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right" />
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Header="Moment My" Width="90">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Text="{Binding InputData.LongTermTuple.My, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="{Binding InputData.ShortTermTuple.My, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right" />
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Header="Force Nz" Width="90">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Text="{Binding InputData.LongTermTuple.Nz, Converter={StaticResource ForceConverter}}" HorizontalAlignment="Right" />
|
||||||
|
<TextBlock Grid.Row="1" Text="{Binding InputData.ShortTermTuple.Nz, Converter={StaticResource ForceConverter}}" HorizontalAlignment="Right" />
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Header="Crack width" Width="80">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ContentControl ContentTemplate="{StaticResource CrackGrid}" Content="{Binding}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTextColumn Header="Description" Width="300" Binding="{Binding Description}"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<TextBlock Grid.Row="1" Text="{Binding CrackResult.Description}"/>
|
||||||
|
</Grid>
|
||||||
|
</DockPanel>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для CrackResultView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class CrackResultView : Window
|
||||||
|
{
|
||||||
|
private readonly CrackResultViewModel viewModel;
|
||||||
|
|
||||||
|
public CrackResultView(CrackResultViewModel viewModel)
|
||||||
|
{
|
||||||
|
this.viewModel = viewModel;
|
||||||
|
InitializeComponent();
|
||||||
|
this.DataContext = this.viewModel;
|
||||||
|
}
|
||||||
|
public CrackResultView(CrackResult result) : this(new CrackResultViewModel(result))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||||
|
{
|
||||||
|
public class CrackResultViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
IShowCrackIsoFieldsLogic showCrackIsoFieldsLogic => new ShowCrackIsoFieldsLogic();
|
||||||
|
private CrackResult crackResult;
|
||||||
|
private RelayCommand? showIsoFieldCommand;
|
||||||
|
private RelayCommand? showRebarsCommand;
|
||||||
|
|
||||||
|
public TupleCrackResult SelectedResult { get; set; }
|
||||||
|
public List<TupleCrackResult> TupleResults => CrackResult.TupleResults;
|
||||||
|
public ICommand ShowRebarsCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return showRebarsCommand ??= new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
var wnd = new TupleCrackResultView(SelectedResult);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
}, o => SelectedResult != null && SelectedResult.IsValid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand ShowIsoFieldCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return showIsoFieldCommand ??= new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
showCrackIsoFieldsLogic.ShowIsoField(SelectedResult.RebarResults);
|
||||||
|
}, o => SelectedResult != null && SelectedResult.IsValid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CrackResult CrackResult => crackResult;
|
||||||
|
|
||||||
|
public CrackResultViewModel(CrackResult crackResult)
|
||||||
|
{
|
||||||
|
this.crackResult = crackResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<DataTemplate x:Key="CrackTextBox">
|
||||||
|
<TextBlock Grid.Row="0" Text="{Binding CrackWidth, Converter={StaticResource CrackWidth}, ConverterParameter='Fixed3'}" HorizontalAlignment="Right">
|
||||||
|
<TextBlock.Style>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsCrackLessThanUltimate}" Value="false">
|
||||||
|
<Setter Property="Background" Value="{StaticResource WarningColorBrush}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</TextBlock.Style>
|
||||||
|
</TextBlock>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="CrackGrid">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<ContentControl ContentTemplate="{StaticResource CrackTextBox}" Content="{Binding LongTermResult}"/>
|
||||||
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource CrackTextBox}" Content="{Binding ShortTermResult}"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||||
|
{
|
||||||
|
public interface IShowCrackIsoFieldsLogic
|
||||||
|
{
|
||||||
|
void ShowIsoField(IEnumerable<RebarCrackResult> rebarResults);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using StructureHelper.Services.Reports.CalculationReports;
|
||||||
|
using StructureHelper.Services.ResultViewers;
|
||||||
|
using StructureHelper.Windows.Errors;
|
||||||
|
using StructureHelper.Windows.ViewModels.Errors;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||||
|
{
|
||||||
|
public class ShowCrackIsoFieldsLogic : IShowCrackIsoFieldsLogic
|
||||||
|
{
|
||||||
|
private IsoFieldReport isoFieldReport;
|
||||||
|
|
||||||
|
public void ShowIsoField(IEnumerable<RebarCrackResult> rebarResults)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(rebarResults, CrackResultFuncFactory.GetResultFuncs());
|
||||||
|
isoFieldReport = new IsoFieldReport(primitiveSets);
|
||||||
|
isoFieldReport.Show();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
var vm = new ErrorProcessor()
|
||||||
|
{
|
||||||
|
ShortText = "Errors apearred during showing isofield, see detailed information",
|
||||||
|
DetailText = $"{ex}"
|
||||||
|
};
|
||||||
|
new ErrorMessage(vm).ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.TupleCrackResultView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews"
|
||||||
|
d:DataContext="{d:DesignInstance local:TupleCrackResultViewModel}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="{Binding WindowTitle}" Height="450" Width="900" MinHeight="300" MinWidth="500" MaxHeight="1000" MaxWidth="1400" WindowStartupLocation="CenterScreen" ShowInTaskbar="False">
|
||||||
|
<Window.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="/Windows/CalculationWindows/CalculatorsViews/Cracks/Cracks.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Window.Resources>
|
||||||
|
<DockPanel>
|
||||||
|
<ToolBarTray DockPanel.Dock="Top">
|
||||||
|
<ToolBar>
|
||||||
|
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowIsoFieldCommand}" ToolTip="Show isofield results">
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource IsoFieldResult}"/>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
</ToolBar>
|
||||||
|
</ToolBarTray>
|
||||||
|
<DataGrid IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding RebarResults}" SelectedItem="{Binding SelectedResult}">
|
||||||
|
<DataGrid.RowStyle>
|
||||||
|
<Style TargetType="DataGridRow">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsValid}" Value="false">
|
||||||
|
<Setter Property="Background" Value="{StaticResource ErrorColorBrush}"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridCheckBoxColumn Header="Valid" Binding="{Binding IsValid}"/>
|
||||||
|
<DataGridTextColumn Header="Rebar name" Binding="{Binding RebarPrimitive.Name}" Width="120" CanUserSort="True"/>
|
||||||
|
<DataGridTemplateColumn Header="Combination term" Width="120">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Text="Long-term" />
|
||||||
|
<TextBlock Grid.Row="1" Text="Short-term" />
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Header="Softening factor" Width="100">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Text="{Binding LongTermResult.SofteningFactor, Converter={StaticResource PlainDouble}, StringFormat=F3}" HorizontalAlignment="Right" />
|
||||||
|
<TextBlock Grid.Row="1" Text="{Binding ShortTermResult.SofteningFactor, Converter={StaticResource PlainDouble}, StringFormat=F3}" HorizontalAlignment="Right" />
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Header="Rebar stress" Width="80">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Text="{Binding LongTermResult.RebarStressResult.RebarStress, Converter={StaticResource StressConverter}, ConverterParameter='Smart3'}" HorizontalAlignment="Right"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="{Binding ShortTermResult.RebarStressResult.RebarStress, Converter={StaticResource StressConverter}, ConverterParameter='Smart3'}" HorizontalAlignment="Right"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Header="Rebar strain" Width="80">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Text="{Binding LongTermResult.RebarStressResult.RebarStrain, StringFormat=F5}" HorizontalAlignment="Right"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="{Binding ShortTermResult.RebarStressResult.RebarStrain, StringFormat=F5}" HorizontalAlignment="Right"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Header="Ref. concrete strain" Width="120">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Text="{Binding LongTermResult.RebarStressResult.ConcreteStrain, StringFormat=F5}" HorizontalAlignment="Right"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="{Binding ShortTermResult.RebarStressResult.ConcreteStrain, StringFormat=F5}" HorizontalAlignment="Right"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Header="Crack width" Width="80">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ContentControl ContentTemplate="{StaticResource CrackGrid}" Content="{Binding}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTextColumn Header="Description" Width="300" Binding="{Binding Description}"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</DockPanel>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для TupleCrackResultView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class TupleCrackResultView : Window
|
||||||
|
{
|
||||||
|
TupleCrackResultViewModel viewModel;
|
||||||
|
public TupleCrackResultView(TupleCrackResultViewModel viewModel)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.viewModel = viewModel;
|
||||||
|
DataContext = this.viewModel;
|
||||||
|
}
|
||||||
|
public TupleCrackResultView(TupleCrackResult crackResult) : this(new TupleCrackResultViewModel(crackResult))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using LoaderCalculator.Data.Matrix;
|
||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Services.Reports.CalculationReports;
|
||||||
|
using StructureHelper.Services.ResultViewers;
|
||||||
|
using StructureHelper.Windows.Errors;
|
||||||
|
using StructureHelper.Windows.ViewModels.Errors;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||||
|
{
|
||||||
|
public class TupleCrackResultViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
IShowCrackIsoFieldsLogic showCrackIsoFieldsLogic => new ShowCrackIsoFieldsLogic();
|
||||||
|
private TupleCrackResult crackResult;
|
||||||
|
private RelayCommand showIsoFieldCommand;
|
||||||
|
private IsoFieldReport isoFieldReport;
|
||||||
|
|
||||||
|
public TupleCrackResult CrackResult => crackResult;
|
||||||
|
public List<RebarCrackResult> RebarResults => crackResult.RebarResults;
|
||||||
|
public RebarCrackResult SelectedResult { get; set; }
|
||||||
|
public string WindowTitle => "Result of calculation of cracks for action " + crackResult.InputData.TupleName;
|
||||||
|
public ICommand ShowIsoFieldCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return showIsoFieldCommand ??= new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
showCrackIsoFieldsLogic.ShowIsoField(crackResult.RebarResults);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public TupleCrackResultViewModel(TupleCrackResult crackResult)
|
||||||
|
{
|
||||||
|
this.crackResult = crackResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models.Parameters;
|
||||||
|
using StructureHelperCommon.Services.Units;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Create array of common values
|
||||||
|
/// </summary>
|
||||||
|
public class DiagramFactory
|
||||||
|
{
|
||||||
|
IConvertUnitLogic operationLogic = new ConvertUnitLogic();
|
||||||
|
IGetUnitLogic unitLogic = new GetUnitLogic();
|
||||||
|
private ArrayParameter<double> arrayParameter;
|
||||||
|
/// <summary>
|
||||||
|
/// Collection of force results
|
||||||
|
/// </summary>
|
||||||
|
public List<IForcesTupleResult> TupleList { get; set; }
|
||||||
|
|
||||||
|
//public Action<int> SetProgress { get; set; }
|
||||||
|
|
||||||
|
public ArrayParameter<double> GetCommonArray()
|
||||||
|
{
|
||||||
|
var labels = LabelsFactory.GetCommonLabels();
|
||||||
|
arrayParameter = new ArrayParameter<double>(TupleList.Count(), labels);
|
||||||
|
Calculate();
|
||||||
|
return arrayParameter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Calculate()
|
||||||
|
{
|
||||||
|
var data = arrayParameter.Data;
|
||||||
|
for (int i = 0; i < TupleList.Count(); i++)
|
||||||
|
{
|
||||||
|
var valueList = ProcessResult(i);
|
||||||
|
for (int j = 0; j < valueList.Count; j++)
|
||||||
|
{
|
||||||
|
data[i, j] = valueList[j];
|
||||||
|
}
|
||||||
|
//SetProgress?.Invoke(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private List<double> ProcessResult(int i)
|
||||||
|
{
|
||||||
|
var unitForce = unitLogic.GetUnit(UnitTypes.Force);
|
||||||
|
var unitMoment = unitLogic.GetUnit(UnitTypes.Moment);
|
||||||
|
var unitCurvature = unitLogic.GetUnit(UnitTypes.Curvature);
|
||||||
|
|
||||||
|
return new List<double>
|
||||||
|
{
|
||||||
|
TupleList[i].DesignForceTuple.ForceTuple.Mx * unitMoment.Multiplyer,
|
||||||
|
TupleList[i].DesignForceTuple.ForceTuple.My * unitMoment.Multiplyer,
|
||||||
|
TupleList[i].DesignForceTuple.ForceTuple.Nz * unitForce.Multiplyer,
|
||||||
|
TupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.Kx * unitCurvature.Multiplyer,
|
||||||
|
TupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.Ky * unitCurvature.Multiplyer,
|
||||||
|
TupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.EpsZ
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using StructureHelper.Windows.Forces;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Parameters;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic
|
||||||
|
{
|
||||||
|
public interface IValuePointDiagramLogic
|
||||||
|
{
|
||||||
|
ForceCalculator Calculator { get; set; }
|
||||||
|
PointPrimitiveLogic PrimitiveLogic { get; set; }
|
||||||
|
IEnumerable<IForcesTupleResult> TupleList { get; set; }
|
||||||
|
ValueDelegatesLogic ValueDelegatesLogic { get; set; }
|
||||||
|
|
||||||
|
GenericResult<ArrayParameter<double>> GetArrayParameter();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,10 +25,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
const string ForceUnitString = "kN";
|
const string ForceUnitString = "kN";
|
||||||
const string MomentUnitString = "kNm";
|
const string MomentUnitString = "kNm";
|
||||||
|
|
||||||
|
IConvertUnitLogic operationLogic;
|
||||||
|
|
||||||
//private List<ArrayParameter<double>> arrayParameters;
|
//private List<ArrayParameter<double>> arrayParameters;
|
||||||
private IResult result;
|
private IResult result;
|
||||||
private IUnit unitForce = CommonOperation.GetUnit(UnitTypes.Force, ForceUnitString);
|
private IUnit unitForce;
|
||||||
private IUnit unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, MomentUnitString);
|
private IUnit unitMoment;
|
||||||
private int stepCount;
|
private int stepCount;
|
||||||
|
|
||||||
private static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
private static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
||||||
@@ -48,6 +50,10 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
stepCount *= InputData.CalcTerms.Count();
|
stepCount *= InputData.CalcTerms.Count();
|
||||||
stepCount *= InputData.PredicateEntries.Count();
|
stepCount *= InputData.PredicateEntries.Count();
|
||||||
//arrayParameters = new();
|
//arrayParameters = new();
|
||||||
|
operationLogic = new ConvertUnitLogic();
|
||||||
|
IGetUnitLogic unitLogic = new GetUnitLogic();
|
||||||
|
unitForce = unitLogic.GetUnit(UnitTypes.Force, ForceUnitString);
|
||||||
|
unitMoment = unitLogic.GetUnit(UnitTypes.Moment, MomentUnitString);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoCalculations()
|
private void DoCalculations()
|
||||||
@@ -90,7 +96,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;
|
||||||
@@ -121,11 +127,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,86 @@
|
|||||||
|
using StructureHelper.Windows.Forces;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic
|
||||||
|
{
|
||||||
|
public class InterpolateValuePointsLogic
|
||||||
|
{
|
||||||
|
private InterpolationProgressLogic interpolationLogic;
|
||||||
|
private ValuePointsInterpolateViewModel viewModel;
|
||||||
|
private IResult result;
|
||||||
|
private ValuePointsInterpolationInputData inputData;
|
||||||
|
public ForcesTupleResult SelectedResult { get; set; }
|
||||||
|
public IEnumerable<INdmPrimitive> NdmPrimitives { get; set; }
|
||||||
|
public ForceCalculator ForceCalculator { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public ILongProcessLogic ProgressLogic { get; set; }
|
||||||
|
public ShowProgressLogic ShowProgressLogic { get; set; }
|
||||||
|
|
||||||
|
public void InterpolateValuePoints()
|
||||||
|
{
|
||||||
|
var tuple = SelectedResult.DesignForceTuple ?? throw new StructureHelperException(ErrorStrings.NullReference + ": Design force combination");
|
||||||
|
PrepareInputData(tuple);
|
||||||
|
viewModel = new ValuePointsInterpolateViewModel(inputData);
|
||||||
|
if (ShowDialog() == false) { return; };
|
||||||
|
ShowDiagram(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PrepareInputData(IDesignForceTuple tuple)
|
||||||
|
{
|
||||||
|
inputData = new ValuePointsInterpolationInputData()
|
||||||
|
{
|
||||||
|
FinishDesignForce = tuple.Clone() as IDesignForceTuple,
|
||||||
|
LimitState = tuple.LimitState,
|
||||||
|
CalcTerm = tuple.CalcTerm,
|
||||||
|
};
|
||||||
|
inputData.PrimitiveBases.AddRange(PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(NdmPrimitives));
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ShowDialog()
|
||||||
|
{
|
||||||
|
var wnd = new ValuePointsInterpolateView(viewModel);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
if (wnd.DialogResult != true) { return false; }
|
||||||
|
interpolationLogic = new InterpolationProgressLogic(ForceCalculator, viewModel.ForceInterpolationViewModel.Result);
|
||||||
|
ProgressLogic = interpolationLogic;
|
||||||
|
ShowProgressLogic = new(interpolationLogic)
|
||||||
|
{
|
||||||
|
WindowTitle = "Interpolate forces",
|
||||||
|
};
|
||||||
|
ShowProgressLogic.Show();
|
||||||
|
result = interpolationLogic.InterpolateCalculator.Result;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowDiagram(IResult result)
|
||||||
|
{
|
||||||
|
if (result.IsValid == false) { return; }
|
||||||
|
if (result is not IForcesResults)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(IForcesResults), result));
|
||||||
|
}
|
||||||
|
var tupleResult = result as IForcesResults;
|
||||||
|
var pointGraphLogic = new ShowValuePointDiagramLogic()
|
||||||
|
{
|
||||||
|
Calculator = interpolationLogic.InterpolateCalculator,
|
||||||
|
PrimitiveLogic = viewModel.PrimitiveLogic,
|
||||||
|
ValueDelegatesLogic = viewModel.ValueDelegatesLogic,
|
||||||
|
TupleList = tupleResult.ForcesResultList
|
||||||
|
};
|
||||||
|
pointGraphLogic.ShowWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
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
|
||||||
|
{
|
||||||
|
static IConvertUnitLogic operationLogic = new ConvertUnitLogic();
|
||||||
|
static IGetUnitLogic unitLogic = new GetUnitLogic();
|
||||||
|
private static IUnit unitForce = unitLogic.GetUnit(UnitTypes.Force);
|
||||||
|
private static IUnit unitMoment = unitLogic.GetUnit(UnitTypes.Moment);
|
||||||
|
private static IUnit unitCurvature = unitLogic.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
internal class ShowCrackResultLogic
|
internal class ShowCrackResultLogic
|
||||||
{
|
{
|
||||||
private CrackForceCalculator calculator;
|
private CrackForceCalculator calculator;
|
||||||
|
private ITriangulatePrimitiveLogic triangulateLogic;
|
||||||
|
|
||||||
public static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
public static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
||||||
public LimitStates LimitState { get; set; }
|
public LimitStates LimitState { get; set; }
|
||||||
@@ -27,12 +28,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +43,13 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
calculator.TraceLogger = new ShiftTraceLogger();
|
calculator.TraceLogger = new ShiftTraceLogger();
|
||||||
calculator.StartTuple = startDesignTuple;
|
calculator.StartTuple = startDesignTuple;
|
||||||
calculator.EndTuple = finishDesignTuple;
|
calculator.EndTuple = finishDesignTuple;
|
||||||
calculator.NdmCollection = NdmPrimitivesService.GetNdms(ndmPrimitives, LimitState, CalcTerm);
|
triangulateLogic = new TriangulatePrimitiveLogic()
|
||||||
|
{
|
||||||
|
Primitives = ndmPrimitives,
|
||||||
|
LimitState = LimitState,
|
||||||
|
CalcTerm = CalcTerm
|
||||||
|
};
|
||||||
|
calculator.NdmCollection = triangulateLogic.GetNdms();
|
||||||
calculator.Run();
|
calculator.Run();
|
||||||
var result = (CrackForceResult)calculator.Result;
|
var result = (CrackForceResult)calculator.Result;
|
||||||
if (result.IsValid)
|
if (result.IsValid)
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
|
|
||||||
internal void Show()
|
internal void Show()
|
||||||
{
|
{
|
||||||
var inputData = new CrackWidthCalculatorInputData()
|
var inputData = new TupleCrackInputData()
|
||||||
{
|
{
|
||||||
LimitState = LimitState,
|
//LimitState = LimitState,
|
||||||
CalcTerm = CalcTerm,
|
//CalcTerm = CalcTerm,
|
||||||
ForceTuple = ForceTuple,
|
LongTermTuple = ForceTuple,
|
||||||
NdmPrimitives = ndmPrimitives
|
Primitives = ndmPrimitives
|
||||||
};
|
};
|
||||||
var calculator = new CrackWidthCalculator() { InputData = inputData };
|
var calculator = new TupleCrackCalculator() { InputData = inputData };
|
||||||
calculator.Run();
|
calculator.Run();
|
||||||
var result = calculator.Result;
|
var result = calculator.Result;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
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;
|
using StructureHelperCommon.Models;
|
||||||
@@ -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; }
|
||||||
@@ -53,67 +52,25 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
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 factory = new DiagramFactory()
|
||||||
arrayParameter = new ArrayParameter<double>(ValidTupleList.Count(), labels.Count(), labels);
|
{
|
||||||
CalculateWithoutCrack(ValidTupleList, unitForce, unitMoment, unitCurvature);
|
TupleList = validTupleList,
|
||||||
|
//SetProgress = SetProgress,
|
||||||
|
};
|
||||||
|
arrayParameter = factory.GetCommonArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
var data = arrayParameter.Data;
|
|
||||||
for (int i = 0; i < resultList.Count(); i++)
|
|
||||||
{
|
|
||||||
var valueList = ProcessResultWithouCrack(resultList, unitForce, unitMoment, unitCurvature, i);
|
|
||||||
for (int j = 0; j < valueList.Count; j++)
|
|
||||||
{
|
|
||||||
data[i, j] = valueList[j];
|
|
||||||
}
|
|
||||||
SetProgress?.Invoke(i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static List<double> ProcessResultWithouCrack(List<IForcesTupleResult> resultList, IUnit unitForce, IUnit unitMoment, IUnit unitCurvature, int i)
|
|
||||||
{
|
|
||||||
return new List<double>
|
|
||||||
{
|
|
||||||
resultList[i].DesignForceTuple.ForceTuple.Mx * unitMoment.Multiplyer,
|
|
||||||
resultList[i].DesignForceTuple.ForceTuple.My * unitMoment.Multiplyer,
|
|
||||||
resultList[i].DesignForceTuple.ForceTuple.Nz * unitForce.Multiplyer,
|
|
||||||
resultList[i].LoaderResults.ForceStrainPair.StrainMatrix.Kx * unitCurvature.Multiplyer,
|
|
||||||
resultList[i].LoaderResults.ForceStrainPair.StrainMatrix.Ky * unitCurvature.Multiplyer,
|
|
||||||
resultList[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}"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelper.Windows.CalculationWindows.ProgressViews;
|
using StructureHelper.Windows.CalculationWindows.ProgressViews;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
@@ -11,7 +12,7 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||||
{
|
{
|
||||||
internal class ShowProgressLogic
|
public class ShowProgressLogic
|
||||||
{
|
{
|
||||||
private ShowProgressViewModel progressViewModel;
|
private ShowProgressViewModel progressViewModel;
|
||||||
private ShowProgressView wndProgress;
|
private ShowProgressView wndProgress;
|
||||||
@@ -82,8 +83,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
throw new StructureHelperException(ex);
|
||||||
throw;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelper.Services.ResultViewers;
|
||||||
|
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic;
|
||||||
|
using StructureHelper.Windows.Forces;
|
||||||
|
using StructureHelper.Windows.Graphs;
|
||||||
|
using StructureHelper.Windows.ViewModels.Errors;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
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;
|
||||||
|
|
||||||
|
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||||
|
{
|
||||||
|
public class ShowValuePointDiagramLogic //: ILongProcessLogic
|
||||||
|
{
|
||||||
|
private ArrayParameter<double> arrayParameter;
|
||||||
|
private IValuePointDiagramLogic pointDiagramLogic;
|
||||||
|
|
||||||
|
public IEnumerable<IForcesTupleResult> TupleList { get; set; }
|
||||||
|
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(IValuePointDiagramLogic pointDiagramLogic)
|
||||||
|
{
|
||||||
|
this.pointDiagramLogic = pointDiagramLogic;
|
||||||
|
}
|
||||||
|
public ShowValuePointDiagramLogic() : this(new ValuePointDiagramLogic())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public void ShowWindow()
|
||||||
|
{
|
||||||
|
var result = GetResult();
|
||||||
|
if (result.IsValid != true)
|
||||||
|
{
|
||||||
|
SafetyProcessor.ShowMessage(ErrorStrings.DataIsInCorrect, result.Description);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
arrayParameter = result.Value;
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private GenericResult<ArrayParameter<double>> GetResult()
|
||||||
|
{
|
||||||
|
pointDiagramLogic.TupleList = TupleList;
|
||||||
|
pointDiagramLogic.PrimitiveLogic = PrimitiveLogic;
|
||||||
|
pointDiagramLogic.Calculator = Calculator;
|
||||||
|
pointDiagramLogic.ValueDelegatesLogic = ValueDelegatesLogic;
|
||||||
|
var results = pointDiagramLogic.GetArrayParameter();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelper.Services.ResultViewers;
|
||||||
|
using StructureHelper.Windows.Forces;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Parameters;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic
|
||||||
|
{
|
||||||
|
public class ValuePointDiagramLogic : IValuePointDiagramLogic
|
||||||
|
{
|
||||||
|
private ArrayParameter<double> arrayParameter;
|
||||||
|
private List<(INamedAreaPoint areaPoint, INdmPrimitive ndmPrimitive)> pointCollection;
|
||||||
|
private List<IForcesTupleResult> validTuplesList;
|
||||||
|
private ArrayParameter<double> arrayOfValuesByPoint;
|
||||||
|
private IEnumerable<ForceResultFunc> selectedDelegates;
|
||||||
|
private string exceptionMessage;
|
||||||
|
|
||||||
|
public IEnumerable<IForcesTupleResult> TupleList { get; set; }
|
||||||
|
public ForceCalculator Calculator { get; set; }
|
||||||
|
public PointPrimitiveLogic PrimitiveLogic { get; set; }
|
||||||
|
public ValueDelegatesLogic ValueDelegatesLogic { get; set; }
|
||||||
|
|
||||||
|
public GenericResult<ArrayParameter<double>> GetArrayParameter()
|
||||||
|
{
|
||||||
|
SetParameters();
|
||||||
|
var checkResult = CheckParameters();
|
||||||
|
if (checkResult != true)
|
||||||
|
{
|
||||||
|
return GetFalseResult();
|
||||||
|
}
|
||||||
|
PrepareArray();
|
||||||
|
return GetValidResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
private GenericResult<ArrayParameter<double>> GetValidResult()
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
foreach (var tuple in validTuplesList)
|
||||||
|
{
|
||||||
|
ProcessPointByTuple(tuple, i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
arrayParameter.AddArray(arrayOfValuesByPoint);
|
||||||
|
return new GenericResult<ArrayParameter<double>>()
|
||||||
|
{
|
||||||
|
IsValid = true,
|
||||||
|
Value = arrayParameter
|
||||||
|
};
|
||||||
|
}
|
||||||
|
private GenericResult<ArrayParameter<double>> GetFalseResult()
|
||||||
|
{
|
||||||
|
return new GenericResult<ArrayParameter<double>>()
|
||||||
|
{
|
||||||
|
IsValid = false,
|
||||||
|
Description = exceptionMessage
|
||||||
|
};
|
||||||
|
}
|
||||||
|
private void SetParameters()
|
||||||
|
{
|
||||||
|
GetPointCollection();
|
||||||
|
selectedDelegates = ValueDelegatesLogic.ResultFuncs.SelectedItems;
|
||||||
|
validTuplesList = TupleList
|
||||||
|
.Where(x => x.IsValid == true)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
private bool CheckParameters()
|
||||||
|
{
|
||||||
|
var result = true;
|
||||||
|
exceptionMessage = ErrorStrings.DataIsInCorrect;
|
||||||
|
if (pointCollection.Any() == false)
|
||||||
|
{
|
||||||
|
exceptionMessage += ", point collection is null";
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (selectedDelegates.Any() == false)
|
||||||
|
{
|
||||||
|
exceptionMessage += ", value expression collection is null";
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (validTuplesList.Any() == false)
|
||||||
|
{
|
||||||
|
exceptionMessage += ", force list is empty";
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
private void GetPointCollection()
|
||||||
|
{
|
||||||
|
pointCollection = new();
|
||||||
|
foreach (var primitiveValuePoint in PrimitiveLogic.Collection.CollectionItems)
|
||||||
|
{
|
||||||
|
foreach (var selectedPoint in primitiveValuePoint.Item.ValuePoints.SelectedItems)
|
||||||
|
{
|
||||||
|
var newPoint = (selectedPoint, primitiveValuePoint.Item.PrimitiveBase.GetNdmPrimitive());
|
||||||
|
pointCollection.Add(newPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ProcessPointByTuple(IForcesTupleResult tuple, int i)
|
||||||
|
{
|
||||||
|
var values = new List<double>();
|
||||||
|
var strainMatrix = tuple.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||||
|
|
||||||
|
foreach (var valuePoint in pointCollection)
|
||||||
|
{
|
||||||
|
var ndm = GetMockNdm(valuePoint, tuple);
|
||||||
|
|
||||||
|
foreach (var valDelegate in selectedDelegates)
|
||||||
|
{
|
||||||
|
double val = valDelegate.ResultFunction.Invoke(strainMatrix, ndm) * valDelegate.UnitFactor;
|
||||||
|
values.Add(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
arrayOfValuesByPoint.AddRow(i, values);
|
||||||
|
}
|
||||||
|
private void PrepareArray()
|
||||||
|
{
|
||||||
|
var factory = new DiagramFactory()
|
||||||
|
{
|
||||||
|
TupleList = validTuplesList,
|
||||||
|
//SetProgress = SetProgress,
|
||||||
|
};
|
||||||
|
arrayParameter = factory.GetCommonArray();
|
||||||
|
|
||||||
|
var labels = GetValueLabels(selectedDelegates);
|
||||||
|
arrayOfValuesByPoint = new ArrayParameter<double>(validTuplesList.Count(), labels);
|
||||||
|
}
|
||||||
|
private INdm GetMockNdm((INamedAreaPoint areaPoint, INdmPrimitive ndmPrimitive) valuePoint, IForcesTupleResult tuple)
|
||||||
|
{
|
||||||
|
var limitState = tuple.DesignForceTuple.LimitState;
|
||||||
|
var calcTerm = tuple.DesignForceTuple.CalcTerm;
|
||||||
|
var material = valuePoint.ndmPrimitive.HeadMaterial.GetLoaderMaterial(limitState, calcTerm);
|
||||||
|
var userPrestrain = valuePoint.ndmPrimitive.UsersPrestrain;
|
||||||
|
var autoPrestrain = valuePoint.ndmPrimitive.AutoPrestrain;
|
||||||
|
var ndm = new Ndm()
|
||||||
|
{
|
||||||
|
Area = valuePoint.areaPoint.Area,
|
||||||
|
CenterX = valuePoint.areaPoint.Point.X,
|
||||||
|
CenterY = valuePoint.areaPoint.Point.Y,
|
||||||
|
Material = material,
|
||||||
|
};
|
||||||
|
ndm.Prestrain = (userPrestrain.Mx + autoPrestrain.Mx) * valuePoint.areaPoint.Point.Y
|
||||||
|
+ (userPrestrain.My + autoPrestrain.My) * valuePoint.areaPoint.Point.X
|
||||||
|
+ userPrestrain.Nz + autoPrestrain.Nz;
|
||||||
|
return ndm;
|
||||||
|
}
|
||||||
|
private List<string> GetValueLabels(IEnumerable<ForceResultFunc> selectedDelegates)
|
||||||
|
{
|
||||||
|
List<string> strings = new();
|
||||||
|
foreach (var valuePoint in pointCollection)
|
||||||
|
{
|
||||||
|
foreach (var deleg in selectedDelegates)
|
||||||
|
{
|
||||||
|
string s = valuePoint.ndmPrimitive.Name;
|
||||||
|
s += "_" + valuePoint.areaPoint.Name;
|
||||||
|
s += "_" + deleg.Name + ", " + deleg.UnitName;
|
||||||
|
strings.Add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return strings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,23 +6,30 @@
|
|||||||
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
|
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
|
||||||
d:DataContext="{d:DesignInstance local:ForcesResultsViewModel}"
|
d:DataContext="{d:DesignInstance local:ForcesResultsViewModel}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Calculation Results" Height="350" Width="850" MinHeight="300" MinWidth="400" WindowStartupLocation="CenterScreen">
|
Title="Calculation Results" Height="350" Width="850" MinHeight="300" MinWidth="400" WindowStartupLocation="CenterScreen" ShowInTaskbar="False">
|
||||||
<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 Style="{DynamicResource ToolButton}" Command="{Binding ShowIsoFieldCommand}" ToolTip="Show isofield results">
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource IsoFieldResult}"/>
|
||||||
|
</Viewbox>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
</ToolBarTray>
|
</ToolBarTray>
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -56,13 +63,11 @@
|
|||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<StackPanel Grid.Column="1">
|
<StackPanel Grid.Column="1">
|
||||||
<Button Margin="3" Content="Graphic" ToolTip="Show graphic results" Command="{Binding ShowIsoFieldCommand}"/>
|
|
||||||
<Button Margin="3" Content="CrcDiagrams" ToolTip="Show diagrams for cracked section" Command="{Binding ShowCrackGraphsCommand}"/>
|
<Button Margin="3" Content="CrcDiagrams" ToolTip="Show diagrams for cracked section" Command="{Binding ShowCrackGraphsCommand}"/>
|
||||||
<Button Margin="3" Content="Export" ToolTip="Export results to *.csv" Command="{Binding ExportToCSVCommand}"/>
|
<Button Margin="3" Content="Export" ToolTip="Export results to *.csv" Command="{Binding ExportToCSVCommand}"/>
|
||||||
<Button Margin="3" Content="Set Prestrain" ToolTip="Set strains as auto prestrain" Command="{Binding SetPrestrainCommand}"/>
|
<Button Margin="3" Content="Set Prestrain" ToolTip="Set strains as auto prestrain" Command="{Binding SetPrestrainCommand}"/>
|
||||||
<Button Margin="3" Content="Anchorage" ToolTip="Set strains as auto prestrain" Command="{Binding ShowAnchorageCommand}"/>
|
<Button Margin="3" Content="Anchorage" ToolTip="Set strains as auto prestrain" Command="{Binding ShowAnchorageCommand}"/>
|
||||||
<Button Margin="3" Content="Geometry" ToolTip="Show Geometry Properties" Command="{Binding ShowGeometryResultCommand}"/>
|
<Button Margin="3" Content="Geometry" ToolTip="Show Geometry Properties" Command="{Binding ShowGeometryResultCommand}"/>
|
||||||
<Button Margin="3" Content="Acrc" ToolTip="Show crack width" Command="{Binding ShowCrackWidthResultCommand}"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -42,7 +43,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
private ShowProgressLogic showProgressLogic;
|
private ShowProgressLogic showProgressLogic;
|
||||||
private InteractionDiagramLogic interactionDiagramLogic;
|
private InteractionDiagramLogic interactionDiagramLogic;
|
||||||
private static readonly ShowCrackResultLogic showCrackResultLogic = new();
|
private static readonly ShowCrackResultLogic showCrackResultLogic = new();
|
||||||
private static readonly ShowCrackWidthLogic showCrackWidthLogic = new();
|
//private static readonly ShowCrackWidthLogic showCrackWidthLogic = new();
|
||||||
private IForcesResults forcesResults;
|
private IForcesResults forcesResults;
|
||||||
private IEnumerable<INdmPrimitive> ndmPrimitives;
|
private IEnumerable<INdmPrimitive> ndmPrimitives;
|
||||||
private IEnumerable<INdmPrimitive> selectedNdmPrimitives;
|
private IEnumerable<INdmPrimitive> selectedNdmPrimitives;
|
||||||
@@ -52,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
|
||||||
{
|
{
|
||||||
@@ -150,12 +152,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
{
|
{
|
||||||
get => showGraphsCommand ??= new RelayCommand(o =>
|
get => showGraphsCommand ??= new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
InterpolateTuplesViewModel interploateTuplesViewModel;
|
InterpolateTuplesViewModel interpolateTuplesViewModel;
|
||||||
InterpolateTuplesView wndTuples;
|
InterpolateTuplesView wndTuples;
|
||||||
ShowInterpolationWindow(out interploateTuplesViewModel, out wndTuples);
|
ShowInterpolationWindow(out interpolateTuplesViewModel, out wndTuples);
|
||||||
if (wndTuples.DialogResult != true) return;
|
if (wndTuples.DialogResult != true) return;
|
||||||
|
|
||||||
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.Result);
|
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interpolateTuplesViewModel.ForceInterpolationViewModel.Result);
|
||||||
showProgressLogic = new(interpolationLogic)
|
showProgressLogic = new(interpolationLogic)
|
||||||
{
|
{
|
||||||
WindowTitle = "Interpolate forces"
|
WindowTitle = "Interpolate forces"
|
||||||
@@ -174,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
|
||||||
{
|
{
|
||||||
@@ -186,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"
|
||||||
@@ -224,22 +225,22 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
showCrackResultLogic.Show(SelectedResult.DesignForceTuple.Clone() as IDesignForceTuple);
|
showCrackResultLogic.Show(SelectedResult.DesignForceTuple.Clone() as IDesignForceTuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICommand ShowCrackWidthResultCommand
|
//public ICommand ShowCrackWidthResultCommand
|
||||||
{
|
//{
|
||||||
get => showCrackWidthResult ??= new RelayCommand(o =>
|
// get => showCrackWidthResult ??= new RelayCommand(o =>
|
||||||
{
|
// {
|
||||||
SafetyProcessor.RunSafeProcess(ShowCrackWidthResult);
|
// SafetyProcessor.RunSafeProcess(ShowCrackWidthResult);
|
||||||
}, o => SelectedResult != null && SelectedResult.IsValid);
|
// }, o => SelectedResult != null && SelectedResult.IsValid);
|
||||||
}
|
//}
|
||||||
|
|
||||||
private void ShowCrackWidthResult()
|
//private void ShowCrackWidthResult()
|
||||||
{
|
//{
|
||||||
showCrackWidthLogic.LimitState = SelectedResult.DesignForceTuple.LimitState;
|
// showCrackWidthLogic.LimitState = SelectedResult.DesignForceTuple.LimitState;
|
||||||
showCrackWidthLogic.CalcTerm = SelectedResult.DesignForceTuple.CalcTerm;
|
// showCrackWidthLogic.CalcTerm = SelectedResult.DesignForceTuple.CalcTerm;
|
||||||
showCrackWidthLogic.ForceTuple = SelectedResult.DesignForceTuple.ForceTuple;
|
// showCrackWidthLogic.ForceTuple = SelectedResult.DesignForceTuple.ForceTuple;
|
||||||
showCrackWidthLogic.ndmPrimitives = ndmPrimitives.ToList();
|
// showCrackWidthLogic.ndmPrimitives = ndmPrimitives.ToList();
|
||||||
showCrackWidthLogic.Show();
|
// showCrackWidthLogic.Show();
|
||||||
}
|
//}
|
||||||
public ICommand InterpolateCommand
|
public ICommand InterpolateCommand
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -259,13 +260,42 @@ 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 logic = new InterpolateValuePointsLogic()
|
||||||
|
{
|
||||||
|
SelectedResult = SelectedResult,
|
||||||
|
ForceCalculator = forceCalculator,
|
||||||
|
NdmPrimitives = ndmPrimitives,
|
||||||
|
ProgressLogic = progressLogic,
|
||||||
|
ShowProgressLogic = showProgressLogic
|
||||||
|
};
|
||||||
|
logic.InterpolateValuePoints();
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
@@ -386,7 +416,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
IStrainMatrix strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
IStrainMatrix strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||||
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ResultFuncFactory.GetResultFuncs());
|
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ForceResultFuncFactory.GetResultFuncs());
|
||||||
isoFieldReport = new IsoFieldReport(primitiveSets);
|
isoFieldReport = new IsoFieldReport(primitiveSets);
|
||||||
isoFieldReport.Show();
|
isoFieldReport.Show();
|
||||||
}
|
}
|
||||||
@@ -399,7 +429,6 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
};
|
};
|
||||||
new ErrorMessage(vm).ShowDialog();
|
new ErrorMessage(vm).ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private void GetNdms()
|
private void GetNdms()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
{
|
{
|
||||||
const string ForceUnitString = "kN";
|
const string ForceUnitString = "kN";
|
||||||
const string MomentUnitString = "kNm";
|
const string MomentUnitString = "kNm";
|
||||||
|
static IConvertUnitLogic operationLogic = new ConvertUnitLogic();
|
||||||
|
static IGetUnitLogic unitLogic = new GetUnitLogic();
|
||||||
public SurroundData SurroundData
|
public SurroundData SurroundData
|
||||||
{
|
{
|
||||||
get => surroundData; set
|
get => surroundData; set
|
||||||
@@ -47,8 +48,8 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
OnPropertyChanged(nameof(ZUnitLabel));
|
OnPropertyChanged(nameof(ZUnitLabel));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly IUnit unitForce = CommonOperation.GetUnit(UnitTypes.Force, ForceUnitString);
|
private static IUnit unitForce = unitLogic.GetUnit(UnitTypes.Force, ForceUnitString);
|
||||||
private static readonly IUnit unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, MomentUnitString);
|
private static IUnit unitMoment = unitLogic.GetUnit(UnitTypes.Moment, MomentUnitString);
|
||||||
private SurroundData surroundData;
|
private SurroundData surroundData;
|
||||||
|
|
||||||
public IValueConverter ForceConverter { get => new Force(); }
|
public IValueConverter ForceConverter { get => new Force(); }
|
||||||
@@ -157,6 +158,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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,26 +22,29 @@ namespace StructureHelper.Windows.CalculationWindows.ProgressViews
|
|||||||
private FlowDocument document;
|
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
|
||||||
@@ -61,7 +64,7 @@ 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 = 30;
|
tabGap = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +84,7 @@ namespace StructureHelper.Windows.CalculationWindows.ProgressViews
|
|||||||
public void Prepare()
|
public void Prepare()
|
||||||
{
|
{
|
||||||
document = new();
|
document = new();
|
||||||
selectedLoggerEntries = loggerEntries.Where(x => x.Priority <= MaxPriority);
|
selectedLoggerEntries = loggerEntries.Where(x => x.Priority <= PriorityLimit);
|
||||||
var blocks = selectedLoggerEntries.Select(x => GetBlockByEntry(x));
|
var blocks = selectedLoggerEntries.Select(x => GetBlockByEntry(x));
|
||||||
document.Blocks.AddRange(blocks);
|
document.Blocks.AddRange(blocks);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.ProgressViews"
|
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.ProgressViews"
|
||||||
d:DataContext="{d:DesignInstance local:TraceDocumentVM}"
|
d:DataContext="{d:DesignInstance local:TraceDocumentVM}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Trace Document Viewer" Height="450" Width="800" MinHeight="400" MinWidth="600" WindowStartupLocation="CenterScreen">
|
Title="Trace Document Viewer" Height="450" Width="800" MinHeight="400" MinWidth="600" WindowStartupLocation="CenterScreen" ShowInTaskbar="False">
|
||||||
<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}"/>
|
||||||
|
|||||||
@@ -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" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
|
||||||
</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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
29
StructureHelper/Windows/Forces/PrimitiveValuePoints.cs
Normal file
29
StructureHelper/Windows/Forces/PrimitiveValuePoints.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelper.Windows.ViewModels;
|
||||||
|
using StructureHelperCommon.Models.Parameters;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
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<INamedAreaPoint> ValuePoints { get; set; }
|
||||||
|
|
||||||
|
public PrimitiveValuePoints(PrimitiveBase primitiveBase)
|
||||||
|
{
|
||||||
|
var ndmPrimitive = primitiveBase.GetNdmPrimitive();
|
||||||
|
var pointCollection = ndmPrimitive.GetValuePoints();
|
||||||
|
ValuePoints = new SelectItemsVM<INamedAreaPoint>(pointCollection)
|
||||||
|
{
|
||||||
|
ShowButtons = false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
27
StructureHelper/Windows/Forces/ValueDelegatesLogic.cs
Normal file
27
StructureHelper/Windows/Forces/ValueDelegatesLogic.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
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<ForceResultFunc> resultFuncs;
|
||||||
|
public SelectItemsVM<ForceResultFunc> ResultFuncs { get; }
|
||||||
|
public ValueDelegatesLogic()
|
||||||
|
{
|
||||||
|
resultFuncs = new List<ForceResultFunc>();
|
||||||
|
resultFuncs.AddRange(ForceResultFuncFactory.GetResultFuncs(FuncsTypes.Full));
|
||||||
|
ResultFuncs = new SelectItemsVM<ForceResultFunc>(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 Points 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}" Width="400"/>
|
||||||
|
</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,20 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.Forces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для ValuePoitsInterpolateView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ValuePointsInterpolateView : Window
|
||||||
|
{
|
||||||
|
private ValuePointsInterpolateViewModel viewModel;
|
||||||
|
public ValuePointsInterpolateView(ValuePointsInterpolateViewModel viewModel)
|
||||||
|
{
|
||||||
|
this.viewModel = viewModel;
|
||||||
|
this.viewModel.ParentWindow = this;
|
||||||
|
this.DataContext = this.viewModel;
|
||||||
|
InitializeComponent();
|
||||||
|
InterpolationControl.Properties = viewModel.ForceInterpolationViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using StructureHelper.Windows.ViewModels;
|
||||||
|
using StructureHelper.Windows.ViewModels.Materials;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,8 +18,9 @@
|
|||||||
</ToolBarTray>-->
|
</ToolBarTray>-->
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="250"/>
|
<ColumnDefinition MinWidth="250"/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="5*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@@ -31,7 +32,7 @@
|
|||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Expander Header="{Binding Name}" IsExpanded="True" Background="{Binding Color}">
|
<Expander Header="{Binding Name}" IsExpanded="True" Background="{Binding Color}">
|
||||||
<Grid >
|
<Grid HorizontalAlignment="Stretch">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="70"/>
|
<RowDefinition Height="70"/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
@@ -81,7 +82,8 @@
|
|||||||
<Button Margin="3" Content="Draw Lines" ToolTip="Draw Lines" Command="{Binding RedrawLinesCommand}"/>
|
<Button Margin="3" Content="Draw Lines" ToolTip="Draw Lines" Command="{Binding RedrawLinesCommand}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<lvc:CartesianChart Name="MainChart" Grid.Column="1" Series="{Binding SeriesCollection}" LegendLocation="Bottom" Zoom="Xy">
|
<GridSplitter Grid.Column="1" Width="3" VerticalAlignment="Stretch" HorizontalAlignment="Center" ShowsPreview="False"/>
|
||||||
|
<lvc:CartesianChart Name="MainChart" Grid.Column="2" Series="{Binding SeriesCollection}" LegendLocation="Bottom" Zoom="Xy">
|
||||||
<lvc:CartesianChart.AxisY>
|
<lvc:CartesianChart.AxisY>
|
||||||
<lvc:Axis Title="y-value"></lvc:Axis>
|
<lvc:Axis Title="y-value"></lvc:Axis>
|
||||||
</lvc:CartesianChart.AxisY>
|
</lvc:CartesianChart.AxisY>
|
||||||
|
|||||||
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,17 @@
|
|||||||
<Window x:Class="StructureHelper.Windows.MainWindow.VisualPropertyView"
|
<Window x:Class="StructureHelper.Windows.MainWindow.AxisCanvasView"
|
||||||
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"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow"
|
xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow"
|
||||||
d:DataContext="{d:DesignInstance local:CrossSectionVisualPropertyVM}"
|
d:DataContext="{d:DesignInstance local:AxisCanvasVM}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Grid properies" Height="200" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
Title="Grid properies" Height="200" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="35"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="22"/>
|
<RowDefinition Height="22"/>
|
||||||
@@ -27,8 +32,10 @@
|
|||||||
<TextBlock Grid.Row="2" Text="Grid line thickness"/>
|
<TextBlock Grid.Row="2" Text="Grid line thickness"/>
|
||||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding GridLineThickness, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding GridLineThickness, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||||
<TextBlock Grid.Row="3" Text="Work plane width"/>
|
<TextBlock Grid.Row="3" Text="Work plane width"/>
|
||||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding WorkPlainWidth, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Width, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||||
<TextBlock Grid.Row="4" Text="Work plane height"/>
|
<TextBlock Grid.Row="4" Text="Work plane height"/>
|
||||||
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding WorkPlainHeight, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
<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>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
@@ -17,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(CrossSectionVisualPropertyVM 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using LoaderCalculator;
|
using LoaderCalculator;
|
||||||
|
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
using LoaderCalculator.Data.Matrix;
|
using LoaderCalculator.Data.Matrix;
|
||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Data.ResultData;
|
using LoaderCalculator.Data.ResultData;
|
||||||
@@ -9,6 +10,7 @@ using StructureHelper.Services.Primitives;
|
|||||||
using StructureHelper.UnitSystem;
|
using StructureHelper.UnitSystem;
|
||||||
using StructureHelper.UnitSystem.Systems;
|
using StructureHelper.UnitSystem.Systems;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Services.Units;
|
using StructureHelperCommon.Services.Units;
|
||||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
@@ -26,6 +28,8 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
{
|
{
|
||||||
public class CrossSectionModel
|
public class CrossSectionModel
|
||||||
{
|
{
|
||||||
|
private ITriangulatePrimitiveLogic triangulateLogic;
|
||||||
|
|
||||||
public ICrossSection Section { get; private set; }
|
public ICrossSection Section { get; private set; }
|
||||||
private IPrimitiveRepository primitiveRepository;
|
private IPrimitiveRepository primitiveRepository;
|
||||||
public IHeadMaterialRepository HeadMaterialRepository { get; }
|
public IHeadMaterialRepository HeadMaterialRepository { get; }
|
||||||
@@ -52,7 +56,13 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
public IEnumerable<INdm> GetNdms(ICalculationProperty calculationProperty)
|
public IEnumerable<INdm> GetNdms(ICalculationProperty calculationProperty)
|
||||||
{
|
{
|
||||||
var ndmPrimitives = Section.SectionRepository.Primitives;
|
var ndmPrimitives = Section.SectionRepository.Primitives;
|
||||||
return NdmPrimitivesService.GetNdms(ndmPrimitives, calculationProperty.LimitState, calculationProperty.CalcTerm);
|
triangulateLogic = new TriangulatePrimitiveLogic()
|
||||||
|
{
|
||||||
|
Primitives = ndmPrimitives,
|
||||||
|
LimitState = calculationProperty.LimitState,
|
||||||
|
CalcTerm = calculationProperty.CalcTerm
|
||||||
|
};
|
||||||
|
return triangulateLogic.GetNdms();
|
||||||
////Настройки триангуляции, пока опции могут быть только такие
|
////Настройки триангуляции, пока опции могут быть только такие
|
||||||
//ITriangulationOptions options = new TriangulationOptions { LimiteState = calculationProperty.LimitState, CalcTerm = calculationProperty.CalcTerm };
|
//ITriangulationOptions options = new TriangulationOptions { LimiteState = calculationProperty.LimitState, CalcTerm = calculationProperty.CalcTerm };
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,9 @@
|
|||||||
<ContextMenu x:Key="AnalisesCRUD">
|
<ContextMenu x:Key="AnalisesCRUD">
|
||||||
<MenuItem Header="Run" Command="{Binding Run}">
|
<MenuItem Header="Run" Command="{Binding Run}">
|
||||||
<MenuItem.Icon>
|
<MenuItem.Icon>
|
||||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Run.png" />
|
<Viewbox Width="16" Height="16">
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource CalculatorRun}"/>
|
||||||
|
</Viewbox>
|
||||||
</MenuItem.Icon>
|
</MenuItem.Icon>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
@@ -143,67 +145,79 @@
|
|||||||
Content="Fact" ToolTip="Add Factored Combination"/>
|
Content="Fact" ToolTip="Add Factored Combination"/>
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
<ToolBar DataContext="{Binding MaterialsLogic}" ToolTip="Materials">
|
<ToolBar DataContext="{Binding MaterialsLogic}" ToolTip="Materials">
|
||||||
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Concrete}">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Concrete}">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/ConMaterial32.png"/>
|
<Image Source="/Windows/MainWindow/ConMaterial32.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Reinforcement}" ToolTip="Add Reinforcement Material">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Reinforcement}" ToolTip="Add Reinforcement Material">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/RFMaterial32.png"/>
|
<Image Source="/Windows/MainWindow/RFMaterial32.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Elastic}" ToolTip="Add Elastic Material">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Elastic}" ToolTip="Add Elastic Material">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/ElasticMaterial32.png"/>
|
<Image Source="/Windows/MainWindow/ElasticMaterial32.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.CarbonFiber}" ToolTip="Add Carbon Fiber Material">
|
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.CarbonFiber}" ToolTip="Add Carbon Fiber Material">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/СarbonMaterial32.png"/>
|
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/СarbonMaterial32.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.GlassFiber}" ToolTip="Add Glass Fiber Material">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.GlassFiber}" ToolTip="Add Glass Fiber Material">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/GlassMaterial32.png"/>
|
<Image Source="/Windows/MainWindow/GlassMaterial32.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding EditMaterialsCommand}" ToolTip="Show Materials">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding EditMaterialsCommand}" ToolTip="Show Materials">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Materials32.png"/>
|
<Image Source="/Windows/MainWindow/Materials32.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
<ToolBar ToolTip="Base Primitives" DataContext="{Binding PrimitiveLogic}">
|
<ToolBar ToolTip="Base Primitives" DataContext="{Binding PrimitiveLogic}">
|
||||||
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}" ToolTip="Add Rectangle Primitive">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}" ToolTip="Add Rectangle Primitive">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Rectangle32.png"/>
|
<Image Source="/Windows/MainWindow/Rectangle32.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}" ToolTip="Add Circle Primitive">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}" ToolTip="Add Circle Primitive">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Circle32.png"/>
|
<Image Source="/Windows/MainWindow/Circle32.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}" ToolTip="Add Rebar Primitive">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}" ToolTip="Add Rebar Primitive">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Rebar32.png"/>
|
<Image Source="/Windows/MainWindow/Rebar32.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}" ToolTip="Add Point Primitive">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}" ToolTip="Add Point Primitive">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Point32.png"/>
|
<Image Source="/Windows/MainWindow/Point32.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
<ToolBar ToolTip="RC Templates">
|
<ToolBar ToolTip="RC Templates">
|
||||||
<Button Command="{Binding AddColumnCase}" ToolTip="Add Rectangle RC Column">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding AddColumnCase}" ToolTip="Add Rectangle RC Column">
|
||||||
<Image Width="32" Height="32" Source="/Windows/MainWindow/RectangleColumn32.png"/>
|
<Image Source="/Windows/MainWindow/RectangleColumn32.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding AddRCCircleCase}" ToolTip="Add Circle RC Column">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding AddRCCircleCase}" ToolTip="Add Circle RC Column">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/CircleColumn32.png"/>
|
<Image Source="/Windows/MainWindow/CircleColumn32.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding AddBeamCase}" ToolTip="Add RC Beam">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding AddBeamCase}" ToolTip="Add RC Beam">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Beam32.png"/>
|
<Image Source="/Windows/MainWindow/Beam32.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding AddSlabCase}" ToolTip="Add RC Slab">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding AddSlabCase}" ToolTip="Add RC Slab">
|
||||||
<Image Width="32" Height="32" Source="/Windows/MainWindow/Slab32.png"/>
|
<Image Source="/Windows/MainWindow/Slab32.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
<ToolBar ToolTip="Analises" DataContext="{Binding CalculatorsLogic}">
|
<ToolBar ToolTip="Analises" DataContext="{Binding CalculatorsLogic}">
|
||||||
<Button Command="{Binding Add}" ToolTip="Add Force Calculator">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:CalculatorTypes.ForceCalculator}" ToolTip="Add Force Calculator">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Calculator32.png"/>
|
<Image Source="/Windows/MainWindow/Calculator32.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding Run}" ToolTip="Run Calculations">
|
<Button Style="{DynamicResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:CalculatorTypes.LimitCurveCalculator}" ToolTip="Add Interaction Diagram Calculator">
|
||||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Analysis32.png"/>
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource DiagramCalculator}"/>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
<Button Style="{DynamicResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:CalculatorTypes.CrackCalculator}" ToolTip="Add Crack Calculator">
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource CrackCalculator}"/>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
<Button Style="{DynamicResource ToolButton}" Command="{Binding Run}" ToolTip="Run Calculations">
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource CalculatorRun}"/>
|
||||||
|
</Viewbox>
|
||||||
</Button>
|
</Button>
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
<ToolBar ToolTip="Tools">
|
<ToolBar ToolTip="Tools">
|
||||||
<Button Command="{Binding MovePrimitiveToGravityCenterCommand}" ToolTip="Move All Primitives to Gravity Center">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding MovePrimitiveToGravityCenterCommand}" ToolTip="Move All Primitives to Gravity Center">
|
||||||
<Image Width="32" Height="32" Source="/Windows/MainWindow/MovePrimitivesToCenter.png"/>
|
<Image Source="/Windows/MainWindow/MovePrimitivesToCenter.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding ShowVisualProperty}" ToolTip="Visual Settings">
|
<Button Style="{StaticResource ToolButton}" Command="{Binding ShowVisualProperty}" ToolTip="Visual Settings">
|
||||||
<Image Width="32" Height="32" Source="/Windows/MainWindow/Tools_Settings.png"/>
|
<Image Source="/Windows/MainWindow/Tools_Settings.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
</ToolBarTray>
|
</ToolBarTray>
|
||||||
@@ -338,7 +352,16 @@
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="Add Interaction Diagram Calculator" Command="{Binding Add}" CommandParameter="{x:Static enums:CalculatorTypes.LimitCurveCalculator}">
|
<MenuItem Header="Add Interaction Diagram Calculator" Command="{Binding Add}" CommandParameter="{x:Static enums:CalculatorTypes.LimitCurveCalculator}">
|
||||||
<MenuItem.Icon>
|
<MenuItem.Icon>
|
||||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Calculator32.png" />
|
<Viewbox Width="16" Height="16">
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource DiagramCalculator}"/>
|
||||||
|
</Viewbox>
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem Header="Add Crack Calculator" Command="{Binding Add}" CommandParameter="{x:Static enums:CalculatorTypes.CrackCalculator}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<Viewbox Width="16" Height="16">
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource CrackCalculator}"/>
|
||||||
|
</Viewbox>
|
||||||
</MenuItem.Icon>
|
</MenuItem.Icon>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
@@ -362,11 +385,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 VisualProperty.WorkPlainWidth}" Height="{Binding VisualProperty.WorkPlainHeight}">
|
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" />
|
||||||
@@ -388,7 +417,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" />
|
||||||
@@ -434,15 +463,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>
|
||||||
<!--Horizontal axis line-->
|
<!--Horizontal axis line-->
|
||||||
<Line X1="0" X2="{Binding RightLimitX}" Y1="{Binding MiddleLimitY}" Y2="{Binding MiddleLimitY}" Stroke="Red" StrokeThickness="{Binding AxisLineThickness}"/>
|
<Line
|
||||||
|
X1="0" X2="{Binding Width}"
|
||||||
|
Y1="{Binding HalfOfHeight}" Y2="{Binding HalfOfHeight}"
|
||||||
|
Stroke="{Binding XAxisColorBrush}"
|
||||||
|
StrokeThickness="{Binding AxisLineThickness}"/>
|
||||||
<!--Vertical axis line-->
|
<!--Vertical axis line-->
|
||||||
<Line X1="{Binding MiddleLimitX}" X2="{Binding MiddleLimitX}" Y1="0" Y2="{Binding BottomLimitY}" Stroke="ForestGreen" StrokeThickness="{Binding AxisLineThickness}"/>
|
<Line
|
||||||
<ItemsControl DataContext="{Binding PrimitiveLogic}" ItemsSource="{Binding Items}" ContextMenu="{StaticResource PrimitiveCRUD}">
|
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/>
|
||||||
@@ -466,7 +510,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>
|
||||||
@@ -478,7 +522,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>
|
||||||
|
|||||||
@@ -29,14 +29,15 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
{
|
{
|
||||||
private ICrossSection section;
|
private ICrossSection section;
|
||||||
private ICrossSectionRepository repository => section.SectionRepository;
|
private ICrossSectionRepository repository => section.SectionRepository;
|
||||||
private readonly double scaleRate = 1.1d;
|
private ITriangulatePrimitiveLogic triangulateLogic;
|
||||||
|
|
||||||
|
|
||||||
public CrossSectionVisualPropertyVM VisualProperty { get; private set; }
|
public CrossSectionVisualPropertyVM VisualProperty { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||||
|
|
||||||
public AnalysisVewModelLogic CalculatorsLogic { get; private set; }
|
public AnalysisViewModelLogic CalculatorsLogic { get; private set; }
|
||||||
public ActionsViewModel CombinationsLogic { get; }
|
public ActionsViewModel CombinationsLogic { get; }
|
||||||
public MaterialsViewModel MaterialsLogic { get; }
|
public MaterialsViewModel MaterialsLogic { get; }
|
||||||
public PrimitiveViewModelLogic PrimitiveLogic { get; }
|
public PrimitiveViewModelLogic PrimitiveLogic { get; }
|
||||||
@@ -44,64 +45,6 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
|
|
||||||
private CrossSectionModel 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string CanvasViewportSize
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
string s = VisualProperty.GridSize.ToString();
|
|
||||||
s = s.Replace(',', '.');
|
|
||||||
return $"0,0,{s},{s}";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public double GridSize => VisualProperty.GridSize;
|
|
||||||
|
|
||||||
public ObservableCollection<IHeadMaterial> HeadMaterials
|
public ObservableCollection<IHeadMaterial> HeadMaterials
|
||||||
{
|
{
|
||||||
@@ -116,23 +59,6 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Right edge of work plane, coordinate X
|
|
||||||
/// </summary>
|
|
||||||
public double RightLimitX => VisualProperty.WorkPlainWidth;
|
|
||||||
/// <summary>
|
|
||||||
/// Bottom edge of work plane Y
|
|
||||||
/// </summary>
|
|
||||||
public double BottomLimitY => VisualProperty.WorkPlainHeight;
|
|
||||||
/// <summary>
|
|
||||||
/// Middle of coordinate X
|
|
||||||
/// </summary>
|
|
||||||
public double MiddleLimitX => VisualProperty.WorkPlainWidth / 2d;
|
|
||||||
/// <summary>
|
|
||||||
/// Middle of coordinate Y
|
|
||||||
/// </summary>
|
|
||||||
public double MiddleLimitY => VisualProperty.WorkPlainHeight / 2d;
|
|
||||||
|
|
||||||
public ICommand Calculate { get; }
|
public ICommand Calculate { get; }
|
||||||
public ICommand EditCalculationPropertyCommand { get; }
|
public ICommand EditCalculationPropertyCommand { get; }
|
||||||
public ICommand EditHeadMaterialsCommand { get; }
|
public ICommand EditHeadMaterialsCommand { get; }
|
||||||
@@ -153,7 +79,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; }
|
||||||
@@ -161,8 +87,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
|
||||||
@@ -172,17 +97,12 @@ 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;
|
||||||
OnPropertyChanged(nameof(RightLimitX));
|
PrimitiveLogic.Height = VisualProperty.Height;
|
||||||
OnPropertyChanged(nameof(BottomLimitY));
|
|
||||||
OnPropertyChanged(nameof(MiddleLimitX));
|
|
||||||
OnPropertyChanged(nameof(MiddleLimitY));
|
|
||||||
PrimitiveLogic.WorkPlaneWidth = VisualProperty.WorkPlainWidth;
|
|
||||||
PrimitiveLogic.WorkPlaneHeight = VisualProperty.WorkPlainHeight;
|
|
||||||
PrimitiveLogic.Refresh();
|
PrimitiveLogic.Refresh();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -192,36 +112,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 RelayCommand showVisualProperty;
|
private RelayCommand showVisualProperty;
|
||||||
private RelayCommand selectPrimitive;
|
private RelayCommand selectPrimitive;
|
||||||
|
|
||||||
public CrossSectionViewModel(CrossSectionModel model)
|
public CrossSectionViewModel(CrossSectionModel model)
|
||||||
{
|
{
|
||||||
VisualProperty = new CrossSectionVisualPropertyVM();
|
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)
|
PrimitiveLogic = new PrimitiveViewModelLogic(section)
|
||||||
{
|
{
|
||||||
WorkPlaneWidth = VisualProperty.WorkPlainWidth,
|
Width = VisualProperty.Width,
|
||||||
WorkPlaneHeight = VisualProperty.WorkPlainHeight
|
Height = VisualProperty.Height
|
||||||
};
|
};
|
||||||
scaleValue = 500d;
|
|
||||||
|
|
||||||
LeftButtonUp = new RelayCommand(o =>
|
LeftButtonUp = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
@@ -231,35 +152,6 @@ 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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
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 =>
|
||||||
{
|
{
|
||||||
@@ -282,7 +174,13 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
MovePrimitiveToGravityCenterCommand = new RelayCommand(o =>
|
MovePrimitiveToGravityCenterCommand = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
if (CheckMaterials() == false) { return;}
|
if (CheckMaterials() == false) { return;}
|
||||||
var ndms = NdmPrimitivesService.GetNdms(repository.Primitives, LimitStates.SLS, CalcTerms.ShortTerm);
|
triangulateLogic = new TriangulatePrimitiveLogic()
|
||||||
|
{
|
||||||
|
Primitives = repository.Primitives,
|
||||||
|
LimitState = LimitStates.SLS,
|
||||||
|
CalcTerm = CalcTerms.ShortTerm
|
||||||
|
};
|
||||||
|
var ndms = triangulateLogic.GetNdms();
|
||||||
var center = GeometryOperations.GetGravityCenter(ndms);
|
var center = GeometryOperations.GetGravityCenter(ndms);
|
||||||
foreach (var item in PrimitiveLogic.Items)
|
foreach (var item in PrimitiveLogic.Items)
|
||||||
{
|
{
|
||||||
@@ -301,17 +199,14 @@ 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()
|
||||||
@@ -338,12 +233,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,11 +272,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);
|
||||||
@@ -378,10 +291,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(VisualProperty.WorkPlainWidth / 2, VisualProperty.WorkPlainHeight / 2);
|
|
||||||
}
|
|
||||||
PrimitiveLogic.Refresh();
|
PrimitiveLogic.Refresh();
|
||||||
foreach (var item in newRepository.HeadMaterials)
|
foreach (var item in newRepository.HeadMaterials)
|
||||||
{
|
{
|
||||||
@@ -392,8 +301,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
GlobalRepository.Actions.Create(item);
|
GlobalRepository.Actions.Create(item);
|
||||||
}
|
}
|
||||||
return primitives;
|
return primitives;
|
||||||
}
|
|
||||||
return new List<PrimitiveBase>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
using StructureHelper.Infrastructure;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelper.Windows.MainWindow
|
|
||||||
{
|
|
||||||
public class CrossSectionVisualPropertyVM : ViewModelBase
|
|
||||||
{
|
|
||||||
private double axisLineThickness;
|
|
||||||
private double gridLineThickness;
|
|
||||||
private double gridSize;
|
|
||||||
private double workPlainWidth;
|
|
||||||
private double workPlainHeight;
|
|
||||||
|
|
||||||
/// <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 WorkPlainWidth
|
|
||||||
{
|
|
||||||
get => workPlainWidth; set
|
|
||||||
{
|
|
||||||
workPlainWidth = value;
|
|
||||||
OnPropertyChanged(nameof(WorkPlainWidth));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Height of work plane
|
|
||||||
/// </summary>
|
|
||||||
public double WorkPlainHeight
|
|
||||||
{
|
|
||||||
get => workPlainHeight; set
|
|
||||||
{
|
|
||||||
workPlainHeight = value;
|
|
||||||
OnPropertyChanged(nameof(WorkPlainHeight));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CrossSectionVisualPropertyVM()
|
|
||||||
{
|
|
||||||
AxisLineThickness = 2d;
|
|
||||||
GridLineThickness = 0.25d;
|
|
||||||
GridSize = 0.05d;
|
|
||||||
WorkPlainWidth = 1.2d;
|
|
||||||
WorkPlainHeight = 1.2d;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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/>
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace StructureHelper.Windows.UserControls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MultiplyDouble : UserControl
|
public partial class MultiplyDouble : UserControl
|
||||||
{
|
{
|
||||||
|
IConvertUnitLogic operationLogic = new ConvertUnitLogic();
|
||||||
public event EventHandler ValueChanged;
|
public event EventHandler ValueChanged;
|
||||||
|
|
||||||
public MultiplyDouble()
|
public MultiplyDouble()
|
||||||
@@ -40,7 +41,7 @@ namespace StructureHelper.Windows.UserControls
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
string s = (string)o;
|
string s = (string)o;
|
||||||
double factor = CommonOperation.ConvertToDoubleChangeComma(s);
|
double factor = ProcessString.ConvertCommaToCultureSettings(s);
|
||||||
ChangeValue(factor);
|
ChangeValue(factor);
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.CalculationResult
|
|||||||
private void ShowIsoField()
|
private void ShowIsoField()
|
||||||
{
|
{
|
||||||
IStrainMatrix strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
IStrainMatrix strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||||
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ResultFuncFactory.GetResultFuncs());
|
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ForceResultFuncFactory.GetResultFuncs());
|
||||||
isoFieldReport = new IsoFieldReport(primitiveSets);
|
isoFieldReport = new IsoFieldReport(primitiveSets);
|
||||||
isoFieldReport.Show();
|
isoFieldReport.Show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,13 @@
|
|||||||
using StructureHelper.Infrastructure.Enums;
|
using StructureHelper.Infrastructure.Enums;
|
||||||
using StructureHelper.Models.Materials;
|
|
||||||
using StructureHelper.Services.Settings;
|
using StructureHelper.Services.Settings;
|
||||||
using StructureHelper.Windows.Forces;
|
using StructureHelper.Windows.Forces;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Materials;
|
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using System;
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.Forces
|
namespace StructureHelper.Windows.ViewModels.Forces
|
||||||
@@ -98,23 +93,39 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
|||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
var calcRepository = repository.CalculatorsList;
|
var calcRepository = repository.CalculatorsList;
|
||||||
foreach (var item in calcRepository)
|
foreach (var calc in calcRepository)
|
||||||
{
|
{
|
||||||
if (item is IForceCalculator)
|
if (calc is IForceCalculator)
|
||||||
{
|
{
|
||||||
var forceCalculator = item as IForceCalculator;
|
var forceCombinations = calc as IHasForceCombinations;
|
||||||
var containSelected = forceCalculator.ForceActions.Contains(SelectedItem);
|
result = DeleteActionFromHost(result, calc, forceCombinations);
|
||||||
|
}
|
||||||
|
else if (calc is CrackCalculator calculator)
|
||||||
|
{
|
||||||
|
var forceCombinations = calculator.InputData as IHasForceCombinations;
|
||||||
|
result = DeleteActionFromHost(result, calc, forceCombinations);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(ICalculator), calc));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool DeleteActionFromHost(bool result, ICalculator item, IHasForceCombinations? forceCombinations)
|
||||||
|
{
|
||||||
|
var containSelected = forceCombinations.ForceActions.Contains(SelectedItem);
|
||||||
if (containSelected)
|
if (containSelected)
|
||||||
{
|
{
|
||||||
var dialogResultCalc = MessageBox.Show($"Action is contained in calculator {item.Name}", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
var dialogResultCalc = MessageBox.Show($"Action is contained in calculator {item.Name}", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||||
if (dialogResultCalc == DialogResult.Yes)
|
if (dialogResultCalc == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
forceCalculator.ForceActions.Remove(SelectedItem);
|
forceCombinations.ForceActions.Remove(SelectedItem);
|
||||||
}
|
}
|
||||||
else result = false;
|
else result = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
using StructureHelper.Infrastructure;
|
using LoaderCalculator;
|
||||||
|
using StructureHelper.Infrastructure;
|
||||||
using StructureHelper.Infrastructure.Enums;
|
using StructureHelper.Infrastructure.Enums;
|
||||||
|
using StructureHelper.Windows.CalculationWindows.CalculatorsViews;
|
||||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||||
using StructureHelper.Windows.CalculationWindows.ProgressViews;
|
using StructureHelper.Windows.CalculationWindows.ProgressViews;
|
||||||
|
using StructureHelper.Windows.Errors;
|
||||||
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;
|
||||||
@@ -10,13 +13,15 @@ using StructureHelperCommon.Models.Calculators;
|
|||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.Logics;
|
using StructureHelperLogics.NdmCalculations.Analyses.Logics;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
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;
|
||||||
@@ -25,17 +30,45 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
private InteractionDiagramLogic interactionDiagramLogic;
|
private InteractionDiagramLogic interactionDiagramLogic;
|
||||||
|
|
||||||
public override void AddMethod(object parameter)
|
public override void AddMethod(object parameter)
|
||||||
|
{
|
||||||
|
if (CheckParameter(parameter) == false) { return; }
|
||||||
|
AddCalculator(parameter);
|
||||||
|
base.AddMethod(parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddCalculator(object parameter)
|
||||||
{
|
{
|
||||||
var parameterType = (CalculatorTypes)parameter;
|
var parameterType = (CalculatorTypes)parameter;
|
||||||
if (parameterType == CalculatorTypes.ForceCalculator)
|
if (parameterType == CalculatorTypes.ForceCalculator)
|
||||||
{
|
{
|
||||||
NewItem = new ForceCalculator()
|
AddForceCalculator();
|
||||||
{
|
|
||||||
Name = "New force calculator",
|
|
||||||
TraceLogger = new ShiftTraceLogger(),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
else if (parameterType == CalculatorTypes.LimitCurveCalculator)
|
else if (parameterType == CalculatorTypes.LimitCurveCalculator)
|
||||||
|
{
|
||||||
|
AddLimitCurveCalculator();
|
||||||
|
}
|
||||||
|
else if (parameterType == CalculatorTypes.CrackCalculator)
|
||||||
|
{
|
||||||
|
AddCrackCalculator();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(parameterType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddCrackCalculator()
|
||||||
|
{
|
||||||
|
var inputData = new CrackInputData();
|
||||||
|
var calculator = new CrackCalculator(inputData, new CheckCrackCalculatorInputDataLogic(inputData))
|
||||||
|
{
|
||||||
|
Name = "New crack calculator",
|
||||||
|
TraceLogger = new ShiftTraceLogger(),
|
||||||
|
};
|
||||||
|
NewItem = calculator;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddLimitCurveCalculator()
|
||||||
{
|
{
|
||||||
var inputData = new LimitCurveInputData(repository.Primitives);
|
var inputData = new LimitCurveInputData(repository.Primitives);
|
||||||
NewItem = new LimitCurvesCalculator()
|
NewItem = new LimitCurvesCalculator()
|
||||||
@@ -45,12 +78,31 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
TraceLogger = new ShiftTraceLogger(),
|
TraceLogger = new ShiftTraceLogger(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
private void AddForceCalculator()
|
||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(parameterType));
|
NewItem = new ForceCalculator()
|
||||||
|
{
|
||||||
|
Name = "New force calculator",
|
||||||
|
TraceLogger = new ShiftTraceLogger(),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
base.AddMethod(parameter);
|
|
||||||
|
private bool CheckParameter(object parameter)
|
||||||
|
{
|
||||||
|
if (parameter is null)
|
||||||
|
{
|
||||||
|
SafetyProcessor.ShowMessage(ErrorStrings.ParameterIsNull, "It is imposible to add object cause parameter is null");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
if (parameter is not CalculatorTypes)
|
||||||
|
{
|
||||||
|
SafetyProcessor.ShowMessage(ErrorStrings.ExpectedWas(typeof(CalculatorTypes), parameter), "Parameter is not correspondent to any type of calculator");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public override void EditMethod(object parameter)
|
public override void EditMethod(object parameter)
|
||||||
{
|
{
|
||||||
SafetyProcessor.RunSafeProcess(EditCalculator, $"Error of editing: {SelectedItem.Name}");
|
SafetyProcessor.RunSafeProcess(EditCalculator, $"Error of editing: {SelectedItem.Name}");
|
||||||
@@ -59,20 +111,18 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
|
|
||||||
private void EditCalculator()
|
private void EditCalculator()
|
||||||
{
|
{
|
||||||
if (SelectedItem is ForceCalculator)
|
if (SelectedItem is ForceCalculator forceCalculator) { EditForceCalculator(forceCalculator);}
|
||||||
{
|
else if (SelectedItem is LimitCurvesCalculator limitCurvesCalculator) { EditLimitCurveCalculator(limitCurvesCalculator); }
|
||||||
var calculator = SelectedItem as ForceCalculator;
|
else if (SelectedItem is CrackCalculator crackCalculator) { EditCrackCalculator(crackCalculator);}
|
||||||
EditForceCalculator(calculator);
|
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(SelectedItem));}
|
||||||
}
|
}
|
||||||
else if (SelectedItem is LimitCurvesCalculator)
|
|
||||||
|
private void EditCrackCalculator(CrackCalculator calculator)
|
||||||
{
|
{
|
||||||
var calculator = SelectedItem as LimitCurvesCalculator;
|
var calculatorCopy = calculator.Clone() as CrackCalculator;
|
||||||
EditLimitCurveCalculator(calculator);
|
var vm = new CrackCalculatorInputDataViewModel(repository.Primitives, repository.ForceActions, calculator);
|
||||||
}
|
var wnd = new CrackCalculatorInputDataView(vm);
|
||||||
else
|
ShowWindow(calculator, calculatorCopy, wnd);
|
||||||
{
|
|
||||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(SelectedItem));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EditLimitCurveCalculator(LimitCurvesCalculator calculator)
|
private void EditLimitCurveCalculator(LimitCurvesCalculator calculator)
|
||||||
@@ -88,7 +138,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);
|
||||||
}
|
}
|
||||||
@@ -129,16 +178,13 @@ 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;
|
|
||||||
ShowInteractionDiagramByInputData(calculator);
|
ShowInteractionDiagramByInputData(calculator);
|
||||||
if (calculator.TraceLogger is not null)
|
|
||||||
{
|
|
||||||
var wnd = new TraceDocumentView(calculator.TraceLogger.TraceLoggerEntries);
|
|
||||||
wnd.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -146,7 +192,12 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
var result = SelectedItem.Result;
|
var result = SelectedItem.Result;
|
||||||
if (result.IsValid == false)
|
if (result.IsValid == false)
|
||||||
{
|
{
|
||||||
MessageBox.Show(result.Description, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
var vm = new ErrorProcessor()
|
||||||
|
{
|
||||||
|
ShortText = "Errors apearred during calculations, see detailed information",
|
||||||
|
DetailText = SelectedItem.Result.Description
|
||||||
|
};
|
||||||
|
new ErrorMessage(vm).ShowDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -154,6 +205,12 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
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)
|
||||||
@@ -170,20 +227,24 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
|
|
||||||
private void ProcessResult()
|
private void ProcessResult()
|
||||||
{
|
{
|
||||||
if (SelectedItem is IForceCalculator)
|
if (SelectedItem is ForceCalculator forceCalculator)
|
||||||
{
|
{
|
||||||
var calculator = SelectedItem as ForceCalculator;
|
var vm = new ForcesResultsViewModel(forceCalculator);
|
||||||
var vm = new ForcesResultsViewModel(calculator);
|
|
||||||
var wnd = new ForceResultsView(vm);
|
var wnd = new ForceResultsView(vm);
|
||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
}
|
}
|
||||||
|
else if (SelectedItem is CrackCalculator crackCalculator)
|
||||||
|
{
|
||||||
|
var wnd = new CrackResultView(crackCalculator.Result as CrackResult);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(SelectedItem));
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(SelectedItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AnalysisVewModelLogic(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
|
public AnalysisViewModelLogic(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
|
||||||
{
|
{
|
||||||
repository = sectionRepository;
|
repository = sectionRepository;
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,24 @@
|
|||||||
using StructureHelper.Infrastructure;
|
using StructureHelper.Infrastructure;
|
||||||
using StructureHelper.Infrastructure.Enums;
|
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.PrimitiveProperiesWindow;
|
||||||
|
using StructureHelper.Windows.PrimitiveTemplates.RCs.Beams;
|
||||||
|
using StructureHelper.Windows.PrimitiveTemplates.RCs.RectangleBeam;
|
||||||
using StructureHelper.Windows.Services;
|
using StructureHelper.Windows.Services;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Materials;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
||||||
|
using StructureHelperLogics.Models.Templates.RCs;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -19,7 +30,7 @@ using System.Windows.Input;
|
|||||||
|
|
||||||
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;
|
||||||
@@ -31,8 +42,9 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
private ICommand setToBack;
|
private ICommand setToBack;
|
||||||
private ICommand copyToCommand;
|
private ICommand copyToCommand;
|
||||||
|
|
||||||
public double WorkPlaneWidth { get; set; }
|
|
||||||
public double WorkPlaneHeight { get; set; }
|
public double Width { get; set; }
|
||||||
|
public double Height { get; set; }
|
||||||
|
|
||||||
public PrimitiveBase SelectedItem { get; set; }
|
public PrimitiveBase SelectedItem { get; set; }
|
||||||
|
|
||||||
@@ -42,14 +54,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);
|
||||||
}
|
}
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +106,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(WorkPlaneWidth / 2, WorkPlaneHeight / 2);
|
viewPrimitive.OnNext(this);
|
||||||
repository.Primitives.Add(ndmPrimitive);
|
repository.Primitives.Add(ndmPrimitive);
|
||||||
ndmPrimitive.CrossSection = section;
|
ndmPrimitive.CrossSection = section;
|
||||||
Items.Add(viewPrimitive);
|
Items.Add(viewPrimitive);
|
||||||
@@ -128,9 +138,24 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
{
|
{
|
||||||
if (calc is IForceCalculator)
|
if (calc is IForceCalculator)
|
||||||
{
|
{
|
||||||
var forceCalc = calc as IForceCalculator;
|
var forceCalc = calc as IHasPrimitives;
|
||||||
forceCalc.Primitives.Remove(ndmPrimitive);
|
forceCalc.Primitives.Remove(ndmPrimitive);
|
||||||
}
|
}
|
||||||
|
else if (calc is LimitCurvesCalculator calculator)
|
||||||
|
{
|
||||||
|
//to do
|
||||||
|
//var forceCalc = calculator.InputData as IHasPrimitives;
|
||||||
|
//forceCalc.Primitives.Remove(ndmPrimitive);
|
||||||
|
}
|
||||||
|
else if (calc is CrackCalculator crackCalculator)
|
||||||
|
{
|
||||||
|
var forceCalc = crackCalculator.InputData as IHasPrimitives;
|
||||||
|
forceCalc.Primitives.Remove(ndmPrimitive);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(ICalculator), calc));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
foreach (var primitive in repository.Primitives)
|
foreach (var primitive in repository.Primitives)
|
||||||
{
|
{
|
||||||
@@ -181,12 +206,10 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return copyCommand ??
|
return copyCommand ??= new RelayCommand(
|
||||||
(
|
|
||||||
copyCommand = new RelayCommand(
|
|
||||||
o => CopySelectedItem(SelectedItem.GetNdmPrimitive()),
|
o => CopySelectedItem(SelectedItem.GetNdmPrimitive()),
|
||||||
o => SelectedItem != null
|
o => SelectedItem != null
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,8 +247,14 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
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)
|
||||||
@@ -238,8 +267,11 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
|
else
|
||||||
primitiveBase.RegisterDeltas(WorkPlaneWidth / 2, WorkPlaneHeight / 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));
|
||||||
@@ -252,13 +284,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()
|
||||||
@@ -281,16 +312,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)
|
||||||
@@ -300,13 +332,22 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Refresh()
|
public void Refresh()
|
||||||
|
{
|
||||||
|
NotifyObservers();
|
||||||
|
OnPropertyChanged(nameof(PrimitivesCount));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NotifyObservers()
|
||||||
{
|
{
|
||||||
foreach (var item in Items)
|
foreach (var item in Items)
|
||||||
{
|
{
|
||||||
item.RegisterDeltas(WorkPlaneWidth / 2, WorkPlaneHeight / 2);
|
item.OnNext(this);
|
||||||
item.Refresh();
|
|
||||||
}
|
}
|
||||||
OnPropertyChanged(nameof(PrimitivesCount));
|
}
|
||||||
|
|
||||||
|
public IDisposable Subscribe(IObserver<PrimitiveBase> observer)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrimitiveViewModelLogic(ICrossSection section)
|
public PrimitiveViewModelLogic(ICrossSection section)
|
||||||
@@ -315,5 +356,6 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
Items = new ObservableCollection<PrimitiveBase>();
|
Items = new ObservableCollection<PrimitiveBase>();
|
||||||
AddItems(PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(this.repository.Primitives));
|
AddItems(PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(this.repository.Primitives));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user