Добавлены сервисы CalculationService, PrimitiveService, Common-сборка с типами
Необходимо реализовать в дальнейшем GetInnerPoints в PrimitiveService
This commit is contained in:
14
StructureHelperCommon/Models/Entities/INdmPrimitive.cs
Normal file
14
StructureHelperCommon/Models/Entities/INdmPrimitive.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperCommon.Models.Entities
|
||||
{
|
||||
public interface INdmPrimitive
|
||||
{
|
||||
ICenter Center { get; set; }
|
||||
IShape Shape { get; set; }
|
||||
IPrimitiveMaterial PrimitiveMaterial {get;set;}
|
||||
double NdmMaxSize { get; set; }
|
||||
int NdmMinDivision { get; set; }
|
||||
}
|
||||
}
|
||||
14
StructureHelperCommon/Models/Entities/NdmPrimitive.cs
Normal file
14
StructureHelperCommon/Models/Entities/NdmPrimitive.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperCommon.Models.Entities
|
||||
{
|
||||
public class NdmPrimitive : INdmPrimitive
|
||||
{
|
||||
public ICenter Center { get; set; }
|
||||
public IShape Shape { get; set; }
|
||||
public IPrimitiveMaterial PrimitiveMaterial { get; set; }
|
||||
public double NdmMaxSize { get; set; }
|
||||
public int NdmMinDivision { get; set; }
|
||||
}
|
||||
}
|
||||
10
StructureHelperCommon/Models/Materials/IPrimitiveMaterial.cs
Normal file
10
StructureHelperCommon/Models/Materials/IPrimitiveMaterial.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
public interface IPrimitiveMaterial
|
||||
{
|
||||
string Id { get;}
|
||||
MaterialTypes MaterialType { get; }
|
||||
string ClassName { get; }
|
||||
double Strength { get; }
|
||||
}
|
||||
}
|
||||
10
StructureHelperCommon/Models/Materials/MaterialTypes.cs
Normal file
10
StructureHelperCommon/Models/Materials/MaterialTypes.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
public enum MaterialTypes
|
||||
{
|
||||
Concrete,
|
||||
Reinforcement,
|
||||
//Steel,
|
||||
//CarbonFiber,
|
||||
}
|
||||
}
|
||||
17
StructureHelperCommon/Models/Materials/PrimitiveMaterial.cs
Normal file
17
StructureHelperCommon/Models/Materials/PrimitiveMaterial.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
public class PrimitiveMaterial : IPrimitiveMaterial
|
||||
{
|
||||
public string Id { get; }
|
||||
public MaterialTypes MaterialType { get; set; }
|
||||
public string ClassName { get; set; }
|
||||
public double Strength { get; set; }
|
||||
|
||||
public PrimitiveMaterial()
|
||||
{
|
||||
Id = Convert.ToString(Guid.NewGuid());
|
||||
}
|
||||
}
|
||||
}
|
||||
10
StructureHelperCommon/Models/NdmPrimitives/IPrimitive.cs
Normal file
10
StructureHelperCommon/Models/NdmPrimitives/IPrimitive.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperCommon.Models.NdmPrimitives
|
||||
{
|
||||
public interface IPrimitive : ICenterShape
|
||||
{
|
||||
INdmPrimitive GetNdmPrimitive();
|
||||
}
|
||||
}
|
||||
30
StructureHelperCommon/Models/NdmPrimitives/PointPrimitive.cs
Normal file
30
StructureHelperCommon/Models/NdmPrimitives/PointPrimitive.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperCommon.Models.NdmPrimitives
|
||||
{
|
||||
public class PointPrimitive : PrimitiveBase<IPoint>, IPoint
|
||||
{
|
||||
public double Area
|
||||
{
|
||||
get => _shape.Area;
|
||||
set => _shape.Area = value;
|
||||
}
|
||||
|
||||
public PointPrimitive(ICenter center, IPoint shape) : base(center, shape) { }
|
||||
public override INdmPrimitive GetNdmPrimitive()
|
||||
{
|
||||
double strength = 400e6d;
|
||||
string materialName = "s400";
|
||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
|
||||
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = _center, Shape = _shape, PrimitiveMaterial = primitiveMaterial };
|
||||
return ndmPrimitive;
|
||||
}
|
||||
|
||||
private MaterialTypes GetMaterialTypes()
|
||||
{
|
||||
return MaterialTypes.Reinforcement;
|
||||
}
|
||||
}
|
||||
}
|
||||
22
StructureHelperCommon/Models/NdmPrimitives/PrimitiveBase.cs
Normal file
22
StructureHelperCommon/Models/NdmPrimitives/PrimitiveBase.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperCommon.Models.NdmPrimitives
|
||||
{
|
||||
public abstract class PrimitiveBase<T> : IPrimitive where T : IShape
|
||||
{
|
||||
protected ICenter _center;
|
||||
protected T _shape;
|
||||
|
||||
public ICenter Center => _center;
|
||||
public IShape Shape => _shape;
|
||||
|
||||
protected PrimitiveBase(ICenter center, T shape)
|
||||
{
|
||||
_center = center;
|
||||
_shape = shape;
|
||||
}
|
||||
|
||||
public abstract INdmPrimitive GetNdmPrimitive();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperCommon.Models.NdmPrimitives
|
||||
{
|
||||
public class RectanglePrimitive : PrimitiveBase<IRectangle>, IRectangle
|
||||
{
|
||||
public RectanglePrimitive(ICenter center, IRectangle shape) : base(center, shape) { }
|
||||
|
||||
public double Width => _shape.Width;
|
||||
|
||||
public double Height => _shape.Height;
|
||||
|
||||
public double Angle => _shape.Angle;
|
||||
|
||||
public override INdmPrimitive GetNdmPrimitive()
|
||||
{
|
||||
double strength = 40e6d;
|
||||
string materialName = "C40/45";
|
||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
|
||||
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = _center, Shape = _shape, PrimitiveMaterial = primitiveMaterial, NdmMaxSize = 1, NdmMinDivision = 20 };
|
||||
return ndmPrimitive;
|
||||
}
|
||||
|
||||
private MaterialTypes GetMaterialTypes()
|
||||
{
|
||||
return MaterialTypes.Concrete;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
StructureHelperCommon/Models/Shapes/Center.cs
Normal file
11
StructureHelperCommon/Models/Shapes/Center.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class Center : ICenter
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public double X { get; set; }
|
||||
/// <inheritdoc />
|
||||
public double Y { get; set; }
|
||||
}
|
||||
}
|
||||
20
StructureHelperCommon/Models/Shapes/ICenter.cs
Normal file
20
StructureHelperCommon/Models/Shapes/ICenter.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for point of center of some shape
|
||||
/// Интерфейс для точки центра некоторой формы
|
||||
/// </summary>
|
||||
public interface ICenter
|
||||
{
|
||||
/// <summary>
|
||||
/// Coordinate of center of rectangle by local axis X, m
|
||||
/// Координата центра вдоль локальной оси X, м
|
||||
/// </summary>
|
||||
double X { get;}
|
||||
/// <summary>
|
||||
/// Coordinate of center of rectangle by local axis Y, m
|
||||
/// Координата центра вдоль локальной оси Y, м
|
||||
/// </summary>
|
||||
double Y { get;}
|
||||
}
|
||||
}
|
||||
8
StructureHelperCommon/Models/Shapes/ICenterShape.cs
Normal file
8
StructureHelperCommon/Models/Shapes/ICenterShape.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public interface ICenterShape
|
||||
{
|
||||
ICenter Center {get;}
|
||||
IShape Shape { get;}
|
||||
}
|
||||
}
|
||||
7
StructureHelperCommon/Models/Shapes/ICircle.cs
Normal file
7
StructureHelperCommon/Models/Shapes/ICircle.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public interface ICircle : IShape
|
||||
{
|
||||
double Diameter { get; set; }
|
||||
}
|
||||
}
|
||||
7
StructureHelperCommon/Models/Shapes/IPoint.cs
Normal file
7
StructureHelperCommon/Models/Shapes/IPoint.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public interface IPoint : IShape
|
||||
{
|
||||
double Area { get; set; }
|
||||
}
|
||||
}
|
||||
18
StructureHelperCommon/Models/Shapes/IRectangle.cs
Normal file
18
StructureHelperCommon/Models/Shapes/IRectangle.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public interface IRectangle : IShape
|
||||
{
|
||||
/// <summary>
|
||||
/// Width of rectangle, m
|
||||
/// </summary>
|
||||
double Width { get; }
|
||||
/// <summary>
|
||||
/// Height of rectangle, m
|
||||
/// </summary>
|
||||
double Height { get; }
|
||||
/// <summary>
|
||||
/// Angle of rotating rectangle, rad
|
||||
/// </summary>
|
||||
double Angle { get; }
|
||||
}
|
||||
}
|
||||
6
StructureHelperCommon/Models/Shapes/IShape.cs
Normal file
6
StructureHelperCommon/Models/Shapes/IShape.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public interface IShape
|
||||
{
|
||||
}
|
||||
}
|
||||
7
StructureHelperCommon/Models/Shapes/Point.cs
Normal file
7
StructureHelperCommon/Models/Shapes/Point.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public class Point : IPoint
|
||||
{
|
||||
public double Area { get; set; }
|
||||
}
|
||||
}
|
||||
13
StructureHelperCommon/Models/Shapes/Rectangle.cs
Normal file
13
StructureHelperCommon/Models/Shapes/Rectangle.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class Rectangle : IRectangle
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public double Width { get; set; }
|
||||
/// <inheritdoc />
|
||||
public double Height { get; set; }
|
||||
/// <inheritdoc />
|
||||
public double Angle { get; set; }
|
||||
}
|
||||
}
|
||||
36
StructureHelperCommon/Properties/AssemblyInfo.cs
Normal file
36
StructureHelperCommon/Properties/AssemblyInfo.cs
Normal file
@@ -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")]
|
||||
66
StructureHelperCommon/StructureHelperCommon.csproj
Normal file
66
StructureHelperCommon/StructureHelperCommon.csproj
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{5DFEC3FD-9677-47BB-9E88-EB71828B5913}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>StructureHelperCommon</RootNamespace>
|
||||
<AssemblyName>StructureHelperCommon</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Models\Entities\INdmPrimitive.cs" />
|
||||
<Compile Include="Models\Entities\NdmPrimitive.cs" />
|
||||
<Compile Include="Models\Materials\IPrimitiveMaterial.cs" />
|
||||
<Compile Include="Models\Materials\MaterialTypes.cs" />
|
||||
<Compile Include="Models\Materials\PrimitiveMaterial.cs" />
|
||||
<Compile Include="Models\NdmPrimitives\IPrimitive.cs" />
|
||||
<Compile Include="Models\NdmPrimitives\PointPrimitive.cs" />
|
||||
<Compile Include="Models\NdmPrimitives\PrimitiveBase.cs" />
|
||||
<Compile Include="Models\NdmPrimitives\RectanglePrimitive.cs" />
|
||||
<Compile Include="Models\Shapes\Center.cs" />
|
||||
<Compile Include="Models\Shapes\ICenter.cs" />
|
||||
<Compile Include="Models\Shapes\ICenterShape.cs" />
|
||||
<Compile Include="Models\Shapes\ICircle.cs" />
|
||||
<Compile Include="Models\Shapes\IPoint.cs" />
|
||||
<Compile Include="Models\Shapes\IRectangle.cs" />
|
||||
<Compile Include="Models\Shapes\IShape.cs" />
|
||||
<Compile Include="Models\Shapes\Point.cs" />
|
||||
<Compile Include="Models\Shapes\Rectangle.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user