diff --git a/App.xaml b/App.xaml
index 222cb68..bf23a8c 100644
--- a/App.xaml
+++ b/App.xaml
@@ -7,6 +7,7 @@
+
diff --git a/FieldVisualizer/ViewModels/FieldViewerViewModels/FieldViewerViewModel.cs b/FieldVisualizer/ViewModels/FieldViewerViewModels/FieldViewerViewModel.cs
index 78bb55d..ceddfa4 100644
--- a/FieldVisualizer/ViewModels/FieldViewerViewModels/FieldViewerViewModel.cs
+++ b/FieldVisualizer/ViewModels/FieldViewerViewModels/FieldViewerViewModel.cs
@@ -160,6 +160,7 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
private double crossLineY;
private double sumAboveLine;
private double sumUnderLine;
+ private Line previosLine;
const int RangeNumber = 16;
public FieldViewerViewModel()
@@ -311,16 +312,16 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
if (crossLineX == 0d)
{
line.X1 = - width / 2d - dX;
- line.Y1 = - crossLineY - dY;
+ line.Y1 = - crossLineY + dY;
line.X2 = width / 2d - dX;
- line.Y2 = - crossLineY - dY;
+ line.Y2 = - crossLineY + dY;
}
else if (crossLineY == 0d)
{
line.X1 = crossLineX - dX;
- line.Y1 = heigth / 2 - dY;
+ line.Y1 = heigth / 2 + dY;
line.X2 = crossLineX - dX;
- line.Y2 = -heigth / 2 - dY;
+ line.Y2 = -heigth / 2 + dY;
}
else
{
@@ -334,6 +335,12 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
line.Fill = brush;
line.Stroke = brush;
line.StrokeThickness = (width + heigth) / 100;
+ if (previosLine != null)
+ {
+ try { WorkPlaneCanvas.Children.Remove(previosLine);}
+ catch (Exception) {}
+ }
+ previosLine = line;
WorkPlaneCanvas.Children.Add(line);
}
private double GetPointOfCrossLine(double x)
diff --git a/Infrastructure/UI/Converters/Units/Area.cs b/Infrastructure/UI/Converters/Units/Area.cs
index b4bce4f..bf813df 100644
--- a/Infrastructure/UI/Converters/Units/Area.cs
+++ b/Infrastructure/UI/Converters/Units/Area.cs
@@ -17,7 +17,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
double val;
if (value != null) { val = (double)value; }
else { throw new Exception($"{unitName} value is null"); }
- val *= UnitConstatnts.LengthConstant * UnitConstatnts.LengthConstant;
+ val *= UnitConstatnts.Length * UnitConstatnts.Length;
return val;
}
@@ -30,7 +30,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
double.TryParse(strVal, out val);
}
else { throw new Exception($"{unitName} value is null"); }
- val /= (UnitConstatnts.LengthConstant * UnitConstatnts.LengthConstant);
+ val /= (UnitConstatnts.Length * UnitConstatnts.Length);
return val;
}
}
diff --git a/Infrastructure/UI/Converters/Units/Force.cs b/Infrastructure/UI/Converters/Units/Force.cs
new file mode 100644
index 0000000..43d250a
--- /dev/null
+++ b/Infrastructure/UI/Converters/Units/Force.cs
@@ -0,0 +1,39 @@
+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 Force : UnitBase
+ {
+ private double coeffficient = UnitConstatnts.Force;
+
+ public override string unitName { get => "Force"; }
+
+ 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;
+ if (value != null)
+ {
+ var strVal = value as string;
+ double.TryParse(strVal, out val);
+ }
+ else { throw new Exception($"{unitName} value is null"); }
+ val /= coeffficient;
+ return val;
+ }
+ }
+}
diff --git a/Infrastructure/UI/Converters/Units/Length.cs b/Infrastructure/UI/Converters/Units/Length.cs
index f8e1805..12006b0 100644
--- a/Infrastructure/UI/Converters/Units/Length.cs
+++ b/Infrastructure/UI/Converters/Units/Length.cs
@@ -17,7 +17,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
double val;
if (value != null) { val = (double)value; }
else { throw new Exception($"{unitName} value is null"); }
- val *= UnitConstatnts.LengthConstant;
+ val *= UnitConstatnts.Length;
return val;
}
@@ -30,7 +30,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
double.TryParse(strVal, out val);
}
else { throw new Exception($"{unitName} value is null"); }
- val /= UnitConstatnts.LengthConstant;
+ val /= UnitConstatnts.Length;
return val;
}
}
diff --git a/Infrastructure/UI/Converters/Units/Stress.cs b/Infrastructure/UI/Converters/Units/Stress.cs
new file mode 100644
index 0000000..6291955
--- /dev/null
+++ b/Infrastructure/UI/Converters/Units/Stress.cs
@@ -0,0 +1,39 @@
+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 Stress : UnitBase
+ {
+ private double coeffficient = UnitConstatnts.Stress;
+
+ public override string unitName { get => "Stress"; }
+
+ 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;
+ if (value != null)
+ {
+ var strVal = value as string;
+ double.TryParse(strVal, out val);
+ }
+ else { throw new Exception($"{unitName} value is null"); }
+ val /= coeffficient;
+ return val;
+ }
+ }
+}
diff --git a/Infrastructure/UI/Converters/Units/UnitConstatnts.cs b/Infrastructure/UI/Converters/Units/UnitConstatnts.cs
index aa99c9a..26e085b 100644
--- a/Infrastructure/UI/Converters/Units/UnitConstatnts.cs
+++ b/Infrastructure/UI/Converters/Units/UnitConstatnts.cs
@@ -8,6 +8,8 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{
internal static class UnitConstatnts
{
- public static double LengthConstant = 1000d;
+ public static double Length = 1e3d;
+ public static double Force = 1e-3d;
+ public static double Stress = 1e-6d;
}
}
diff --git a/Infrastructure/UI/DataContexts/PrimitiveBase.cs b/Infrastructure/UI/DataContexts/PrimitiveBase.cs
index 2d82ceb..30619a5 100644
--- a/Infrastructure/UI/DataContexts/PrimitiveBase.cs
+++ b/Infrastructure/UI/DataContexts/PrimitiveBase.cs
@@ -337,12 +337,12 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
{
if (this is Rectangle)
{
- X = showedX + OwnerVm.YX1 / UnitConstatnts.LengthConstant;
+ X = showedX + OwnerVm.YX1 / UnitConstatnts.Length;
}
else if (this is Point)
{
Point point = this as Point;
- X = showedX + OwnerVm.YX1 / UnitConstatnts.LengthConstant;
+ X = showedX + OwnerVm.YX1 / UnitConstatnts.Length;
}
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); }
}
@@ -350,12 +350,12 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
{
if (this is Rectangle)
{
- Y = -showedY + OwnerVm.XY1 / UnitConstatnts.LengthConstant - PrimitiveHeight;
+ Y = -showedY + OwnerVm.XY1 / UnitConstatnts.Length - PrimitiveHeight;
}
else if (this is Point)
{
Point point = this as Point;
- Y = -showedY + OwnerVm.XY1 / UnitConstatnts.LengthConstant - point.Diameter;
+ Y = -showedY + OwnerVm.XY1 / UnitConstatnts.Length - point.Diameter;
}
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); }
}
diff --git a/Infrastructure/UI/Resources/Converters.xaml b/Infrastructure/UI/Resources/Converters.xaml
new file mode 100644
index 0000000..fa0fe35
--- /dev/null
+++ b/Infrastructure/UI/Resources/Converters.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Services/ResultViewers/IResultFunc.cs b/Services/ResultViewers/IResultFunc.cs
index a42b8b0..21110f5 100644
--- a/Services/ResultViewers/IResultFunc.cs
+++ b/Services/ResultViewers/IResultFunc.cs
@@ -12,5 +12,6 @@ namespace StructureHelper.Services.ResultViewers
{
string Name { get; }
Func ResultFunction { get; }
+ double UnitFactor { get; }
}
}
diff --git a/Services/ResultViewers/ResultFunc.cs b/Services/ResultViewers/ResultFunc.cs
index e9812fb..d0b624c 100644
--- a/Services/ResultViewers/ResultFunc.cs
+++ b/Services/ResultViewers/ResultFunc.cs
@@ -12,5 +12,11 @@ namespace StructureHelper.Services.ResultViewers
{
public string Name { get; set; }
public Func ResultFunction { get; set; }
+ public double UnitFactor { get; set; }
+
+ public ResultFunc()
+ {
+ UnitFactor = 1d;
+ }
}
}
diff --git a/Services/ResultViewers/ResultFuncFactory.cs b/Services/ResultViewers/ResultFuncFactory.cs
index 5d10202..dd4a280 100644
--- a/Services/ResultViewers/ResultFuncFactory.cs
+++ b/Services/ResultViewers/ResultFuncFactory.cs
@@ -1,4 +1,5 @@
using LoaderCalculator.Logics;
+using StructureHelper.Infrastructure.UI.Converters.Units;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -17,12 +18,12 @@ namespace StructureHelper.Services.ResultViewers
resultFuncs.Add(new ResultFunc() { Name = "Total Strain with prestrain", ResultFunction = stressLogic.GetTotalStrainWithPresrain });
resultFuncs.Add(new ResultFunc() { Name = "Elastic Strain", ResultFunction = stressLogic.GetElasticStrain });
resultFuncs.Add(new ResultFunc() { Name = "Plastic Strain", ResultFunction = stressLogic.GetPlasticStrain });
- resultFuncs.Add(new ResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress });
- resultFuncs.Add(new ResultFunc() { Name = "Secant modulus", ResultFunction = stressLogic.GetSecantModulus });
+ resultFuncs.Add(new ResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress, UnitFactor = UnitConstatnts.Stress });
+ resultFuncs.Add(new ResultFunc() { Name = "Secant modulus", ResultFunction = stressLogic.GetSecantModulus, UnitFactor = UnitConstatnts.Stress });
resultFuncs.Add(new ResultFunc() { Name = "Modulus degradation", ResultFunction = stressLogic.GetModulusDegradation });
- resultFuncs.Add(new ResultFunc() { Name = "Force", ResultFunction = stressLogic.GetForce });
- resultFuncs.Add(new ResultFunc() { Name = "Moment X", ResultFunction = stressLogic.GetMomentX });
- resultFuncs.Add(new ResultFunc() { Name = "Moment Y", ResultFunction = stressLogic.GetMomentY });
+ resultFuncs.Add(new ResultFunc() { Name = "Force", ResultFunction = stressLogic.GetForce, UnitFactor = UnitConstatnts.Force });
+ resultFuncs.Add(new ResultFunc() { Name = "Moment X", ResultFunction = stressLogic.GetMomentX, UnitFactor = UnitConstatnts.Force });
+ resultFuncs.Add(new ResultFunc() { Name = "Moment Y", ResultFunction = stressLogic.GetMomentY, UnitFactor = UnitConstatnts.Force });
return resultFuncs;
}
}
diff --git a/Services/ResultViewers/ShowIsoFieldResult.cs b/Services/ResultViewers/ShowIsoFieldResult.cs
index 2beef02..035fc76 100644
--- a/Services/ResultViewers/ShowIsoFieldResult.cs
+++ b/Services/ResultViewers/ShowIsoFieldResult.cs
@@ -29,7 +29,7 @@ namespace StructureHelper.Services.ResultViewers
List primitives = new List();
foreach (INdm ndm in ndms)
{
- double val = valDelegate.ResultFunction.Invoke(strainMatrix, ndm);
+ double val = valDelegate.ResultFunction.Invoke(strainMatrix, ndm) * valDelegate.UnitFactor;
IValuePrimitive valuePrimitive;
if (ndm is IRectangleNdm)
{
diff --git a/StructureHelper.csproj b/StructureHelper.csproj
index 0d581ab..dfc1102 100644
--- a/StructureHelper.csproj
+++ b/StructureHelper.csproj
@@ -135,6 +135,8 @@
+
+
@@ -229,6 +231,10 @@
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/Windows/CalculationWindows/CalculationPropertyWindow/CalculationPropertyView.xaml b/Windows/CalculationWindows/CalculationPropertyWindow/CalculationPropertyView.xaml
index 8c34bce..1165519 100644
--- a/Windows/CalculationWindows/CalculationPropertyWindow/CalculationPropertyView.xaml
+++ b/Windows/CalculationWindows/CalculationPropertyWindow/CalculationPropertyView.xaml
@@ -35,9 +35,9 @@
SelectedItem="{Binding Path=SelectedCombination}">
-
-
-
+
+
+
diff --git a/Windows/CalculationWindows/CalculationResultWindow/CalculationResultView.xaml b/Windows/CalculationWindows/CalculationResultWindow/CalculationResultView.xaml
index ec25856..a40b5b8 100644
--- a/Windows/CalculationWindows/CalculationResultWindow/CalculationResultView.xaml
+++ b/Windows/CalculationWindows/CalculationResultWindow/CalculationResultView.xaml
@@ -25,12 +25,15 @@
-
-
-
+
+
+
+
+
+
diff --git a/Windows/MainWindow/MainViewModel.cs b/Windows/MainWindow/MainViewModel.cs
index f6cadd6..fac1610 100644
--- a/Windows/MainWindow/MainViewModel.cs
+++ b/Windows/MainWindow/MainViewModel.cs
@@ -287,7 +287,7 @@ namespace StructureHelper.Windows.MainWindow
Primitives.Add(primitive);
PrimitiveRepository.Add(primitive);
}
- AddCaseLoads(50e3d, 50e3d, 0d);
+ AddCaseLoads(-50e3d, 50e3d, 0d);
});
AddColumnCase = new RelayCommand(o =>
@@ -454,11 +454,11 @@ namespace StructureHelper.Windows.MainWindow
double[] xs = new double[] { -width / 2 + gap, width / 2 - gap };
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
- yield return new Rectangle(width, height, 0, 0, this) { HeadMaterial = concrete };
- yield return new Point(area1, xs[0], ys[0], this) { HeadMaterial = reinforcement };
- yield return new Point(area1, xs[1], ys[0], this) { HeadMaterial = reinforcement };
- yield return new Point(area2, xs[0], ys[1], this) { HeadMaterial = reinforcement };
- yield return new Point(area2, xs[1], ys[1], this) { HeadMaterial = reinforcement };
+ yield return new Rectangle(width, height, 0, 0, this) { HeadMaterial = concrete, Name = "Concrete block" };
+ yield return new Point(area1, xs[0], ys[0], this) { HeadMaterial = reinforcement, Name = "Left bottom point" };
+ yield return new Point(area1, xs[1], ys[0], this) { HeadMaterial = reinforcement, Name = "Right bottom point" };
+ yield return new Point(area2, xs[0], ys[1], this) { HeadMaterial = reinforcement, Name = "Left top point" };
+ yield return new Point(area2, xs[1], ys[1], this) { HeadMaterial = reinforcement, Name = "Right top point" };
if (template.WidthCount > 2)
{
@@ -466,8 +466,8 @@ namespace StructureHelper.Windows.MainWindow
double dist = (xs[1] - xs[0]) / count;
for (int i = 1; i < count; i++)
{
- yield return new Point(area1, xs[0] + dist * i, ys[0], this) { HeadMaterial = reinforcement };
- yield return new Point(area2, xs[0] + dist * i, ys[1], this) { HeadMaterial = reinforcement };
+ yield return new Point(area1, xs[0] + dist * i, ys[0], this) { HeadMaterial = reinforcement, Name = $"Bottom point {i}" };
+ yield return new Point(area2, xs[0] + dist * i, ys[1], this) { HeadMaterial = reinforcement, Name = $"Top point {i}" };
}
}
@@ -477,8 +477,8 @@ namespace StructureHelper.Windows.MainWindow
double dist = (ys[1] - ys[0]) / count;
for (int i = 1; i < count; i++)
{
- yield return new Point(area1, xs[0], ys[0] + dist * i, this) { HeadMaterial = reinforcement };
- yield return new Point(area1, xs[1], ys[0] + dist * i, this) { HeadMaterial = reinforcement };
+ yield return new Point(area1, xs[0], ys[0] + dist * i, this) { HeadMaterial = reinforcement, Name = $"Left point {i}" };
+ yield return new Point(area1, xs[1], ys[0] + dist * i, this) { HeadMaterial = reinforcement, Name = $"Right point {i}" };
}
}
}
diff --git a/Windows/PrimitiveProperiesWindow/PrimitivePropertiesView.xaml b/Windows/PrimitiveProperiesWindow/PrimitivePropertiesView.xaml
index 573741b..7745310 100644
--- a/Windows/PrimitiveProperiesWindow/PrimitivePropertiesView.xaml
+++ b/Windows/PrimitiveProperiesWindow/PrimitivePropertiesView.xaml
@@ -5,15 +5,10 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StructureHelper.Windows.PrimitiveProperiesWindow"
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.PrimitiveProperties"
- xmlns:convertersCommon ="clr-namespace:StructureHelper.Infrastructure.UI.Converters.Common"
- xmlns:convertersUnits ="clr-namespace:StructureHelper.Infrastructure.UI.Converters.Units"
d:DataContext="{d:DesignInstance vm:PrimitivePropertiesViewModel}"
mc:Ignorable="d"
Title="PrimitiveProperties" Height="450" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
-
-
-