diff --git a/FieldVisualizer/ViewModels/FieldViewerViewModels/FieldViewerViewModel.cs b/FieldVisualizer/ViewModels/FieldViewerViewModels/FieldViewerViewModel.cs
index a4a5efe..78bb55d 100644
--- a/FieldVisualizer/ViewModels/FieldViewerViewModels/FieldViewerViewModel.cs
+++ b/FieldVisualizer/ViewModels/FieldViewerViewModels/FieldViewerViewModel.cs
@@ -198,7 +198,7 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
double sizeX = PrimitiveOperations.GetSizeX(PrimitiveSet.ValuePrimitives);
double sizeY = PrimitiveOperations.GetSizeY(PrimitiveSet.ValuePrimitives);
dX = PrimitiveOperations.GetMinMaxX(PrimitiveSet.ValuePrimitives)[0];
- dY = PrimitiveOperations.GetMinMaxY(PrimitiveSet.ValuePrimitives)[0];
+ dY = PrimitiveOperations.GetMinMaxY(PrimitiveSet.ValuePrimitives)[1];
WorkPlaneCanvas.Width = Math.Abs(sizeX);
WorkPlaneCanvas.Height = Math.Abs(sizeY);
WorkPlaneBox.Width = ScrolWidth - 50;
@@ -260,7 +260,7 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
shape.Tag = valuePrimitive;
shape.Fill = brush;
Canvas.SetLeft(shape, valuePrimitive.CenterX - addX - dX);
- Canvas.SetTop(shape, -valuePrimitive.CenterY - addY - dY);
+ Canvas.SetTop(shape, -valuePrimitive.CenterY - addY + dY);
}
private void Zoom(double coefficient)
{
diff --git a/Infrastructure/Strings/ErrorStrings.cs b/Infrastructure/Strings/ErrorStrings.cs
deleted file mode 100644
index b864870..0000000
--- a/Infrastructure/Strings/ErrorStrings.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace StructureHelper.Infrastructure.Strings
-{
- internal static class ErrorStrings
- {
- public static string ObjectTypeIsUnknown => "#0001: Object type is unknown";
- public static string MaterialTypeIsUnknown => "#0002: Material type is unknown";
- }
-}
diff --git a/Infrastructure/UI/DataContexts/Point.cs b/Infrastructure/UI/DataContexts/Point.cs
index 7b0ab3b..5acd966 100644
--- a/Infrastructure/UI/DataContexts/Point.cs
+++ b/Infrastructure/UI/DataContexts/Point.cs
@@ -44,8 +44,13 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
string materialName = MaterialName;
ICenter center = new Center { X = CenterX, Y = CenterY };
IShape shape = new StructureHelperCommon.Models.Shapes.Point { Area = this.Area };
- IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = Material.DesignCompressiveStrength };
- INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
+ IPrimitiveMaterial primitiveMaterial = GetPrimitiveMaterial();
+ //IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = Material.DesignCompressiveStrength };
+ INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial,
+ PrestrainKx = PrestrainKx,
+ PrestrainKy = PrestrainKy,
+ PrestrainEpsZ = PrestrainEpsZ
+ };
return ndmPrimitive;
}
}
diff --git a/Infrastructure/UI/DataContexts/PrimitiveBase.cs b/Infrastructure/UI/DataContexts/PrimitiveBase.cs
index 03bb9c5..9cf271d 100644
--- a/Infrastructure/UI/DataContexts/PrimitiveBase.cs
+++ b/Infrastructure/UI/DataContexts/PrimitiveBase.cs
@@ -5,21 +5,24 @@ using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using StructureHelper.Infrastructure.Enums;
-using StructureHelper.Infrastructure.Exceptions;
-using StructureHelper.Infrastructure.Strings;
using StructureHelper.Infrastructure.UI.Converters.Units;
using StructureHelper.Models.Materials;
+using StructureHelper.Services.Primitives;
using StructureHelper.UnitSystem.Systems;
using StructureHelper.Windows.MainWindow;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Materials;
+using StructureHelperCommon.Services.ColorServices;
namespace StructureHelper.Infrastructure.UI.DataContexts
{
public abstract class PrimitiveBase : ViewModelBase
{
#region Поля
-
+ private IPrimitiveRepository primitiveRepository;
private readonly PrimitiveType type;
private string name;
private double centerX, centerY;
@@ -31,7 +34,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
private Color color;
private IHeadMaterial headMaterial;
private MaterialDefinitionBase material;
- private double prestrain_kx, prestrain_ky, prestrain_epsz;
+ private double prestrainKx, prestrainKy, prestrainEpsZ;
private double opacity = 1, showedOpacity = 0, x, y, xY1, yX1, primitiveWidth, primitiveHeight, showedX, showedY;
protected double delta = 0.5;
private int showedZIndex = 1, zIndex;
@@ -52,6 +55,8 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
}
}
+ public IPrimitiveRepository PrimitiveRepository => primitiveRepository;
+
public string Name
{
get => name;
@@ -96,6 +101,9 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
OnPropertyChanged(value, ref centerY);
}
}
+ public double PrestrainKx { get; set; }
+ public double PrestrainKy { get; set; }
+ public double PrestrainEpsZ { get; set; }
public IHeadMaterial HeadMaterial
{
@@ -103,6 +111,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
set
{
OnPropertyChanged(value, ref headMaterial);
+ OnPropertyChanged(nameof(Color));
}
}
@@ -113,7 +122,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
}
public Color Color
{
- get => setMaterialColor? headMaterial.Color :color;
+ get => ((setMaterialColor == true) & (headMaterial !=null))? headMaterial.Color :color;
set
{
SetMaterialColor = false;
@@ -285,10 +294,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
this.type = type;
X = ownerVM.YX1 + x;
Y = ownerVM.XY1 + y;
- var randomR = new Random(new Random((int)DateTime.Now.Ticks % 1000).Next(50)).Next(0, 255);
- var randomG = new Random(new Random((int)DateTime.Now.Ticks % 200).Next(100, 200)).Next(0, 255);
- var randomB = new Random(new Random((int)DateTime.Now.Ticks % 50).Next(500, 1000)).Next(0, 255);
- color = Color.FromRgb((byte)randomR, (byte)randomG, (byte)randomB);
+ color = ColorProcessor.GetRandomColor();
PrimitiveLeftButtonUp = new RelayCommand(o => Captured = false);
PrimitiveLeftButtonDown = new RelayCommand(o => Captured = true);
@@ -302,6 +308,9 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
});
OwnerVm = ownerVM;
SetMaterialColor = true;
+ PrestrainKx = 0;
+ PrestrainKy = 0;
+ PrestrainEpsZ = 0;
}
protected readonly MainViewModel OwnerVm;
@@ -342,5 +351,9 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
else { throw new StructureHelperException(ErrorStrings.MaterialTypeIsUnknown); }
return materialTypes;
}
+ public IPrimitiveMaterial GetPrimitiveMaterial()
+ {
+ return HeadMaterial.HelperMaterial.GetPrimitiveMaterial();
+ }
}
}
diff --git a/Infrastructure/UI/DataContexts/Rectangle.cs b/Infrastructure/UI/DataContexts/Rectangle.cs
index c10a57b..aa95efd 100644
--- a/Infrastructure/UI/DataContexts/Rectangle.cs
+++ b/Infrastructure/UI/DataContexts/Rectangle.cs
@@ -47,11 +47,16 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
var height = PrimitiveHeight;
double centerX = CenterX;
double centerY = CenterY;
- string materialName = MaterialName;
ICenter center = new Center { X = centerX, Y = centerY };
IShape shape = new StructureHelperCommon.Models.Shapes.Rectangle { Height = height, Width = width, Angle = 0 };
- IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = Material.DesignCompressiveStrength };
- INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial, NdmMaxSize = MaxElementSize, NdmMinDivision = MinElementDivision };
+ IPrimitiveMaterial primitiveMaterial = GetPrimitiveMaterial();
+ //IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = Material.DesignCompressiveStrength };
+ INdmPrimitive ndmPrimitive = new NdmPrimitive
+ { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial,
+ NdmMaxSize = MaxElementSize, NdmMinDivision = MinElementDivision,
+ PrestrainKx = PrestrainKx,
+ PrestrainKy = PrestrainKy,
+ PrestrainEpsZ = PrestrainEpsZ };
return ndmPrimitive;
}
}
diff --git a/Models/Materials/HeadMaterial.cs b/Models/Materials/HeadMaterial.cs
deleted file mode 100644
index 672d532..0000000
--- a/Models/Materials/HeadMaterial.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Media;
-
-namespace StructureHelper.Models.Materials
-{
- public class HeadMaterial : IHeadMaterial
- {
- public string Name { get; set; }
- public Color Color { get; set; }
- public MaterialDefinitionBase Material { get; set; }
-
- public HeadMaterial()
- {
- Thread.Sleep(100);
- var randomR = new Random(new Random((int)DateTime.Now.Ticks % 1000).Next(50)).Next(0, 255);
- var randomG = new Random(new Random((int)DateTime.Now.Ticks % 200).Next(100, 200)).Next(0, 255);
- var randomB = new Random(new Random((int)DateTime.Now.Ticks % 50).Next(500, 1000)).Next(0, 255);
- Color = Color.FromRgb((byte)randomR, (byte)randomG, (byte)randomB);
- }
- }
-}
diff --git a/StructureHelper.csproj b/StructureHelper.csproj
index 62157ed..16ba3d4 100644
--- a/StructureHelper.csproj
+++ b/StructureHelper.csproj
@@ -93,6 +93,7 @@
packages\System.Diagnostics.DiagnosticSource.6.0.0\lib\net461\System.Diagnostics.DiagnosticSource.dll
True
+
packages\System.Memory.4.5.5\lib\net461\System.Memory.dll
True
@@ -132,8 +133,6 @@
Designer
-
-
@@ -142,8 +141,6 @@
PrimitivePopup.xaml
-
-
@@ -276,7 +273,7 @@
-
+
diff --git a/StructureHelper.sln b/StructureHelper.sln
index 9096489..dd8c1da 100644
--- a/StructureHelper.sln
+++ b/StructureHelper.sln
@@ -11,6 +11,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperTests", "Str
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureHelperLogics", "StructureHelperLogics\StructureHelperLogics.csproj", "{330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}"
+ ProjectSection(ProjectDependencies) = postProject
+ {5DFEC3FD-9677-47BB-9E88-EB71828B5913} = {5DFEC3FD-9677-47BB-9E88-EB71828B5913}
+ EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperCommon", "StructureHelperCommon\StructureHelperCommon.csproj", "{5DFEC3FD-9677-47BB-9E88-EB71828B5913}"
EndProject
diff --git a/StructureHelperCommon/Infrastructures/Enums/CodeTypes.cs b/StructureHelperCommon/Infrastructures/Enums/CodeTypes.cs
new file mode 100644
index 0000000..66213b9
--- /dev/null
+++ b/StructureHelperCommon/Infrastructures/Enums/CodeTypes.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperCommon.Infrastructures.Enums
+{
+ public enum CodeTypes
+ {
+ SP63_13330_2018,
+ EuroCode_2_1990
+ }
+}
diff --git a/StructureHelperCommon/Models/Materials/MaterialTypes.cs b/StructureHelperCommon/Infrastructures/Enums/MaterialTypes.cs
similarity index 68%
rename from StructureHelperCommon/Models/Materials/MaterialTypes.cs
rename to StructureHelperCommon/Infrastructures/Enums/MaterialTypes.cs
index b53a479..ff4c2ce 100644
--- a/StructureHelperCommon/Models/Materials/MaterialTypes.cs
+++ b/StructureHelperCommon/Infrastructures/Enums/MaterialTypes.cs
@@ -1,4 +1,5 @@
-namespace StructureHelperCommon.Models.Materials
+namespace StructureHelperCommon.Infrastructures.Enums
+
{
public enum MaterialTypes
{
diff --git a/Infrastructure/Exceptions/StructureHelperException.cs b/StructureHelperCommon/Infrastructures/Exceptions/StructureHelperException.cs
similarity index 67%
rename from Infrastructure/Exceptions/StructureHelperException.cs
rename to StructureHelperCommon/Infrastructures/Exceptions/StructureHelperException.cs
index 01d5cd8..9c96b5e 100644
--- a/Infrastructure/Exceptions/StructureHelperException.cs
+++ b/StructureHelperCommon/Infrastructures/Exceptions/StructureHelperException.cs
@@ -4,9 +4,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace StructureHelper.Infrastructure.Exceptions
+namespace StructureHelperCommon.Infrastructures.Exceptions
{
- internal class StructureHelperException : Exception
+ public class StructureHelperException : Exception
{
public StructureHelperException(string errorString) : base(errorString)
{
diff --git a/StructureHelperCommon/Infrastructures/Interfaces/IHasParent.cs b/StructureHelperCommon/Infrastructures/Interfaces/IHasParent.cs
new file mode 100644
index 0000000..99f6895
--- /dev/null
+++ b/StructureHelperCommon/Infrastructures/Interfaces/IHasParent.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperCommon.Infrastructures.Interfaces
+{
+ public interface IHasParent
+ {
+ object Parent { get; }
+ void RegisterParent();
+ }
+}
diff --git a/StructureHelperCommon/Infrastructures/Strings/ErrorString.cs b/StructureHelperCommon/Infrastructures/Strings/ErrorString.cs
new file mode 100644
index 0000000..9684acd
--- /dev/null
+++ b/StructureHelperCommon/Infrastructures/Strings/ErrorString.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperCommon.Infrastructures.Strings
+{
+ public static class ErrorStrings
+ {
+ public static string UnknownError => "#0000: Unknown error";
+ public static string ObjectTypeIsUnknown => "#0001: Object type is unknown";
+ public static string MaterialTypeIsUnknown => "#0002: Material type is unknown";
+ public static string DataIsInCorrect => "#0003: Data is not correct";
+ public static string ShapeIsNotCorrect => "#0004: Shape is not valid";
+ public static string LimitStatesIsNotValid => "#0005: Type of limite state is not valid";
+ public static string LoadTermIsNotValid => "#0006: Load term is not valid";
+ }
+}
diff --git a/StructureHelperCommon/Models/Entities/INdmPrimitive.cs b/StructureHelperCommon/Models/Entities/INdmPrimitive.cs
index 34e29fe..1ddc65a 100644
--- a/StructureHelperCommon/Models/Entities/INdmPrimitive.cs
+++ b/StructureHelperCommon/Models/Entities/INdmPrimitive.cs
@@ -10,5 +10,8 @@ namespace StructureHelperCommon.Models.Entities
IPrimitiveMaterial PrimitiveMaterial {get;set;}
double NdmMaxSize { get; set; }
int NdmMinDivision { get; set; }
+ double PrestrainKx { get; set; }
+ double PrestrainKy { get; set; }
+ double PrestrainEpsZ { get; set; }
}
}
diff --git a/StructureHelperCommon/Models/Entities/NdmPrimitive.cs b/StructureHelperCommon/Models/Entities/NdmPrimitive.cs
index 627c5f7..a837b67 100644
--- a/StructureHelperCommon/Models/Entities/NdmPrimitive.cs
+++ b/StructureHelperCommon/Models/Entities/NdmPrimitive.cs
@@ -10,5 +10,8 @@ namespace StructureHelperCommon.Models.Entities
public IPrimitiveMaterial PrimitiveMaterial { get; set; }
public double NdmMaxSize { get; set; }
public int NdmMinDivision { get; set; }
+ public double PrestrainKx { get; set; }
+ public double PrestrainKy { get; set; }
+ public double PrestrainEpsZ { get; set; }
}
}
diff --git a/StructureHelperCommon/Models/Materials/IPrimitiveMaterial.cs b/StructureHelperCommon/Models/Materials/IPrimitiveMaterial.cs
index 881c4c9..9289b2b 100644
--- a/StructureHelperCommon/Models/Materials/IPrimitiveMaterial.cs
+++ b/StructureHelperCommon/Models/Materials/IPrimitiveMaterial.cs
@@ -1,9 +1,12 @@
-namespace StructureHelperCommon.Models.Materials
+using StructureHelperCommon.Infrastructures.Enums;
+
+namespace StructureHelperCommon.Models.Materials
{
public interface IPrimitiveMaterial
{
string Id { get;}
MaterialTypes MaterialType { get; }
+ CodeTypes CodeType { get; set; }
string ClassName { get; }
double Strength { get; }
}
diff --git a/StructureHelperCommon/Models/Materials/PrimitiveMaterial.cs b/StructureHelperCommon/Models/Materials/PrimitiveMaterial.cs
index c39a763..4a05055 100644
--- a/StructureHelperCommon/Models/Materials/PrimitiveMaterial.cs
+++ b/StructureHelperCommon/Models/Materials/PrimitiveMaterial.cs
@@ -1,4 +1,5 @@
-using System;
+using StructureHelperCommon.Infrastructures.Enums;
+using System;
namespace StructureHelperCommon.Models.Materials
{
@@ -6,9 +7,11 @@ namespace StructureHelperCommon.Models.Materials
{
public string Id { get; }
public MaterialTypes MaterialType { get; set; }
+ public CodeTypes CodeType { get; set; }
public string ClassName { get; set; }
public double Strength { get; set; }
+
public PrimitiveMaterial()
{
Id = Convert.ToString(Guid.NewGuid());
diff --git a/StructureHelperCommon/Models/NdmPrimitives/PointPrimitive.cs b/StructureHelperCommon/Models/NdmPrimitives/PointPrimitive.cs
index 1b7f8ac..d098f2a 100644
--- a/StructureHelperCommon/Models/NdmPrimitives/PointPrimitive.cs
+++ b/StructureHelperCommon/Models/NdmPrimitives/PointPrimitive.cs
@@ -1,4 +1,5 @@
-using StructureHelperCommon.Models.Entities;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Shapes;
diff --git a/StructureHelperCommon/Models/NdmPrimitives/RectanglePrimitive.cs b/StructureHelperCommon/Models/NdmPrimitives/RectanglePrimitive.cs
index 01f72ca..6fb5ea4 100644
--- a/StructureHelperCommon/Models/NdmPrimitives/RectanglePrimitive.cs
+++ b/StructureHelperCommon/Models/NdmPrimitives/RectanglePrimitive.cs
@@ -1,4 +1,5 @@
-using StructureHelperCommon.Models.Entities;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Shapes;
diff --git a/StructureHelperCommon/Services/ColorServices/ColorProcessor.cs b/StructureHelperCommon/Services/ColorServices/ColorProcessor.cs
new file mode 100644
index 0000000..67f7980
--- /dev/null
+++ b/StructureHelperCommon/Services/ColorServices/ColorProcessor.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Windows.Media;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
+
+namespace StructureHelperCommon.Services.ColorServices
+{
+ public static class ColorProcessor
+ {
+ public static Color GetRandomColor()
+ {
+ Thread.Sleep(100);
+ var randomR = new Random(new Random((int)DateTime.Now.Ticks % 1000).Next(50)).Next(0, 255);
+ var randomG = new Random(new Random((int)DateTime.Now.Ticks % 200).Next(100, 200)).Next(0, 255);
+ var randomB = new Random(new Random((int)DateTime.Now.Ticks % 50).Next(500, 1000)).Next(0, 255);
+ return Color.FromRgb((byte)randomR, (byte)randomG, (byte)randomB);
+ }
+ public static void EditColor(ref Color wpfColor)
+ {
+ var winformsColor = System.Drawing.Color.FromArgb(wpfColor.A, wpfColor.R, wpfColor.G, wpfColor.B);
+ ColorDialog dialog = new ColorDialog();
+ dialog.FullOpen = true;
+ dialog.Color = winformsColor;
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ wpfColor = Color.FromArgb(dialog.Color.A, dialog.Color.R, dialog.Color.G, dialog.Color.B);
+ }
+ }
+ }
+}
diff --git a/StructureHelperCommon/StructureHelperCommon.csproj b/StructureHelperCommon/StructureHelperCommon.csproj
index fcc0973..af6a756 100644
--- a/StructureHelperCommon/StructureHelperCommon.csproj
+++ b/StructureHelperCommon/StructureHelperCommon.csproj
@@ -32,8 +32,12 @@
4
+
+
+
+
@@ -42,10 +46,14 @@
+
+
+
+
-
+
@@ -61,6 +69,7 @@
+
\ No newline at end of file
diff --git a/StructureHelperCommon/StructureHelperCommon.csproj.bak b/StructureHelperCommon/StructureHelperCommon.csproj.bak
new file mode 100644
index 0000000..6311dda
--- /dev/null
+++ b/StructureHelperCommon/StructureHelperCommon.csproj.bak
@@ -0,0 +1,69 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {5DFEC3FD-9677-47BB-9E88-EB71828B5913}
+ Library
+ Properties
+ StructureHelperCommon
+ StructureHelperCommon
+ v4.7.2
+ 512
+ true
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StructureHelperLogics/Models/Materials/ElasticMaterial.cs b/StructureHelperLogics/Models/Materials/ElasticMaterial.cs
new file mode 100644
index 0000000..500212d
--- /dev/null
+++ b/StructureHelperLogics/Models/Materials/ElasticMaterial.cs
@@ -0,0 +1,24 @@
+using StructureHelperCommon.Models.Materials;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperLogics.Models.Materials
+{
+ public class ElasticMaterial : IElasticMaterial
+ {
+ public double Modulus { get; set; }
+
+ public object Clone()
+ {
+ return new ElasticMaterial() { Modulus = Modulus };
+ }
+
+ public IPrimitiveMaterial GetPrimitiveMaterial()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/StructureHelperLogics/Models/Materials/Factories/LibMaterialFactory.cs b/StructureHelperLogics/Models/Materials/Factories/LibMaterialFactory.cs
new file mode 100644
index 0000000..a437eef
--- /dev/null
+++ b/StructureHelperLogics/Models/Materials/Factories/LibMaterialFactory.cs
@@ -0,0 +1,105 @@
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Infrastructures.Strings;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperLogics.Models.Materials.Factories
+{
+ public static class LibMaterialFactory
+ {
+ public static List GetLibMaterials(CodeTypes code)
+ {
+ List libMaterials = new List();
+ libMaterials.AddRange(GetConcrete(code));
+ libMaterials.AddRange(GetReinforcement(code));
+ return libMaterials;
+ }
+
+ private static IEnumerable GetReinforcement(CodeTypes code)
+ {
+ if (code == CodeTypes.EuroCode_2_1990)
+ {
+ return GetReinforcementEurocode();
+ }
+ else if (code == CodeTypes.SP63_13330_2018)
+ {
+ return GetReinforcementSP63();
+ }
+ else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); }
+ }
+
+ private static IEnumerable GetConcrete(CodeTypes code)
+ {
+ if (code == CodeTypes.EuroCode_2_1990)
+ {
+ return GetConcreteEurocode();
+ }
+ else if (code == CodeTypes.SP63_13330_2018)
+ {
+ return GetConcreteSP63();
+ }
+ else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); }
+ }
+
+ private static IEnumerable GetConcreteEurocode()
+ {
+ var code = CodeTypes.EuroCode_2_1990;
+ var material = MaterialTypes.Concrete;
+ List libMaterials = new List();
+ libMaterials.Add(new LibMaterial(material, code, "C12", 12e6));
+ libMaterials.Add(new LibMaterial(material, code, "C20", 20e6));
+ libMaterials.Add(new LibMaterial(material, code, "C30", 30e6));
+ libMaterials.Add(new LibMaterial(material, code, "C40", 40e6));
+ libMaterials.Add(new LibMaterial(material, code, "C50", 50e6));
+ libMaterials.Add(new LibMaterial(material, code, "C60", 60e6));
+ libMaterials.Add(new LibMaterial(material, code, "C70", 70e6));
+ libMaterials.Add(new LibMaterial(material, code, "C80", 80e6));
+ return libMaterials;
+ }
+
+ private static IEnumerable GetReinforcementEurocode()
+ {
+ var code = CodeTypes.EuroCode_2_1990;
+ var material = MaterialTypes.Reinforcement;
+ List libMaterials = new List();
+ libMaterials.Add(new LibMaterial(material, code, "S240", 240e6));
+ libMaterials.Add(new LibMaterial(material, code, "S400", 400e6));
+ libMaterials.Add(new LibMaterial(material, code, "S500", 500e6));
+ return libMaterials;
+ }
+
+ private static IEnumerable GetConcreteSP63()
+ {
+ var code = CodeTypes.SP63_13330_2018;
+ var material = MaterialTypes.Concrete;
+ List libMaterials = new List();
+ libMaterials.Add(new LibMaterial(material, code, "B5", 5e6));
+ libMaterials.Add(new LibMaterial(material, code, "B7,5", 7.5e6));
+ libMaterials.Add(new LibMaterial(material, code, "B10", 10e6));
+ libMaterials.Add(new LibMaterial(material, code, "B15", 15e6));
+ libMaterials.Add(new LibMaterial(material, code, "B20", 20e6));
+ libMaterials.Add(new LibMaterial(material, code, "B25", 25e6));
+ libMaterials.Add(new LibMaterial(material, code, "B30", 30e6));
+ libMaterials.Add(new LibMaterial(material, code, "B35", 35e6));
+ libMaterials.Add(new LibMaterial(material, code, "B40", 40e6));
+ libMaterials.Add(new LibMaterial(material, code, "B50", 50e6));
+ libMaterials.Add(new LibMaterial(material, code, "B60", 60e6));
+ return libMaterials;
+ }
+
+ private static IEnumerable GetReinforcementSP63()
+ {
+ var code = CodeTypes.EuroCode_2_1990;
+ var material = MaterialTypes.Reinforcement;
+ List libMaterials = new List();
+ libMaterials.Add(new LibMaterial(material, code, "A240", 240e6));
+ libMaterials.Add(new LibMaterial(material, code, "A400", 400e6));
+ libMaterials.Add(new LibMaterial(material, code, "A500", 500e6));
+ return libMaterials;
+ }
+ }
+}
diff --git a/StructureHelperLogics/Models/Materials/HeadMaterial.cs b/StructureHelperLogics/Models/Materials/HeadMaterial.cs
new file mode 100644
index 0000000..4a4b349
--- /dev/null
+++ b/StructureHelperLogics/Models/Materials/HeadMaterial.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Media;
+using StructureHelperCommon.Services.ColorServices;
+using StructureHelperLogics.Models.Materials;
+
+namespace StructureHelper.Models.Materials
+{
+ public class HeadMaterial : IHeadMaterial
+ {
+ public string Name { get; set; }
+ public Color Color { get; set; }
+ public IHelperMaterial HelperMaterial {get; set;}
+
+ //public MaterialDefinitionBase Material { get; set; }
+
+ public HeadMaterial()
+ {
+ Color = ColorProcessor.GetRandomColor();
+ }
+
+ public object Clone()
+ {
+ IHeadMaterial material = new HeadMaterial
+ {
+ Name = Name,
+ Color = Color,
+ HelperMaterial = HelperMaterial.Clone() as IHelperMaterial
+ };
+ return material;
+ }
+ }
+}
diff --git a/StructureHelperLogics/Models/Materials/HeadMaterialRepository.cs b/StructureHelperLogics/Models/Materials/HeadMaterialRepository.cs
new file mode 100644
index 0000000..fa52826
--- /dev/null
+++ b/StructureHelperLogics/Models/Materials/HeadMaterialRepository.cs
@@ -0,0 +1,35 @@
+using StructureHelper.Models.Materials;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperLogics.Models.Materials
+{
+ public class HeadMaterialRepository : IHeadMaterialRepository
+ {
+ public object Parent { get; private set; }
+
+ public List HeadMaterials { get; set; }
+ public List LibMaterials { get; set; }
+
+ public HeadMaterialRepository()
+ {
+ HeadMaterials = new List();
+ LibMaterials = new List();
+ }
+
+ public HeadMaterialRepository(object parent)
+ {
+ Parent = parent;
+ HeadMaterials = new List();
+ LibMaterials = new List();
+ }
+
+ public void RegisterParent(object obj)
+ {
+ Parent = obj;
+ }
+ }
+}
diff --git a/StructureHelperLogics/Models/Materials/IElasticMaterial.cs b/StructureHelperLogics/Models/Materials/IElasticMaterial.cs
new file mode 100644
index 0000000..d9e34be
--- /dev/null
+++ b/StructureHelperLogics/Models/Materials/IElasticMaterial.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperLogics.Models.Materials
+{
+ public interface IElasticMaterial : IHelperMaterial
+ {
+ double Modulus { get; set; }
+ }
+}
diff --git a/Models/Materials/IHeadMaterial.cs b/StructureHelperLogics/Models/Materials/IHeadMaterial.cs
similarity index 53%
rename from Models/Materials/IHeadMaterial.cs
rename to StructureHelperLogics/Models/Materials/IHeadMaterial.cs
index 0b55d40..830996f 100644
--- a/Models/Materials/IHeadMaterial.cs
+++ b/StructureHelperLogics/Models/Materials/IHeadMaterial.cs
@@ -1,4 +1,5 @@
-using System;
+using StructureHelperLogics.Models.Materials;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,10 +8,11 @@ using System.Windows.Media;
namespace StructureHelper.Models.Materials
{
- public interface IHeadMaterial
+ public interface IHeadMaterial : ICloneable
{
string Name { get; set; }
Color Color { get; set; }
- MaterialDefinitionBase Material { get; set; }
+ IHelperMaterial HelperMaterial { get; set; }
+ //MaterialDefinitionBase Material { get; set; }
}
}
diff --git a/StructureHelperLogics/Models/Materials/IHeadMaterialRepository.cs b/StructureHelperLogics/Models/Materials/IHeadMaterialRepository.cs
new file mode 100644
index 0000000..a11e7bd
--- /dev/null
+++ b/StructureHelperLogics/Models/Materials/IHeadMaterialRepository.cs
@@ -0,0 +1,19 @@
+using StructureHelper.Models.Materials;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml.Serialization;
+
+namespace StructureHelperLogics.Models.Materials
+{
+ public interface IHeadMaterialRepository
+ {
+ object Parent { get; }
+ List HeadMaterials { get; set; }
+ List LibMaterials { get; set; }
+ void RegisterParent(object obj);
+
+ }
+}
diff --git a/StructureHelperLogics/Models/Materials/IHelperMaterial.cs b/StructureHelperLogics/Models/Materials/IHelperMaterial.cs
new file mode 100644
index 0000000..df10795
--- /dev/null
+++ b/StructureHelperLogics/Models/Materials/IHelperMaterial.cs
@@ -0,0 +1,13 @@
+using LoaderCalculator.Data.Materials;
+using StructureHelperCommon.Models.Materials;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.Models.Materials
+{
+ public interface IHelperMaterial : ICloneable
+ {
+ IPrimitiveMaterial GetPrimitiveMaterial();
+ }
+}
diff --git a/StructureHelperLogics/Models/Materials/ILibMaterial.cs b/StructureHelperLogics/Models/Materials/ILibMaterial.cs
new file mode 100644
index 0000000..667f110
--- /dev/null
+++ b/StructureHelperLogics/Models/Materials/ILibMaterial.cs
@@ -0,0 +1,17 @@
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Models.Materials;
+using StructureHelperLogics.Infrastructures.CommonEnums;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.Models.Materials
+{
+ public interface ILibMaterial : IHelperMaterial
+ {
+ MaterialTypes MaterialType { get; set; }
+ CodeTypes CodeType { get; set; }
+ string Name { get; set; }
+ double MainStrength { get; set; }
+ }
+}
diff --git a/StructureHelperLogics/Models/Materials/LibMaterial.cs b/StructureHelperLogics/Models/Materials/LibMaterial.cs
new file mode 100644
index 0000000..4ff2199
--- /dev/null
+++ b/StructureHelperLogics/Models/Materials/LibMaterial.cs
@@ -0,0 +1,73 @@
+using LoaderCalculator.Data.Materials;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Infrastructures.Strings;
+using StructureHelperCommon.Models.Materials;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.Models.Materials
+{
+ public class LibMaterial : ILibMaterial
+ {
+ public MaterialTypes MaterialType { get; set; }
+ public CodeTypes CodeType { get; set; }
+ public string Name { get; set; }
+ public double MainStrength { get; set; }
+
+ public LibMaterial(MaterialTypes materialType, CodeTypes codeType, string name, double mainStrength)
+ {
+ MaterialType = materialType;
+ CodeType = codeType;
+ Name = name;
+ MainStrength = mainStrength;
+ }
+
+ public IPrimitiveMaterial GetPrimitiveMaterial()
+ {
+ if (MaterialType == MaterialTypes.Concrete & CodeType == CodeTypes.EuroCode_2_1990)
+ { return GetConcreteEurocode();}
+ else if (MaterialType == MaterialTypes.Reinforcement & CodeType == CodeTypes.EuroCode_2_1990)
+ { return GetReinfrocementeEurocode();}
+ if (MaterialType == MaterialTypes.Concrete & CodeType == CodeTypes.SP63_13330_2018)
+ { return GetConcreteSP63(); }
+ else if (MaterialType == MaterialTypes.Reinforcement & CodeType == CodeTypes.SP63_13330_2018)
+ { return GetReinfrocementeSP63(); }
+ else throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown}: material type = {MaterialType}, code type = {CodeType}");
+ }
+
+ private IPrimitiveMaterial GetReinfrocementeSP63()
+ {
+ IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial
+ { MaterialType = MaterialType, CodeType = CodeTypes.SP63_13330_2018, ClassName = $"Reinforcement {Name}", Strength = MainStrength };
+ return primitiveMaterial;
+ }
+
+ private IPrimitiveMaterial GetConcreteSP63()
+ {
+ IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial
+ { MaterialType = MaterialType, CodeType = CodeTypes.SP63_13330_2018, ClassName = $"Concrete {Name}", Strength = MainStrength };
+ return primitiveMaterial;
+ }
+
+ private IPrimitiveMaterial GetReinfrocementeEurocode()
+ {
+ IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial
+ { MaterialType = MaterialType, CodeType = CodeTypes.EuroCode_2_1990, ClassName = $"Reinforcement {Name}", Strength = MainStrength };
+ return primitiveMaterial;
+ }
+
+ private IPrimitiveMaterial GetConcreteEurocode()
+ {
+ IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial
+ { MaterialType = MaterialType, CodeType = CodeTypes.EuroCode_2_1990, ClassName = $"Concrete {Name}", Strength = MainStrength };
+ return primitiveMaterial;
+ }
+
+ public object Clone()
+ {
+ return new LibMaterial(this.MaterialType, this.CodeType, this.Name, this.MainStrength);
+ }
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogicOptions.cs
index 9abe4ec..513a185 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogicOptions.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogicOptions.cs
@@ -2,5 +2,8 @@
{
public interface ITriangulationLogicOptions
{
+ double PrestrainKx { get;}
+ double PrestrainKy { get;}
+ double PrestrainEpsZ { get;}
}
}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs
index a324533..20afe30 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs
@@ -3,6 +3,8 @@ using LoaderCalculator.Data.Ndms;
using System;
using System.Collections.Generic;
using StructureHelperCommon.Models.Shapes;
+using LoaderCalculator.Data.Matrix;
+using LoaderCalculator.Data.Ndms.Transformations;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
@@ -23,6 +25,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
List ndmCollection = new List();
INdm ndm = new Ndm { CenterX = center.X, CenterY = center.Y, Area = area, Material = material };
ndmCollection.Add(ndm);
+ NdmTransform.SetPrestrain(ndmCollection, new StrainMatrix() { Kx = Options.PrestrainKx, Ky = Options.PrestrainKy, EpsZ = Options.PrestrainEpsZ });
return ndmCollection;
}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs
index 3f8b36c..faede61 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs
@@ -1,4 +1,8 @@
-using StructureHelperCommon.Models.Shapes;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Infrastructures.Strings;
+using StructureHelperCommon.Models.Entities;
+using StructureHelperCommon.Models.NdmPrimitives;
+using StructureHelperCommon.Models.Shapes;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
@@ -11,13 +15,31 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
///
///
public ICenter Center { get; }
-
+ ///
public double Area { get; }
+ ///
+ public double PrestrainKx { get; }
+ ///
+ public double PrestrainKy { get; }
+ ///
+ public double PrestrainEpsZ { get; }
public PointTriangulationLogicOptions(ICenter center, double area)
{
Center = center;
Area = area;
}
+
+ public PointTriangulationLogicOptions(INdmPrimitive primitive)
+ {
+ if (!(primitive.Shape is IPoint)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
+ Center = primitive.Center;
+ IPoint point = primitive.Shape as IPoint;
+ Center = primitive.Center;
+ Area = point.Area;
+ PrestrainKx = primitive.PrestrainKx;
+ PrestrainKy = primitive.PrestrainKy;
+ PrestrainEpsZ = primitive.PrestrainEpsZ;
+ }
}
}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs
index 7297316..a11e435 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs
@@ -3,6 +3,7 @@ using LoaderCalculator.Data.Ndms;
using System;
using System.Collections.Generic;
using LoaderCalculator.Data.Ndms.Transformations;
+using LoaderCalculator.Data.Matrix;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
@@ -25,6 +26,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
NdmTransform.Move(ndmCollection, dX, dY);
double angle = rectangleOptions.Rectangle.Angle;
NdmTransform.Rotate(ndmCollection, angle);
+ NdmTransform.SetPrestrain(ndmCollection, new StrainMatrix() { Kx = Options.PrestrainKx, Ky = Options.PrestrainKy, EpsZ = Options.PrestrainEpsZ });
return ndmCollection;
}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs
index b941871..aa70138 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs
@@ -1,4 +1,6 @@
using System;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Shapes;
@@ -15,6 +17,12 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public double NdmMaxSize { get; }
///
public int NdmMinDivision { get; }
+ ///
+ public double PrestrainKx { get;}
+ ///
+ public double PrestrainKy { get; }
+ ///
+ public double PrestrainEpsZ { get;}
public RectangleTriangulationLogicOptions(ICenter center, IRectangle rectangle, double ndmMaxSize, int ndmMinDivision)
{
@@ -26,11 +34,14 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public RectangleTriangulationLogicOptions(INdmPrimitive primitive)
{
- if (! (primitive.Shape is IRectangle)) { throw new Exception("Shape type is not valid"); }
+ if (! (primitive.Shape is IRectangle)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
Center = primitive.Center;
Rectangle = primitive.Shape as IRectangle;
NdmMaxSize = primitive.NdmMaxSize;
NdmMinDivision = primitive.NdmMinDivision;
+ PrestrainKx = primitive.PrestrainKx;
+ PrestrainKy = primitive.PrestrainKy;
+ PrestrainEpsZ = primitive.PrestrainEpsZ;
}
}
}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs
index 4c810fe..07a8718 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs
@@ -3,6 +3,9 @@ using System.Collections.Generic;
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Materials.MaterialBuilders;
using LoaderCalculator.Data.Ndms;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Shapes;
@@ -67,12 +70,11 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
}
else if (shape is IPoint)
{
- IPoint point = shape as IPoint;
- options = new PointTriangulationLogicOptions(primitive.Center, point.Area);
+ options = new PointTriangulationLogicOptions(primitive);
IPointTriangulationLogic logic = new PointTriangulationLogic(options);
ndms.AddRange(logic.GetNdmCollection(material));
}
- else { throw new Exception("Primitive type is not valid"); }
+ else { throw new StructureHelperException($"{ErrorStrings.ShapeIsNotCorrect} :{nameof(primitive.Shape)}"); }
return ndms;
}
@@ -81,7 +83,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
IMaterial material;
if (primitiveMaterial.MaterialType == MaterialTypes.Concrete) { material = GetConcreteMaterial(primitiveMaterial, options); }
else if (primitiveMaterial.MaterialType == MaterialTypes.Reinforcement) { material = GetReinforcementMaterial(primitiveMaterial, options); }
- else { throw new Exception("Material type is invalid"); }
+ else { throw new StructureHelperException(ErrorStrings.MaterialTypeIsUnknown); }
return material;
}
@@ -106,14 +108,22 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
private static void SetMaterialOptions(IMaterialOptions materialOptions, IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
{
materialOptions.Strength = primitiveMaterial.Strength;
- materialOptions.CodesType = CodesType.EC2_1990;
+ if (primitiveMaterial.CodeType == CodeTypes.EuroCode_2_1990)
+ {
+ materialOptions.CodesType = CodesType.EC2_1990;
+ }
+ else if (primitiveMaterial.CodeType == CodeTypes.SP63_13330_2018)
+ {
+ materialOptions.CodesType = CodesType.SP63_2018;
+ }
+ else { throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {primitiveMaterial.CodeType}"); }
if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.Collapse) { materialOptions.LimitState = LimitStates.Collapse; }
else if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.ServiceAbility) { materialOptions.LimitState = LimitStates.ServiceAbility; }
else if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.Special) { materialOptions.LimitState = LimitStates.Special; }
- else { throw new Exception("LimitStateType is not valid"); }
+ else { throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid); }
if (options.CalcTerm == Infrastructures.CommonEnums.CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }
else if (options.CalcTerm == Infrastructures.CommonEnums.CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; }
- else { throw new Exception("Calculation term is not valid"); }
+ else { throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid); }
}
}
}
diff --git a/StructureHelperLogics/StructureHelperLogics.csproj b/StructureHelperLogics/StructureHelperLogics.csproj
index 8fc4ebc..df78d7b 100644
--- a/StructureHelperLogics/StructureHelperLogics.csproj
+++ b/StructureHelperLogics/StructureHelperLogics.csproj
@@ -1,21 +1,20 @@
-
+
- netstandard2.0
+ net472
+ Library
-
-
-
-
- ..\..\StructureHelper\Libraries\LoaderCalculator.dll
+ ..\Libraries\LoaderCalculator.dll
+
+
-
+
\ No newline at end of file
diff --git a/StructureHelperLogics/StructureHelperLogics.csproj.bak b/StructureHelperLogics/StructureHelperLogics.csproj.bak
new file mode 100644
index 0000000..1b7c1f1
--- /dev/null
+++ b/StructureHelperLogics/StructureHelperLogics.csproj.bak
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/StructureHelperLogics/StructureHelperLogics1.csproj b/StructureHelperLogics/StructureHelperLogics1.csproj
new file mode 100644
index 0000000..439819a
--- /dev/null
+++ b/StructureHelperLogics/StructureHelperLogics1.csproj
@@ -0,0 +1,42 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ v4.7.2
+ Library
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+ ..\..\StructureHelper\Libraries\LoaderCalculator.dll
+
+
+
+
diff --git a/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs
index 8daf761..91a88a9 100644
--- a/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs
+++ b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs
@@ -10,6 +10,7 @@ using System.Threading;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Shapes;
+using StructureHelperCommon.Infrastructures.Enums;
namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
{
diff --git a/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs b/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs
index ac40fa8..6d19bb4 100644
--- a/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs
+++ b/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs
@@ -9,6 +9,7 @@ using System.Threading;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Shapes;
+using StructureHelperCommon.Infrastructures.Enums;
namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
{
diff --git a/Windows/MainWindow/MainModel.cs b/Windows/MainWindow/MainModel.cs
index 6a93263..7c4b43c 100644
--- a/Windows/MainWindow/MainModel.cs
+++ b/Windows/MainWindow/MainModel.cs
@@ -8,8 +8,11 @@ using StructureHelper.Services;
using StructureHelper.Services.Primitives;
using StructureHelper.UnitSystem;
using StructureHelper.UnitSystem.Systems;
+using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperLogics.Infrastructures.CommonEnums;
using StructureHelperLogics.Models.Calculations.CalculationProperties;
+using StructureHelperLogics.Models.Materials;
+using StructureHelperLogics.Models.Materials.Factories;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services;
using System.Collections;
@@ -21,11 +24,17 @@ namespace StructureHelper.Windows.MainWindow
{
public class MainModel
{
+ //const CodeTypes code = CodeTypes.EuroCode_2_1990;
+ const CodeTypes code = CodeTypes.SP63_13330_2018;
+
private IPrimitiveRepository primitiveRepository;
+ public IHeadMaterialRepository HeadMaterialRepository { get; }
public List HeadMaterials { get; }
private CalculationService calculationService;
private UnitSystemService unitSystemService;
+ public IPrimitiveRepository PrimitiveRepository => primitiveRepository;
+
public ICalculationProperty CalculationProperty { get; private set; }
public MainModel(IPrimitiveRepository primitiveRepository, CalculationService calculationService, UnitSystemService unitSystemService)
@@ -36,6 +45,8 @@ namespace StructureHelper.Windows.MainWindow
CalculationProperty = new CalculationProperty();
HeadMaterials = new List();
+ HeadMaterialRepository = new HeadMaterialRepository(this);
+ HeadMaterialRepository.LibMaterials = LibMaterialFactory.GetLibMaterials(code);
}
public IStrainMatrix Calculate(double mx, double my, double nz)
diff --git a/Windows/MainWindow/MainView.xaml b/Windows/MainWindow/MainView.xaml
index a12649b..3b7544f 100644
--- a/Windows/MainWindow/MainView.xaml
+++ b/Windows/MainWindow/MainView.xaml
@@ -29,8 +29,7 @@
-
-
+
@@ -49,6 +48,9 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
diff --git a/Windows/MainWindow/Materials/HeadMaterialsView.xaml.cs b/Windows/MainWindow/Materials/HeadMaterialsView.xaml.cs
index c6ba83a..2f63593 100644
--- a/Windows/MainWindow/Materials/HeadMaterialsView.xaml.cs
+++ b/Windows/MainWindow/Materials/HeadMaterialsView.xaml.cs
@@ -1,5 +1,6 @@
using StructureHelper.Models.Materials;
using StructureHelper.Windows.ViewModels.Materials;
+using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -23,9 +24,9 @@ namespace StructureHelper.Windows.MainWindow.Materials
{
private HeadMaterialsViewModel viewmodel;
- public HeadMaterialsView(IEnumerable materials)
+ public HeadMaterialsView(IHeadMaterialRepository headMaterialRepository)
{
- viewmodel = new HeadMaterialsViewModel(materials);
+ viewmodel = new HeadMaterialsViewModel(headMaterialRepository);
this.DataContext = viewmodel;
InitializeComponent();
}
diff --git a/Windows/PrimitiveProperiesWindow/PrimitivePropertiesView.xaml b/Windows/PrimitiveProperiesWindow/PrimitivePropertiesView.xaml
index 963b43c..6759349 100644
--- a/Windows/PrimitiveProperiesWindow/PrimitivePropertiesView.xaml
+++ b/Windows/PrimitiveProperiesWindow/PrimitivePropertiesView.xaml
@@ -87,9 +87,26 @@
-
-
-
-
+
diff --git a/Windows/PrimitiveProperiesWindow/PrimitivePropertiesView.xaml.cs b/Windows/PrimitiveProperiesWindow/PrimitivePropertiesView.xaml.cs
index 5c53fc1..97c0d0f 100644
--- a/Windows/PrimitiveProperiesWindow/PrimitivePropertiesView.xaml.cs
+++ b/Windows/PrimitiveProperiesWindow/PrimitivePropertiesView.xaml.cs
@@ -1,6 +1,7 @@
using StructureHelper.Infrastructure.Enums;
using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
+using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -27,10 +28,10 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
{
PrimitiveBase primitive;
private PrimitivePropertiesViewModel viewModel;
- public PrimitiveProperties(PrimitiveBase primitive)
+ public PrimitiveProperties(PrimitiveBase primitive, IHeadMaterialRepository materialRepository)
{
this.primitive = primitive;
- viewModel = new PrimitivePropertiesViewModel(this.primitive);
+ viewModel = new PrimitivePropertiesViewModel(this.primitive, materialRepository);
this.DataContext = viewModel;
InitializeComponent();
if (primitive is Rectangle) { AddPrimitiveProperties(PrimitiveType.Rectangle); }
@@ -60,10 +61,5 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
StpProperties.Children.Add(contentControl);
}
}
-
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- viewModel.EditColor();
- }
}
}
diff --git a/Windows/ViewModels/Materials/HeadMaterialsViewModel.cs b/Windows/ViewModels/Materials/HeadMaterialsViewModel.cs
index 64fa5cb..349e62a 100644
--- a/Windows/ViewModels/Materials/HeadMaterialsViewModel.cs
+++ b/Windows/ViewModels/Materials/HeadMaterialsViewModel.cs
@@ -1,5 +1,10 @@
using StructureHelper.Infrastructure;
using StructureHelper.Models.Materials;
+using StructureHelper.Services.Primitives;
+using StructureHelper.Windows.MainWindow;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Services.ColorServices;
+using StructureHelperLogics.Models.Materials;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -7,30 +12,136 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Windows.Forms;
using System.Windows.Input;
+using System.Windows.Media;
namespace StructureHelper.Windows.ViewModels.Materials
{
public class HeadMaterialsViewModel : ViewModelBase
{
+ IHeadMaterialRepository materialRepository;
IEnumerable headMaterials;
+ IEnumerable libMaterials;
+ IHeadMaterial selectedMaterial;
+ ILibMaterial selectedLibMaterial;
- public ICommand AddHeadMaterial;
- public ICommand CopyHeadMaterial;
- public ICommand DeleteHeadMaterial;
+ public ICommand AddNewMaterialCommand { get; set; }
+ public ICommand CopyHeadMaterialCommand { get; set; }
+ public ICommand EditColorCommand { get; set; }
+ public ICommand DeleteMaterialCommand { get; set; }
public ICommand EditHeadMaterial;
public ObservableCollection HeadMaterials { get; private set; }
- public IHeadMaterial SelectedMaterial { get; set; }
-
- public HeadMaterialsViewModel(IEnumerable materials)
+ public IHeadMaterial SelectedMaterial
{
- headMaterials = materials;
+ get => selectedMaterial;
+ set
+ {
+ OnPropertyChanged(value, ref selectedMaterial);
+ if (!(selectedMaterial is null))
+ {
+ selectedLibMaterial = selectedMaterial.HelperMaterial as ILibMaterial;
+ OnPropertyChanged(nameof(selectedLibMaterial));
+ }
+ }
+ }
+
+ public string SelectedName
+ {
+ get => selectedMaterial.Name;
+ set
+ {
+ selectedMaterial.Name = value;
+ OnPropertyChanged(nameof(selectedMaterial));
+ }
+ }
+
+ public ILibMaterial SelectedLibMaterial
+ {
+ get
+ {
+ if (selectedLibMaterial is null) { return null; }
+ else { return selectedLibMaterial; }
+ }
+ set
+ {
+ selectedMaterial.HelperMaterial = value;
+ }
+ }
+
+ public IEnumerable LibMaterials
+ {
+ get
+ {
+ //if (SelectedMaterial is null)
+ //{
+ // return null;
+ //}
+ return libMaterials;//.Where(x => x.MaterialType == (SelectedMaterial.HelperMaterial as ILibMaterial).MaterialType);
+ }
+ }
+
+ public HeadMaterialsViewModel(IHeadMaterialRepository headMaterialRepository)
+ {
+ materialRepository = headMaterialRepository;
+ headMaterials = materialRepository.HeadMaterials;
HeadMaterials = new ObservableCollection();
foreach (var material in headMaterials)
{
HeadMaterials.Add(material);
}
+ libMaterials = materialRepository.LibMaterials;
+ AddNewMaterialCommand = new RelayCommand(o => AddNewMaterial(MaterialTypes.Reinforcement));
+ CopyHeadMaterialCommand = new RelayCommand(o => CopyMaterial(), o => !(SelectedMaterial is null));
+ EditColorCommand = new RelayCommand(o => EditColor(), o=> ! (SelectedMaterial is null));
+ DeleteMaterialCommand = new RelayCommand(o => DeleteMaterial(), o => !(SelectedMaterial is null));
+ }
+
+ private void CopyMaterial()
+ {
+ var material = SelectedMaterial.Clone() as IHeadMaterial;
+ HeadMaterials.Add(material);
+ materialRepository.HeadMaterials.Add(material);
+ SelectedMaterial = material;
+
+ }
+
+ private void DeleteMaterial()
+ {
+ var mainModel = materialRepository.Parent as MainModel;
+ var primitivesWithMaterial = mainModel.PrimitiveRepository.Primitives.Where(x => x.HeadMaterial == SelectedMaterial);
+ int primitivesCount = primitivesWithMaterial.Count();
+ if (primitivesCount > 0)
+ {
+ MessageBox.Show("Some primitives reference to this material", "Material can not be deleted", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
+ var dialogResult = MessageBox.Show("Delete material?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
+ if (dialogResult == DialogResult.Yes)
+ {
+ materialRepository.HeadMaterials.Remove(SelectedMaterial);
+ HeadMaterials.Remove(SelectedMaterial);
+ }
+ }
+
+ private void EditColor()
+ {
+ Color color = SelectedMaterial.Color;
+ ColorProcessor.EditColor(ref color);
+ SelectedMaterial.Color = color;
+ OnPropertyChanged(nameof(selectedMaterial.Color));
+ OnPropertyChanged(nameof(selectedMaterial));
+ }
+
+ private void AddNewMaterial(MaterialTypes materialType)
+ {
+ IHeadMaterial material = new HeadMaterial() { Name = "New material" };
+ material.HelperMaterial = LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Concrete & x.Name.Contains("40"))).First();
+ HeadMaterials.Add(material);
+ //headMaterials.Append(material);
+ materialRepository.HeadMaterials.Add(material);
+ SelectedMaterial = material;
}
}
}
diff --git a/Windows/ViewModels/PrimitiveProperties/PrimitivePropertiesViewModel.cs b/Windows/ViewModels/PrimitiveProperties/PrimitivePropertiesViewModel.cs
index 7e35059..43f7ad8 100644
--- a/Windows/ViewModels/PrimitiveProperties/PrimitivePropertiesViewModel.cs
+++ b/Windows/ViewModels/PrimitiveProperties/PrimitivePropertiesViewModel.cs
@@ -1,9 +1,15 @@
using StructureHelper.Infrastructure;
using StructureHelper.Infrastructure.UI.DataContexts;
+using StructureHelper.Models.Materials;
using StructureHelper.Windows.ColorPickerWindow;
+using StructureHelper.Windows.MainWindow.Materials;
+using StructureHelperCommon.Models.NdmPrimitives;
using StructureHelperCommon.Models.Shapes;
+using StructureHelperCommon.Services.ColorServices;
+using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
@@ -19,8 +25,13 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
public class PrimitivePropertiesViewModel : ViewModelBase, IDataErrorInfo
{
private PrimitiveBase primitive;
+ private IHeadMaterialRepository headMaterialRepository;
+ private List headMaterials;
- public ICommand EditColorCommand;
+ public ICommand EditColorCommand { get; private set; }
+ public ICommand EditMaterialCommand { get; private set; }
+
+ public ObservableCollection HeadMaterials { get; private set; }
public string Name
{
@@ -40,6 +51,18 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
OnPropertyChanged(nameof(MaterialName));
}
}
+ public IHeadMaterial PrimitiveMaterial
+ { get => primitive.HeadMaterial;
+ set
+ {
+ primitive.HeadMaterial = value;
+ OnPropertyChanged(nameof(PrimitiveMaterial));
+ if (primitive.SetMaterialColor == true)
+ {
+ OnPropertyChanged(nameof(Color));
+ }
+ }
+ }
public double CenterX
{
@@ -65,6 +88,22 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
}
}
+ public double PrestrainKx
+ {
+ get => primitive.PrestrainKx;
+ set => primitive.PrestrainKx = value;
+ }
+ public double PrestrainKy
+ {
+ get => primitive.PrestrainKy;
+ set => primitive.PrestrainKy = value;
+ }
+ public double PrestrainEpsZ
+ {
+ get => primitive.PrestrainEpsZ;
+ set => primitive.PrestrainEpsZ = value;
+ }
+
public int MinElementDivision
{
get => primitive.MinElementDivision;
@@ -99,6 +138,7 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
var shape = primitive as Rectangle;
shape.PrimitiveWidth = value;
}
+ CenterX = CenterX;
}
}
@@ -120,8 +160,9 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
var shape = primitive as Rectangle;
shape.PrimitiveHeight = value;
}
+ CenterY = CenterY; ;
}
- }
+ }
public double Area
{
@@ -160,6 +201,7 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
set
{
primitive.SetMaterialColor = value;
+ OnPropertyChanged(nameof(Color));
OnPropertyChanged(nameof(SetMaterialColor));
}
}
@@ -185,17 +227,32 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
public string Error => throw new NotImplementedException();
- public PrimitivePropertiesViewModel(PrimitiveBase primitive)
+ public PrimitivePropertiesViewModel(PrimitiveBase primitive, IHeadMaterialRepository materialRepository)
{
this.primitive = primitive;
+ headMaterialRepository = materialRepository;
+ headMaterials = materialRepository.HeadMaterials;
+ HeadMaterials = new ObservableCollection();
+ foreach (var material in headMaterials)
+ {
+ HeadMaterials.Add(material);
+ }
EditColorCommand = new RelayCommand(o => EditColor(), o => !SetMaterialColor);
+ EditMaterialCommand = new RelayCommand(o => EditMaterial());
+
+ }
+
+ private void EditMaterial()
+ {
+ var wnd = new HeadMaterialsView(headMaterialRepository);
+ wnd.ShowDialog();
}
public void EditColor()
{
- var wnd = new ColorPickerView(primitive);
- wnd.ShowDialog();
- OnPropertyChanged(nameof(Color));
+ Color color = Color;
+ ColorProcessor.EditColor(ref color);
+ Color = color;
}
}
}