diff --git a/App.config b/App.config
index 56efbc7..d089989 100644
--- a/App.config
+++ b/App.config
@@ -1,6 +1,14 @@
-
+
-
+
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
diff --git a/App.xaml.cs b/App.xaml.cs
index a696ce9..835413f 100644
--- a/App.xaml.cs
+++ b/App.xaml.cs
@@ -1,4 +1,7 @@
using System.Windows;
+using Autofac;
+using StructureHelper.Services;
+using StructureHelper.Windows.MainWindow;
namespace StructureHelper
{
@@ -7,5 +10,24 @@ namespace StructureHelper
///
public partial class App : Application
{
+ public static IContainer Container { get; private set; }
+ protected override void OnStartup(StartupEventArgs e)
+ {
+ var builder = new ContainerBuilder();
+ builder.RegisterType().As();
+ builder.RegisterType().As();
+ builder.RegisterType().AsSelf();
+ builder.RegisterType().AsSelf();
+
+ builder.RegisterType().AsSelf();
+
+ Container = builder.Build();
+
+ using (var scope = Container.BeginLifetimeScope())
+ {
+ var window = scope.Resolve();
+ window.ShowDialog();
+ }
+ }
}
}
diff --git a/Infrastructure/UI/DataContexts/Point.cs b/Infrastructure/UI/DataContexts/Point.cs
index e6c34ac..d7632f7 100644
--- a/Infrastructure/UI/DataContexts/Point.cs
+++ b/Infrastructure/UI/DataContexts/Point.cs
@@ -1,9 +1,9 @@
using System;
using StructureHelper.Infrastructure.Enums;
using StructureHelper.Windows.MainWindow;
-using StructureHelperLogics.Data.Shapes;
-using StructureHelperLogics.NdmCalculations.Entities;
-using StructureHelperLogics.NdmCalculations.Materials;
+using StructureHelperCommon.Models.Entities;
+using StructureHelperCommon.Models.Materials;
+using StructureHelperCommon.Models.Shapes;
namespace StructureHelper.Infrastructure.UI.DataContexts
{
@@ -36,10 +36,10 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
double centerY = 0;
double area = 0;
string materialName = "s400";
- ICenter center = new Center() { X = centerX, Y = centerY };
- IShape shape = new StructureHelperLogics.Data.Shapes.Point() { Area = area };
- IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
- INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
+ ICenter center = new Center { X = centerX, Y = centerY };
+ IShape shape = new StructureHelperCommon.Models.Shapes.Point { Area = area };
+ IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
+ INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
return ndmPrimitive;
}
}
diff --git a/Infrastructure/UI/DataContexts/PrimitiveBase.cs b/Infrastructure/UI/DataContexts/PrimitiveBase.cs
index 5937084..bfed87c 100644
--- a/Infrastructure/UI/DataContexts/PrimitiveBase.cs
+++ b/Infrastructure/UI/DataContexts/PrimitiveBase.cs
@@ -4,8 +4,8 @@ using System.Windows.Media;
using StructureHelper.Infrastructure.Enums;
using StructureHelper.Models.Materials;
using StructureHelper.Windows.MainWindow;
-using StructureHelperLogics.NdmCalculations.Entities;
-using StructureHelperLogics.NdmCalculations.Materials;
+using StructureHelperCommon.Models.Entities;
+using StructureHelperCommon.Models.Materials;
namespace StructureHelper.Infrastructure.UI.DataContexts
{
diff --git a/Infrastructure/UI/DataContexts/Rectangle.cs b/Infrastructure/UI/DataContexts/Rectangle.cs
index b655723..7fa02b3 100644
--- a/Infrastructure/UI/DataContexts/Rectangle.cs
+++ b/Infrastructure/UI/DataContexts/Rectangle.cs
@@ -1,8 +1,8 @@
using StructureHelper.Infrastructure.Enums;
using StructureHelper.Windows.MainWindow;
-using StructureHelperLogics.Data.Shapes;
-using StructureHelperLogics.NdmCalculations.Entities;
-using StructureHelperLogics.NdmCalculations.Materials;
+using StructureHelperCommon.Models.Entities;
+using StructureHelperCommon.Models.Materials;
+using StructureHelperCommon.Models.Shapes;
namespace StructureHelper.Infrastructure.UI.DataContexts
{
@@ -25,7 +25,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
ICenter center = new Center() { X = centerX, Y = centerY };
double height = 0;
double width = 0;
- IShape shape = new StructureHelperLogics.Data.Shapes.Rectangle() { Height = height, Width = width, Angle = 0 };
+ IShape shape = new StructureHelperCommon.Models.Shapes.Rectangle() { Height = height, Width = width, Angle = 0 };
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
return ndmPrimitive;
diff --git a/Services/PrimitiveService.cs b/Services/PrimitiveService.cs
new file mode 100644
index 0000000..eae3a35
--- /dev/null
+++ b/Services/PrimitiveService.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using StructureHelper.Infrastructure.UI.DataContexts;
+using StructureHelperCommon.Models.NdmPrimitives;
+using StructureHelperCommon.Models.Shapes;
+using Point = StructureHelper.Infrastructure.UI.DataContexts.Point;
+using Rectangle = StructureHelper.Infrastructure.UI.DataContexts.Rectangle;
+
+namespace StructureHelper.Services
+{
+ public interface IPrimitiveRepository
+ {
+ void Add(PrimitiveBase primitive);
+ void Delete(PrimitiveBase primitive);
+ IEnumerable GetPoints();
+ IEnumerable GetRectangles();
+ }
+ class PrimitiveRepository : IPrimitiveRepository
+ {
+ List points = new List();
+ List rectangles = new List();
+
+ public void Add(PrimitiveBase primitive)
+ {
+ switch (primitive)
+ {
+ case Point point:
+ points.Add(point);
+ break;
+ case Rectangle rectangle:
+ rectangles.Add(rectangle);
+ break;
+ }
+ }
+ public void Delete(PrimitiveBase primitive)
+ {
+ switch (primitive)
+ {
+ case Point point:
+ points.Remove(point);
+ break;
+ case Rectangle rectangle:
+ rectangles.Remove(rectangle);
+ break;
+ }
+ }
+
+ public IEnumerable GetPoints() => points;
+
+ public IEnumerable GetRectangles() => rectangles;
+ }
+
+ public class PrimitiveService : IPrimitiveService
+ {
+ IPrimitiveRepository primitiveRepository;
+
+ public PrimitiveService(IPrimitiveRepository primitiveRepository)
+ {
+ this.primitiveRepository = primitiveRepository;
+ }
+
+ public PointPrimitive[] GetInnerPoints(RectanglePrimitive rectanglePrimitive)
+ {
+ return new[] { new PointPrimitive(new Center(), new StructureHelperCommon.Models.Shapes.Point()) };
+ }
+ }
+
+ public interface IPrimitiveService
+ {
+ PointPrimitive[] GetInnerPoints(RectanglePrimitive rectanglePrimitive);
+ }
+}
diff --git a/StructureHelper.csproj b/StructureHelper.csproj
index 22861e5..e29a909 100644
--- a/StructureHelper.csproj
+++ b/StructureHelper.csproj
@@ -8,12 +8,13 @@
WinExe
StructureHelper
StructureHelper
- v4.7.2
+ v4.8
512
{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
4
true
true
+
AnyCPU
@@ -35,6 +36,16 @@
4
+
+ packages\Autofac.6.4.0\lib\netstandard2.0\Autofac.dll
+
+
+ False
+ Libraries\LoaderCalculator.dll
+
+
+ packages\Microsoft.Bcl.AsyncInterfaces.1.1.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
+
packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\Microsoft.Expression.Interactions.dll
@@ -42,7 +53,26 @@
packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll
+
+ packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll
+
+
+ packages\System.Diagnostics.DiagnosticSource.4.7.1\lib\net46\System.Diagnostics.DiagnosticSource.dll
+
+
+ packages\System.Memory.4.5.4\lib\net461\System.Memory.dll
+
+
+
+ packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
+
+ packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
+
+
+ packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll
+
packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\System.Windows.Interactivity.dll
@@ -69,6 +99,7 @@
PrimitivePopup.xaml
+
AddMaterialView.xaml
@@ -158,9 +189,9 @@
-
- {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}
- StructureHelperLogics
+
+ {5dfec3fd-9677-47bb-9e88-eb71828b5913}
+ StructureHelperCommon
diff --git a/StructureHelper.sln b/StructureHelper.sln
index 9807f81..af32771 100644
--- a/StructureHelper.sln
+++ b/StructureHelper.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.32002.261
+# Visual Studio Version 17
+VisualStudioVersion = 17.2.32630.192
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelper", "StructureHelper.csproj", "{BAD27E27-4444-4300-ADF8-E21042C0781D}"
EndProject
@@ -12,6 +12,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperTests", "Str
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureHelperLogics", "StructureHelperLogics\StructureHelperLogics.csproj", "{330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperCommon", "StructureHelperCommon\StructureHelperCommon.csproj", "{5DFEC3FD-9677-47BB-9E88-EB71828B5913}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -30,6 +32,10 @@ Global
{330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5DFEC3FD-9677-47BB-9E88-EB71828B5913}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5DFEC3FD-9677-47BB-9E88-EB71828B5913}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5DFEC3FD-9677-47BB-9E88-EB71828B5913}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5DFEC3FD-9677-47BB-9E88-EB71828B5913}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs b/StructureHelperCommon/Models/Entities/INdmPrimitive.cs
similarity index 62%
rename from StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs
rename to StructureHelperCommon/Models/Entities/INdmPrimitive.cs
index 7c42182..34e29fe 100644
--- a/StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs
+++ b/StructureHelperCommon/Models/Entities/INdmPrimitive.cs
@@ -1,7 +1,7 @@
-using StructureHelperLogics.Data.Shapes;
-using StructureHelperLogics.NdmCalculations.Materials;
+using StructureHelperCommon.Models.Materials;
+using StructureHelperCommon.Models.Shapes;
-namespace StructureHelperLogics.NdmCalculations.Entities
+namespace StructureHelperCommon.Models.Entities
{
public interface INdmPrimitive
{
diff --git a/StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs b/StructureHelperCommon/Models/Entities/NdmPrimitive.cs
similarity index 66%
rename from StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs
rename to StructureHelperCommon/Models/Entities/NdmPrimitive.cs
index 74988d0..627c5f7 100644
--- a/StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs
+++ b/StructureHelperCommon/Models/Entities/NdmPrimitive.cs
@@ -1,7 +1,7 @@
-using StructureHelperLogics.Data.Shapes;
-using StructureHelperLogics.NdmCalculations.Materials;
+using StructureHelperCommon.Models.Materials;
+using StructureHelperCommon.Models.Shapes;
-namespace StructureHelperLogics.NdmCalculations.Entities
+namespace StructureHelperCommon.Models.Entities
{
public class NdmPrimitive : INdmPrimitive
{
diff --git a/StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs b/StructureHelperCommon/Models/Materials/IPrimitiveMaterial.cs
similarity index 75%
rename from StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs
rename to StructureHelperCommon/Models/Materials/IPrimitiveMaterial.cs
index b0307ff..881c4c9 100644
--- a/StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs
+++ b/StructureHelperCommon/Models/Materials/IPrimitiveMaterial.cs
@@ -1,4 +1,4 @@
-namespace StructureHelperLogics.NdmCalculations.Materials
+namespace StructureHelperCommon.Models.Materials
{
public interface IPrimitiveMaterial
{
diff --git a/StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs b/StructureHelperCommon/Models/Materials/MaterialTypes.cs
similarity index 67%
rename from StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs
rename to StructureHelperCommon/Models/Materials/MaterialTypes.cs
index 487bcc7..b53a479 100644
--- a/StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs
+++ b/StructureHelperCommon/Models/Materials/MaterialTypes.cs
@@ -1,4 +1,4 @@
-namespace StructureHelperLogics.NdmCalculations.Materials
+namespace StructureHelperCommon.Models.Materials
{
public enum MaterialTypes
{
diff --git a/StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs b/StructureHelperCommon/Models/Materials/PrimitiveMaterial.cs
similarity index 86%
rename from StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs
rename to StructureHelperCommon/Models/Materials/PrimitiveMaterial.cs
index 4c45b3b..c39a763 100644
--- a/StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs
+++ b/StructureHelperCommon/Models/Materials/PrimitiveMaterial.cs
@@ -1,6 +1,6 @@
using System;
-namespace StructureHelperLogics.NdmCalculations.Materials
+namespace StructureHelperCommon.Models.Materials
{
public class PrimitiveMaterial : IPrimitiveMaterial
{
diff --git a/StructureHelperCommon/Models/NdmPrimitives/IPrimitive.cs b/StructureHelperCommon/Models/NdmPrimitives/IPrimitive.cs
new file mode 100644
index 0000000..53d260a
--- /dev/null
+++ b/StructureHelperCommon/Models/NdmPrimitives/IPrimitive.cs
@@ -0,0 +1,10 @@
+using StructureHelperCommon.Models.Entities;
+using StructureHelperCommon.Models.Shapes;
+
+namespace StructureHelperCommon.Models.NdmPrimitives
+{
+ public interface IPrimitive : ICenterShape
+ {
+ INdmPrimitive GetNdmPrimitive();
+ }
+}
diff --git a/StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs b/StructureHelperCommon/Models/NdmPrimitives/PointPrimitive.cs
similarity index 81%
rename from StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs
rename to StructureHelperCommon/Models/NdmPrimitives/PointPrimitive.cs
index 4985a6a..7bdaf6f 100644
--- a/StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs
+++ b/StructureHelperCommon/Models/NdmPrimitives/PointPrimitive.cs
@@ -1,8 +1,8 @@
-using StructureHelperLogics.Data.Shapes;
-using StructureHelperLogics.NdmCalculations.Entities;
-using StructureHelperLogics.NdmCalculations.Materials;
+using StructureHelperCommon.Models.Entities;
+using StructureHelperCommon.Models.Materials;
+using StructureHelperCommon.Models.Shapes;
-namespace StructureHelperLogics.Models.NdmPrimitives
+namespace StructureHelperCommon.Models.NdmPrimitives
{
public class PointPrimitive : PrimitiveBase, IPoint
{
diff --git a/StructureHelperLogics/Models/NdmPrimitives/PrimitiveBase.cs b/StructureHelperCommon/Models/NdmPrimitives/PrimitiveBase.cs
similarity index 64%
rename from StructureHelperLogics/Models/NdmPrimitives/PrimitiveBase.cs
rename to StructureHelperCommon/Models/NdmPrimitives/PrimitiveBase.cs
index 089d110..0af755d 100644
--- a/StructureHelperLogics/Models/NdmPrimitives/PrimitiveBase.cs
+++ b/StructureHelperCommon/Models/NdmPrimitives/PrimitiveBase.cs
@@ -1,7 +1,7 @@
-using StructureHelperLogics.Data.Shapes;
-using StructureHelperLogics.NdmCalculations.Entities;
+using StructureHelperCommon.Models.Entities;
+using StructureHelperCommon.Models.Shapes;
-namespace StructureHelperLogics.Models.NdmPrimitives
+namespace StructureHelperCommon.Models.NdmPrimitives
{
public abstract class PrimitiveBase : IPrimitive where T : IShape
{
@@ -11,7 +11,7 @@ namespace StructureHelperLogics.Models.NdmPrimitives
public ICenter Center => _center;
public IShape Shape => _shape;
- public PrimitiveBase(ICenter center, T shape)
+ protected PrimitiveBase(ICenter center, T shape)
{
_center = center;
_shape = shape;
diff --git a/StructureHelperLogics/Models/NdmPrimitives/RectanglePrimitive.cs b/StructureHelperCommon/Models/NdmPrimitives/RectanglePrimitive.cs
similarity index 82%
rename from StructureHelperLogics/Models/NdmPrimitives/RectanglePrimitive.cs
rename to StructureHelperCommon/Models/NdmPrimitives/RectanglePrimitive.cs
index 4d18109..8b94342 100644
--- a/StructureHelperLogics/Models/NdmPrimitives/RectanglePrimitive.cs
+++ b/StructureHelperCommon/Models/NdmPrimitives/RectanglePrimitive.cs
@@ -1,8 +1,8 @@
-using StructureHelperLogics.Data.Shapes;
-using StructureHelperLogics.NdmCalculations.Entities;
-using StructureHelperLogics.NdmCalculations.Materials;
+using StructureHelperCommon.Models.Entities;
+using StructureHelperCommon.Models.Materials;
+using StructureHelperCommon.Models.Shapes;
-namespace StructureHelperLogics.Models.NdmPrimitives
+namespace StructureHelperCommon.Models.NdmPrimitives
{
public class RectanglePrimitive : PrimitiveBase, IRectangle
{
diff --git a/StructureHelperLogics/Data/Shapes/Center.cs b/StructureHelperCommon/Models/Shapes/Center.cs
similarity index 80%
rename from StructureHelperLogics/Data/Shapes/Center.cs
rename to StructureHelperCommon/Models/Shapes/Center.cs
index 358144b..74630ce 100644
--- a/StructureHelperLogics/Data/Shapes/Center.cs
+++ b/StructureHelperCommon/Models/Shapes/Center.cs
@@ -1,4 +1,4 @@
-namespace StructureHelperLogics.Data.Shapes
+namespace StructureHelperCommon.Models.Shapes
{
///
public class Center : ICenter
diff --git a/StructureHelperLogics/Data/Shapes/ICenter.cs b/StructureHelperCommon/Models/Shapes/ICenter.cs
similarity index 93%
rename from StructureHelperLogics/Data/Shapes/ICenter.cs
rename to StructureHelperCommon/Models/Shapes/ICenter.cs
index 78ed338..2fb9f90 100644
--- a/StructureHelperLogics/Data/Shapes/ICenter.cs
+++ b/StructureHelperCommon/Models/Shapes/ICenter.cs
@@ -1,4 +1,4 @@
-namespace StructureHelperLogics.Data.Shapes
+namespace StructureHelperCommon.Models.Shapes
{
///
/// Interface for point of center of some shape
diff --git a/StructureHelperLogics/Data/Shapes/ICenterShape.cs b/StructureHelperCommon/Models/Shapes/ICenterShape.cs
similarity index 68%
rename from StructureHelperLogics/Data/Shapes/ICenterShape.cs
rename to StructureHelperCommon/Models/Shapes/ICenterShape.cs
index 38d19f4..00f2531 100644
--- a/StructureHelperLogics/Data/Shapes/ICenterShape.cs
+++ b/StructureHelperCommon/Models/Shapes/ICenterShape.cs
@@ -1,4 +1,4 @@
-namespace StructureHelperLogics.Data.Shapes
+namespace StructureHelperCommon.Models.Shapes
{
public interface ICenterShape
{
diff --git a/StructureHelperLogics/Data/Shapes/ICircle.cs b/StructureHelperCommon/Models/Shapes/ICircle.cs
similarity index 65%
rename from StructureHelperLogics/Data/Shapes/ICircle.cs
rename to StructureHelperCommon/Models/Shapes/ICircle.cs
index 8a5ad56..93b181f 100644
--- a/StructureHelperLogics/Data/Shapes/ICircle.cs
+++ b/StructureHelperCommon/Models/Shapes/ICircle.cs
@@ -1,4 +1,4 @@
-namespace StructureHelperLogics.Data.Shapes
+namespace StructureHelperCommon.Models.Shapes
{
public interface ICircle : IShape
{
diff --git a/StructureHelperLogics/Data/Shapes/IPoint.cs b/StructureHelperCommon/Models/Shapes/IPoint.cs
similarity index 63%
rename from StructureHelperLogics/Data/Shapes/IPoint.cs
rename to StructureHelperCommon/Models/Shapes/IPoint.cs
index 7df8127..c1077c7 100644
--- a/StructureHelperLogics/Data/Shapes/IPoint.cs
+++ b/StructureHelperCommon/Models/Shapes/IPoint.cs
@@ -1,4 +1,4 @@
-namespace StructureHelperLogics.Data.Shapes
+namespace StructureHelperCommon.Models.Shapes
{
public interface IPoint : IShape
{
diff --git a/StructureHelperLogics/Data/Shapes/IRectangle.cs b/StructureHelperCommon/Models/Shapes/IRectangle.cs
similarity index 89%
rename from StructureHelperLogics/Data/Shapes/IRectangle.cs
rename to StructureHelperCommon/Models/Shapes/IRectangle.cs
index 255cf63..5ecbad3 100644
--- a/StructureHelperLogics/Data/Shapes/IRectangle.cs
+++ b/StructureHelperCommon/Models/Shapes/IRectangle.cs
@@ -1,4 +1,4 @@
-namespace StructureHelperLogics.Data.Shapes
+namespace StructureHelperCommon.Models.Shapes
{
public interface IRectangle : IShape
{
diff --git a/StructureHelperCommon/Models/Shapes/IShape.cs b/StructureHelperCommon/Models/Shapes/IShape.cs
new file mode 100644
index 0000000..d916974
--- /dev/null
+++ b/StructureHelperCommon/Models/Shapes/IShape.cs
@@ -0,0 +1,6 @@
+namespace StructureHelperCommon.Models.Shapes
+{
+ public interface IShape
+ {
+ }
+}
diff --git a/StructureHelperLogics/Data/Shapes/Point.cs b/StructureHelperCommon/Models/Shapes/Point.cs
similarity index 64%
rename from StructureHelperLogics/Data/Shapes/Point.cs
rename to StructureHelperCommon/Models/Shapes/Point.cs
index 0a4a124..2bbf5a4 100644
--- a/StructureHelperLogics/Data/Shapes/Point.cs
+++ b/StructureHelperCommon/Models/Shapes/Point.cs
@@ -1,4 +1,4 @@
-namespace StructureHelperLogics.Data.Shapes
+namespace StructureHelperCommon.Models.Shapes
{
public class Point : IPoint
{
diff --git a/StructureHelperLogics/Data/Shapes/Rectangle.cs b/StructureHelperCommon/Models/Shapes/Rectangle.cs
similarity index 85%
rename from StructureHelperLogics/Data/Shapes/Rectangle.cs
rename to StructureHelperCommon/Models/Shapes/Rectangle.cs
index cd3fce7..be9d236 100644
--- a/StructureHelperLogics/Data/Shapes/Rectangle.cs
+++ b/StructureHelperCommon/Models/Shapes/Rectangle.cs
@@ -1,4 +1,4 @@
-namespace StructureHelperLogics.Data.Shapes
+namespace StructureHelperCommon.Models.Shapes
{
///
public class Rectangle : IRectangle
diff --git a/StructureHelperCommon/Properties/AssemblyInfo.cs b/StructureHelperCommon/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..27e2e0c
--- /dev/null
+++ b/StructureHelperCommon/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Общие сведения об этой сборке предоставляются следующим набором
+// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
+// связанные со сборкой.
+[assembly: AssemblyTitle("StructureHelperCommon")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("StructureHelperCommon")]
+[assembly: AssemblyCopyright("Copyright © 2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
+// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
+// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
+[assembly: ComVisible(false)]
+
+// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
+[assembly: Guid("5dfec3fd-9677-47bb-9e88-eb71828b5913")]
+
+// Сведения о версии сборки состоят из указанных ниже четырех значений:
+//
+// Основной номер версии
+// Дополнительный номер версии
+// Номер сборки
+// Редакция
+//
+// Можно задать все значения или принять номера сборки и редакции по умолчанию
+// используя "*", как показано ниже:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/StructureHelperCommon/StructureHelperCommon.csproj b/StructureHelperCommon/StructureHelperCommon.csproj
new file mode 100644
index 0000000..568d6ad
--- /dev/null
+++ b/StructureHelperCommon/StructureHelperCommon.csproj
@@ -0,0 +1,66 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {5DFEC3FD-9677-47BB-9E88-EB71828B5913}
+ Library
+ Properties
+ StructureHelperCommon
+ StructureHelperCommon
+ v4.8
+ 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/Data/Shapes/IShape.cs b/StructureHelperLogics/Data/Shapes/IShape.cs
deleted file mode 100644
index 6d32153..0000000
--- a/StructureHelperLogics/Data/Shapes/IShape.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace StructureHelperLogics.Data.Shapes
-{
- public interface IShape
- {
- }
-}
diff --git a/StructureHelperLogics/Models/NdmPrimitives/IPrimitive.cs b/StructureHelperLogics/Models/NdmPrimitives/IPrimitive.cs
deleted file mode 100644
index 944a386..0000000
--- a/StructureHelperLogics/Models/NdmPrimitives/IPrimitive.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using StructureHelperLogics.Data.Shapes;
-using StructureHelperLogics.NdmCalculations.Entities;
-
-namespace StructureHelperLogics.Models.NdmPrimitives
-{
- public interface IPrimitive : ICenterShape
- {
- INdmPrimitive GetNdmPrimitive();
- }
-}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs
index 24c8b6a..5f6ec96 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs
@@ -1,4 +1,4 @@
-using StructureHelperLogics.Data.Shapes;
+using StructureHelperCommon.Models.Shapes;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs
index 82004e3..ddfd6a8 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs
@@ -1,4 +1,4 @@
-using StructureHelperLogics.Data.Shapes;
+using StructureHelperCommon.Models.Shapes;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs
index 99b413d..8500845 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs
@@ -1,8 +1,8 @@
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Ndms;
-using StructureHelperLogics.Data.Shapes;
using System;
using System.Collections.Generic;
+using StructureHelperCommon.Models.Shapes;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs
index 254b187..3f8b36c 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs
@@ -1,4 +1,4 @@
-using StructureHelperLogics.Data.Shapes;
+using StructureHelperCommon.Models.Shapes;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs
index e33ee89..b941871 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs
@@ -1,6 +1,6 @@
-using StructureHelperLogics.Data.Shapes;
-using StructureHelperLogics.NdmCalculations.Entities;
-using System;
+using System;
+using StructureHelperCommon.Models.Entities;
+using StructureHelperCommon.Models.Shapes;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs
index 786d0c7..4c810fe 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs
@@ -3,9 +3,9 @@ using System.Collections.Generic;
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Materials.MaterialBuilders;
using LoaderCalculator.Data.Ndms;
-using StructureHelperLogics.Data.Shapes;
-using StructureHelperLogics.NdmCalculations.Entities;
-using StructureHelperLogics.NdmCalculations.Materials;
+using StructureHelperCommon.Models.Entities;
+using StructureHelperCommon.Models.Materials;
+using StructureHelperCommon.Models.Shapes;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
diff --git a/StructureHelperLogics/Services/CalculationService.cs b/StructureHelperLogics/Services/CalculationService.cs
new file mode 100644
index 0000000..259b2b6
--- /dev/null
+++ b/StructureHelperLogics/Services/CalculationService.cs
@@ -0,0 +1,67 @@
+using Autofac;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using LoaderCalculator;
+using LoaderCalculator.Data.Matrix;
+using LoaderCalculator.Data.Ndms;
+using LoaderCalculator.Data.SourceData;
+using StructureHelper;
+using StructureHelper.Services;
+using StructureHelperCommon.Models.Entities;
+using StructureHelperCommon.Models.NdmPrimitives;
+using StructureHelperLogics.NdmCalculations.Triangulations;
+using StructureHelperLogics.Infrastructures.CommonEnums;
+
+namespace StructureHelperLogics.Services
+{
+ public class CalculationService
+ {
+ public IStrainMatrix GetPrimitiveStrainMatrix(double topArea, double bottomArea, RectanglePrimitive concreteRectangle, double mx, double my, double nz)
+ {
+ var ndmPrimitives = new List();
+ //Добавляем прямоугольник бетонного сечения
+
+ ndmPrimitives.Add(concreteRectangle.GetNdmPrimitive());
+
+ using (var scope = App.Container.BeginLifetimeScope())
+ {
+ var primitiveService = scope.Resolve();
+ //Добавляем точки внутри прямоугольника
+ ndmPrimitives.AddRange(primitiveService.GetInnerPoints(concreteRectangle).Select(x=>x.GetNdmPrimitive()));
+ }
+
+ //Коллекция для хранения элементарных участков
+ var ndmCollection = new List();
+ //Настройки триангуляции, пока опции могут быть только такие
+ ITriangulationOptions options = new TriangulationOptions
+ {
+ LimiteState = LimitStates.Collapse,
+ CalcTerm = CalcTerms.ShortTerm
+ };
+
+ //Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
+ ndmCollection.AddRange(Triangulation.GetNdms(ndmPrimitives, options));
+
+ var calculator = new Calculator();
+ var calculationData = new LoaderOptions
+ {
+ Preconditions = new Preconditions
+ {
+ ConditionRate = 0.01,
+ MaxIterationCount = 100,
+ StartForceMatrix = new ForceMatrix
+ {
+ Mx = mx,
+ My = my,
+ Nz = nz
+ }
+ },
+ NdmCollection = ndmCollection
+ };
+ calculator.Run(calculationData, new CancellationToken());
+ var results = calculator.Result;
+ return results.StrainMatrix;
+ }
+ }
+}
diff --git a/StructureHelperLogics/StructureHelperLogics.csproj b/StructureHelperLogics/StructureHelperLogics.csproj
index 325d167..30b7446 100644
--- a/StructureHelperLogics/StructureHelperLogics.csproj
+++ b/StructureHelperLogics/StructureHelperLogics.csproj
@@ -4,6 +4,15 @@
netstandard2.0
+
+
+
+
+
+
+
+
+
..\..\StructureHelper\Libraries\LoaderCalculator.dll
diff --git a/Windows/MainWindow/MainView.xaml.cs b/Windows/MainWindow/MainView.xaml.cs
index 1ec16a6..c714a32 100644
--- a/Windows/MainWindow/MainView.xaml.cs
+++ b/Windows/MainWindow/MainView.xaml.cs
@@ -1,13 +1,17 @@
using System.Windows;
+using StructureHelper.Services;
namespace StructureHelper.Windows.MainWindow
{
public partial class MainView : Window
{
- public MainView()
+ public IPrimitiveRepository PrimitiveRepository { get; }
+ public IPrimitiveService PrimitiveService { get; }
+
+ public MainView(IPrimitiveRepository primitiveRepository, IPrimitiveService primitiveService, MainViewModel viewModel)
{
- var model = new MainModel();
- var viewModel = new MainViewModel(model, this);
+ PrimitiveRepository = primitiveRepository;
+ PrimitiveService = primitiveService;
DataContext = viewModel;
InitializeComponent();
}
diff --git a/Windows/MainWindow/MainViewModel.cs b/Windows/MainWindow/MainViewModel.cs
index f1b9f62..1d4fffd 100644
--- a/Windows/MainWindow/MainViewModel.cs
+++ b/Windows/MainWindow/MainViewModel.cs
@@ -6,14 +6,16 @@ using StructureHelper.Infrastructure;
using StructureHelper.Infrastructure.Extensions;
using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelper.MaterialCatalogWindow;
+using StructureHelper.Services;
using StructureHelper.Windows.ColorPickerWindow;
namespace StructureHelper.Windows.MainWindow
{
public class MainViewModel : ViewModelBase
{
- private MainModel rectanglesModel;
- private MainView rectanglesView;
+ private IPrimitiveService PrimitiveService { get; }
+ private IPrimitiveRepository PrimitiveRepository { get; }
+ private MainModel Model { get; }
public ObservableCollection Primitives { get; set; }
public ICommand AddRectangle { get; }
@@ -178,13 +180,12 @@ namespace StructureHelper.Windows.MainWindow
public ICommand SetPopupCanBeClosedFalse { get; }
private double delta = 0.5;
-
-
- public MainViewModel() { }
- public MainViewModel(MainModel rectanglesModel, MainView rectanglesView)
+
+ public MainViewModel(MainModel model, IPrimitiveService primitiveService, IPrimitiveRepository primitiveRepository)
{
- this.rectanglesModel = rectanglesModel;
- this.rectanglesView = rectanglesView;
+ PrimitiveService = primitiveService;
+ PrimitiveRepository = primitiveRepository;
+ Model = model;
CanvasWidth = 1500;
CanvasHeight = 1000;
@@ -304,17 +305,21 @@ namespace StructureHelper.Windows.MainWindow
});
Primitives = new ObservableCollection();
+
AddRectangle = new RelayCommand(o =>
{
var rectangle = new Rectangle(60, 40, YX1, XY1, this);
Primitives.Add(rectangle);
PrimitivesCount = Primitives.Count;
+ PrimitiveRepository.Add(rectangle);
});
+
AddEllipse = new RelayCommand(o =>
{
var point = new Point(2000, YX1, XY1, this);
Primitives.Add(point);
PrimitivesCount = Primitives.Count;
+ PrimitiveRepository.Add(point);
});
SetPopupCanBeClosedTrue = new RelayCommand(o =>
@@ -329,4 +334,4 @@ namespace StructureHelper.Windows.MainWindow
});
}
}
-}
+}
\ No newline at end of file
diff --git a/packages.config b/packages.config
index e7d7544..700ac20 100644
--- a/packages.config
+++ b/packages.config
@@ -1,5 +1,13 @@
+
+
+
+
+
+
+
+
\ No newline at end of file