Merge pull request #8 from RedikultsevEvg/develop

Develop
This commit is contained in:
RedikultsevEvg
2024-06-02 17:01:34 +05:00
committed by GitHub
227 changed files with 6777 additions and 1473 deletions

View 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; }
}
}

View File

@@ -11,25 +11,8 @@ namespace FieldVisualizer.Entities.ColorMaps
/// Flag of activity
/// </summary>
bool IsActive { get; set; }
/// <summary>
/// Minimum value of range
/// </summary>
double BottomValue { get; set; }
/// <summary>
/// Average value of range
/// </summary>
double AverageValue { get; set; }
/// <summary>
/// Maximum value of range
/// </summary>
double TopValue {get;set;}
/// <summary>
/// Color correspondent to minimum value
/// </summary>
Color BottomColor { get; set; }
/// <summary>
/// Color correspondent to maximum value
/// </summary>
Color TopColor { get; set; }
IValueColorArray ExactValues { get; }
IValueColorArray RoundedValues { get; }
}
}

View 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; }
}
}

View File

@@ -7,15 +7,10 @@ namespace FieldVisualizer.Entities.ColorMaps
{
/// <inheritdoc/>
public bool IsActive { get; set; }
/// <inheritdoc/>
public double BottomValue { get; set; }
/// <inheritdoc/>
public double AverageValue { get; set; }
/// <inheritdoc/>
public double TopValue { get; set; }
/// <inheritdoc/>
public Color BottomColor { get; set; }
/// <inheritdoc/>
public Color TopColor { get; set; }
public IValueColorArray ExactValues { get; private set; } = new ValueColorArray();
public IValueColorArray RoundedValues { get; private set; } = new ValueColorArray();
}
}

View File

@@ -1,6 +1,7 @@
using FieldVisualizer.Entities.ColorMaps;
using FieldVisualizer.Entities.Values;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Text;
@@ -11,6 +12,7 @@ namespace FieldVisualizer.Services.ColorServices
public static class ColorOperations
{
const byte Alpha = 0xff;
static IMathRoundLogic roundLogic = new SmartRoundLogic();
/// <summary>
///
/// </summary>
@@ -23,15 +25,18 @@ namespace FieldVisualizer.Services.ColorServices
var colorRanges = new List<IValueColorRange>();
foreach (var valueRange in valueRanges)
{
IValueColorRange valueColorRange = new ValueColorRange
var valueColorRange = new ValueColorRange
{
IsActive = true,
BottomValue = valueRange.BottomValue,
AverageValue = (valueRange.BottomValue + valueRange.TopValue) / 2,
TopValue = valueRange.TopValue
};
valueColorRange.BottomColor = GetColorByValue(fullRange, colorMap, valueColorRange.BottomValue);
valueColorRange.TopColor = GetColorByValue(fullRange, colorMap, valueColorRange.TopValue);
valueColorRange.ExactValues.BottomValue = valueRange.BottomValue;
valueColorRange.ExactValues.AverageValue = (valueRange.BottomValue + valueRange.TopValue) / 2;
valueColorRange.ExactValues.TopValue = valueRange.TopValue;
valueColorRange.ExactValues.BottomColor = GetColorByValue(fullRange, colorMap, valueColorRange.ExactValues.BottomValue);
valueColorRange.ExactValues.TopColor = GetColorByValue(fullRange, colorMap, valueColorRange.ExactValues.TopValue);
valueColorRange.RoundedValues.BottomValue = roundLogic.RoundValue(valueColorRange.ExactValues.BottomValue);
valueColorRange.RoundedValues.AverageValue = roundLogic.RoundValue(valueColorRange.ExactValues.AverageValue);
valueColorRange.RoundedValues.TopValue = roundLogic.RoundValue(valueColorRange.ExactValues.TopValue);
colorRanges.Add(valueColorRange);
}
return colorRanges;
@@ -85,11 +90,16 @@ namespace FieldVisualizer.Services.ColorServices
return map.Colors[^1];
}
double colorPerc = 1d / (map.Colors.Count - 1d); // % of each block of color. the last is the "100% Color"
double blockOfColor = valPerc / colorPerc;// the integer part repersents how many block to skip
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;
}

View File

@@ -9,6 +9,7 @@ using FieldVisualizer.Services.ColorServices;
using FieldVisualizer.Services.PrimitiveServices;
using FieldVisualizer.Services.ValueRanges;
using FieldVisualizer.Windows.UserControls;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -22,6 +23,7 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
{
public class FieldViewerViewModel : ViewModelBase, IDataErrorInfo
{
private IMathRoundLogic roundLogic = new SmartRoundLogic() { DigitQuant = 3 };
public ICommand RebuildCommand { get; }
public ICommand ZoomInCommand { get; }
public ICommand ZoomOutCommand { get; }
@@ -159,8 +161,8 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
private ColorMapsTypes _ColorMapType;
private IColorMap _ColorMap;
private IValueRange valueRange;
private IEnumerable<IValueRange> _ValueRanges;
private IEnumerable<IValueColorRange> _ValueColorRanges;
private IEnumerable<IValueRange> valueRanges;
private IEnumerable<IValueColorRange> valueColorRanges;
private bool setMinValue;
private bool setMaxValue;
private double crossLineX;
@@ -190,7 +192,7 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
if ((PrimitiveSet is null) == false)
{
ProcessPrimitives();
Legend.ValueColorRanges = _ValueColorRanges;
Legend.ValueColorRanges = valueColorRanges;
Legend.Refresh();
}
}
@@ -257,14 +259,14 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
{
SolidColorBrush brush = new SolidColorBrush();
brush.Color = ColorOperations.GetColorByValue(valueRange, _ColorMap, valuePrimitive.Value);
foreach (var valueRange in _ValueColorRanges)
foreach (var valueRange in valueColorRanges)
{
if (valuePrimitive.Value >= valueRange.BottomValue & valuePrimitive.Value <= valueRange.TopValue & (!valueRange.IsActive))
if (valuePrimitive.Value >= valueRange.ExactValues.BottomValue & valuePrimitive.Value <= valueRange.ExactValues.TopValue & (!valueRange.IsActive))
{
brush.Color = Colors.Gray;
}
}
shape.ToolTip = valuePrimitive.Value;
shape.ToolTip = roundLogic.RoundValue(valuePrimitive.Value);
shape.Tag = valuePrimitive;
shape.Fill = brush;
Canvas.SetLeft(shape, valuePrimitive.CenterX - addX - dX);
@@ -301,10 +303,24 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
{
UserValueRange.TopValue = UserValueRange.BottomValue;
}
if (SetMinValue) { valueRange.BottomValue = UserValueRange.BottomValue; } else { UserValueRange.BottomValue = valueRange.BottomValue; }
if (SetMaxValue) { valueRange.TopValue = UserValueRange.TopValue; } else { UserValueRange.TopValue = valueRange.TopValue; }
_ValueRanges = ValueRangeOperations.DivideValueRange(valueRange, RangeNumber);
_ValueColorRanges = ColorOperations.GetValueColorRanges(valueRange, _ValueRanges, _ColorMap);
if (SetMinValue == true)
{
valueRange.BottomValue = UserValueRange.BottomValue;
}
else
{
UserValueRange.BottomValue = valueRange.BottomValue;
}
if (SetMaxValue == true)
{
valueRange.TopValue = UserValueRange.TopValue;
}
else
{
UserValueRange.TopValue = valueRange.TopValue;
}
valueRanges = ValueRangeOperations.DivideValueRange(valueRange, RangeNumber);
valueColorRanges = ColorOperations.GetValueColorRanges(valueRange, valueRanges, _ColorMap);
}
private void SetCrossLine(object commandParameter)
{

View File

@@ -20,23 +20,23 @@
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<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>
<SolidColorBrush Color="{Binding Path=BottomColor}"/>
<SolidColorBrush Color="{Binding Path=ExactValues.BottomColor}"/>
</Rectangle.Fill>
</Rectangle>
<Rectangle Grid.Column="2" Margin="0,2,0,2">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
<GradientStop Color="{Binding Path=BottomColor}"/>
<GradientStop Color="{Binding Path=TopColor}" Offset="1"/>
<GradientStop Color="{Binding Path=ExactValues.BottomColor}"/>
<GradientStop Color="{Binding Path=ExactValues.TopColor}" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<TextBlock Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="#FF868686" Text="{Binding AverageValue}"/>
<Rectangle Grid.Column="3" Margin="0,2,0,2" ToolTip="{Binding Path=TopValue}">
<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=RoundedValues.TopValue}">
<Rectangle.Fill>
<SolidColorBrush Color="{Binding Path=TopColor}"/>
<SolidColorBrush Color="{Binding Path=ExactValues.TopColor}"/>
</Rectangle.Fill>
</Rectangle>
</Grid>

View File

@@ -6,7 +6,7 @@
xmlns:FieldViewerControl="clr-namespace:FieldVisualizer.Windows.UserControls"
xmlns:local="clr-namespace:FieldVisualizer.Windows"
mc:Ignorable="d"
Title="FieldViewer" Height="800" Width="1200" WindowStartupLocation="CenterOwner">
Title="FieldViewer" Height="800" Width="1200" MinHeight="400" MinWidth="800" MaxHeight="1000" MaxWidth="1500" WindowStartupLocation="CenterScreen" ShowInTaskbar="False">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/>

View File

@@ -19,6 +19,7 @@
<ResourceDictionary Source="Infrastructure/UI/Resources/IconDictionary.xaml"/>
<ResourceDictionary Source="Infrastructure/UI/Resources/GraphsTemplates.xaml"/>
<ResourceDictionary Source="Infrastructure/UI/Resources/LimitCurveTemplates.xaml"/>
<ResourceDictionary Source="Infrastructure/UI/Resources/ServiceColors.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

View File

@@ -10,6 +10,7 @@ namespace StructureHelper.Infrastructure.Enums
{
ForceCalculator,
LimitCurveCalculator,
CrackCalculator,
FireCalculator
}
}

View File

@@ -14,7 +14,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
internal class Area : UnitBase
{
public override UnitTypes UnitType { get => UnitTypes.Area; }
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "mm2"); }
public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "mm2"); }
public override string UnitName { get => "Area"; }
}
}

View File

@@ -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"; }
}
}

View File

@@ -11,7 +11,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
internal class Curvature : UnitBase
{
public override UnitTypes UnitType { get => UnitTypes.Curvature; }
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "1/mm"); }
public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "1/mm"); }
public override string UnitName { get => "Curvature"; }
}
}

View File

@@ -13,7 +13,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
internal class Force : UnitBase
{
public override UnitTypes UnitType { get => UnitTypes.Force; }
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "kN"); }
public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "kN"); }
public override string UnitName { get => "Force"; }
}
}

View File

@@ -5,8 +5,9 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{
internal class Length : UnitBase
{
public override UnitTypes UnitType { get => UnitTypes.Length; }
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "mm"); }
public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "mm"); }
public override string UnitName { get => "Length"; }
}
}

View File

@@ -11,7 +11,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
internal class Moment : UnitBase
{
public override UnitTypes UnitType { get => UnitTypes.Moment; }
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "kNm"); }
public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "kNm"); }
public override string UnitName { get => "Moment"; }
}
}

View File

@@ -12,6 +12,8 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{
internal class PlainDouble : IValueConverter
{
IConvertUnitLogic operationLogic = new ConvertUnitLogic();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
try
@@ -28,7 +30,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{
try
{
return CommonOperation.ConvertToDoubleChangeComma((string)value);
return ProcessString.ConvertCommaToCultureSettings((string)value);
}
catch (Exception)
{

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Services;
using StructureHelperCommon.Services.Units;
using System;
using System.Collections.Generic;
@@ -12,8 +13,19 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{
internal class Stress : UnitBase
{
public override UnitTypes UnitType { get => UnitTypes.Stress; }
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "MPa"); }
public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "MPa"); }
public override string UnitName { get => "Stress"; }
public Stress()
{
OperationLogic = new ConvertUnitLogic()
{
MathRoundLogic = new SmartRoundLogic()
{
DigitQuant = 3
}
};
}
}
}

View File

@@ -1,4 +1,7 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Parameters;
using StructureHelperCommon.Services;
using StructureHelperCommon.Services.Units;
using System;
using System.Collections.Generic;
@@ -14,19 +17,61 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{
internal abstract class UnitBase : IValueConverter
{
IMathRoundLogic roundLogic = new DirectRoundLogic();
public IConvertUnitLogic OperationLogic { get; set; } = new ConvertUnitLogic();
public IGetUnitLogic UnitLogic { get; set; } = new GetUnitLogic();
public abstract UnitTypes UnitType { get; }
public abstract IUnit CurrentUnit { get; }
public abstract string UnitName { get;}
/// <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)
{
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)
{
try
{
return CommonOperation.ConvertBack(UnitType, CurrentUnit, value);
double result = OperationLogic.ConvertBack(UnitType, CurrentUnit, value);
return result;
}
catch (Exception)
{

View File

@@ -1,8 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="Button" x:Key="ButtonBase">
</Style>
<Style TargetType="Button" x:Key="CommandButton" BasedOn="{StaticResource ButtonBase}">
<Style.Setters>
@@ -55,7 +55,7 @@
<Style TargetType="Image">
<Setter Property="Width" Value="32"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Margin" Value="-2"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Style.Triggers>
@@ -64,12 +64,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="Height" Value="32"/>
<Setter Property="Margin" Value="2,0,2,0"/>
<Setter Property="Background" Value="#FFA19BC3"/>
<Setter Property="BorderBrush" Value="#FF857AB9"/>
<Setter Property="BorderBrush" Value="Black"/>
</Style>
<Style x:Key="ButtonImage16" TargetType="Image">
@@ -81,12 +94,128 @@
<Setter Property="Width" Value="32"/>
</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">
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Style="{StaticResource CancelButton}" Command="{Binding CancelCommand}"/>
<Button Style="{StaticResource OkButton}" Command="{Binding OkCommand}"/>
</StackPanel>
</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>

View File

@@ -12,5 +12,6 @@
<convertersUnits:Moment x:Key="MomentConverter"/>
<convertersUnits:Stress x:Key="StressConverter"/>
<convertersUnits:Curvature x:Key="Curvature"/>
<convertersUnits:CrackWidth x:Key="CrackWidth"/>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
</ResourceDictionary>

View 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>

View File

@@ -23,7 +23,8 @@
</StackPanel>
<ListBox Grid.Column="2" ItemsSource="{Binding TargetItems}"
SelectedItem="{Binding SelectedTargetItem}"
ItemTemplate="{Binding ItemDataDemplate}">
ItemTemplate="{Binding ItemDataDemplate}"
>
<!--<InputBindingCollection>
<MouseBinding Gesture="LeftDoubleClick" Command="{Binding RemoveSelected}"/>
</InputBindingCollection>-->
@@ -41,8 +42,16 @@
<Button Content="Unselect All" Command="{Binding UnSelectAllCommand}"/>
<Button Content="Invert Selection" Command="{Binding InvertSelectionCommand}"/>
</StackPanel>
<ListBox Grid.Row="1" ItemsSource="{Binding CollectionItems}" SelectedItem="SelectedItem">
<ListBox.ItemTemplate>
<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>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
@@ -54,7 +63,8 @@
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ListBox>
</ScrollViewer>
</Grid>
</DataTemplate>
</ResourceDictionary>

View File

@@ -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>

View File

@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<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 />
</PropertyGroup>
</Project>

View 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; }
}
}

View File

@@ -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;
}
}
}

View File

@@ -8,13 +8,14 @@ using System.Threading.Tasks;
namespace StructureHelper.Services.ResultViewers
{
public class ResultFunc : IResultFunc
public class ForceResultFunc : IResultFunc<Func<IStrainMatrix, INdm, double>>
{
public string Name { get; set; }
public Func<IStrainMatrix, INdm, double> ResultFunction { get; set; }
public string UnitName { get; set; }
public double UnitFactor { get; set; }
public ResultFunc()
public ForceResultFunc()
{
UnitFactor = 1d;
}

View File

@@ -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;
}
}
}

View File

@@ -8,10 +8,11 @@ using System.Threading.Tasks;
namespace StructureHelper.Services.ResultViewers
{
public interface IResultFunc
public interface IResultFunc <T>
{
string Name { get; }
Func<IStrainMatrix, INdm, double> ResultFunction { get; }
T ResultFunction { get; }
string UnitName { get; set; }
double UnitFactor { get; }
}
}

View File

@@ -1,75 +0,0 @@
using LoaderCalculator.Logics;
using StructureHelper.Infrastructure.UI.Converters.Units;
using StructureHelperCommon.Infrastructures.Exceptions;
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 ResultFuncFactory
{
static readonly IStressLogic stressLogic = new StressLogic();
public static List<IResultFunc> GetResultFuncs(FuncsTypes funcsType = FuncsTypes.Full)
{
List<IResultFunc> results = new();
if (funcsType == FuncsTypes.Strain)
{
results.AddRange(GetStrainResultFuncs());
}
else if (funcsType == FuncsTypes.Stress)
{
results.AddRange(GetStressResultFuncs());
}
else if (funcsType == FuncsTypes.Forces)
{
results.AddRange(GetForcesResultFuncs());
}
else if (funcsType == FuncsTypes.Full)
{
results.AddRange(GetStrainResultFuncs());
results.AddRange(GetStressResultFuncs());
results.AddRange(GetForcesResultFuncs());
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(funcsType));
}
return results;
}
private static List<IResultFunc> GetStrainResultFuncs()
{
List<IResultFunc> resultFuncs = new List<IResultFunc>();
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 });
return resultFuncs;
}
private static List<IResultFunc> GetStressResultFuncs()
{
List<IResultFunc> resultFuncs = new List<IResultFunc>();
resultFuncs.Add(new ResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress, UnitFactor = UnitConstants.Stress });
resultFuncs.Add(new ResultFunc() { Name = "Secant modulus", ResultFunction = stressLogic.GetSecantModulus, UnitFactor = UnitConstants.Stress });
resultFuncs.Add(new ResultFunc() { Name = "Modulus degradation", ResultFunction = stressLogic.GetModulusDegradation });
return resultFuncs;
}
private static List<IResultFunc> GetForcesResultFuncs()
{
List<IResultFunc> resultFuncs = new List<IResultFunc>();
resultFuncs.Add(new ResultFunc() { Name = "Force", ResultFunction = stressLogic.GetForce, UnitFactor = UnitConstants.Force });
resultFuncs.Add(new ResultFunc() { Name = "Moment X", ResultFunction = stressLogic.GetMomentX, UnitFactor = UnitConstants.Force });
resultFuncs.Add(new ResultFunc() { Name = "Moment Y", ResultFunction = stressLogic.GetMomentY, UnitFactor = UnitConstants.Force });
return resultFuncs;
}
}
}

View File

@@ -4,6 +4,10 @@ using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.ResultData;
using LoaderCalculator.Logics;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Services;
using StructureHelperLogics.NdmCalculations.Cracking;
using StructureHelperLogics.NdmCalculations.Triangulations;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -14,13 +18,14 @@ namespace StructureHelper.Services.ResultViewers
{
public static class ShowIsoFieldResult
{
public static void ShowResult(IStrainMatrix strainMatrix, IEnumerable<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);
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>();
foreach (var valDelegate in resultFuncs)
@@ -29,23 +34,85 @@ namespace StructureHelper.Services.ResultViewers
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
foreach (INdm ndm in ndms)
{
double val = valDelegate.ResultFunction.Invoke(strainMatrix, ndm) * valDelegate.UnitFactor;
IValuePrimitive valuePrimitive;
if (ndm is IRectangleNdm)
{
var shapeNdm = ndm as IRectangleNdm;
valuePrimitive = new RectanglePrimitive() { CenterX = ndm.CenterX, CenterY = ndm.CenterY, Height = shapeNdm.Height, Width = shapeNdm.Width, Value = val };
}
else
{
valuePrimitive = new CirclePrimitive() { CenterX = ndm.CenterX, CenterY = ndm.CenterY, Diameter = Math.Sqrt(ndm.Area / Math.PI) * 2, Value = val };
}
primitives.Add(valuePrimitive);
primitives.Add(ProcessNdm(strainMatrix, valDelegate, ndm));
}
primitiveSet.ValuePrimitives = primitives;
primitiveSets.Add(primitiveSet);
}
return primitiveSets;
}
public static List<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
};
}
}
}

View File

@@ -12,6 +12,15 @@
<Compile Update="Windows\Arrays\ArrayView.xaml.cs">
<SubType>Code</SubType>
</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">
<SubType>Code</SubType>
</Compile>
@@ -68,6 +77,9 @@
</Compile>
</ItemGroup>
<ItemGroup>
<Page Update="Infrastructure\UI\Resources\Cracks.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Infrastructure\UI\Resources\ForceTemplates.xaml">
<SubType>Designer</SubType>
</Page>
@@ -83,9 +95,24 @@
<Page Update="Infrastructure\UI\Resources\Materials.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Infrastructure\UI\Resources\ServiceColors.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\Arrays\ArrayView.xaml">
<SubType>Designer</SubType>
</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">
<SubType>Designer</SubType>
</Page>

View File

@@ -21,7 +21,11 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
{
internal class CrackDiagramLogic : ILongProcessLogic
{
static IConvertUnitLogic operationLogic = new ConvertUnitLogic();
static IGetUnitLogic unitLogic = new GetUnitLogic();
static readonly CrackForceCalculator calculator = new();
private ITriangulatePrimitiveLogic triangulateLogic;
private List<IForcesTupleResult> ValidTupleList { get; set; }
ArrayParameter<double> arrayParameter;
private IEnumerable<IForcesTupleResult> TupleList { get; set; }
@@ -65,9 +69,9 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
arrayParameter = new ArrayParameter<double>(ValidTupleList.Count(), labels);
CalculateWithCrack(ValidTupleList,
NdmPrimitives,
CommonOperation.GetUnit(UnitTypes.Force),
CommonOperation.GetUnit(UnitTypes.Moment),
CommonOperation.GetUnit(UnitTypes.Curvature));
unitLogic.GetUnit(UnitTypes.Force),
unitLogic.GetUnit(UnitTypes.Moment),
unitLogic.GetUnit(UnitTypes.Curvature));
}
public void ShowWindow()
@@ -102,7 +106,14 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
calculator.EndTuple = validTupleList[i].DesignForceTuple.ForceTuple;
var limitState = validTupleList[i].DesignForceTuple.LimitState;
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.Run();
var result = (CrackForceResult)calculator.Result;
@@ -143,7 +154,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
const string crc = "Crc";
const string crcFactor = "CrcSofteningFactor";
var labels = LabelsFactory.GetCommonLabels();
IUnit unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature);
IUnit unitCurvature = unitLogic.GetUnit(UnitTypes.Curvature);
var crclabels = new List<string>
{
$"{crc}{GeometryNames.CurvFstName}, {unitCurvature.Name}",

View File

@@ -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>

View File

@@ -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();
}
}
}

View File

@@ -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());
}
}
}
}

View File

@@ -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>

View File

@@ -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))
{
}
}
}

View File

@@ -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;
}
}
}

View 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 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>

View File

@@ -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);
}
}

View File

@@ -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();
}
}
}
}

View File

@@ -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>

View File

@@ -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))
{
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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
};
}
}
}

View File

@@ -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();
}
}

View File

@@ -25,10 +25,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
const string ForceUnitString = "kN";
const string MomentUnitString = "kNm";
IConvertUnitLogic operationLogic;
//private List<ArrayParameter<double>> arrayParameters;
private IResult result;
private IUnit unitForce = CommonOperation.GetUnit(UnitTypes.Force, ForceUnitString);
private IUnit unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, MomentUnitString);
private IUnit unitForce;
private IUnit unitMoment;
private int stepCount;
private static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
@@ -48,7 +50,11 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
stepCount *= InputData.CalcTerms.Count();
stepCount *= InputData.PredicateEntries.Count();
//arrayParameters = new();
}
operationLogic = new ConvertUnitLogic();
IGetUnitLogic unitLogic = new GetUnitLogic();
unitForce = unitLogic.GetUnit(UnitTypes.Force, ForceUnitString);
unitMoment = unitLogic.GetUnit(UnitTypes.Moment, MomentUnitString);
}
private void DoCalculations()
{

View File

@@ -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();
}
}
}

View File

@@ -11,9 +11,11 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
{
public static class LabelsFactory
{
private static IUnit unitForce = CommonOperation.GetUnit(UnitTypes.Force);
private static IUnit unitMoment = CommonOperation.GetUnit(UnitTypes.Moment);
private static IUnit unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature);
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()
{

View File

@@ -18,6 +18,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
internal class ShowCrackResultLogic
{
private CrackForceCalculator calculator;
private ITriangulatePrimitiveLogic triangulateLogic;
public static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
public LimitStates LimitState { get; set; }
@@ -42,7 +43,13 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
calculator.TraceLogger = new ShiftTraceLogger();
calculator.StartTuple = startDesignTuple;
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();
var result = (CrackForceResult)calculator.Result;
if (result.IsValid)

View File

@@ -19,14 +19,14 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
internal void Show()
{
var inputData = new CrackWidthCalculatorInputData()
var inputData = new TupleCrackInputData()
{
LimitState = LimitState,
CalcTerm = CalcTerm,
ForceTuple = ForceTuple,
NdmPrimitives = ndmPrimitives
//LimitState = LimitState,
//CalcTerm = CalcTerm,
LongTermTuple = ForceTuple,
Primitives = ndmPrimitives
};
var calculator = new CrackWidthCalculator() { InputData = inputData };
var calculator = new TupleCrackCalculator() { InputData = inputData };
calculator.Run();
var result = calculator.Result;

View File

@@ -58,9 +58,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
{
validTupleList = tupleList.Where(x => x.IsValid == true).ToList();
var labels = LabelsFactory.GetCommonLabels();
arrayParameter = new ArrayParameter<double>(validTupleList.Count(), labels);
Calculate();
var factory = new DiagramFactory()
{
TupleList = validTupleList,
//SetProgress = SetProgress,
};
arrayParameter = factory.GetCommonArray();
}
public ShowDiagramLogic(IEnumerable<IForcesTupleResult> tupleList, IEnumerable<INdmPrimitive> ndmPrimitives)
@@ -69,37 +72,5 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
this.ndmPrimitives = ndmPrimitives;
validTupleList = tupleList.Where(x => x.IsValid == true).ToList();
}
private void Calculate()
{
var data = arrayParameter.Data;
for (int i = 0; i < validTupleList.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 = CommonOperation.GetUnit(UnitTypes.Force);
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment);
var unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature);
return new List<double>
{
validTupleList[i].DesignForceTuple.ForceTuple.Mx * unitMoment.Multiplyer,
validTupleList[i].DesignForceTuple.ForceTuple.My * unitMoment.Multiplyer,
validTupleList[i].DesignForceTuple.ForceTuple.Nz * unitForce.Multiplyer,
validTupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.Kx * unitCurvature.Multiplyer,
validTupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.Ky * unitCurvature.Multiplyer,
validTupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.EpsZ
};
}
}
}

View File

@@ -1,4 +1,5 @@
using StructureHelper.Windows.CalculationWindows.ProgressViews;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
@@ -11,7 +12,7 @@ using System.Windows.Forms;
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
{
internal class ShowProgressLogic
public class ShowProgressLogic
{
private ShowProgressViewModel progressViewModel;
private ShowProgressView wndProgress;
@@ -82,8 +83,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
}
catch (Exception ex)
{
throw;
throw new StructureHelperException(ex);
}
}
}

View File

@@ -1,11 +1,17 @@
using StructureHelper.Infrastructure.UI.DataContexts;
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;
@@ -17,45 +23,43 @@ 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
public class ShowValuePointDiagramLogic //: ILongProcessLogic
{
private ArrayParameter<double> arrayParameter;
private IEnumerable<IForcesTupleResult> tupleList;
private IEnumerable<INdmPrimitive> ndmPrimitives;
private List<IForcesTupleResult> validTupleList;
private List<(PrimitiveBase PrimitiveBase, List<NamedValue<IPoint2D>>)> valuePoints;
private List<IResultFunc> resultFuncList;
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 int StepCount => throw new NotImplementedException();
public Action<int> SetProgress { get; set; }
public bool Result { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public ShowValuePointDiagramLogic(IEnumerable<IForcesTupleResult> tupleList, IEnumerable<INdmPrimitive> ndmPrimitives)
//public Action<int> SetProgress { get; set; }
//public bool Result { get; set; }
//public IShiftTraceLogger? TraceLogger { get; set; }
public ShowValuePointDiagramLogic(IValuePointDiagramLogic pointDiagramLogic)
{
this.tupleList = tupleList;
this.ndmPrimitives = ndmPrimitives;
validTupleList = this.tupleList.Where(x => x.IsValid == true).ToList();
valuePoints = new List<(PrimitiveBase PrimitiveBase, List<NamedValue<IPoint2D>>)>();
foreach (var item in PrimitiveLogic.Collection.CollectionItems)
{
var pointsCount = item.Item.ValuePoints.SelectedCount;
if (pointsCount > 0)
{
var points = item.Item.ValuePoints.SelectedItems.ToList();
var primitive = item.Item.PrimitiveBase;
valuePoints.Add((primitive, points));
}
}
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)
@@ -71,32 +75,14 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
}, ErrorStrings.ErrorDuring("building chart"));
}
public void WorkerDoWork(object sender, DoWorkEventArgs e)
private GenericResult<ArrayParameter<double>> GetResult()
{
Show();
Result = true;
}
public void WorkerProgressChanged(object sender, ProgressChangedEventArgs e)
{
//Nothing to do
}
public void WorkerRunWorkCompleted(object sender, RunWorkerCompletedEventArgs e)
{
//Nothing to do
}
private void Show()
{
}
private List<string> GetColumnNames()
{
var columnNames = LabelsFactory.GetCommonLabels();
return columnNames;
pointDiagramLogic.TupleList = TupleList;
pointDiagramLogic.PrimitiveLogic = PrimitiveLogic;
pointDiagramLogic.Calculator = Calculator;
pointDiagramLogic.ValueDelegatesLogic = ValueDelegatesLogic;
var results = pointDiagramLogic.GetArrayParameter();
return results;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
d:DataContext="{d:DesignInstance local:ForcesResultsViewModel}"
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>
<ToolBarTray DockPanel.Dock="Top">
<ToolBar>
@@ -25,7 +25,11 @@
<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>
</ToolBar>
</ToolBarTray>
<Grid>
@@ -59,13 +63,11 @@
</DataGrid.Columns>
</DataGrid>
<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="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="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="Acrc" ToolTip="Show crack width" Command="{Binding ShowCrackWidthResultCommand}"/>
</StackPanel>
</Grid>
</DockPanel>

View File

@@ -43,7 +43,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
private ShowProgressLogic showProgressLogic;
private InteractionDiagramLogic interactionDiagramLogic;
private static readonly ShowCrackResultLogic showCrackResultLogic = new();
private static readonly ShowCrackWidthLogic showCrackWidthLogic = new();
//private static readonly ShowCrackWidthLogic showCrackWidthLogic = new();
private IForcesResults forcesResults;
private IEnumerable<INdmPrimitive> ndmPrimitives;
private IEnumerable<INdmPrimitive> selectedNdmPrimitives;
@@ -152,12 +152,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
{
get => showGraphsCommand ??= new RelayCommand(o =>
{
InterpolateTuplesViewModel interploateTuplesViewModel;
InterpolateTuplesViewModel interpolateTuplesViewModel;
InterpolateTuplesView wndTuples;
ShowInterpolationWindow(out interploateTuplesViewModel, out wndTuples);
ShowInterpolationWindow(out interpolateTuplesViewModel, out wndTuples);
if (wndTuples.DialogResult != true) return;
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.ForceInterpolationViewModel.Result);
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interpolateTuplesViewModel.ForceInterpolationViewModel.Result);
showProgressLogic = new(interpolationLogic)
{
WindowTitle = "Interpolate forces"
@@ -225,22 +225,22 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
showCrackResultLogic.Show(SelectedResult.DesignForceTuple.Clone() as IDesignForceTuple);
}
public ICommand ShowCrackWidthResultCommand
{
get => showCrackWidthResult ??= new RelayCommand(o =>
{
SafetyProcessor.RunSafeProcess(ShowCrackWidthResult);
}, o => SelectedResult != null && SelectedResult.IsValid);
}
//public ICommand ShowCrackWidthResultCommand
//{
// get => showCrackWidthResult ??= new RelayCommand(o =>
// {
// SafetyProcessor.RunSafeProcess(ShowCrackWidthResult);
// }, o => SelectedResult != null && SelectedResult.IsValid);
//}
private void ShowCrackWidthResult()
{
showCrackWidthLogic.LimitState = SelectedResult.DesignForceTuple.LimitState;
showCrackWidthLogic.CalcTerm = SelectedResult.DesignForceTuple.CalcTerm;
showCrackWidthLogic.ForceTuple = SelectedResult.DesignForceTuple.ForceTuple;
showCrackWidthLogic.ndmPrimitives = ndmPrimitives.ToList();
showCrackWidthLogic.Show();
}
//private void ShowCrackWidthResult()
//{
// showCrackWidthLogic.LimitState = SelectedResult.DesignForceTuple.LimitState;
// showCrackWidthLogic.CalcTerm = SelectedResult.DesignForceTuple.CalcTerm;
// showCrackWidthLogic.ForceTuple = SelectedResult.DesignForceTuple.ForceTuple;
// showCrackWidthLogic.ndmPrimitives = ndmPrimitives.ToList();
// showCrackWidthLogic.Show();
//}
public ICommand InterpolateCommand
{
get
@@ -285,31 +285,15 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
{
throw new StructureHelperException(ErrorStrings.NullReference + ": Nothing is selected");
}
var tuple = SelectedResult.DesignForceTuple ?? throw new StructureHelperException(ErrorStrings.NullReference + ": Design force combination");
var inputData = new ValuePointsInterpolationInputData()
var logic = new InterpolateValuePointsLogic()
{
FinishDesignForce = tuple.Clone() as IDesignForceTuple,
LimitState = tuple.LimitState,
CalcTerm = tuple.CalcTerm,
SelectedResult = SelectedResult,
ForceCalculator = forceCalculator,
NdmPrimitives = ndmPrimitives,
ProgressLogic = progressLogic,
ShowProgressLogic = showProgressLogic
};
inputData.PrimitiveBases.AddRange(PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(ndmPrimitives));
var viewModel = new ValuePointsInterpolateViewModel(inputData);
var wnd = new ValuePointsInterpolateView(viewModel);
wnd.ShowDialog();
if (wnd.DialogResult != true) { return; }
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, viewModel.ForceInterpolationViewModel.Result);
ShowValuePointDiagramLogic pointGraphLogic = new(ForcesResults.ForcesResultList, ndmPrimitives)
{
Calculator = interpolationLogic.InterpolateCalculator,
PrimitiveLogic = viewModel.PrimitiveLogic,
ValueDelegatesLogic = viewModel.ValueDelegatesLogic
};
progressLogic = interpolationLogic;
showProgressLogic = new(interpolationLogic)
{
ShowResult = pointGraphLogic.ShowWindow
};
showProgressLogic.Show();
logic.InterpolateValuePoints();
}
private void ShowInterpolationWindow(out InterpolateTuplesViewModel interploateTuplesViewModel, out InterpolateTuplesView wndTuples)
@@ -432,7 +416,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
try
{
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.Show();
}
@@ -445,7 +429,6 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
};
new ErrorMessage(vm).ShowDialog();
}
}
private void GetNdms()
{

View File

@@ -21,7 +21,8 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
{
const string ForceUnitString = "kN";
const string MomentUnitString = "kNm";
static IConvertUnitLogic operationLogic = new ConvertUnitLogic();
static IGetUnitLogic unitLogic = new GetUnitLogic();
public SurroundData SurroundData
{
get => surroundData; set
@@ -47,8 +48,8 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
OnPropertyChanged(nameof(ZUnitLabel));
}
private static readonly IUnit unitForce = CommonOperation.GetUnit(UnitTypes.Force, ForceUnitString);
private static readonly IUnit unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, MomentUnitString);
private static IUnit unitForce = unitLogic.GetUnit(UnitTypes.Force, ForceUnitString);
private static IUnit unitMoment = unitLogic.GetUnit(UnitTypes.Moment, MomentUnitString);
private SurroundData surroundData;
public IValueConverter ForceConverter { get => new Force(); }

View File

@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.ProgressViews"
d:DataContext="{d:DesignInstance local:TraceDocumentVM}"
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.ColumnDefinitions>
<ColumnDefinition Width="*"/>

View File

@@ -2,6 +2,7 @@
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;
@@ -13,13 +14,13 @@ namespace StructureHelper.Windows.Forces
public class PrimitiveValuePoints
{
public PrimitiveBase PrimitiveBase {get;set;}
public SelectItemsVM<NamedValue<IPoint2D>> ValuePoints { get; set; }
public SelectItemsVM<INamedAreaPoint> ValuePoints { get; set; }
public PrimitiveValuePoints(PrimitiveBase primitiveBase)
{
var ndmPrimitive = primitiveBase.GetNdmPrimitive();
var pointCollection = ndmPrimitive.GetValuePoints();
ValuePoints = new SelectItemsVM<NamedValue<IPoint2D>>(pointCollection)
ValuePoints = new SelectItemsVM<INamedAreaPoint>(pointCollection)
{
ShowButtons = false
};

View File

@@ -11,14 +11,13 @@ namespace StructureHelper.Windows.Forces
{
public class ValueDelegatesLogic : ViewModelBase
{
private readonly List<IResultFunc> resultFuncs;
public SelectItemsVM<IResultFunc> ResultFuncs { get; }
private readonly List<ForceResultFunc> resultFuncs;
public SelectItemsVM<ForceResultFunc> ResultFuncs { get; }
public ValueDelegatesLogic()
{
resultFuncs = new List<IResultFunc>();
resultFuncs.AddRange(ResultFuncFactory.GetResultFuncs(FuncsTypes.Strain));
resultFuncs.AddRange(ResultFuncFactory.GetResultFuncs(FuncsTypes.Stress));
ResultFuncs = new SelectItemsVM<IResultFunc>(resultFuncs)
resultFuncs = new List<ForceResultFunc>();
resultFuncs.AddRange(ForceResultFuncFactory.GetResultFuncs(FuncsTypes.Full));
ResultFuncs = new SelectItemsVM<ForceResultFunc>(resultFuncs)
{
ShowButtons = true
};

View File

@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:StructureHelper.Windows.Forces"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:ValuePointsInterpolateViewModel}"
Title="Value Poits Interpolation" Height="250" Width="460" MinHeight="250" MinWidth="460" MaxHeight="450" MaxWidth="460" WindowStartupLocation="CenterScreen">
Title="Value Points Interpolation" Height="250" Width="460" MinHeight="250" MinWidth="460" MaxHeight="450" MaxWidth="460" WindowStartupLocation="CenterScreen">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
@@ -24,7 +24,7 @@
<Expander.Header>
<ContentControl ContentTemplate="{StaticResource ResourceKey=ColoredItemTemplate}" Content="{Binding Item.PrimitiveBase}"/>
</Expander.Header>
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding Item.ValuePoints}"/>
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding Item.ValuePoints}" Width="400"/>
</Expander>
</DataTemplate>
</ListBox.ItemTemplate>

View File

@@ -1,16 +1,4 @@
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;
using System.Windows;
namespace StructureHelper.Windows.Forces
{
@@ -22,10 +10,11 @@ namespace StructureHelper.Windows.Forces
private ValuePointsInterpolateViewModel viewModel;
public ValuePointsInterpolateView(ValuePointsInterpolateViewModel viewModel)
{
InitializeComponent();
this.viewModel = viewModel;
this.viewModel.ParentWindow = this;
this.DataContext = this.viewModel;
InitializeComponent();
InterpolationControl.Properties = viewModel.ForceInterpolationViewModel;
}
}
}

View File

@@ -1,4 +1,5 @@
using StructureHelper.Windows.ViewModels;
using StructureHelper.Windows.ViewModels.Materials;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;

View File

@@ -18,8 +18,9 @@
</ToolBarTray>-->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250"/>
<ColumnDefinition/>
<ColumnDefinition MinWidth="250"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
@@ -31,7 +32,7 @@
<ListBox.ItemTemplate>
<DataTemplate>
<Expander Header="{Binding Name}" IsExpanded="True" Background="{Binding Color}">
<Grid >
<Grid HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="70"/>
<RowDefinition/>
@@ -81,7 +82,8 @@
<Button Margin="3" Content="Draw Lines" ToolTip="Draw Lines" Command="{Binding RedrawLinesCommand}"/>
</StackPanel>
</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:Axis Title="y-value"></lvc:Axis>
</lvc:CartesianChart.AxisY>

View File

@@ -1,4 +1,5 @@
using LoaderCalculator;
using LoaderCalculator.Data.Materials.MaterialBuilders;
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.ResultData;
@@ -9,6 +10,7 @@ using StructureHelper.Services.Primitives;
using StructureHelper.UnitSystem;
using StructureHelper.UnitSystem.Systems;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models;
using StructureHelperCommon.Services.Units;
using StructureHelperLogics.Models.Calculations.CalculationProperties;
using StructureHelperLogics.Models.CrossSections;
@@ -26,6 +28,8 @@ namespace StructureHelper.Windows.MainWindow
{
public class CrossSectionModel
{
private ITriangulatePrimitiveLogic triangulateLogic;
public ICrossSection Section { get; private set; }
private IPrimitiveRepository primitiveRepository;
public IHeadMaterialRepository HeadMaterialRepository { get; }
@@ -52,7 +56,13 @@ namespace StructureHelper.Windows.MainWindow
public IEnumerable<INdm> GetNdms(ICalculationProperty calculationProperty)
{
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 };

View File

@@ -79,7 +79,9 @@
<ContextMenu x:Key="AnalisesCRUD">
<MenuItem Header="Run" Command="{Binding Run}">
<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>
<Separator/>
@@ -143,67 +145,79 @@
Content="Fact" ToolTip="Add Factored Combination"/>
</ToolBar>
<ToolBar DataContext="{Binding MaterialsLogic}" ToolTip="Materials">
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Concrete}">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/ConMaterial32.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Concrete}">
<Image Source="/Windows/MainWindow/ConMaterial32.png"/>
</Button>
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Reinforcement}" ToolTip="Add Reinforcement Material">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/RFMaterial32.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Reinforcement}" ToolTip="Add Reinforcement Material">
<Image Source="/Windows/MainWindow/RFMaterial32.png"/>
</Button>
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Elastic}" ToolTip="Add Elastic Material">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/ElasticMaterial32.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Elastic}" ToolTip="Add Elastic Material">
<Image Source="/Windows/MainWindow/ElasticMaterial32.png"/>
</Button>
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.CarbonFiber}" ToolTip="Add Carbon Fiber Material">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/СarbonMaterial32.png"/>
</Button>
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.GlassFiber}" ToolTip="Add Glass Fiber Material">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/GlassMaterial32.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.GlassFiber}" ToolTip="Add Glass Fiber Material">
<Image Source="/Windows/MainWindow/GlassMaterial32.png"/>
</Button>
<Button Command="{Binding EditMaterialsCommand}" ToolTip="Show Materials">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Materials32.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding EditMaterialsCommand}" ToolTip="Show Materials">
<Image Source="/Windows/MainWindow/Materials32.png"/>
</Button>
</ToolBar>
<ToolBar ToolTip="Base Primitives" DataContext="{Binding PrimitiveLogic}">
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}" ToolTip="Add Rectangle Primitive">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Rectangle32.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}" ToolTip="Add Rectangle Primitive">
<Image Source="/Windows/MainWindow/Rectangle32.png"/>
</Button>
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}" ToolTip="Add Circle Primitive">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Circle32.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}" ToolTip="Add Circle Primitive">
<Image Source="/Windows/MainWindow/Circle32.png"/>
</Button>
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}" ToolTip="Add Rebar Primitive">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Rebar32.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}" ToolTip="Add Rebar Primitive">
<Image Source="/Windows/MainWindow/Rebar32.png"/>
</Button>
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}" ToolTip="Add Point Primitive">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Point32.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}" ToolTip="Add Point Primitive">
<Image Source="/Windows/MainWindow/Point32.png"/>
</Button>
</ToolBar>
<ToolBar ToolTip="RC Templates">
<Button Command="{Binding AddColumnCase}" ToolTip="Add Rectangle RC Column">
<Image Width="32" Height="32" Source="/Windows/MainWindow/RectangleColumn32.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding AddColumnCase}" ToolTip="Add Rectangle RC Column">
<Image Source="/Windows/MainWindow/RectangleColumn32.png"/>
</Button>
<Button Command="{Binding AddRCCircleCase}" ToolTip="Add Circle RC Column">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/CircleColumn32.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding AddRCCircleCase}" ToolTip="Add Circle RC Column">
<Image Source="/Windows/MainWindow/CircleColumn32.png"/>
</Button>
<Button Command="{Binding AddBeamCase}" ToolTip="Add RC Beam">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Beam32.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding AddBeamCase}" ToolTip="Add RC Beam">
<Image Source="/Windows/MainWindow/Beam32.png"/>
</Button>
<Button Command="{Binding AddSlabCase}" ToolTip="Add RC Slab">
<Image Width="32" Height="32" Source="/Windows/MainWindow/Slab32.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding AddSlabCase}" ToolTip="Add RC Slab">
<Image Source="/Windows/MainWindow/Slab32.png"/>
</Button>
</ToolBar>
<ToolBar ToolTip="Analises" DataContext="{Binding CalculatorsLogic}">
<Button Command="{Binding Add}" ToolTip="Add Force Calculator">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Calculator32.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:CalculatorTypes.ForceCalculator}" ToolTip="Add Force Calculator">
<Image Source="/Windows/MainWindow/Calculator32.png"/>
</Button>
<Button Command="{Binding Run}" ToolTip="Run Calculations">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/Analysis32.png"/>
<Button Style="{DynamicResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:CalculatorTypes.LimitCurveCalculator}" ToolTip="Add Interaction Diagram Calculator">
<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>
</ToolBar>
<ToolBar ToolTip="Tools">
<Button Command="{Binding MovePrimitiveToGravityCenterCommand}" ToolTip="Move All Primitives to Gravity Center">
<Image Width="32" Height="32" Source="/Windows/MainWindow/MovePrimitivesToCenter.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding MovePrimitiveToGravityCenterCommand}" ToolTip="Move All Primitives to Gravity Center">
<Image Source="/Windows/MainWindow/MovePrimitivesToCenter.png"/>
</Button>
<Button Command="{Binding ShowVisualProperty}" ToolTip="Visual Settings">
<Image Width="32" Height="32" Source="/Windows/MainWindow/Tools_Settings.png"/>
<Button Style="{StaticResource ToolButton}" Command="{Binding ShowVisualProperty}" ToolTip="Visual Settings">
<Image Source="/Windows/MainWindow/Tools_Settings.png"/>
</Button>
</ToolBar>
</ToolBarTray>
@@ -338,7 +352,16 @@
</MenuItem>
<MenuItem Header="Add Interaction Diagram Calculator" Command="{Binding Add}" CommandParameter="{x:Static enums:CalculatorTypes.LimitCurveCalculator}">
<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>
</MenuItem>

View File

@@ -29,6 +29,8 @@ namespace StructureHelper.Windows.MainWindow
{
private ICrossSection section;
private ICrossSectionRepository repository => section.SectionRepository;
private ITriangulatePrimitiveLogic triangulateLogic;
public CrossSectionVisualPropertyVM VisualProperty { get; private set; }
@@ -172,7 +174,13 @@ namespace StructureHelper.Windows.MainWindow
MovePrimitiveToGravityCenterCommand = new RelayCommand(o =>
{
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);
foreach (var item in PrimitiveLogic.Items)
{

View File

@@ -25,6 +25,7 @@ namespace StructureHelper.Windows.UserControls
/// </summary>
public partial class MultiplyDouble : UserControl
{
IConvertUnitLogic operationLogic = new ConvertUnitLogic();
public event EventHandler ValueChanged;
public MultiplyDouble()
@@ -40,7 +41,7 @@ namespace StructureHelper.Windows.UserControls
try
{
string s = (string)o;
double factor = CommonOperation.ConvertToDoubleChangeComma(s);
double factor = ProcessString.ConvertCommaToCultureSettings(s);
ChangeValue(factor);
}
catch(Exception ex)

View File

@@ -55,7 +55,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.CalculationResult
private void ShowIsoField()
{
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.Show();
}

View File

@@ -1,18 +1,13 @@
using StructureHelper.Infrastructure.Enums;
using StructureHelper.Models.Materials;
using StructureHelper.Services.Settings;
using StructureHelper.Windows.Forces;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StructureHelperLogics.NdmCalculations.Cracking;
using System.Windows.Forms;
namespace StructureHelper.Windows.ViewModels.Forces
@@ -98,24 +93,40 @@ namespace StructureHelper.Windows.ViewModels.Forces
{
bool result = true;
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 containSelected = forceCalculator.ForceActions.Contains(SelectedItem);
if (containSelected)
{
var dialogResultCalc = MessageBox.Show($"Action is contained in calculator {item.Name}", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (dialogResultCalc == DialogResult.Yes)
{
forceCalculator.ForceActions.Remove(SelectedItem);
}
else result = false;
}
var forceCombinations = calc as IHasForceCombinations;
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)
{
var dialogResultCalc = MessageBox.Show($"Action is contained in calculator {item.Name}", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (dialogResultCalc == DialogResult.Yes)
{
forceCombinations.ForceActions.Remove(SelectedItem);
}
else result = false;
}
return result;
}
}
}

View File

@@ -1,7 +1,10 @@
using StructureHelper.Infrastructure;
using LoaderCalculator;
using StructureHelper.Infrastructure;
using StructureHelper.Infrastructure.Enums;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
using StructureHelper.Windows.CalculationWindows.ProgressViews;
using StructureHelper.Windows.Errors;
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
using StructureHelper.Windows.ViewModels.Errors;
using StructureHelperCommon.Infrastructures.Exceptions;
@@ -10,6 +13,8 @@ using StructureHelperCommon.Models.Calculators;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Analyses.Logics;
using StructureHelperLogics.NdmCalculations.Cracking;
using System;
using System.Windows;
using System.Windows.Forms;
using MessageBox = System.Windows.Forms.MessageBox;
@@ -25,32 +30,79 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
private InteractionDiagramLogic interactionDiagramLogic;
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;
if (parameterType == CalculatorTypes.ForceCalculator)
{
NewItem = new ForceCalculator()
{
Name = "New force calculator",
TraceLogger = new ShiftTraceLogger(),
};
AddForceCalculator();
}
else if (parameterType == CalculatorTypes.LimitCurveCalculator)
{
var inputData = new LimitCurveInputData(repository.Primitives);
NewItem = new LimitCurvesCalculator()
{
Name = "New interaction diagram calculator",
InputData = inputData,
TraceLogger = new ShiftTraceLogger(),
};
AddLimitCurveCalculator();
}
else if (parameterType == CalculatorTypes.CrackCalculator)
{
AddCrackCalculator();
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(parameterType));
}
base.AddMethod(parameter);
}
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);
NewItem = new LimitCurvesCalculator()
{
Name = "New interaction diagram calculator",
InputData = inputData,
TraceLogger = new ShiftTraceLogger(),
};
}
private void AddForceCalculator()
{
NewItem = new ForceCalculator()
{
Name = "New force calculator",
TraceLogger = new ShiftTraceLogger(),
};
}
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)
{
SafetyProcessor.RunSafeProcess(EditCalculator, $"Error of editing: {SelectedItem.Name}");
@@ -59,20 +111,18 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
private void EditCalculator()
{
if (SelectedItem is ForceCalculator)
{
var calculator = SelectedItem as ForceCalculator;
EditForceCalculator(calculator);
}
else if (SelectedItem is LimitCurvesCalculator)
{
var calculator = SelectedItem as LimitCurvesCalculator;
EditLimitCurveCalculator(calculator);
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(SelectedItem));
}
if (SelectedItem is ForceCalculator forceCalculator) { EditForceCalculator(forceCalculator);}
else if (SelectedItem is LimitCurvesCalculator limitCurvesCalculator) { EditLimitCurveCalculator(limitCurvesCalculator); }
else if (SelectedItem is CrackCalculator crackCalculator) { EditCrackCalculator(crackCalculator);}
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(SelectedItem));}
}
private void EditCrackCalculator(CrackCalculator calculator)
{
var calculatorCopy = calculator.Clone() as CrackCalculator;
var vm = new CrackCalculatorInputDataViewModel(repository.Primitives, repository.ForceActions, calculator);
var wnd = new CrackCalculatorInputDataView(vm);
ShowWindow(calculator, calculatorCopy, wnd);
}
private void EditLimitCurveCalculator(LimitCurvesCalculator calculator)
@@ -134,7 +184,6 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
}
if (SelectedItem is LimitCurvesCalculator calculator)
{
var inputData = calculator.InputData;
ShowInteractionDiagramByInputData(calculator);
}
else
@@ -143,13 +192,20 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
var result = SelectedItem.Result;
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;
}
else
{
ProcessResult();
}
}
if (SelectedItem.TraceLogger is not null)
{
var wnd = new TraceDocumentView(SelectedItem.TraceLogger.TraceLoggerEntries);
@@ -171,13 +227,17 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
private void ProcessResult()
{
if (SelectedItem is IForceCalculator)
if (SelectedItem is ForceCalculator forceCalculator)
{
var calculator = SelectedItem as ForceCalculator;
var vm = new ForcesResultsViewModel(calculator);
var vm = new ForcesResultsViewModel(forceCalculator);
var wnd = new ForceResultsView(vm);
wnd.ShowDialog();
}
else if (SelectedItem is CrackCalculator crackCalculator)
{
var wnd = new CrackResultView(crackCalculator.Result as CrackResult);
wnd.ShowDialog();
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(SelectedItem));

View File

@@ -7,6 +7,8 @@ using StructureHelper.Windows.PrimitiveTemplates.RCs.Beams;
using StructureHelper.Windows.PrimitiveTemplates.RCs.RectangleBeam;
using StructureHelper.Windows.Services;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.CrossSections;
@@ -14,6 +16,7 @@ using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
using StructureHelperLogics.Models.Templates.RCs;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Cracking;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
@@ -135,9 +138,24 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
{
if (calc is IForceCalculator)
{
var forceCalc = calc as IForceCalculator;
var forceCalc = calc as IHasPrimitives;
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)
{

View File

@@ -7,5 +7,9 @@ namespace StructureHelperCommon.Infrastructures.Exceptions
public StructureHelperException(string errorString) : base(errorString)
{
}
public StructureHelperException(Exception ex) : this(ex.Message)
{
}
}
}

View File

@@ -0,0 +1,14 @@
using StructureHelperCommon.Models.Calculators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Infrastructures.Interfaces
{
public interface ICheckInputDataLogic : ICheckLogic
{
IInputData InputData { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Infrastructures.Interfaces
{
public interface ICheckLogic : ILogic
{
string CheckResult { get; }
bool Check();
}
}

View File

@@ -5,6 +5,9 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
{
public interface IHasForceCombinations
{
/// <summary>
/// Collection of force actions
/// </summary>
List<IForceAction> ForceActions { get; }
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Calculators
{
public class GenericResult<T> : IResult
{
public bool IsValid { get; set; }
public string? Description { get; set; }
public T? Value { get; set; }
}
}

View File

@@ -10,6 +10,7 @@ namespace StructureHelperCommon.Models.Loggers
{
public static string DimensionLess => "(dimensionless)";
public static string MethodBasedOn => "Method of calculation based on ";
public static string CalculationError => "Some errors happened during calculations: ";
public static string CalculationHasDone => "Calculation has done succesfully";
public static string Summary => "Summary";
public static string Maximum => "Maximum";

View File

@@ -33,8 +33,16 @@ namespace StructureHelperCommon.Models.Materials
{
GetLoaderOptions();
IBuilderDirector director = GetMaterialDirector();
var material = director.BuildMaterial();
return material;
try
{
var material = director.BuildMaterial();
return material;
}
catch (System.Exception)
{
throw;
}
}
private IBuilderDirector GetMaterialDirector()

View File

@@ -16,7 +16,7 @@ namespace StructureHelperCommon.Models.Materials
{
private ConcreteLogicOptions options;
private MaterialCommonOptionLogic optionLogic;
private FactorLogic factorLogic;
public ConcreteMaterialOptionLogic(ConcreteLogicOptions options)
{
@@ -32,10 +32,6 @@ namespace StructureHelperCommon.Models.Materials
var concreteOptions = materialOptions as ConcreteOptions;
optionLogic = new MaterialCommonOptionLogic(options);
optionLogic.SetMaterialOptions(concreteOptions);
factorLogic = new FactorLogic(options.SafetyFactors);
var strength = factorLogic.GetTotalFactor(options.LimitState, options.CalcTerm);
concreteOptions.ExternalFactor.Compressive = strength.Compressive;
concreteOptions.ExternalFactor.Tensile = strength.Tensile;
concreteOptions.WorkInTension = options.WorkInTension;
concreteOptions.RelativeHumidity = options.RelativeHumidity;
concreteOptions.Age = options.Age;

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Materials
{
public interface ICrackedMaterial
{
bool TensionForULS { get; set; }
bool TensionForSLS { get; set; }
}
}

View File

@@ -240,7 +240,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
Code = code,
Name = "A400",
InitModulus = 2e11d,
MainStrength = 400e6d
MainStrength = 390e6d
},
new ReinforcementMaterialEntity(new Guid("045b54b1-0bbf-41fd-a27d-aeb20f600bb4"))
{

View File

@@ -1,12 +1,16 @@
using StructureHelperCommon.Infrastructures.Enums;
using LoaderCalculator.Data.Materials.MaterialBuilders;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Materials.Libraries;
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
using SHEnums = StructureHelperCommon.Infrastructures.Enums;
namespace StructureHelperCommon.Models.Materials
{
public class MaterialCommonOptionLogic : IMaterialOptionLogic
{
private IMaterialLogicOptions options;
private FactorLogic factorLogic;
public MaterialCommonOptionLogic(IMaterialLogicOptions options)
{
@@ -17,6 +21,58 @@ namespace StructureHelperCommon.Models.Materials
{
materialOptions.InitModulus = options.MaterialEntity.InitModulus;
materialOptions.Strength = options.MaterialEntity.MainStrength;
ProcessCodeType(materialOptions);
ProcessLimitState(materialOptions);
ProcessCalcTerm(materialOptions);
ProcessExternalFactors(materialOptions);
}
private void ProcessExternalFactors(IMaterialOptions materialOptions)
{
factorLogic = new FactorLogic(options.SafetyFactors);
var strength = factorLogic.GetTotalFactor(options.LimitState, options.CalcTerm);
materialOptions.ExternalFactor.Compressive = strength.Compressive;
materialOptions.ExternalFactor.Tensile = strength.Tensile;
}
private void ProcessCalcTerm(IMaterialOptions materialOptions)
{
if (options.CalcTerm == CalcTerms.ShortTerm)
{
materialOptions.IsShortTerm = true;
}
else if (options.CalcTerm == CalcTerms.LongTerm)
{
materialOptions.IsShortTerm = false;
}
else
{
throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid);
}
}
private void ProcessLimitState(IMaterialOptions materialOptions)
{
if (options.LimitState == SHEnums.LimitStates.ULS)
{
materialOptions.LimitState = LCMB.LimitStates.Collapse;
}
else if (options.LimitState == SHEnums.LimitStates.SLS)
{
materialOptions.LimitState = LCMB.LimitStates.ServiceAbility;
}
else if (options.LimitState == SHEnums.LimitStates.Special)
{
materialOptions.LimitState = LCMB.LimitStates.Special;
}
else
{
throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid);
}
}
private void ProcessCodeType(IMaterialOptions materialOptions)
{
if (options.MaterialEntity.CodeType == CodeTypes.EuroCode_2_1990)
{
materialOptions.CodesType = LCMB.CodesType.EC2_1990;
@@ -25,23 +81,10 @@ namespace StructureHelperCommon.Models.Materials
{
materialOptions.CodesType = LCMB.CodesType.SP63_2018;
}
else { throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {materialOptions.CodesType}"); }
if (options.LimitState == LimitStates.ULS)
else
{
materialOptions.LimitState = LCMB.LimitStates.Collapse;
throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {materialOptions.CodesType}");
}
else if (options.LimitState == LimitStates.SLS)
{
materialOptions.LimitState = LCMB.LimitStates.ServiceAbility;
}
else if (options.LimitState == LimitStates.Special)
{
materialOptions.LimitState = LCMB.LimitStates.Special;
}
else { throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid); }
if (options.CalcTerm == CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }
else if (options.CalcTerm == CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; }
else { throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid); }
}
}
}

View File

@@ -30,8 +30,17 @@ namespace StructureHelperCommon.Models.Materials
{
GetLoaderOptions();
IBuilderDirector director = GetMaterialDirector();
var material = director.BuildMaterial();
return material;
try
{
var material = director.BuildMaterial();
return material;
}
catch (System.Exception)
{
throw;
}
}
private IBuilderDirector GetMaterialDirector()
@@ -43,7 +52,10 @@ namespace StructureHelperCommon.Models.Materials
private void GetLoaderOptions()
{
materialOptions = new ReinforcementOptions() { DiagramType = DiagramType};
materialOptions = new ReinforcementOptions()
{
DiagramType = DiagramType,
};
optionLogic = new MaterialCommonOptionLogic(options);
optionLogic.SetMaterialOptions(materialOptions);
}

View File

@@ -43,5 +43,62 @@ namespace StructureHelperCommon.Models.Parameters
}
}
public ArrayParameter(int rowCount, List<string> columnLabels) : this(rowCount, columnLabels.Count, columnLabels) { }
public void AddArray(IArrayParameter<T> array)
{
var rowCount = array.Data.GetLength(0);
int existingRowCount = this.Data.GetLength(0);
if (rowCount != existingRowCount)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": number of rows in new array {rowCount} is not equal existing row count {existingRowCount}");
}
var existingColumnCount = this.Data.GetLength(1);
var newColumnCount = array.Data.GetLength(1);
var totalCount = existingColumnCount + newColumnCount;
var newData = new T[rowCount, totalCount];
var lackColumns = existingColumnCount - ColumnLabels.Count;
if (lackColumns > 0)
{
for (int i = 0; i < lackColumns; i++)
{
ColumnLabels.Add(string.Empty);
}
}
ColumnLabels.AddRange(array.ColumnLabels);
for (int i = 0; i < rowCount; i++)
{
for (int j = 0; j < existingColumnCount; j++)
{
newData[i, j] = Data[i, j];
}
for (int j = 0; j < newColumnCount; j++)
{
newData[i, existingColumnCount + j] = array.Data[i,j];
}
}
Data = newData;
}
public void AddRow(int rowNumber, IEnumerable<T> values)
{
CheckParams(rowNumber, values);
var valueList = values.ToList();
for (int i = 0; i < values.Count(); i++)
{
Data[rowNumber, i] = valueList[i];
}
}
private void CheckParams(int rowNumber, IEnumerable<T> values)
{
int rowCount = Data.GetLength(0) - 1;
if (rowNumber > rowCount)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": number of rows {rowNumber} is greater than length of array {rowCount}");
}
if (values.Count() != Data.GetLength(1))
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": number of colums in values {values.Count()} is not equal existing column count {Data.GetLength(1)}");
}
}
}
}

View File

@@ -0,0 +1,7 @@
namespace StructureHelperCommon.Models.Parameters
{
public interface IProcessValuePairLogic<T>
{
ValuePair<T> GetValuePairByString(string s);
}
}

View File

@@ -0,0 +1,12 @@
namespace StructureHelperCommon.Models.Parameters
{
/// <summary>
/// Represent pair of value with text
/// </summary>
/// <typeparam name="T"></typeparam>
public interface IValuePair<T>
{
string Text { get; set; }
T Value { get; set; }
}
}

View File

@@ -7,14 +7,12 @@ using System.Windows.Media;
namespace StructureHelperCommon.Models.Parameters
{
public interface IValueParameter<T>
public interface IValueParameter<T> : IValuePair<T>
{
bool IsValid { get; set; }
string Name { get; set; }
string ShortName { get; set; }
Color Color { get; set; }
string MeasurementUnit { get; set; }
T Value { get; set; }
string Description { get; set; }
}
}

View File

@@ -0,0 +1,65 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Services.Units;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Media.Media3D;
namespace StructureHelperCommon.Models.Parameters
{
public enum DigitPlace
{
Start,
Any
}
public class ProcessDoublePairLogic : IProcessValuePairLogic<double>
{
const string digitalPattern = @"^[-]?[+]?\d*\.?\,?\d*";
const string allowedPattern = @"[0-9]|\.|\,";
const string characterPattern = "[a-z]+$";
const string target = "";
public DigitPlace DigitPlace { get; set; } = DigitPlace.Start;
public ValuePair<double> GetValuePairByString(string s)
{
s = s.Replace(" ", string.Empty);
Regex regexText = new (allowedPattern);
string textString = regexText.Replace(s, target);
var textMatch = Regex.Match(textString, characterPattern, RegexOptions.IgnoreCase);
if (textMatch.Success == true)
{
textString = textMatch.Value.ToLower();
}
var digitalOnlyString = DigitPlace == DigitPlace.Start ? s : s.ToLower().Replace(textString, string.Empty);
var match = Regex.Match(digitalOnlyString, digitalPattern);
if (match.Success == true)
{
return GetDoubleValue(textString, match);
}
throw new StructureHelperException(ErrorStrings.DataIsInCorrect);
}
private static ValuePair<double> GetDoubleValue(string textString, Match match)
{
string digitalString = match.Value;
if (digitalString != string.Empty || digitalString != "")
{
double digit = ProcessString.ConvertCommaToCultureSettings(digitalString);
return new ValuePair<double>()
{
Value = digit,
Text = textString
};
}
else
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": value does not contain digital simbols");
}
}
}
}

View File

@@ -4,11 +4,12 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Services.Units
namespace StructureHelperCommon.Models.Parameters
{
internal class StringDoublePair : IStringDoublePair
/// <inheritdoc/>
public class ValuePair<T> : IValuePair<T>
{
public double Digit { get; set; }
public string Text { get; set; }
public T Value { get; set; }
}
}

View File

@@ -13,7 +13,7 @@ namespace StructureHelperCommon.Models.Parameters
public string Name { get; set; }
public string ShortName { get; set; }
public Color Color { get; set; }
public string MeasurementUnit { get; set; }
public string Text { get; set; }
public T Value { get; set; }
public string Description { get; set; }
}

View File

@@ -1,90 +0,0 @@
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
//All rights reserved.
namespace StructureHelperCommon.Models.Sections
{
public class AccidentalEccentricityLogic : IAccidentalEccentricityLogic
{
private double lengthFactor;
private double sizeFactor;
private double minEccentricity;
public double Length { get; set; }
public double SizeX { get; set; }
public double SizeY { get; set; }
public IForceTuple InitialForceTuple { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public AccidentalEccentricityLogic()
{
lengthFactor = 600d;
sizeFactor = 30d;
minEccentricity = 0.01d;
}
public ForceTuple GetForceTuple()
{
var lengthEccetricity = Length / lengthFactor;
TraceLogger?.AddMessage(string.Format("Accidental eccentricity by length ea = {0} / {1} = {2}", Length, lengthFactor, lengthEccetricity));
var sizeXEccetricity = SizeX / sizeFactor;
TraceLogger?.AddMessage(string.Format("Accidental eccentricity by SizeX ea ={0} / {1} = {2}", SizeX, sizeFactor, sizeXEccetricity));
var sizeYEccetricity = SizeY / sizeFactor;
TraceLogger?.AddMessage(string.Format("Accidental eccentricity by SizeY ea ={0} / {1} = {2}", SizeY, sizeFactor, sizeYEccetricity));
TraceLogger?.AddMessage(string.Format("Minimum accidental eccentricity ea = {0}", minEccentricity));
var xEccentricity = Math.Abs(InitialForceTuple.My / InitialForceTuple.Nz);
TraceLogger?.AddMessage(string.Format("Actual eccentricity e0,x = {0}", xEccentricity));
var yEccentricity = Math.Abs(InitialForceTuple.Mx / InitialForceTuple.Nz);
TraceLogger?.AddMessage(string.Format("Actual eccentricity e0,y = {0}", yEccentricity));
var xFullEccentricity = new List<double>()
{
lengthEccetricity,
sizeXEccetricity,
minEccentricity,
xEccentricity
}
.Max();
string mesEx = string.Format("Eccentricity e,x = max({0}; {1}; {2}; {3}) = {4}",
lengthEccetricity, sizeXEccetricity,
minEccentricity, xEccentricity,
xFullEccentricity);
TraceLogger?.AddMessage(mesEx);
var yFullEccentricity = new List<double>()
{
lengthEccetricity,
sizeYEccetricity,
minEccentricity,
yEccentricity
}
.Max();
string mesEy = string.Format("Eccentricity e,y = max({0}; {1}; {2}; {3}) = {4}",
lengthEccetricity, sizeYEccetricity,
minEccentricity, yEccentricity,
yFullEccentricity);
TraceLogger?.AddMessage(mesEy);
var xSign = InitialForceTuple.Mx == 0d ? -1d : Math.Sign(InitialForceTuple.Mx);
var ySign = InitialForceTuple.My == 0d ? -1d : Math.Sign(InitialForceTuple.My);
var mx = (-1d) * InitialForceTuple.Nz * yFullEccentricity * xSign;
var my = (-1d) * InitialForceTuple.Nz * xFullEccentricity * ySign;
TraceLogger?.AddMessage(string.Format("Bending moment arbitrary X-axis Mx = {0} * {1} = {2}", InitialForceTuple.Nz, yFullEccentricity, mx), TraceLogStatuses.Debug);
TraceLogger?.AddMessage(string.Format("Bending moment arbitrary Y-axis My = {0} * {1} = {2}", InitialForceTuple.Nz, xFullEccentricity, my), TraceLogStatuses.Debug);
var newTuple = new ForceTuple()
{
Mx = mx,
My = my,
Nz = InitialForceTuple.Nz,
Qx = InitialForceTuple.Qx,
Qy = InitialForceTuple.Qy,
Mz = InitialForceTuple.Mz,
};
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(newTuple));
return newTuple;
}
}
}

View File

@@ -0,0 +1,23 @@
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Sections.Logics
{
public class ForceTupleCopier : IProcessorLogic<IForceTuple>
{
public IForceTuple InputForceTuple { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public ForceTupleCopier(IForceTuple forceTuple)
{
InputForceTuple = forceTuple;
}
public IForceTuple GetValue()
{
return InputForceTuple.Clone() as IForceTuple;
}
}
}

View File

@@ -0,0 +1,32 @@
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Sections.Logics
{
public class ForceTupleMoveToPointDecorator : IProcessorDecorator<IForceTuple>
{
public IPoint2D Point2D { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
/// <summary>
/// Internal source of ForceTuple
/// </summary>
public IProcessorLogic<IForceTuple> ForceTupleLogics { get; }
public ForceTupleMoveToPointDecorator(IProcessorLogic<IForceTuple> procLogic)
{
ForceTupleLogics = procLogic;
}
public IForceTuple GetValue()
{
ForceTupleLogics.TraceLogger = TraceLogger;
var newTuple = ForceTupleLogics.GetValue();
newTuple.Mx += newTuple.Nz * Point2D.Y;
newTuple.My -= newTuple.Nz * Point2D.X;
return newTuple;
}
}
}

View File

@@ -1,38 +0,0 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Sections
{
/// <summary>
/// Logic for calculating of value of accidental eccentricity
/// </summary>
public interface IAccidentalEccentricityLogic : ILogic
{
/// <summary>
/// Properties of compressed member
/// </summary>
double Length { get;set;}
/// <summary>
/// Size of cross-section along X-axis, m
/// </summary>
double SizeX { get; set; }
/// <summary>
/// Size of cross-section along Y-axis, m
/// </summary>
double SizeY { get; set; }
/// <summary>
/// Initial tuple of force
/// </summary>
IForceTuple InitialForceTuple { get; set; }
/// <summary>
/// Returns new force tuple with accidental eccentricity
/// </summary>
/// <returns></returns>
ForceTuple GetForceTuple();
}
}

View File

@@ -0,0 +1,17 @@
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Sections.Logics
{
public interface IHasInputForce
{
/// <summary>
/// Initial tuple of force
/// </summary>
IForceTuple InputForceTuple { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More