UnitSystem inplementation started, Calculation started
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Autofac;
|
using Autofac;
|
||||||
using StructureHelper.Services;
|
using StructureHelper.Services;
|
||||||
|
using StructureHelper.UnitSystem;
|
||||||
using StructureHelper.Windows.MainWindow;
|
using StructureHelper.Windows.MainWindow;
|
||||||
|
using StructureHelperLogics.Services;
|
||||||
|
|
||||||
namespace StructureHelper
|
namespace StructureHelper
|
||||||
{
|
{
|
||||||
@@ -18,7 +20,8 @@ namespace StructureHelper
|
|||||||
base.OnStartup(e);
|
base.OnStartup(e);
|
||||||
var builder = new ContainerBuilder();
|
var builder = new ContainerBuilder();
|
||||||
builder.RegisterType<PrimitiveRepository>().As<IPrimitiveRepository>().SingleInstance();
|
builder.RegisterType<PrimitiveRepository>().As<IPrimitiveRepository>().SingleInstance();
|
||||||
builder.RegisterType<PrimitiveService>().As<IPrimitiveService>().SingleInstance();
|
builder.RegisterType<UnitSystemService>().AsSelf().SingleInstance();
|
||||||
|
builder.RegisterType<CalculationService>().AsSelf().SingleInstance();
|
||||||
builder.RegisterType<MainModel>().AsSelf().SingleInstance();
|
builder.RegisterType<MainModel>().AsSelf().SingleInstance();
|
||||||
builder.RegisterType<MainViewModel>().AsSelf().SingleInstance();
|
builder.RegisterType<MainViewModel>().AsSelf().SingleInstance();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using StructureHelper.Infrastructure.Enums;
|
using StructureHelper.Infrastructure.Enums;
|
||||||
|
using StructureHelper.UnitSystem.Systems;
|
||||||
using StructureHelper.Windows.MainWindow;
|
using StructureHelper.Windows.MainWindow;
|
||||||
using StructureHelperCommon.Models.Entities;
|
using StructureHelperCommon.Models.Entities;
|
||||||
using StructureHelperCommon.Models.Materials;
|
using StructureHelperCommon.Models.Materials;
|
||||||
@@ -9,36 +10,21 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
{
|
{
|
||||||
public class Point : PrimitiveBase
|
public class Point : PrimitiveBase
|
||||||
{
|
{
|
||||||
private double square;
|
public Point(double d, double x, double y, MainViewModel mainViewModel) : base(PrimitiveType.Point, x, y, mainViewModel)
|
||||||
public double Square
|
|
||||||
{
|
{
|
||||||
get => square;
|
PrimitiveWidth = d;
|
||||||
set
|
|
||||||
{
|
|
||||||
square = value;
|
|
||||||
PrimitiveWidth = Math.Round(Math.Sqrt(4 * value / Math.PI), 2);
|
|
||||||
OnPropertyChanged(nameof(PrimitiveWidth));
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Point(double square, double x, double y, MainViewModel mainViewModel) : base(PrimitiveType.Point, x, y, mainViewModel)
|
|
||||||
{
|
|
||||||
Square = square;
|
|
||||||
ShowedX = 0;
|
ShowedX = 0;
|
||||||
ShowedY = 0;
|
ShowedY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override INdmPrimitive GetNdmPrimitive()
|
public override INdmPrimitive GetNdmPrimitive(IUnitSystem unitSystem)
|
||||||
{
|
{
|
||||||
double strength = 0;
|
var width = unitSystem.ConvertLength(PrimitiveWidth);
|
||||||
double centerX = 0;
|
double area = Math.Round(width * width * Math.PI / 4, 2);
|
||||||
double centerY = 0;
|
string materialName = MaterialName;
|
||||||
double area = 0;
|
ICenter center = new Center { X = unitSystem.ConvertLength(ShowedX), Y = unitSystem.ConvertLength(ShowedY) };
|
||||||
string materialName = "s400";
|
|
||||||
ICenter center = new Center { X = centerX, Y = centerY };
|
|
||||||
IShape shape = new StructureHelperCommon.Models.Shapes.Point { Area = area };
|
IShape shape = new StructureHelperCommon.Models.Shapes.Point { Area = area };
|
||||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
|
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = Material.DesingTensileStrength }; ;
|
||||||
INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
|
INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
|
||||||
return ndmPrimitive;
|
return ndmPrimitive;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Windows.Input;
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using StructureHelper.Infrastructure.Enums;
|
using StructureHelper.Infrastructure.Enums;
|
||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelper.UnitSystem.Systems;
|
||||||
using StructureHelper.Windows.MainWindow;
|
using StructureHelper.Windows.MainWindow;
|
||||||
using StructureHelperCommon.Models.Entities;
|
using StructureHelperCommon.Models.Entities;
|
||||||
using StructureHelperCommon.Models.Materials;
|
using StructureHelperCommon.Models.Materials;
|
||||||
@@ -62,9 +63,12 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
get => material;
|
get => material;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
MaterialName = material.MaterialClass;
|
if (value != null)
|
||||||
OnPropertyChanged(value, ref material);
|
{
|
||||||
OnPropertyChanged(nameof(MaterialName));
|
MaterialName = value.MaterialClass;
|
||||||
|
OnPropertyChanged(value, ref material);
|
||||||
|
OnPropertyChanged(nameof(MaterialName));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private string materialName = string.Empty;
|
private string materialName = string.Empty;
|
||||||
@@ -276,7 +280,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
if (Type == PrimitiveType.Point) Y = -showedY + Xy1 - PrimitiveWidth / 2;
|
if (Type == PrimitiveType.Point) Y = -showedY + Xy1 - PrimitiveWidth / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract INdmPrimitive GetNdmPrimitive();
|
public abstract INdmPrimitive GetNdmPrimitive(IUnitSystem unitSystem);
|
||||||
public MaterialTypes GetMaterialTypes()
|
public MaterialTypes GetMaterialTypes()
|
||||||
{
|
{
|
||||||
MaterialTypes materialTypes;
|
MaterialTypes materialTypes;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelper.Infrastructure.Enums;
|
using StructureHelper.Infrastructure.Enums;
|
||||||
|
using StructureHelper.UnitSystem.Systems;
|
||||||
using StructureHelper.Windows.MainWindow;
|
using StructureHelper.Windows.MainWindow;
|
||||||
using StructureHelperCommon.Models.Entities;
|
using StructureHelperCommon.Models.Entities;
|
||||||
using StructureHelperCommon.Models.Materials;
|
using StructureHelperCommon.Models.Materials;
|
||||||
@@ -17,18 +18,17 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
ShowedY = 0;
|
ShowedY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override INdmPrimitive GetNdmPrimitive()
|
public override INdmPrimitive GetNdmPrimitive(IUnitSystem unitSystem)
|
||||||
{
|
{
|
||||||
double strength = 0;
|
var width = unitSystem.ConvertLength(PrimitiveWidth);
|
||||||
double centerX = 0;
|
var height = unitSystem.ConvertLength(PrimitiveHeight);
|
||||||
double centerY = 0;
|
double centerX = unitSystem.ConvertLength(ShowedX) + width / 2;
|
||||||
string materialName = "C20";
|
double centerY = unitSystem.ConvertLength(ShowedY) + height / 2;
|
||||||
ICenter center = new Center() { X = centerX, Y = centerY };
|
string materialName = MaterialName;
|
||||||
double height = 0;
|
ICenter center = new Center { X = centerX, Y = centerY };
|
||||||
double width = 0;
|
IShape shape = new StructureHelperCommon.Models.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 = Material.DesingTensileStrength };
|
||||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
|
INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
|
||||||
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
|
|
||||||
return ndmPrimitive;
|
return ndmPrimitive;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,6 @@
|
|||||||
<RowDefinition Height="40"/>
|
<RowDefinition Height="40"/>
|
||||||
<RowDefinition Height="40"/>
|
<RowDefinition Height="40"/>
|
||||||
<RowDefinition Height="40"/>
|
<RowDefinition Height="40"/>
|
||||||
<RowDefinition Height="40"/>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="170"/>
|
<ColumnDefinition Width="170"/>
|
||||||
@@ -61,14 +59,12 @@
|
|||||||
<TextBox VerticalAlignment="Center" HorizontalAlignment="Left" Width="50" Margin="10"
|
<TextBox VerticalAlignment="Center" HorizontalAlignment="Left" Width="50" Margin="10"
|
||||||
Text="{Binding ShowedZIndex, Mode=TwoWay}"/>
|
Text="{Binding ShowedZIndex, Mode=TwoWay}"/>
|
||||||
<TextBlock VerticalAlignment="Center" Text="Max = "/>
|
<TextBlock VerticalAlignment="Center" Text="Max = "/>
|
||||||
<TextBlock VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PrimitivesCount, Mode=TwoWay}"/>
|
<TextBlock VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PrimitivesCount}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Button Grid.Row="9" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Установить впереди всех" Margin="10"
|
<Button Grid.Row="9" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Установить впереди всех" Margin="10"
|
||||||
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetInFrontOfAll}" CommandParameter="{Binding}"/>
|
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetInFrontOfAll}" CommandParameter="{Binding}"/>
|
||||||
<Button Grid.Row="9" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Установить позади всех" Margin="10"
|
<Button Grid.Row="9" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Установить позади всех" Margin="10"
|
||||||
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetInBackOfAll}" CommandParameter="{Binding}"/>
|
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetInBackOfAll}" CommandParameter="{Binding}"/>
|
||||||
<Button Grid.Row="10" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="10" Content="Установить параметры"
|
|
||||||
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetParameters}" CommandParameter="{Binding}"/>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Controls.Primitives;
|
using System.Windows.Controls.Primitives;
|
||||||
using StructureHelper.Infrastructure.Enums;
|
using StructureHelper.Infrastructure.Enums;
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace StructureHelper.MaterialCatalogWindow
|
|||||||
|
|
||||||
private void InitializeRebarDefinitions()
|
private void InitializeRebarDefinitions()
|
||||||
{
|
{
|
||||||
RebarDefinitions = new NamedList<MaterialDefinitionBase>()
|
RebarDefinitions = new NamedList<MaterialDefinitionBase>
|
||||||
{
|
{
|
||||||
new RebarDefinition("S240", 2, 240, 240, 1.15, 1.15),
|
new RebarDefinition("S240", 2, 240, 240, 1.15, 1.15),
|
||||||
new RebarDefinition("S400", 2, 400, 400, 1.15, 1.15),
|
new RebarDefinition("S400", 2, 400, 400, 1.15, 1.15),
|
||||||
@@ -38,7 +38,7 @@ namespace StructureHelper.MaterialCatalogWindow
|
|||||||
|
|
||||||
private void InitializeConcreteDefinitions()
|
private void InitializeConcreteDefinitions()
|
||||||
{
|
{
|
||||||
ConcreteDefinitions = new NamedList<MaterialDefinitionBase>()
|
ConcreteDefinitions = new NamedList<MaterialDefinitionBase>
|
||||||
{
|
{
|
||||||
new ConcreteDefinition("C10", 0, 10, 0, 1.3, 1.5),
|
new ConcreteDefinition("C10", 0, 10, 0, 1.3, 1.5),
|
||||||
new ConcreteDefinition("C15", 0, 15, 0, 1.3, 1.5),
|
new ConcreteDefinition("C15", 0, 15, 0, 1.3, 1.5),
|
||||||
|
|||||||
@@ -52,24 +52,4 @@ namespace StructureHelper.Services
|
|||||||
|
|
||||||
public IEnumerable<Rectangle> GetRectangles() => rectangles;
|
public IEnumerable<Rectangle> 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,10 @@
|
|||||||
<DependentUpon>PrimitivePopup.xaml</DependentUpon>
|
<DependentUpon>PrimitivePopup.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Services\PrimitiveService.cs" />
|
<Compile Include="Services\PrimitiveService.cs" />
|
||||||
|
<Compile Include="UnitSystem\UnitSystemService.cs" />
|
||||||
|
<Compile Include="UnitSystem\Enums\SystemTypes.cs" />
|
||||||
|
<Compile Include="UnitSystem\Systems\SystemSi.cs" />
|
||||||
|
<Compile Include="UnitSystem\Systems\IUnitSystem.cs" />
|
||||||
<Compile Include="Windows\AddMaterialWindow\AddMaterialView.xaml.cs">
|
<Compile Include="Windows\AddMaterialWindow\AddMaterialView.xaml.cs">
|
||||||
<DependentUpon>AddMaterialView.xaml</DependentUpon>
|
<DependentUpon>AddMaterialView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -193,6 +197,10 @@
|
|||||||
<Project>{5dfec3fd-9677-47bb-9e88-eb71828b5913}</Project>
|
<Project>{5dfec3fd-9677-47bb-9e88-eb71828b5913}</Project>
|
||||||
<Name>StructureHelperCommon</Name>
|
<Name>StructureHelperCommon</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="StructureHelperLogics\StructureHelperLogics.csproj">
|
||||||
|
<Project>{330bef5b-15be-4d2c-a750-b1ae50fb2be3}</Project>
|
||||||
|
<Name>StructureHelperLogics</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@@ -17,8 +17,8 @@ namespace StructureHelperCommon.Models.NdmPrimitives
|
|||||||
{
|
{
|
||||||
double strength = 400e6d;
|
double strength = 400e6d;
|
||||||
string materialName = "s400";
|
string materialName = "s400";
|
||||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
|
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
|
||||||
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = _center, Shape = _shape, PrimitiveMaterial = primitiveMaterial };
|
INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = _center, Shape = _shape, PrimitiveMaterial = primitiveMaterial };
|
||||||
return ndmPrimitive;
|
return ndmPrimitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace StructureHelperCommon.Models.NdmPrimitives
|
|||||||
{
|
{
|
||||||
double strength = 40e6d;
|
double strength = 40e6d;
|
||||||
string materialName = "C40/45";
|
string materialName = "C40/45";
|
||||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
|
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
|
||||||
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = _center, Shape = _shape, PrimitiveMaterial = primitiveMaterial, NdmMaxSize = 1, NdmMinDivision = 20 };
|
INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = _center, Shape = _shape, PrimitiveMaterial = primitiveMaterial, NdmMaxSize = 1, NdmMinDivision = 20 };
|
||||||
return ndmPrimitive;
|
return ndmPrimitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
ICenter center = options.Center;
|
ICenter center = options.Center;
|
||||||
double area = options.Area;
|
double area = options.Area;
|
||||||
List<INdm> ndmCollection = new List<INdm>();
|
List<INdm> ndmCollection = new List<INdm>();
|
||||||
INdm ndm = new Ndm() { CenterX = center.X, CenterY = center.Y, Area = area, Material = material };
|
INdm ndm = new Ndm { CenterX = center.X, CenterY = center.Y, Area = area, Material = material };
|
||||||
ndmCollection.Add(ndm);
|
ndmCollection.Add(ndm);
|
||||||
return ndmCollection;
|
return ndmCollection;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
using Autofac;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using LoaderCalculator;
|
using LoaderCalculator;
|
||||||
using LoaderCalculator.Data.Matrix;
|
using LoaderCalculator.Data.Matrix;
|
||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Data.SourceData;
|
using LoaderCalculator.Data.SourceData;
|
||||||
using StructureHelper;
|
|
||||||
using StructureHelper.Services;
|
|
||||||
using StructureHelperCommon.Models.Entities;
|
using StructureHelperCommon.Models.Entities;
|
||||||
using StructureHelperCommon.Models.NdmPrimitives;
|
|
||||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
using StructureHelperLogics.Infrastructures.CommonEnums;
|
using StructureHelperLogics.Infrastructures.CommonEnums;
|
||||||
|
|
||||||
@@ -17,51 +12,29 @@ namespace StructureHelperLogics.Services
|
|||||||
{
|
{
|
||||||
public class CalculationService
|
public class CalculationService
|
||||||
{
|
{
|
||||||
public IStrainMatrix GetPrimitiveStrainMatrix(double topArea, double bottomArea, RectanglePrimitive concreteRectangle, double mx, double my, double nz)
|
public IStrainMatrix GetPrimitiveStrainMatrix(INdmPrimitive[] ndmPrimitives, double mx, double my, double nz)
|
||||||
{
|
{
|
||||||
var ndmPrimitives = new List<INdmPrimitive>();
|
|
||||||
//Добавляем прямоугольник бетонного сечения
|
|
||||||
|
|
||||||
ndmPrimitives.Add(concreteRectangle.GetNdmPrimitive());
|
|
||||||
|
|
||||||
using (var scope = App.Container.BeginLifetimeScope())
|
|
||||||
{
|
|
||||||
var primitiveService = scope.Resolve<PrimitiveService>();
|
|
||||||
//Добавляем точки внутри прямоугольника
|
|
||||||
ndmPrimitives.AddRange(primitiveService.GetInnerPoints(concreteRectangle).Select(x=>x.GetNdmPrimitive()));
|
|
||||||
}
|
|
||||||
|
|
||||||
//Коллекция для хранения элементарных участков
|
//Коллекция для хранения элементарных участков
|
||||||
var ndmCollection = new List<INdm>();
|
var ndmCollection = new List<INdm>();
|
||||||
//Настройки триангуляции, пока опции могут быть только такие
|
//Настройки триангуляции, пока опции могут быть только такие
|
||||||
ITriangulationOptions options = new TriangulationOptions
|
ITriangulationOptions options = new TriangulationOptions { LimiteState = LimitStates.Collapse, CalcTerm = CalcTerms.ShortTerm };
|
||||||
{
|
|
||||||
LimiteState = LimitStates.Collapse,
|
|
||||||
CalcTerm = CalcTerms.ShortTerm
|
|
||||||
};
|
|
||||||
|
|
||||||
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
|
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
|
||||||
ndmCollection.AddRange(Triangulation.GetNdms(ndmPrimitives, options));
|
ndmCollection.AddRange(Triangulation.GetNdms(ndmPrimitives, options));
|
||||||
|
var loaderData = new LoaderOptions
|
||||||
var calculator = new Calculator();
|
|
||||||
var calculationData = new LoaderOptions
|
|
||||||
{
|
{
|
||||||
Preconditions = new Preconditions
|
Preconditions = new Preconditions
|
||||||
{
|
{
|
||||||
ConditionRate = 0.01,
|
ConditionRate = 0.01,
|
||||||
MaxIterationCount = 100,
|
MaxIterationCount = 100,
|
||||||
StartForceMatrix = new ForceMatrix
|
StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz }
|
||||||
{
|
|
||||||
Mx = mx,
|
|
||||||
My = my,
|
|
||||||
Nz = nz
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
NdmCollection = ndmCollection
|
NdmCollection = ndmCollection
|
||||||
};
|
};
|
||||||
calculator.Run(calculationData, new CancellationToken());
|
var calculator = new Calculator();
|
||||||
var results = calculator.Result;
|
//Act
|
||||||
return results.StrainMatrix;
|
calculator.Run(loaderData, new CancellationToken());
|
||||||
|
return calculator.Result.StrainMatrix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\StructureHelper.csproj" />
|
|
||||||
<ProjectReference Include="..\StructureHelperCommon\StructureHelperCommon.csproj" />
|
<ProjectReference Include="..\StructureHelperCommon\StructureHelperCommon.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -37,22 +37,22 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
|||||||
//Коллекция для хранения элементарных участков
|
//Коллекция для хранения элементарных участков
|
||||||
var ndmCollection = new List<INdm>();
|
var ndmCollection = new List<INdm>();
|
||||||
//Настройки триангуляции, пока опции могут быть только такие
|
//Настройки триангуляции, пока опции могут быть только такие
|
||||||
ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
ITriangulationOptions options = new TriangulationOptions { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
||||||
var ndmPrimitives = new List<INdmPrimitive>();
|
var ndmPrimitives = new List<INdmPrimitive>();
|
||||||
//Добавляем прямоугольник бетонного сечения
|
//Добавляем прямоугольник бетонного сечения
|
||||||
var concreteRectangle = new RectanglePrimitive(new Center() { X = 0, Y = 0 }, new Rectangle() { Width = width, Height = height, Angle = 0 });
|
var concreteRectangle = new RectanglePrimitive(new Center { X = 0, Y = 0 }, new Rectangle { Width = width, Height = height, Angle = 0 });
|
||||||
ndmPrimitives.Add(concreteRectangle.GetNdmPrimitive());
|
ndmPrimitives.Add(concreteRectangle.GetNdmPrimitive());
|
||||||
//Добавляем 4 точки для арматуры
|
//Добавляем 4 точки для арматуры
|
||||||
// 0.05 - величина защитного слоя (расстояние от грани прямоугольника до центра арматуры
|
// 0.05 - величина защитного слоя (расстояние от грани прямоугольника до центра арматуры
|
||||||
//С площадью нижней арматуры
|
//С площадью нижней арматуры
|
||||||
var leftBottomReinforcementPoint = new PointPrimitive(new Center() { X = -width / 2 + 0.05d, Y = -height / 2 + 0.05 }, new Point() { Area = bottomArea });
|
var leftBottomReinforcementPoint = new PointPrimitive(new Center { X = -width / 2 + 0.05d, Y = -height / 2 + 0.05 }, new Point { Area = bottomArea });
|
||||||
ndmPrimitives.Add(leftBottomReinforcementPoint.GetNdmPrimitive());
|
ndmPrimitives.Add(leftBottomReinforcementPoint.GetNdmPrimitive());
|
||||||
var rightBottomReinforcementPoint = new PointPrimitive(new Center() { X = width / 2 - 0.05d, Y = -height / 2 + 0.05 }, new Point() { Area = bottomArea });
|
var rightBottomReinforcementPoint = new PointPrimitive(new Center { X = width / 2 - 0.05d, Y = -height / 2 + 0.05 }, new Point { Area = bottomArea });
|
||||||
ndmPrimitives.Add(rightBottomReinforcementPoint.GetNdmPrimitive());
|
ndmPrimitives.Add(rightBottomReinforcementPoint.GetNdmPrimitive());
|
||||||
//С площадью верхней арматуры
|
//С площадью верхней арматуры
|
||||||
var leftTopReinforcementPoint = new PointPrimitive(new Center() { X = -width / 2 + 0.05d, Y = height / 2 - 0.05 }, new Point() { Area = topArea });
|
var leftTopReinforcementPoint = new PointPrimitive(new Center { X = -width / 2 + 0.05d, Y = height / 2 - 0.05 }, new Point { Area = topArea });
|
||||||
ndmPrimitives.Add(leftTopReinforcementPoint.GetNdmPrimitive());
|
ndmPrimitives.Add(leftTopReinforcementPoint.GetNdmPrimitive());
|
||||||
var rightTopReinforcementPoint = new PointPrimitive(new Center() { X = width / 2 - 0.05d, Y = height / 2 - 0.05 }, new Point() { Area = topArea });
|
var rightTopReinforcementPoint = new PointPrimitive(new Center { X = width / 2 - 0.05d, Y = height / 2 - 0.05 }, new Point { Area = topArea });
|
||||||
ndmPrimitives.Add(rightTopReinforcementPoint.GetNdmPrimitive());
|
ndmPrimitives.Add(rightTopReinforcementPoint.GetNdmPrimitive());
|
||||||
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
|
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
|
||||||
ndmCollection.AddRange(Triangulation.GetNdms(ndmPrimitives, options));
|
ndmCollection.AddRange(Triangulation.GetNdms(ndmPrimitives, options));
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
|||||||
double width = 0.4;
|
double width = 0.4;
|
||||||
double height = 0.6;
|
double height = 0.6;
|
||||||
var ndmCollection = new List<INdm>();
|
var ndmCollection = new List<INdm>();
|
||||||
ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
ITriangulationOptions options = new TriangulationOptions { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
||||||
var primitives = new List<INdmPrimitive>();
|
var primitives = new List<INdmPrimitive>();
|
||||||
primitives.AddRange(GetConcreteNdms(width, height));
|
primitives.AddRange(GetConcreteNdms(width, height));
|
||||||
primitives.AddRange(GetReinforcementNdms(width, height, topArea, bottomArea));
|
primitives.AddRange(GetReinforcementNdms(width, height, topArea, bottomArea));
|
||||||
@@ -60,11 +60,11 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
|||||||
private IEnumerable<INdmPrimitive> GetConcreteNdms(double width, double height)
|
private IEnumerable<INdmPrimitive> GetConcreteNdms(double width, double height)
|
||||||
{
|
{
|
||||||
double strength = 40e6;
|
double strength = 40e6;
|
||||||
ICenter center = new Center() { X = 0, Y = 0 };
|
ICenter center = new Center { X = 0, Y = 0 };
|
||||||
IRectangle rectangle = new Rectangle() { Width = width, Height = height, Angle = 0 };
|
IRectangle rectangle = new Rectangle { Width = width, Height = height, Angle = 0 };
|
||||||
IPrimitiveMaterial material = new PrimitiveMaterial() { MaterialType = MaterialTypes.Concrete, ClassName = "С40", Strength = strength };
|
IPrimitiveMaterial material = new PrimitiveMaterial { MaterialType = MaterialTypes.Concrete, ClassName = "С40", Strength = strength };
|
||||||
//ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
//ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
||||||
INdmPrimitive primitive = new NdmPrimitive() { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 20 };
|
INdmPrimitive primitive = new NdmPrimitive { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 20 };
|
||||||
List<INdmPrimitive> primitives = new List<INdmPrimitive> {primitive};
|
List<INdmPrimitive> primitives = new List<INdmPrimitive> {primitive};
|
||||||
return primitives;
|
return primitives;
|
||||||
}
|
}
|
||||||
@@ -73,27 +73,27 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
|||||||
{
|
{
|
||||||
double gap = 0.05d;
|
double gap = 0.05d;
|
||||||
double strength = 4e8;
|
double strength = 4e8;
|
||||||
IShape topReinforcement = new Point() { Area = topArea };
|
IShape topReinforcement = new Point { Area = topArea };
|
||||||
IShape bottomReinforcement = new Point() { Area = bottomArea };
|
IShape bottomReinforcement = new Point { Area = bottomArea };
|
||||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength };
|
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength };
|
||||||
//ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
//ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
||||||
ICenter centerRT = new Center() { X = width / 2 - gap, Y = height / 2 - gap };
|
ICenter centerRT = new Center { X = width / 2 - gap, Y = height / 2 - gap };
|
||||||
ICenter centerLT = new Center() { X = - (width / 2 - gap), Y = height / 2 - gap };
|
ICenter centerLT = new Center { X = - (width / 2 - gap), Y = height / 2 - gap };
|
||||||
ICenter centerRB = new Center() { X = width / 2 - gap, Y = - (height / 2 - gap) };
|
ICenter centerRB = new Center { X = width / 2 - gap, Y = - (height / 2 - gap) };
|
||||||
ICenter centerLB = new Center() { X = -(width / 2 - gap), Y = - (height / 2 - gap) };
|
ICenter centerLB = new Center { X = -(width / 2 - gap), Y = - (height / 2 - gap) };
|
||||||
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||||
INdmPrimitive primitive;
|
INdmPrimitive primitive;
|
||||||
//Right top bar
|
//Right top bar
|
||||||
primitive = new NdmPrimitive() { Center = centerRT, Shape = topReinforcement, PrimitiveMaterial = primitiveMaterial};
|
primitive = new NdmPrimitive { Center = centerRT, Shape = topReinforcement, PrimitiveMaterial = primitiveMaterial};
|
||||||
primitives.Add(primitive);
|
primitives.Add(primitive);
|
||||||
//Left top bar
|
//Left top bar
|
||||||
primitive = new NdmPrimitive() { Center = centerLT, Shape = topReinforcement, PrimitiveMaterial = primitiveMaterial };
|
primitive = new NdmPrimitive { Center = centerLT, Shape = topReinforcement, PrimitiveMaterial = primitiveMaterial };
|
||||||
primitives.Add(primitive);
|
primitives.Add(primitive);
|
||||||
//Right bottom bar
|
//Right bottom bar
|
||||||
primitive = new NdmPrimitive() { Center = centerRB, Shape = bottomReinforcement, PrimitiveMaterial = primitiveMaterial };
|
primitive = new NdmPrimitive { Center = centerRB, Shape = bottomReinforcement, PrimitiveMaterial = primitiveMaterial };
|
||||||
primitives.Add(primitive);
|
primitives.Add(primitive);
|
||||||
//Left bottom bar
|
//Left bottom bar
|
||||||
primitive = new NdmPrimitive() { Center = centerLB, Shape = bottomReinforcement, PrimitiveMaterial = primitiveMaterial };
|
primitive = new NdmPrimitive { Center = centerLB, Shape = bottomReinforcement, PrimitiveMaterial = primitiveMaterial };
|
||||||
primitives.Add(primitive);
|
primitives.Add(primitive);
|
||||||
return primitives;
|
return primitives;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
|
|||||||
public void Run_ShouldPass(double width, double height, double strength, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
|
public void Run_ShouldPass(double width, double height, double strength, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
|
||||||
{
|
{
|
||||||
//Arrange
|
//Arrange
|
||||||
ICenter center = new Center() { X = 0, Y = 0 };
|
ICenter center = new Center { X = 0, Y = 0 };
|
||||||
IRectangle rectangle = new Rectangle() { Width = width, Height = height, Angle = 0 };
|
IRectangle rectangle = new Rectangle { Width = width, Height = height, Angle = 0 };
|
||||||
IPrimitiveMaterial material = new PrimitiveMaterial() { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength };
|
IPrimitiveMaterial material = new PrimitiveMaterial { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength };
|
||||||
ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
ITriangulationOptions options = new TriangulationOptions { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
||||||
INdmPrimitive primitive = new NdmPrimitive() { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 100 };
|
INdmPrimitive primitive = new NdmPrimitive { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 100 };
|
||||||
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||||
primitives.Add(primitive);
|
primitives.Add(primitive);
|
||||||
var ndmCollection = Triangulation.GetNdms(primitives, options);
|
var ndmCollection = Triangulation.GetNdms(primitives, options);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace LoaderCalculator.Tests.FunctionalTests.SectionTests
|
|||||||
double height = 0.6;
|
double height = 0.6;
|
||||||
ArrangeMaterial(LimitStates.Collapse, true);
|
ArrangeMaterial(LimitStates.Collapse, true);
|
||||||
List<INdm> ndmList = new List<INdm>();
|
List<INdm> ndmList = new List<INdm>();
|
||||||
IStrainMatrix prestrainMatrix = new StrainMatrix() { Kx = prestrainKx, Ky = prestrainKy, EpsZ = prestrainEpsZ };
|
IStrainMatrix prestrainMatrix = new StrainMatrix { Kx = prestrainKx, Ky = prestrainKy, EpsZ = prestrainEpsZ };
|
||||||
ndmList.AddRange(GetConcreteNdms(width, height));
|
ndmList.AddRange(GetConcreteNdms(width, height));
|
||||||
var reinforcement = GetReinforcementNdms(width, height, topArea, bottomArea);
|
var reinforcement = GetReinforcementNdms(width, height, topArea, bottomArea);
|
||||||
NdmTransform.SetPrestrain(reinforcement, prestrainMatrix);
|
NdmTransform.SetPrestrain(reinforcement, prestrainMatrix);
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
|||||||
{
|
{
|
||||||
//Arrange
|
//Arrange
|
||||||
IMaterial material = new Material();
|
IMaterial material = new Material();
|
||||||
ICenter center = new Center() { X = centerX, Y = centerY };
|
ICenter center = new Center { X = centerX, Y = centerY };
|
||||||
IRectangle rectangle = new Rectangle() { Width = width, Height = height, Angle = angle };
|
IRectangle rectangle = new Rectangle { Width = width, Height = height, Angle = angle };
|
||||||
IRectangleTriangulationLogicOptions options = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogicOptions(center, rectangle, ndmMaxSize, ndmMinDivision);
|
IRectangleTriangulationLogicOptions options = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogicOptions(center, rectangle, ndmMaxSize, ndmMinDivision);
|
||||||
IRectangleTriangulationLogic logic = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogic(options);
|
IRectangleTriangulationLogic logic = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogic(options);
|
||||||
//Act
|
//Act
|
||||||
|
|||||||
23
UnitSystem/Enums/SystemTypes.cs
Normal file
23
UnitSystem/Enums/SystemTypes.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.UnitSystem.Enums
|
||||||
|
{
|
||||||
|
public enum Force
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public enum Pressure
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public enum Length
|
||||||
|
{
|
||||||
|
M
|
||||||
|
}
|
||||||
|
public enum MultiplyPrefix
|
||||||
|
{
|
||||||
|
m
|
||||||
|
}
|
||||||
|
}
|
||||||
14
UnitSystem/Systems/IUnitSystem.cs
Normal file
14
UnitSystem/Systems/IUnitSystem.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using StructureHelper.UnitSystem.Enums;
|
||||||
|
|
||||||
|
namespace StructureHelper.UnitSystem.Systems
|
||||||
|
{
|
||||||
|
public interface IUnitSystem
|
||||||
|
{
|
||||||
|
string Name { get; }
|
||||||
|
Tuple<Force, MultiplyPrefix> ForceUnits { get; }
|
||||||
|
Tuple<Pressure, MultiplyPrefix> PressureUnits { get; }
|
||||||
|
Tuple<Length, MultiplyPrefix> LengthUnits { get; }
|
||||||
|
double ConvertLength(double length);
|
||||||
|
}
|
||||||
|
}
|
||||||
29
UnitSystem/Systems/SystemSi.cs
Normal file
29
UnitSystem/Systems/SystemSi.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using StructureHelper.UnitSystem.Enums;
|
||||||
|
using StructureHelper.UnitSystem.Systems;
|
||||||
|
|
||||||
|
namespace StructureHelper.UnitSystem
|
||||||
|
{
|
||||||
|
internal class SystemSi : IUnitSystem
|
||||||
|
{
|
||||||
|
public SystemSi()
|
||||||
|
{
|
||||||
|
LengthUnits = new Tuple<Length, MultiplyPrefix>(Length.M, MultiplyPrefix.m);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name => "СИ";
|
||||||
|
public Tuple<Force, MultiplyPrefix> ForceUnits { get; }
|
||||||
|
public Tuple<Pressure, MultiplyPrefix> PressureUnits { get; }
|
||||||
|
public Tuple<Length, MultiplyPrefix> LengthUnits { get; }
|
||||||
|
public double ConvertLength(double length)
|
||||||
|
{
|
||||||
|
switch (LengthUnits.Item2)
|
||||||
|
{
|
||||||
|
case MultiplyPrefix.m:
|
||||||
|
return length / 1000;
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
UnitSystem/UnitSystemService.cs
Normal file
19
UnitSystem/UnitSystemService.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using StructureHelper.UnitSystem.Systems;
|
||||||
|
|
||||||
|
namespace StructureHelper.UnitSystem
|
||||||
|
{
|
||||||
|
public class UnitSystemService
|
||||||
|
{
|
||||||
|
private IUnitSystem currentSystem;
|
||||||
|
public IUnitSystem GetCurrentSystem() => currentSystem;
|
||||||
|
public UnitSystemService()
|
||||||
|
{
|
||||||
|
currentSystem = new SystemSi();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,8 +4,9 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:StructureHelper"
|
xmlns:local="clr-namespace:StructureHelper"
|
||||||
|
xmlns:colorPickerWindow="clr-namespace:StructureHelper.Windows.ColorPickerWindow"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance local:ColorPickerViewModel}"
|
d:DataContext="{d:DesignInstance colorPickerWindow:ColorPickerViewModel}"
|
||||||
Title="Выбрать цвет" Height="200" Width="500" Topmost="True" ResizeMode="NoResize">
|
Title="Выбрать цвет" Height="200" Width="500" Topmost="True" ResizeMode="NoResize">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@@ -28,6 +29,7 @@
|
|||||||
<Rectangle Fill="{Binding SelectedColor}"/>
|
<Rectangle Fill="{Binding SelectedColor}"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
|
||||||
<TextBlock Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Зеленый"/>
|
<TextBlock Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Зеленый"/>
|
||||||
<Slider Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Value="{Binding Green}" Minimum="0" Maximum="255"/>
|
<Slider Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Value="{Binding Green}" Minimum="0" Maximum="255"/>
|
||||||
<TextBox Grid.Row="1" Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Text="{Binding Green}"/>
|
<TextBox Grid.Row="1" Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Text="{Binding Green}"/>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace StructureHelper.Windows.ColorPickerWindow
|
|||||||
public Brush SelectedColor
|
public Brush SelectedColor
|
||||||
{
|
{
|
||||||
get => selectedColor;
|
get => selectedColor;
|
||||||
set => OnPropertyChanged(value, selectedColor);
|
set => OnPropertyChanged(value, ref selectedColor);
|
||||||
}
|
}
|
||||||
public ICommand SetColor { get; }
|
public ICommand SetColor { get; }
|
||||||
public ColorPickerViewModel(PrimitiveBase primitive)
|
public ColorPickerViewModel(PrimitiveBase primitive)
|
||||||
|
|||||||
@@ -1,7 +1,30 @@
|
|||||||
namespace StructureHelper.Windows.MainWindow
|
using LoaderCalculator.Data.Matrix;
|
||||||
|
using StructureHelper.Services;
|
||||||
|
using StructureHelper.UnitSystem;
|
||||||
|
using StructureHelperLogics.Services;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.MainWindow
|
||||||
{
|
{
|
||||||
public class MainModel
|
public class MainModel
|
||||||
{
|
{
|
||||||
|
private IPrimitiveRepository primitiveRepository;
|
||||||
|
private CalculationService calculationService;
|
||||||
|
private UnitSystemService unitSystemService;
|
||||||
|
|
||||||
|
public MainModel(IPrimitiveRepository primitiveRepository, CalculationService calculationService, UnitSystemService unitSystemService)
|
||||||
|
{
|
||||||
|
this.primitiveRepository = primitiveRepository;
|
||||||
|
this.calculationService = calculationService;
|
||||||
|
this.unitSystemService = unitSystemService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IStrainMatrix Calculate(double mx, double my, double nz)
|
||||||
|
{
|
||||||
|
var unitSystem = unitSystemService.GetCurrentSystem();
|
||||||
|
return calculationService.GetPrimitiveStrainMatrix(primitiveRepository.GetPoints()
|
||||||
|
.Select(x => x.GetNdmPrimitive(unitSystem))
|
||||||
|
.Concat(primitiveRepository.GetRectangles().Select(x => x.GetNdmPrimitive(unitSystem))).ToArray(), mx, my, nz);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,10 @@
|
|||||||
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
|
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
|
||||||
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
|
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
|
||||||
xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow"
|
xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow"
|
||||||
|
xmlns:enums="clr-namespace:StructureHelper.Infrastructure.Enums"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance local:MainViewModel}"
|
d:DataContext="{d:DesignInstance local:MainViewModel}"
|
||||||
Title="StructureHelper" Height="700" Width="1000">
|
Title="StructureHelper" Height="700" Width="1000">
|
||||||
<Window.InputBindings>
|
|
||||||
<KeyBinding Command="{Binding SetParameters}" Key="Enter"/>
|
|
||||||
</Window.InputBindings>
|
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<DataTemplate DataType="{x:Type dataContexts:Rectangle}">
|
<DataTemplate DataType="{x:Type dataContexts:Rectangle}">
|
||||||
<dataTemplates:RectangleTemplate/>
|
<dataTemplates:RectangleTemplate/>
|
||||||
@@ -29,7 +27,10 @@
|
|||||||
<RowDefinition Height="40"/>
|
<RowDefinition Height="40"/>
|
||||||
<RowDefinition Height="40"/>
|
<RowDefinition Height="40"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Border BorderBrush="Black" Background="White" BorderThickness="1" Margin="5">
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Border BorderBrush="Black" Background="White" BorderThickness="1" Margin="5" Grid.ColumnSpan="5">
|
||||||
<i:Interaction.Triggers>
|
<i:Interaction.Triggers>
|
||||||
<i:EventTrigger EventName="PreviewMouseDown">
|
<i:EventTrigger EventName="PreviewMouseDown">
|
||||||
<i:InvokeCommandAction Command="{Binding ClearSelection}" CommandParameter="{Binding}"/>
|
<i:InvokeCommandAction Command="{Binding ClearSelection}" CommandParameter="{Binding}"/>
|
||||||
@@ -87,8 +88,15 @@
|
|||||||
</Canvas>
|
</Canvas>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Border>
|
</Border>
|
||||||
<Button Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Content="Справочник" Command="{Binding OpenMaterialCatalog}"/>
|
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||||
<Button Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="10" Content="Добавить прямоугольник" Command="{Binding AddRectangle}"/>
|
<Button VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Content="Справочник" Command="{Binding OpenMaterialCatalog}"/>
|
||||||
<Button Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="10" Content="Добавить точку" Command="{Binding AddEllipse}"/>
|
<Button VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Content="Система едениц" Command="{Binding OpenUnitsSystemSettings}"/>
|
||||||
|
<Label VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Content="{Binding UnitsSystemName}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<Button VerticalAlignment="Center" Margin="5" Content="Добавить прямоугольник" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||||
|
<Button VerticalAlignment="Center" Margin="5" Content="Добавить точку" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<Button Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5" Content="Рассчитать" Command="{Binding Calculate}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -6,12 +6,10 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
public partial class MainView : Window
|
public partial class MainView : Window
|
||||||
{
|
{
|
||||||
public IPrimitiveRepository PrimitiveRepository { get; }
|
public IPrimitiveRepository PrimitiveRepository { get; }
|
||||||
public IPrimitiveService PrimitiveService { get; }
|
|
||||||
|
|
||||||
public MainView(IPrimitiveRepository primitiveRepository, IPrimitiveService primitiveService, MainViewModel viewModel)
|
public MainView(IPrimitiveRepository primitiveRepository, MainViewModel viewModel)
|
||||||
{
|
{
|
||||||
PrimitiveRepository = primitiveRepository;
|
PrimitiveRepository = primitiveRepository;
|
||||||
PrimitiveService = primitiveService;
|
|
||||||
DataContext = viewModel;
|
DataContext = viewModel;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,21 +3,25 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using StructureHelper.Infrastructure;
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Infrastructure.Enums;
|
||||||
using StructureHelper.Infrastructure.Extensions;
|
using StructureHelper.Infrastructure.Extensions;
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
using StructureHelper.MaterialCatalogWindow;
|
using StructureHelper.MaterialCatalogWindow;
|
||||||
using StructureHelper.Services;
|
using StructureHelper.Services;
|
||||||
using StructureHelper.Windows.ColorPickerWindow;
|
using StructureHelper.Windows.ColorPickerWindow;
|
||||||
|
using StructureHelper.UnitSystem;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.MainWindow
|
namespace StructureHelper.Windows.MainWindow
|
||||||
{
|
{
|
||||||
public class MainViewModel : ViewModelBase
|
public class MainViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private IPrimitiveService PrimitiveService { get; }
|
private readonly double scaleRate = 1.1;
|
||||||
|
|
||||||
private IPrimitiveRepository PrimitiveRepository { get; }
|
private IPrimitiveRepository PrimitiveRepository { get; }
|
||||||
|
private readonly UnitSystemService unitSystemService;
|
||||||
|
|
||||||
private MainModel Model { get; }
|
private MainModel Model { get; }
|
||||||
public ObservableCollection<PrimitiveBase> Primitives { get; set; }
|
public ObservableCollection<PrimitiveBase> Primitives { get; set; }
|
||||||
public ICommand AddRectangle { get; }
|
|
||||||
|
|
||||||
private double panelX, panelY, scrollPanelX, scrollPanelY;
|
private double panelX, panelY, scrollPanelX, scrollPanelY;
|
||||||
|
|
||||||
@@ -42,85 +46,9 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
set => OnPropertyChanged(value, ref scrollPanelY);
|
set => OnPropertyChanged(value, ref scrollPanelY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private double rectParameterX, rectParameterY, rectParameterWidth, rectParameterHeight;
|
public int PrimitivesCount => Primitives.Count;
|
||||||
|
|
||||||
public double RectParameterX
|
|
||||||
{
|
|
||||||
get => rectParameterX;
|
|
||||||
set => OnPropertyChanged(value, ref rectParameterX);
|
|
||||||
}
|
|
||||||
public double RectParameterY
|
|
||||||
{
|
|
||||||
get => rectParameterY;
|
|
||||||
set => OnPropertyChanged(value, ref rectParameterY);
|
|
||||||
}
|
|
||||||
public double RectParameterWidth
|
|
||||||
{
|
|
||||||
get => rectParameterWidth;
|
|
||||||
set => OnPropertyChanged(value, ref rectParameterWidth);
|
|
||||||
}
|
|
||||||
public double RectParameterHeight
|
|
||||||
{
|
|
||||||
get => rectParameterHeight;
|
|
||||||
set => OnPropertyChanged(value, ref rectParameterHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
private double parameterOpacity = 0;
|
|
||||||
|
|
||||||
public double ParameterOpacity
|
|
||||||
{
|
|
||||||
get => parameterOpacity;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value >= 0 && value <= 100)
|
|
||||||
OnPropertyChanged(value, ref parameterOpacity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private double pointParameterX, pointParameterY, pointParameterSquare;
|
|
||||||
public double EllipseParameterX
|
|
||||||
{
|
|
||||||
get => pointParameterX;
|
|
||||||
set => OnPropertyChanged(value, ref pointParameterX);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double EllipseParameterY
|
|
||||||
{
|
|
||||||
get => pointParameterY;
|
|
||||||
set => OnPropertyChanged(value, ref pointParameterY);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double EllipseParameterSquare
|
|
||||||
{
|
|
||||||
get => pointParameterSquare;
|
|
||||||
set => OnPropertyChanged(value, ref pointParameterSquare);
|
|
||||||
}
|
|
||||||
private bool elementLock;
|
|
||||||
public bool ElementLock
|
|
||||||
{
|
|
||||||
get => elementLock;
|
|
||||||
set => OnPropertyChanged(value, ref elementLock);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int primitivesCount;
|
|
||||||
public int PrimitivesCount
|
|
||||||
{
|
|
||||||
get => primitivesCount;
|
|
||||||
set => OnPropertyChanged(value, ref primitivesCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int primitiveIndex = 1;
|
|
||||||
public int PrimitiveIndex
|
|
||||||
{
|
|
||||||
get => primitiveIndex;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value >= 0 && value <= primitivesCount)
|
|
||||||
OnPropertyChanged(value, ref primitiveIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private double scaleValue = 1.0;
|
private double scaleValue = 1.0;
|
||||||
|
|
||||||
public double ScaleValue
|
public double ScaleValue
|
||||||
{
|
{
|
||||||
get => scaleValue;
|
get => scaleValue;
|
||||||
@@ -160,42 +88,37 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
get => yY2;
|
get => yY2;
|
||||||
set => OnPropertyChanged(value, ref yY2);
|
set => OnPropertyChanged(value, ref yY2);
|
||||||
}
|
}
|
||||||
|
public ICommand AddPrimitive { get; }
|
||||||
public ICommand LeftButtonDown { get; }
|
public ICommand LeftButtonDown { get; }
|
||||||
public ICommand LeftButtonUp { get; }
|
public ICommand LeftButtonUp { get; }
|
||||||
public ICommand PreviewMouseMove { get; }
|
public ICommand PreviewMouseMove { get; }
|
||||||
|
|
||||||
public ICommand SetParameters { get; }
|
|
||||||
public ICommand ClearSelection { get; }
|
public ICommand ClearSelection { get; }
|
||||||
|
|
||||||
public ICommand OpenMaterialCatalog { get; }
|
public ICommand OpenMaterialCatalog { get; }
|
||||||
public ICommand OpenMaterialCatalogWithSelection { get; }
|
public ICommand OpenMaterialCatalogWithSelection { get; }
|
||||||
|
public ICommand OpenUnitsSystemSettings { get; }
|
||||||
public ICommand SetColor { get; }
|
public ICommand SetColor { get; }
|
||||||
public ICommand SetInFrontOfAll { get; }
|
public ICommand SetInFrontOfAll { get; }
|
||||||
public ICommand SetInBackOfAll { get; }
|
public ICommand SetInBackOfAll { get; }
|
||||||
public ICommand ScaleCanvasDown { get; }
|
public ICommand ScaleCanvasDown { get; }
|
||||||
public ICommand ScaleCanvasUp { get; }
|
public ICommand ScaleCanvasUp { get; }
|
||||||
public ICommand AddEllipse { get; }
|
public ICommand Calculate { get; }
|
||||||
public ICommand SetPopupCanBeClosedTrue { get; }
|
public ICommand SetPopupCanBeClosedTrue { get; }
|
||||||
public ICommand SetPopupCanBeClosedFalse { get; }
|
public ICommand SetPopupCanBeClosedFalse { get; }
|
||||||
|
public string UnitsSystemName => unitSystemService.GetCurrentSystem().Name;
|
||||||
|
|
||||||
private double delta = 0.5;
|
private double delta = 0.5;
|
||||||
|
|
||||||
public MainViewModel(MainModel model, IPrimitiveService primitiveService, IPrimitiveRepository primitiveRepository)
|
public MainViewModel(MainModel model, IPrimitiveRepository primitiveRepository, UnitSystemService unitSystemService)
|
||||||
{
|
{
|
||||||
PrimitiveService = primitiveService;
|
|
||||||
PrimitiveRepository = primitiveRepository;
|
PrimitiveRepository = primitiveRepository;
|
||||||
Model = model;
|
Model = model;
|
||||||
|
this.unitSystemService = unitSystemService;
|
||||||
CanvasWidth = 1500;
|
CanvasWidth = 1500;
|
||||||
CanvasHeight = 1000;
|
CanvasHeight = 1000;
|
||||||
XX2 = CanvasWidth;
|
XX2 = CanvasWidth;
|
||||||
XY1 = CanvasHeight / 2;
|
XY1 = CanvasHeight / 2;
|
||||||
YX1 = CanvasWidth / 2;
|
YX1 = CanvasWidth / 2;
|
||||||
YY2 = CanvasHeight;
|
YY2 = CanvasHeight;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LeftButtonUp = new RelayCommand(o =>
|
LeftButtonUp = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
if (o is Rectangle rect) rect.BorderCaptured = false;
|
if (o is Rectangle rect) rect.BorderCaptured = false;
|
||||||
@@ -219,44 +142,15 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
rect.PrimitiveHeight = PanelY - rect.Y + 10;
|
rect.PrimitiveHeight = PanelY - rect.Y + 10;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
SetParameters = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
var primitive = Primitives.FirstOrDefault(x => x.ParameterCaptured);
|
|
||||||
if (primitive != null)
|
|
||||||
{
|
|
||||||
primitive.ElementLock = ElementLock;
|
|
||||||
primitive.ShowedOpacity = ParameterOpacity;
|
|
||||||
Primitives.MoveElementToSelectedIndex(primitive, PrimitiveIndex);
|
|
||||||
foreach (var primitiveDefinition in Primitives)
|
|
||||||
primitiveDefinition.ShowedZIndex = Primitives.IndexOf(primitiveDefinition) + 1;
|
|
||||||
|
|
||||||
switch (primitive)
|
|
||||||
{
|
|
||||||
case Rectangle rectangle:
|
|
||||||
rectangle.ShowedX = RectParameterX;
|
|
||||||
rectangle.ShowedY = RectParameterY;
|
|
||||||
rectangle.PrimitiveWidth = RectParameterWidth;
|
|
||||||
rectangle.PrimitiveHeight = RectParameterHeight;
|
|
||||||
break;
|
|
||||||
case Point point:
|
|
||||||
point.Square = EllipseParameterSquare;
|
|
||||||
point.ShowedX = EllipseParameterX;
|
|
||||||
point.ShowedY = EllipseParameterY;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ClearSelection = new RelayCommand(o =>
|
ClearSelection = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
var primitive = Primitives.FirstOrDefault(x => x.ParamsPanelVisibilty);
|
var primitive = Primitives?.FirstOrDefault(x => x.ParamsPanelVisibilty);
|
||||||
if (primitive != null && primitive.PopupCanBeClosed)
|
if (primitive != null && primitive.PopupCanBeClosed)
|
||||||
{
|
{
|
||||||
primitive.ParamsPanelVisibilty = false;
|
primitive.ParamsPanelVisibilty = false;
|
||||||
primitive.ParameterCaptured = false;
|
primitive.ParameterCaptured = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
OpenMaterialCatalog = new RelayCommand(o =>
|
OpenMaterialCatalog = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
var materialCatalogView = new MaterialCatalogView();
|
var materialCatalogView = new MaterialCatalogView();
|
||||||
@@ -268,6 +162,10 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
var materialCatalogView = new MaterialCatalogView(true, primitive);
|
var materialCatalogView = new MaterialCatalogView(true, primitive);
|
||||||
materialCatalogView.ShowDialog();
|
materialCatalogView.ShowDialog();
|
||||||
});
|
});
|
||||||
|
OpenUnitsSystemSettings = new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(UnitsSystemName));
|
||||||
|
});
|
||||||
SetColor = new RelayCommand(o =>
|
SetColor = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
var primitive = o as PrimitiveBase;
|
var primitive = o as PrimitiveBase;
|
||||||
@@ -287,21 +185,21 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
{
|
{
|
||||||
if (!(o is PrimitiveBase primitive)) return;
|
if (!(o is PrimitiveBase primitive)) return;
|
||||||
foreach (var primitiveDefinition in Primitives)
|
foreach (var primitiveDefinition in Primitives)
|
||||||
if (primitiveDefinition.ShowedZIndex < primitive.ShowedZIndex && primitiveDefinition != primitive)
|
if (primitiveDefinition != primitive && primitiveDefinition.ShowedZIndex < primitive.ShowedZIndex)
|
||||||
primitiveDefinition.ShowedZIndex++;
|
primitiveDefinition.ShowedZIndex++;
|
||||||
primitive.ShowedZIndex = 1;
|
primitive.ShowedZIndex = 1;
|
||||||
OnPropertyChanged(nameof(primitive.ShowedZIndex));
|
OnPropertyChanged(nameof(primitive.ShowedZIndex));
|
||||||
});
|
});
|
||||||
|
|
||||||
ScaleCanvasDown = new RelayCommand(o =>
|
ScaleCanvasDown = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
var scaleRate = 1.1;
|
|
||||||
ScrollPanelX = PanelX;
|
ScrollPanelX = PanelX;
|
||||||
ScrollPanelY = PanelY;
|
ScrollPanelY = PanelY;
|
||||||
ScaleValue *= scaleRate;
|
ScaleValue *= scaleRate;
|
||||||
});
|
});
|
||||||
|
|
||||||
ScaleCanvasUp = new RelayCommand(o =>
|
ScaleCanvasUp = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
var scaleRate = 1.1;
|
|
||||||
ScrollPanelX = PanelX;
|
ScrollPanelX = PanelX;
|
||||||
ScrollPanelY = PanelY;
|
ScrollPanelY = PanelY;
|
||||||
ScaleValue /= scaleRate;
|
ScaleValue /= scaleRate;
|
||||||
@@ -309,20 +207,19 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
|
|
||||||
Primitives = new ObservableCollection<PrimitiveBase>();
|
Primitives = new ObservableCollection<PrimitiveBase>();
|
||||||
|
|
||||||
AddRectangle = new RelayCommand(o =>
|
AddPrimitive = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
var rectangle = new Rectangle(60, 40, YX1, XY1, this);
|
if (!(o is PrimitiveType primitiveType)) return;
|
||||||
Primitives.Add(rectangle);
|
var primitive = primitiveType == PrimitiveType.Point
|
||||||
PrimitivesCount = Primitives.Count;
|
? (PrimitiveBase) new Point(50, YX1, XY1, this)
|
||||||
PrimitiveRepository.Add(rectangle);
|
: (PrimitiveBase) new Rectangle(60, 40, YX1, XY1, this);
|
||||||
|
Primitives.Add(primitive);
|
||||||
|
PrimitiveRepository.Add(primitive);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddEllipse = new RelayCommand(o =>
|
Calculate = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
var point = new Point(2000, YX1, XY1, this);
|
model.Calculate(-50e3, 0d, 0d);
|
||||||
Primitives.Add(point);
|
|
||||||
PrimitivesCount = Primitives.Count;
|
|
||||||
PrimitiveRepository.Add(point);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
SetPopupCanBeClosedTrue = new RelayCommand(o =>
|
SetPopupCanBeClosedTrue = new RelayCommand(o =>
|
||||||
@@ -330,6 +227,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
if (!(o is PrimitiveBase primitive)) return;
|
if (!(o is PrimitiveBase primitive)) return;
|
||||||
primitive.PopupCanBeClosed = true;
|
primitive.PopupCanBeClosed = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
SetPopupCanBeClosedFalse = new RelayCommand(o =>
|
SetPopupCanBeClosedFalse = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
if (!(o is PrimitiveBase primitive)) return;
|
if (!(o is PrimitiveBase primitive)) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user