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.Infrastructures.Strings;
using StructureHelperCommon.Services.Units;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
@@ -12,6 +16,8 @@ namespace StructureHelper.Infrastructure.UI.Converters
{ {
internal static class CommonOperation internal static class CommonOperation
{ {
private static IEnumerable<IUnit> units = UnitsFactory.GetUnitCollection();
public static double ConvertToDoubleChangeComma(string s) public static double ConvertToDoubleChangeComma(string s)
{ {
double result; double result;
@@ -26,6 +32,7 @@ namespace StructureHelper.Infrastructure.UI.Converters
public static IStringDoublePair DivideIntoStringDoublePair(string s) public static IStringDoublePair DivideIntoStringDoublePair(string s)
{ {
s = s.Replace(" ", "");
string digitPattern = @"\d+(\.?|\,?)\d+"; string digitPattern = @"\d+(\.?|\,?)\d+";
string textPattern = @"[0-9]|\.|\,"; string textPattern = @"[0-9]|\.|\,";
string caracterPattern = "[a-z]+$"; string caracterPattern = "[a-z]+$";
@@ -43,5 +50,51 @@ namespace StructureHelper.Infrastructure.UI.Converters
} }
throw new StructureHelperException(ErrorStrings.DataIsInCorrect); 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.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
@@ -11,33 +13,8 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{ {
internal class Area : UnitBase 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 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.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
@@ -10,35 +12,8 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{ {
internal class Force : UnitBase 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 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -14,60 +15,8 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{ {
internal class Length : UnitBase internal class Length : UnitBase
{ {
private IEnumerable<IUnit> units = UnitsFactory.GetUnitCollection(); public override UnitTypes unitType { get => UnitTypes.Length; }
private UnitTypes type = UnitTypes.Length; public override IUnit currentUnit { get => CommonOperation.GetUnit(unitType, "mm"); }
private IUnit currentUnit => units.Where(u => u.UnitType == type & u.Name == "mm").Single(); public override string unitName { get => "Length"; }
public override string MeasureUnit => currentUnit.Name;
private double coeffficient => currentUnit.Multiplyer;
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.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
@@ -10,35 +12,8 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{ {
internal class Stress : UnitBase 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 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.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
@@ -10,9 +12,17 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{ {
internal abstract class UnitBase : IValueConverter internal abstract class UnitBase : IValueConverter
{ {
public abstract UnitTypes unitType { get; }
public abstract IUnit currentUnit { get; }
public abstract string unitName { get;} public abstract string unitName { get;}
public abstract string MeasureUnit { get; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public abstract object Convert(object value, Type targetType, object parameter, CultureInfo culture); {
public abstract object ConvertBack(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; primitive.Area = value;
OnPropertyChanged(nameof(Area)); OnPropertyChanged(nameof(Area));
OnPropertyChanged(nameof(Diameter)); 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"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="Name: "/> <TextBlock Text="Name: " FontWeight="Bold"/>
<TextBlock Grid.Column="1" Text="{Binding Name}"/> <TextBlock Grid.Column="1" Text="{Binding Name}" FontWeight="Bold"/>
<TextBlock Grid.Row="1" Text="Material Name: "/> <TextBlock Grid.Row="1" Text="Material Name: " FontWeight="Bold"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding HeadMaterial.Name}"/> <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding HeadMaterial.Name}" FontWeight="Bold"/>
<TextBlock Grid.Row="2" Text="Center X: "/> <TextBlock Grid.Row="2" Text="Center X: "/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}}"/> <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}}"/>
<TextBlock Grid.Row="3" Text="Center Y: "/> <TextBlock Grid.Row="3" Text="Center Y: "/>

View File

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

View File

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

View File

@@ -26,6 +26,14 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
<Setter Property="Opacity" Value="{Binding Opacity, Mode=TwoWay}"/> <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>
<Style x:Key="EllipseStyle" TargetType="Ellipse" BasedOn="{StaticResource ShapeStyle}"> <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\IStringDoublePair.cs" />
<Compile Include="Infrastructure\UI\Converters\StringDoublePair.cs" /> <Compile Include="Infrastructure\UI\Converters\StringDoublePair.cs" />
<Compile Include="Infrastructure\UI\Converters\Units\Area.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\Stress.cs" />
<Compile Include="Infrastructure\UI\Converters\Units\Force.cs" /> <Compile Include="Infrastructure\UI\Converters\Units\Force.cs" />
<Compile Include="Infrastructure\UI\Converters\Units\Length.cs" /> <Compile Include="Infrastructure\UI\Converters\Units\Length.cs" />

View File

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

View File

@@ -12,6 +12,7 @@ namespace StructureHelperCommon.Infrastructures.Enums
Area, Area,
Stress, Stress,
Force, 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 public interface ICenterShape
{ {
ICenter Center {get;} IPoint2D Center {get;}
IShape Shape { get;} IShape Shape { get;}
} }
} }

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
namespace StructureHelperCommon.Models.Shapes namespace StructureHelperCommon.Models.Shapes
{ {
/// <inheritdoc /> /// <inheritdoc />
public class Center : ICenter public class Point2D : IPoint2D
{ {
/// <inheritdoc /> /// <inheritdoc />
public double X { get; set; } 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 = "mm", Multiplyer = 1e3d });
units.Add(new Unit() { UnitType = type, Name = "cm", Multiplyer = 1e2d }); units.Add(new Unit() { UnitType = type, Name = "cm", Multiplyer = 1e2d });
units.Add(new Unit() { UnitType = type, Name = "km", Multiplyer = 1e-3d }); 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; type = UnitTypes.Stress;
units.Add(new Unit() { UnitType = type, Name = "Pa", Multiplyer = 1d }); 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 = "kPa", Multiplyer = 1e-3d });
units.Add(new Unit() { UnitType = type, Name = "MPa", Multiplyer = 1e-6d }); 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; return units;
} }
} }

View File

@@ -55,8 +55,15 @@
<Compile Include="Infrastructures\Interfaces\ISaveable.cs" /> <Compile Include="Infrastructures\Interfaces\ISaveable.cs" />
<Compile Include="Infrastructures\Strings\ErrorString.cs" /> <Compile Include="Infrastructures\Strings\ErrorString.cs" />
<Compile Include="Infrastructures\Enums\MaterialTypes.cs" /> <Compile Include="Infrastructures\Enums\MaterialTypes.cs" />
<Compile Include="Models\Shapes\Center.cs" /> <Compile Include="Models\Calculators\IHelperCalculator.cs" />
<Compile Include="Models\Shapes\ICenter.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\ICenterShape.cs" />
<Compile Include="Models\Shapes\ICircle.cs" /> <Compile Include="Models\Shapes\ICircle.cs" />
<Compile Include="Models\Shapes\ILineShape.cs" /> <Compile Include="Models\Shapes\ILineShape.cs" />
@@ -73,5 +80,6 @@
<Compile Include="Services\Units\Unit.cs" /> <Compile Include="Services\Units\Unit.cs" />
<Compile Include="Services\Units\UnitsFactory.cs" /> <Compile Include="Services\Units\UnitsFactory.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -20,7 +20,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public IEnumerable<INdm> GetNdmCollection(IMaterial material) public IEnumerable<INdm> GetNdmCollection(IMaterial material)
{ {
IPointTriangulationLogicOptions options = Options as IPointTriangulationLogicOptions; IPointTriangulationLogicOptions options = Options as IPointTriangulationLogicOptions;
ICenter center = options.Center; IPoint2D center = options.Center;
double area = options.Area; double area = options.Area;
List<INdm> ndmCollection = new List<INdm>(); List<INdm> ndmCollection = new List<INdm>();
INdm ndm = new Ndm { CenterX = center.X, CenterY = center.Y, Area = area, Material = material }; 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>
/// ///
/// </summary> /// </summary>
public ICenter Center { get; } public IPoint2D Center { get; }
/// <inheritdoc /> /// <inheritdoc />
public double Area { get; } public double Area { get; }
/// <inheritdoc /> /// <inheritdoc />
@@ -24,7 +24,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
/// <inheritdoc /> /// <inheritdoc />
public double PrestrainEpsZ { get; } public double PrestrainEpsZ { get; }
public PointTriangulationLogicOptions(ICenter center, double area) public PointTriangulationLogicOptions(IPoint2D center, double area)
{ {
Center = center; Center = center;
Area = area; Area = area;
@@ -32,7 +32,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public PointTriangulationLogicOptions(IPointPrimitive primitive) 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; Area = primitive.Area;
PrestrainKx = primitive.PrestrainKx; PrestrainKx = primitive.PrestrainKx;
PrestrainKy = primitive.PrestrainKy; PrestrainKy = primitive.PrestrainKy;

View File

@@ -11,7 +11,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public class RectangleTriangulationLogicOptions : IRectangleTriangulationLogicOptions public class RectangleTriangulationLogicOptions : IRectangleTriangulationLogicOptions
{ {
/// <inheritdoc /> /// <inheritdoc />
public ICenter Center { get; } public IPoint2D Center { get; }
/// <inheritdoc /> /// <inheritdoc />
public IRectangleShape Rectangle { get; } public IRectangleShape Rectangle { get; }
/// <inheritdoc /> /// <inheritdoc />
@@ -25,7 +25,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
/// <inheritdoc /> /// <inheritdoc />
public double PrestrainEpsZ { get;} 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; Center = center;
Rectangle = rectangle; Rectangle = rectangle;
@@ -35,7 +35,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public RectangleTriangulationLogicOptions(IRectanglePrimitive primitive) public RectangleTriangulationLogicOptions(IRectanglePrimitive primitive)
{ {
Center = new Center() { X = primitive.CenterX, Y = primitive.CenterY }; Center = new Point2D() { X = primitive.CenterX, Y = primitive.CenterY };
Rectangle = primitive; Rectangle = primitive;
NdmMaxSize = primitive.NdmMaxSize; NdmMaxSize = primitive.NdmMaxSize;
NdmMinDivision = primitive.NdmMinDivision; 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 }; ITriangulationOptions options = new TriangulationOptions { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
var ndmPrimitives = new List<INdmPrimitive>(); 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()); ndmPrimitives.Add(concreteRectangle.GetNdmPrimitive());
//Добавляем 4 точки для арматуры //Добавляем 4 точки для арматуры
// 0.05 - величина защитного слоя (расстояние от грани прямоугольника до центра арматуры // 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()); 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()); 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()); 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()); ndmPrimitives.Add(rightTopReinforcementPoint.GetNdmPrimitive());
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию) //Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
ndmCollection.AddRange(Triangulation.GetNdms(ndmPrimitives, options)); 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) private IEnumerable<INdmPrimitive> GetConcreteNdms(double width, double height)
{ {
double strength = 40e6; 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 }; IRectangleShape rectangle = new RectangleShape { Width = width, Height = height, Angle = 0 };
IPrimitiveMaterial material = new PrimitiveMaterial { MaterialType = MaterialTypes.Concrete, ClassName = "С40", Strength = strength }; 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 }; //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 }; IShape bottomReinforcement = new PointShape { Area = bottomArea };
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength }; 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 }; //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 }; IPoint2D centerRT = new Point2D { X = width / 2 - gap, Y = height / 2 - gap };
ICenter centerLT = new Center { X = - (width / 2 - gap), Y = height / 2 - gap }; IPoint2D centerLT = new Point2D { X = - (width / 2 - gap), Y = height / 2 - gap };
ICenter centerRB = new Center { X = width / 2 - gap, Y = - (height / 2 - gap) }; IPoint2D centerRB = new Point2D { X = width / 2 - gap, Y = - (height / 2 - gap) };
ICenter centerLB = new Center { 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>(); List<INdmPrimitive> primitives = new List<INdmPrimitive>();
INdmPrimitive primitive; INdmPrimitive primitive;
//Right top bar //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) public void Run_ShouldPass(double width, double height, double strength, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
{ {
//Arrange //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 }; IRectangleShape rectangle = new RectangleShape { Width = width, Height = height, Angle = 0 };
IPrimitiveMaterial material = new PrimitiveMaterial { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength }; 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 }; 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 //Arrange
IMaterial material = new Material(); 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 }; IRectangleShape rectangle = new RectangleShape { Width = width, Height = height, Angle = angle };
IRectangleTriangulationLogicOptions options = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogicOptions(center, rectangle, ndmMaxSize, ndmMinDivision); IRectangleTriangulationLogicOptions options = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogicOptions(center, rectangle, ndmMaxSize, ndmMinDivision);
IRectangleTriangulationLogic logic = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogic(options); IRectangleTriangulationLogic logic = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogic(options);

View File

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

View File

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

View File

@@ -25,8 +25,8 @@
</DataGrid.RowStyle> </DataGrid.RowStyle>
<DataGrid.Columns> <DataGrid.Columns>
<DataGridCheckBoxColumn Header="Valid" Binding="{Binding Path=IsValid}"/> <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 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 ForceConverter}}"/> <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="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="Accuracy" Width="90" Binding="{Binding Path=LoaderResults.AccuracyRate}"/>
<DataGridTextColumn Header="Max Iteration" Width="90" Binding="{Binding Path=LoaderResults.IterationCounter}"/> <DataGridTextColumn Header="Max Iteration" Width="90" Binding="{Binding Path=LoaderResults.IterationCounter}"/>

View File

@@ -52,7 +52,7 @@
<Button Content="Concrete slab" Command="{Binding AddSlabCase}"/> <Button Content="Concrete slab" Command="{Binding AddSlabCase}"/>
</MenuItem> </MenuItem>
</MenuItem> </MenuItem>
<MenuItem Header="Analisys"> <MenuItem Header="Analysis">
<Button Content="Solve problem" Command="{Binding Path=Calculate}"/> <Button Content="Solve problem" Command="{Binding Path=Calculate}"/>
</MenuItem> </MenuItem>
</Menu> </Menu>
@@ -206,7 +206,16 @@
</Grid> </Grid>
<StatusBar Grid.Row="2"> <StatusBar Grid.Row="2">
<StatusBarItem> <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> </StatusBarItem>
</StatusBar> </StatusBar>
</Grid> </Grid>

View File

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

View File

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