Force combination was added

This commit is contained in:
Evgeny Redikultsev
2022-11-27 17:04:34 +05:00
parent c5e503252e
commit 96b331f14c
52 changed files with 427 additions and 214 deletions

View File

@@ -1,5 +1,9 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using Newtonsoft.Json.Linq;
using StructureHelper.Infrastructure.UI.Converters.Units;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Services.Units;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -12,6 +16,8 @@ namespace StructureHelper.Infrastructure.UI.Converters
{
internal static class CommonOperation
{
private static IEnumerable<IUnit> units = UnitsFactory.GetUnitCollection();
public static double ConvertToDoubleChangeComma(string s)
{
double result;
@@ -26,6 +32,7 @@ namespace StructureHelper.Infrastructure.UI.Converters
public static IStringDoublePair DivideIntoStringDoublePair(string s)
{
s = s.Replace(" ", "");
string digitPattern = @"\d+(\.?|\,?)\d+";
string textPattern = @"[0-9]|\.|\,";
string caracterPattern = "[a-z]+$";
@@ -43,5 +50,51 @@ namespace StructureHelper.Infrastructure.UI.Converters
}
throw new StructureHelperException(ErrorStrings.DataIsInCorrect);
}
public static IUnit GetUnit(UnitTypes unitType, string unitName)
{
return units.Where(u => u.UnitType == unitType & u.Name == unitName).Single();
}
public static string Convert(IUnit unit, string unitName, object value)
{
double val;
if (value != null) { val = (double)value; }
else { throw new Exception($"{unitName} value is null"); }
val *= unit.Multiplyer;
string strValue = $"{val} {unit.Name}";
return strValue;
}
public static double ConvertBack(UnitTypes unitType, IUnit unit, object value)
{
double val;
double multy;
double coefficient = unit.Multiplyer;
var strVal = value as string;
IStringDoublePair pair = DivideIntoStringDoublePair(strVal);
try
{
multy = GetMultiplyer(unitType, pair.Text);
}
catch (Exception ex)
{
multy = coefficient;
}
val = pair.Digit / multy;
return val;
}
private static double GetMultiplyer(UnitTypes unitType, string unitName)
{
try
{
return units.Where(u => u.UnitType == unitType & u.Name == unitName).Single().Multiplyer;
}
catch (Exception ex)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ex);
}
}
}
}

View File

@@ -1,4 +1,6 @@
using System;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Services.Units;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
@@ -11,33 +13,8 @@ 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 string unitName { get => "Area"; }
public override string MeasureUnit => throw new NotImplementedException();
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
if (value != null) { val = (double)value; }
else { throw new Exception($"{unitName} value is null"); }
val *= UnitConstatnts.Length * UnitConstatnts.Length;
return val;
}
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
try
{
var strVal = value as string;
val = CommonOperation.ConvertToDoubleChangeComma(strVal);
}
catch
{
return null;
}
val /= (UnitConstatnts.Length * UnitConstatnts.Length);
return val;
}
}
}

View File

@@ -0,0 +1,17 @@
using StructureHelperCommon.Infrastructures.Enums;
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 Curvature : UnitBase
{
public override UnitTypes unitType { get => UnitTypes.Curvature; }
public override IUnit currentUnit { get => CommonOperation.GetUnit(unitType, "1/mm"); }
public override string unitName { get => "Curvature"; }
}
}

View File

@@ -1,4 +1,6 @@
using System;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Services.Units;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@@ -10,35 +12,8 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{
internal class Force : UnitBase
{
private double coeffficient = UnitConstatnts.Force;
public override UnitTypes unitType { get => UnitTypes.Force; }
public override IUnit currentUnit { get => CommonOperation.GetUnit(unitType, "kN"); }
public override string unitName { get => "Force"; }
public override string MeasureUnit => throw new NotImplementedException();
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
if (value != null) { val = (double)value; }
else { throw new Exception($"{unitName} value is null"); }
val *= coeffficient;
return val;
}
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
try
{
var strVal = value as string;
val = CommonOperation.ConvertToDoubleChangeComma(strVal);
}
catch
{
return null;
}
val /= coeffficient;
return val;
}
}
}

View File

@@ -5,6 +5,7 @@ using StructureHelperCommon.Services.Units;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -14,60 +15,8 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{
internal class Length : UnitBase
{
private IEnumerable<IUnit> units = UnitsFactory.GetUnitCollection();
private UnitTypes type = UnitTypes.Length;
private IUnit currentUnit => units.Where(u => u.UnitType == type & u.Name == "mm").Single();
public override string MeasureUnit => currentUnit.Name;
private double coeffficient => currentUnit.Multiplyer;
public override UnitTypes unitType { get => UnitTypes.Length; }
public override IUnit currentUnit { get => CommonOperation.GetUnit(unitType, "mm"); }
public override string unitName { get => "Length"; }
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
if (value != null) { val = (double)value; }
else { throw new Exception($"{unitName} value is null"); }
val *= coeffficient;
string strValue = $"{val} {MeasureUnit}";
return strValue;
}
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
try
{
var strVal = value as string;
IStringDoublePair pair = CommonOperation.DivideIntoStringDoublePair(strVal);
double multy;
try
{
multy = coeffficient / GetMultiplyer(units, type, pair.Text);
}
catch (Exception ex)
{
multy = 1d;
}
val = pair.Digit * multy;
}
catch
{
return null;
}
val /= coeffficient;
return val;
}
private double GetMultiplyer(IEnumerable<IUnit> units, UnitTypes unitType, string unitName)
{
try
{
return units.Where(u => u.UnitType == unitType & u.Name == unitName).Single().Multiplyer;
}
catch (Exception ex)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ex);
}
}
}
}

View File

@@ -0,0 +1,17 @@
using StructureHelperCommon.Infrastructures.Enums;
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 Moment : UnitBase
{
public override UnitTypes unitType { get => UnitTypes.Moment; }
public override IUnit currentUnit { get => CommonOperation.GetUnit(unitType, "kNm"); }
public override string unitName { get => "Moment"; }
}
}

View File

@@ -0,0 +1,39 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace StructureHelper.Infrastructure.UI.Converters.Units
{
internal class PlainDouble : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
try
{
return (double)value;
}
catch(Exception)
{
return new StructureHelperException(ErrorStrings.DataIsInCorrect);
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
try
{
return CommonOperation.ConvertToDoubleChangeComma((string)value);
}
catch (Exception)
{
return new StructureHelperException(ErrorStrings.DataIsInCorrect);
}
}
}
}

View File

@@ -1,4 +1,6 @@
using System;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Services.Units;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@@ -10,35 +12,8 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{
internal class Stress : UnitBase
{
private double coeffficient = UnitConstatnts.Stress;
public override UnitTypes unitType { get => UnitTypes.Stress; }
public override IUnit currentUnit { get => CommonOperation.GetUnit(unitType, "MPa"); }
public override string unitName { get => "Stress"; }
public override string MeasureUnit => throw new NotImplementedException();
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
if (value != null) { val = (double)value; }
else { throw new Exception($"{unitName} value is null"); }
val *= coeffficient;
return val;
}
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
try
{
var strVal = value as string;
val = CommonOperation.ConvertToDoubleChangeComma(strVal);
}
catch
{
return null;
}
val /= coeffficient;
return val;
}
}
}

View File

@@ -1,4 +1,6 @@
using System;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Services.Units;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@@ -10,9 +12,17 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{
internal abstract class UnitBase : IValueConverter
{
public abstract UnitTypes unitType { get; }
public abstract IUnit currentUnit { get; }
public abstract string unitName { get;}
public abstract string MeasureUnit { get; }
public abstract object Convert(object value, Type targetType, object parameter, CultureInfo culture);
public abstract object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture);
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return CommonOperation.Convert(currentUnit, unitName, value);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return CommonOperation.ConvertBack(unitType, currentUnit, value);
}
}
}

View File

@@ -20,6 +20,10 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
primitive.Area = value;
OnPropertyChanged(nameof(Area));
OnPropertyChanged(nameof(Diameter));
OnPropertyChanged(nameof(CenterX));
OnPropertyChanged(nameof(CenterY));
OnPropertyChanged(nameof(PrimitiveLeft));
OnPropertyChanged(nameof(PrimitiveTop));
}
}

View File

@@ -243,5 +243,10 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
{
}
public void RefreshColor()
{
OnPropertyChanged(nameof(Color));
}
}
}

View File

@@ -24,10 +24,10 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Name: "/>
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
<TextBlock Grid.Row="1" Text="Material Name: "/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding HeadMaterial.Name}"/>
<TextBlock Text="Name: " FontWeight="Bold"/>
<TextBlock Grid.Column="1" Text="{Binding Name}" FontWeight="Bold"/>
<TextBlock Grid.Row="1" Text="Material Name: " FontWeight="Bold"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding HeadMaterial.Name}" FontWeight="Bold"/>
<TextBlock Grid.Row="2" Text="Center X: "/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}}"/>
<TextBlock Grid.Row="3" Text="Center Y: "/>

View File

@@ -30,10 +30,10 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Name: "/>
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
<TextBlock Grid.Row="1" Text="Material Name: "/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding HeadMaterial.Name}"/>
<TextBlock Text="Name: " FontWeight="Bold"/>
<TextBlock Grid.Column="1" Text="{Binding Name}" FontWeight="Bold"/>
<TextBlock Grid.Row="1" Text="Material Name: " FontWeight="Bold"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding HeadMaterial.Name}" FontWeight="Bold"/>
<TextBlock Grid.Row="2" Text="Center X: "/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}}"/>
<TextBlock Grid.Row="3" Text="Center Y: "/>

View File

@@ -5,8 +5,11 @@
xmlns:convertersUnits ="clr-namespace:StructureHelper.Infrastructure.UI.Converters.Units">
<convertersCommon:InvertBoolConverter x:Key="InvertBoolConverter"/>
<convertersUnits:PlainDouble x:Key="PlainDouble"/>
<convertersUnits:Length x:Key="LengthConverter"/>
<convertersUnits:Area x:Key="AreaConverter"/>
<convertersUnits:Force x:Key="ForceConverter"/>
<convertersUnits:Moment x:Key="MomentConverter"/>
<convertersUnits:Stress x:Key="StressConverter"/>
<convertersUnits:Curvature x:Key="Curvature"/>
</ResourceDictionary>

View File

@@ -26,6 +26,14 @@
</Setter.Value>
</Setter>
<Setter Property="Opacity" Value="{Binding Opacity, Mode=TwoWay}"/>
<Setter Property="Stroke" Value="Black"/>
<Setter Property="StrokeThickness" Value="0.001"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Stroke" Value="Red"/>
<Setter Property="StrokeThickness" Value="0.002"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="EllipseStyle" TargetType="Ellipse" BasedOn="{StaticResource ShapeStyle}">

View File

@@ -138,6 +138,9 @@
<Compile Include="Infrastructure\UI\Converters\IStringDoublePair.cs" />
<Compile Include="Infrastructure\UI\Converters\StringDoublePair.cs" />
<Compile Include="Infrastructure\UI\Converters\Units\Area.cs" />
<Compile Include="Infrastructure\UI\Converters\Units\Curvature.cs" />
<Compile Include="Infrastructure\UI\Converters\Units\Moment.cs" />
<Compile Include="Infrastructure\UI\Converters\Units\PlainDouble.cs" />
<Compile Include="Infrastructure\UI\Converters\Units\Stress.cs" />
<Compile Include="Infrastructure\UI\Converters\Units\Force.cs" />
<Compile Include="Infrastructure\UI\Converters\Units\Length.cs" />

View File

@@ -2,8 +2,8 @@
{
public enum LimitStates
{
Collapse = 1,
ServiceAbility = 2,
ULS = 1,
SLS = 2,
Special = 3,
}
}

View File

@@ -12,6 +12,7 @@ namespace StructureHelperCommon.Infrastructures.Enums
Area,
Stress,
Force,
Moment
Moment,
Curvature
}
}

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.Calculators
{
public interface IHelperCalculator <in TInputData, TCalculationResult>
where TInputData : class
where TCalculationResult : class
{
}
}

View File

@@ -0,0 +1,23 @@
using StructureHelperCommon.Infrastructures.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public class DesignForceTuple : IDesignForceTuple
{
public LimitStates LimitState { get; set; }
public CalcTerms CalcTerm { get; set; }
public IForceTuple ForceTuple { get; private set; }
public DesignForceTuple(LimitStates limitState, CalcTerms calcTerm)
{
LimitState = limitState;
CalcTerm = calcTerm;
ForceTuple = new ForceTuple();
}
}
}

View File

@@ -0,0 +1,27 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public class ForceCombinationList : IForceCombinationList
{
public string Name { get; set; }
public Point2D ForcePoint { get; private set; }
public List<IDesignForceTuple> DesignForces { get; private set; }
public ForceCombinationList()
{
DesignForces = new List<IDesignForceTuple>();
DesignForces.Add(new DesignForceTuple(LimitStates.ULS, CalcTerms.ShortTerm));
DesignForces.Add(new DesignForceTuple(LimitStates.ULS, CalcTerms.LongTerm));
DesignForces.Add(new DesignForceTuple(LimitStates.SLS, CalcTerms.ShortTerm));
DesignForces.Add(new DesignForceTuple(LimitStates.SLS, CalcTerms.LongTerm));
}
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public class ForceTuple : IForceTuple
{
public double Mx { get; set; }
public double My { get; set; }
public double Nz { get; set; }
public double Qx { get; set; }
public double Qy { get; set; }
public double Mz { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using StructureHelperCommon.Infrastructures.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public interface IDesignForceTuple
{
LimitStates LimitState { get; set; }
CalcTerms CalcTerm { get; set; }
IForceTuple ForceTuple {get;}
}
}

View File

@@ -0,0 +1,16 @@
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public interface IForceCombinationList
{
string Name { get; set; }
Point2D ForcePoint {get ;}
List<IDesignForceTuple> DesignForces { get; }
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public interface IForceTuple
{
double Mx { get; set; }
double My { get; set; }
double Nz { get; set; }
double Qx { get; set; }
double Qy { get; set; }
double Mz { get; set; }
}
}

View File

@@ -2,7 +2,7 @@
{
public interface ICenterShape
{
ICenter Center {get;}
IPoint2D Center {get;}
IShape Shape { get;}
}
}

View File

@@ -8,8 +8,8 @@ namespace StructureHelperCommon.Models.Shapes
{
public interface ILineShape : IShape
{
ICenter StartPoint { get; set; }
ICenter EndPoint { get; set; }
IPoint2D StartPoint { get; set; }
IPoint2D EndPoint { get; set; }
double Thickness { get; set; }
}
}

View File

@@ -4,7 +4,7 @@
/// Interface for point of center of some shape
/// Интерфейс для точки центра некоторой формы
/// </summary>
public interface ICenter
public interface IPoint2D
{
/// <summary>
/// Coordinate of center of rectangle by local axis X, m

View File

@@ -10,16 +10,16 @@ namespace StructureHelperCommon.Models.Shapes
public class LineShape : ILineShape
{
/// <inheritdoc />
public ICenter StartPoint { get; set; }
public IPoint2D StartPoint { get; set; }
/// <inheritdoc />
public ICenter EndPoint { get; set; }
public IPoint2D EndPoint { get; set; }
/// <inheritdoc />
public double Thickness { get; set; }
public LineShape()
{
StartPoint = new Center();
EndPoint = new Center();
StartPoint = new Point2D();
EndPoint = new Point2D();
Thickness = 0;
}
}

View File

@@ -1,7 +1,7 @@
namespace StructureHelperCommon.Models.Shapes
{
/// <inheritdoc />
public class Center : ICenter
public class Point2D : IPoint2D
{
/// <inheritdoc />
public double X { get; set; }

View File

@@ -17,10 +17,27 @@ namespace StructureHelperCommon.Services.Units
units.Add(new Unit() { UnitType = type, Name = "mm", Multiplyer = 1e3d });
units.Add(new Unit() { UnitType = type, Name = "cm", Multiplyer = 1e2d });
units.Add(new Unit() { UnitType = type, Name = "km", Multiplyer = 1e-3d });
type = UnitTypes.Area;
units.Add(new Unit() { UnitType = type, Name = "m2", Multiplyer = 1d });
units.Add(new Unit() { UnitType = type, Name = "mm2", Multiplyer = 1e6d });
units.Add(new Unit() { UnitType = type, Name = "cm2", Multiplyer = 1e4d });
type = UnitTypes.Stress;
units.Add(new Unit() { UnitType = type, Name = "Pa", Multiplyer = 1d });
units.Add(new Unit() { UnitType = type, Name = "kPa", Multiplyer = 1e-3d });
units.Add(new Unit() { UnitType = type, Name = "MPa", Multiplyer = 1e-6d });
type = UnitTypes.Force;
units.Add(new Unit() { UnitType = type, Name = "N", Multiplyer = 1d });
units.Add(new Unit() { UnitType = type, Name = "kN", Multiplyer = 1e-3d });
units.Add(new Unit() { UnitType = type, Name = "MN", Multiplyer = 1e-6d });
type = UnitTypes.Moment;
units.Add(new Unit() { UnitType = type, Name = "Nm", Multiplyer = 1d });
units.Add(new Unit() { UnitType = type, Name = "kNm", Multiplyer = 1e-3d });
units.Add(new Unit() { UnitType = type, Name = "kgfm", Multiplyer = 9.8d });
units.Add(new Unit() { UnitType = type, Name = "tfm", Multiplyer = 9.8e-3d });
type = UnitTypes.Curvature;
units.Add(new Unit() { UnitType = type, Name = "1/m", Multiplyer = 1d });
units.Add(new Unit() { UnitType = type, Name = "1/mm", Multiplyer = 1e-3d });
units.Add(new Unit() { UnitType = type, Name = "1/cm", Multiplyer = 1e-2d });
return units;
}
}

View File

@@ -55,8 +55,15 @@
<Compile Include="Infrastructures\Interfaces\ISaveable.cs" />
<Compile Include="Infrastructures\Strings\ErrorString.cs" />
<Compile Include="Infrastructures\Enums\MaterialTypes.cs" />
<Compile Include="Models\Shapes\Center.cs" />
<Compile Include="Models\Shapes\ICenter.cs" />
<Compile Include="Models\Calculators\IHelperCalculator.cs" />
<Compile Include="Models\Forces\DesignForceTuple.cs" />
<Compile Include="Models\Forces\ForceCombinationList.cs" />
<Compile Include="Models\Forces\ForceTuple.cs" />
<Compile Include="Models\Forces\IDesignForceTuple.cs" />
<Compile Include="Models\Forces\IForceCombinationList.cs" />
<Compile Include="Models\Forces\IForceTuple.cs" />
<Compile Include="Models\Shapes\Point2D.cs" />
<Compile Include="Models\Shapes\IPoint2D.cs" />
<Compile Include="Models\Shapes\ICenterShape.cs" />
<Compile Include="Models\Shapes\ICircle.cs" />
<Compile Include="Models\Shapes\ILineShape.cs" />
@@ -73,5 +80,6 @@
<Compile Include="Services\Units\Unit.cs" />
<Compile Include="Services\Units\UnitsFactory.cs" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -16,7 +16,7 @@ namespace StructureHelperLogics.Models.Calculations.CalculationProperties
{
new ForceCombination()
};
LimitState = LimitStates.Collapse;
LimitState = LimitStates.ULS;
CalcTerm = CalcTerms.ShortTerm;
IterationProperty = new IterationProperty() { Accuracy = 0.001d, MaxIterationCount = 100};
}

View File

@@ -68,8 +68,8 @@ namespace StructureHelperLogics.Models.Materials
materialOptions.CodesType = LCMB.CodesType.SP63_2018;
}
else { throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {codeType}"); }
if (limitState == LimitStates.Collapse) { materialOptions.LimitState = LCMB.LimitStates.Collapse; }
else if (limitState == LimitStates.ServiceAbility) { materialOptions.LimitState = LCMB.LimitStates.ServiceAbility; }
if (limitState == LimitStates.ULS) { materialOptions.LimitState = LCMB.LimitStates.Collapse; }
else if (limitState == LimitStates.SLS) { materialOptions.LimitState = LCMB.LimitStates.ServiceAbility; }
else if (limitState == LimitStates.Special) { materialOptions.LimitState = LCMB.LimitStates.Special; }
else { throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid); }
if (calcTerm == CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }

View File

@@ -12,7 +12,7 @@ namespace StructureHelperLogics.Models.Primitives
public interface IPrimitive : ISaveable, ICloneable
{
string Name { get; set; }
ICenter Center { get; }
IPoint2D Center { get; }
IShape Shape { get; }
IEnumerable<INdmPrimitive> GetNdmPrimitives();

View File

@@ -11,7 +11,7 @@ namespace StructureHelperLogics.Models.Primitives
{
public int Id { get; set; }
public string Name { get; set; }
public ICenter Center { get; set; }
public IPoint2D Center { get; set; }
public IShape Shape { get; }
public LinePrimitive()

View File

@@ -27,15 +27,15 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public double PrestrainKy { get; set; }
public double PrestrainEpsZ { get; set; }
public ICenter StartPoint { get; set; }
public ICenter EndPoint { get; set; }
public IPoint2D StartPoint { get; set; }
public IPoint2D EndPoint { get; set; }
public double Thickness { get; set; }
public LinePrimitive()
{
StartPoint = new Center();
EndPoint = new Center();
StartPoint = new Point2D();
EndPoint = new Point2D();
Name = "New Line";
NdmMaxSize = 0.01d;

View File

@@ -4,7 +4,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
{
public interface IPointTriangulationLogicOptions : ITriangulationLogicOptions
{
ICenter Center { get; }
IPoint2D Center { get; }
double Area { get; }
}
}

View File

@@ -11,7 +11,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
/// <summary>
///
/// </summary>
ICenter Center { get; }
IPoint2D Center { get; }
/// <summary>
///
/// </summary>

View File

@@ -20,7 +20,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public IEnumerable<INdm> GetNdmCollection(IMaterial material)
{
IPointTriangulationLogicOptions options = Options as IPointTriangulationLogicOptions;
ICenter center = options.Center;
IPoint2D center = options.Center;
double area = options.Area;
List<INdm> ndmCollection = new List<INdm>();
INdm ndm = new Ndm { CenterX = center.X, CenterY = center.Y, Area = area, Material = material };

View File

@@ -14,7 +14,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
/// <summary>
///
/// </summary>
public ICenter Center { get; }
public IPoint2D Center { get; }
/// <inheritdoc />
public double Area { get; }
/// <inheritdoc />
@@ -24,7 +24,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
/// <inheritdoc />
public double PrestrainEpsZ { get; }
public PointTriangulationLogicOptions(ICenter center, double area)
public PointTriangulationLogicOptions(IPoint2D center, double area)
{
Center = center;
Area = area;
@@ -32,7 +32,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public PointTriangulationLogicOptions(IPointPrimitive primitive)
{
Center = new Center() { X = primitive.CenterX, Y = primitive.CenterY };
Center = new Point2D() { X = primitive.CenterX, Y = primitive.CenterY };
Area = primitive.Area;
PrestrainKx = primitive.PrestrainKx;
PrestrainKy = primitive.PrestrainKy;

View File

@@ -11,7 +11,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public class RectangleTriangulationLogicOptions : IRectangleTriangulationLogicOptions
{
/// <inheritdoc />
public ICenter Center { get; }
public IPoint2D Center { get; }
/// <inheritdoc />
public IRectangleShape Rectangle { get; }
/// <inheritdoc />
@@ -25,7 +25,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
/// <inheritdoc />
public double PrestrainEpsZ { get;}
public RectangleTriangulationLogicOptions(ICenter center, IRectangleShape rectangle, double ndmMaxSize, int ndmMinDivision)
public RectangleTriangulationLogicOptions(IPoint2D center, IRectangleShape rectangle, double ndmMaxSize, int ndmMinDivision)
{
Center = center;
Rectangle = rectangle;
@@ -35,7 +35,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public RectangleTriangulationLogicOptions(IRectanglePrimitive primitive)
{
Center = new Center() { X = primitive.CenterX, Y = primitive.CenterY };
Center = new Point2D() { X = primitive.CenterX, Y = primitive.CenterY };
Rectangle = primitive;
NdmMaxSize = primitive.NdmMaxSize;
NdmMinDivision = primitive.NdmMinDivision;

View File

@@ -41,19 +41,19 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
ITriangulationOptions options = new TriangulationOptions { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
var ndmPrimitives = new List<INdmPrimitive>();
//Добавляем прямоугольник бетонного сечения
var concreteRectangle = new dContext.Rectangle(new Center { X = 0, Y = 0 }, new Rectangle { Width = width, Height = height, Angle = 0 });
var concreteRectangle = new dContext.Rectangle(new Point2D { X = 0, Y = 0 }, new Rectangle { Width = width, Height = height, Angle = 0 });
ndmPrimitives.Add(concreteRectangle.GetNdmPrimitive());
//Добавляем 4 точки для арматуры
// 0.05 - величина защитного слоя (расстояние от грани прямоугольника до центра арматуры
//С площадью нижней арматуры
var leftBottomReinforcementPoint = new dContext.Point(new Center { X = -width / 2 + 0.05d, Y = -height / 2 + 0.05 }, new Point { Area = bottomArea });
var leftBottomReinforcementPoint = new dContext.Point(new Point2D { X = -width / 2 + 0.05d, Y = -height / 2 + 0.05 }, new Point { Area = bottomArea });
ndmPrimitives.Add(leftBottomReinforcementPoint.GetNdmPrimitive());
var rightBottomReinforcementPoint = new Point(new Center { X = width / 2 - 0.05d, Y = -height / 2 + 0.05 }, new Point { Area = bottomArea });
var rightBottomReinforcementPoint = new Point(new Point2D { X = width / 2 - 0.05d, Y = -height / 2 + 0.05 }, new Point { Area = bottomArea });
ndmPrimitives.Add(rightBottomReinforcementPoint.GetNdmPrimitive());
//С площадью верхней арматуры
var leftTopReinforcementPoint = new dContext.Point(new Center { X = -width / 2 + 0.05d, Y = height / 2 - 0.05 }, new Point { Area = topArea });
var leftTopReinforcementPoint = new dContext.Point(new Point2D { X = -width / 2 + 0.05d, Y = height / 2 - 0.05 }, new Point { Area = topArea });
ndmPrimitives.Add(leftTopReinforcementPoint.GetNdmPrimitive());
var rightTopReinforcementPoint = new dContext.Point(new Center { X = width / 2 - 0.05d, Y = height / 2 - 0.05 }, new Point { Area = topArea });
var rightTopReinforcementPoint = new dContext.Point(new Point2D { X = width / 2 - 0.05d, Y = height / 2 - 0.05 }, new Point { Area = topArea });
ndmPrimitives.Add(rightTopReinforcementPoint.GetNdmPrimitive());
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
ndmCollection.AddRange(Triangulation.GetNdms(ndmPrimitives, options));

View File

@@ -61,7 +61,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
private IEnumerable<INdmPrimitive> GetConcreteNdms(double width, double height)
{
double strength = 40e6;
ICenter center = new Center { X = 0, Y = 0 };
IPoint2D center = new Point2D { X = 0, Y = 0 };
IRectangleShape rectangle = new RectangleShape { Width = width, Height = height, Angle = 0 };
IPrimitiveMaterial material = new PrimitiveMaterial { MaterialType = MaterialTypes.Concrete, ClassName = "С40", Strength = strength };
//ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
@@ -78,10 +78,10 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
IShape bottomReinforcement = new PointShape { Area = bottomArea };
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength };
//ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
ICenter centerRT = new Center { X = width / 2 - gap, Y = height / 2 - gap };
ICenter centerLT = new Center { X = - (width / 2 - gap), Y = height / 2 - gap };
ICenter centerRB = new Center { X = width / 2 - gap, Y = - (height / 2 - gap) };
ICenter centerLB = new Center { X = -(width / 2 - gap), Y = - (height / 2 - gap) };
IPoint2D centerRT = new Point2D { X = width / 2 - gap, Y = height / 2 - gap };
IPoint2D centerLT = new Point2D { X = - (width / 2 - gap), Y = height / 2 - gap };
IPoint2D centerRB = new Point2D { X = width / 2 - gap, Y = - (height / 2 - gap) };
IPoint2D centerLB = new Point2D { X = -(width / 2 - gap), Y = - (height / 2 - gap) };
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
INdmPrimitive primitive;
//Right top bar

View File

@@ -21,7 +21,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
public void Run_ShouldPass(double width, double height, double strength, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
{
//Arrange
ICenter center = new Center { X = 0, Y = 0 };
IPoint2D center = new Point2D { X = 0, Y = 0 };
IRectangleShape rectangle = new RectangleShape { Width = width, Height = height, Angle = 0 };
IPrimitiveMaterial material = new PrimitiveMaterial { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength };
ITriangulationOptions options = new TriangulationOptions { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };

View File

@@ -21,7 +21,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
{
//Arrange
IMaterial material = new Material();
ICenter center = new Center { X = centerX, Y = centerY };
IPoint2D center = new Point2D { X = centerX, Y = centerY };
IRectangleShape rectangle = new RectangleShape { Width = width, Height = height, Angle = angle };
IRectangleTriangulationLogicOptions options = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogicOptions(center, rectangle, ndmMaxSize, ndmMinDivision);
IRectangleTriangulationLogic logic = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogic(options);

View File

@@ -39,8 +39,8 @@
SelectedItem="{Binding Path=SelectedCombination}">
<DataGrid.Columns>
<DataGridCheckBoxColumn Header="Active" Binding="{Binding Path=TakeInCalculate}"/>
<DataGridTextColumn Header="Moment Mx" Width="90" Binding="{Binding Path=ForceMatrix.Mx, Converter={StaticResource ForceConverter}}"/>
<DataGridTextColumn Header="Moment My" Width="90" Binding="{Binding Path=ForceMatrix.My, Converter={StaticResource ForceConverter}}"/>
<DataGridTextColumn Header="Moment Mx" Width="90" Binding="{Binding Path=ForceMatrix.Mx, Converter={StaticResource MomentConverter}}"/>
<DataGridTextColumn Header="Moment My" Width="90" Binding="{Binding Path=ForceMatrix.My, Converter={StaticResource MomentConverter}}"/>
<DataGridTextColumn Header="Force Nz" Width="90" Binding="{Binding Path=ForceMatrix.Nz, Converter={StaticResource ForceConverter}}"/>
</DataGrid.Columns>
</DataGrid>

View File

@@ -16,7 +16,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow
InitializeComponent();
viewModel = calculationProperty;
this.DataContext = viewModel;
if (viewModel.LimitState == LimitStates.Collapse) { LsCollapse.IsChecked = true; }
if (viewModel.LimitState == LimitStates.ULS) { LsCollapse.IsChecked = true; }
else { LsServiceability.IsChecked = true; }
if (viewModel.CalcTerm == CalcTerms.ShortTerm) { ShortLoads.IsChecked = true; }
else { LongLoads.IsChecked = true; }
@@ -31,14 +31,14 @@ namespace StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow
{
var chBox = sender as RadioButton;
if (chBox.IsChecked == true & viewModel != null)
{ viewModel.LimitState = LimitStates.Collapse; }
{ viewModel.LimitState = LimitStates.ULS; }
}
private void LsServiceability_Checked(object sender, RoutedEventArgs e)
{
var chBox = sender as RadioButton;
if (chBox.IsChecked == true & viewModel != null)
{ viewModel.LimitState = LimitStates.ServiceAbility; }
{ viewModel.LimitState = LimitStates.SLS; }
}
private void ShortLoads_Checked(object sender, RoutedEventArgs e)

View File

@@ -25,8 +25,8 @@
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridCheckBoxColumn Header="Valid" Binding="{Binding Path=IsValid}"/>
<DataGridTextColumn Header="Moment Mx" Width="90" Binding="{Binding Path=LoaderResults.ForceStrainPair.ForceMatrix.Mx, Converter={StaticResource ForceConverter}}"/>
<DataGridTextColumn Header="Moment My" Width="90" Binding="{Binding Path=LoaderResults.ForceStrainPair.ForceMatrix.My, Converter={StaticResource ForceConverter}}"/>
<DataGridTextColumn Header="Moment Mx" Width="90" Binding="{Binding Path=LoaderResults.ForceStrainPair.ForceMatrix.Mx, Converter={StaticResource MomentConverter}}"/>
<DataGridTextColumn Header="Moment My" Width="90" Binding="{Binding Path=LoaderResults.ForceStrainPair.ForceMatrix.My, Converter={StaticResource MomentConverter}}"/>
<DataGridTextColumn Header="Force Nz" Width="90" Binding="{Binding Path=LoaderResults.ForceStrainPair.ForceMatrix.Nz, Converter={StaticResource ForceConverter}}"/>
<DataGridTextColumn Header="Accuracy" Width="90" Binding="{Binding Path=LoaderResults.AccuracyRate}"/>
<DataGridTextColumn Header="Max Iteration" Width="90" Binding="{Binding Path=LoaderResults.IterationCounter}"/>

View File

@@ -52,7 +52,7 @@
<Button Content="Concrete slab" Command="{Binding AddSlabCase}"/>
</MenuItem>
</MenuItem>
<MenuItem Header="Analisys">
<MenuItem Header="Analysis">
<Button Content="Solve problem" Command="{Binding Path=Calculate}"/>
</MenuItem>
</Menu>
@@ -206,7 +206,16 @@
</Grid>
<StatusBar Grid.Row="2">
<StatusBarItem>
<TextBlock Text="Structure Helper"/>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Zoom: "/>
<TextBlock Text="{Binding ScaleValue}"/>
</StackPanel>
</StatusBarItem>
<StatusBarItem>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Number of primitives: "/>
<TextBlock Text="{Binding PrimitivesCount}"/>
</StackPanel>
</StatusBarItem>
</StatusBar>
</Grid>

View File

@@ -75,11 +75,12 @@ namespace StructureHelper.Windows.MainWindow
}
public int PrimitivesCount => Primitives.Count;
private double scaleValue;
public double ScaleValue
{
get => scaleValue;
get => Math.Round(scaleValue);
set
{
OnPropertyChanged(value, ref scaleValue);
@@ -186,7 +187,7 @@ namespace StructureHelper.Windows.MainWindow
XY1 = CanvasHeight / 2d;
YX1 = CanvasWidth / 2d;
YY2 = CanvasHeight;
scaleValue = 1000d / scale;
scaleValue = 400d / scale;
axisLineThickness = ConstAxisLineThickness / scaleValue;
gridLineThickness = ConstGridLineThickness / scaleValue;
calculationProperty = new CalculationProperty();
@@ -307,6 +308,7 @@ namespace StructureHelper.Windows.MainWindow
viewPrimitive.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
Primitives.Add(viewPrimitive);
PrimitiveRepository.Add(viewPrimitive);
OnPropertyChanged(nameof(PrimitivesCount));
});
DeletePrimitive = new RelayCommand(
@@ -326,6 +328,7 @@ namespace StructureHelper.Windows.MainWindow
Primitives.Add(primitive);
PrimitiveRepository.Add(primitive);
}
OnPropertyChanged(nameof(PrimitivesCount));
AddCaseLoads(-50e3d, 50e3d, 0d);
});
@@ -336,6 +339,7 @@ namespace StructureHelper.Windows.MainWindow
Primitives.Add(primitive);
PrimitiveRepository.Add(primitive);
}
OnPropertyChanged(nameof(PrimitivesCount));
AddCaseLoads(50e3d, 50e3d, -100e3d);
});
@@ -346,6 +350,7 @@ namespace StructureHelper.Windows.MainWindow
Primitives.Add(primitive);
PrimitiveRepository.Add(primitive);
}
OnPropertyChanged(nameof(PrimitivesCount));
AddCaseLoads(-20e3d, 0d, 0d);
});
@@ -391,6 +396,10 @@ namespace StructureHelper.Windows.MainWindow
wnd.ShowDialog();
headMaterials = Model.HeadMaterialRepository.HeadMaterials;
OnPropertyChanged(nameof(headMaterials));
foreach (var primitive in Primitives)
{
primitive.RefreshColor();
}
}
private void DeleteSelectedPrimitive()
@@ -405,6 +414,7 @@ namespace StructureHelper.Windows.MainWindow
}
}
else { MessageBox.Show("Selection is changed", "Please, select primitive", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); }
OnPropertyChanged(nameof(PrimitivesCount));
}
private void EditSelectedPrimitive()

View File

@@ -134,9 +134,9 @@
<TextBlock Grid.Row="0" Text="k_x"/>
<TextBlock Grid.Row="1" Text="k_y"/>
<TextBlock Grid.Row="2" Text="epsilon_z"/>
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding PrestrainKx, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding PrestrainKy, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding PrestrainEpsZ, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding PrestrainKx, Converter={StaticResource Curvature}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding PrestrainKy, Converter={StaticResource Curvature}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding PrestrainEpsZ, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
</Grid>
</Expander>
</StackPanel>