Z-Index was added

This commit is contained in:
Evgeny Redikultsev
2022-11-10 22:06:27 +05:00
parent 5d19958fd7
commit 1d7a97f4fd
28 changed files with 93 additions and 147 deletions

View File

@@ -2,15 +2,24 @@
using StructureHelper.Infrastructure.Enums;
using StructureHelper.UnitSystem.Systems;
using StructureHelper.Windows.MainWindow;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Materials;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.Models.Materials;
using StructureHelperCommon.Models.Shapes;
namespace StructureHelper.Infrastructure.UI.DataContexts
{
public class Point : PrimitiveBase
{
public double Area { get; set; }
private double area;
public double Area
{ get => area;
set
{
area = value;
OnPropertyChanged(nameof(Area));
OnPropertyChanged(nameof(Diameter));
}
}
public Point(double area, double x, double y, MainViewModel ownerVm) : base(PrimitiveType.Point, x, y, ownerVm)
{
Name = "New point";
@@ -37,7 +46,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
CenterY = y;
}
public double Diameter { get => Math.Sqrt(Area / Math.PI) * 2; }
public double Diameter { get => Math.Sqrt(area / Math.PI) * 2; }
public override INdmPrimitive GetNdmPrimitive(IUnitSystem unitSystem)
{

View File

@@ -13,9 +13,9 @@ using StructureHelper.Windows.MainWindow;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Materials;
using StructureHelperLogics.Models.Materials;
using StructureHelperCommon.Services.ColorServices;
using StructureHelperLogics.Models.Primitives;
namespace StructureHelper.Infrastructure.UI.DataContexts
{
@@ -37,6 +37,8 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
private double prestrainKx, prestrainKy, prestrainEpsZ;
private double opacity = 1, showedOpacity = 0, x, y, xY1, yX1, primitiveWidth, primitiveHeight, showedX, showedY;
protected double delta = 0.5;
private double stressValue;
private double strainValue;
private int showedZIndex = 1, zIndex;
#endregion
@@ -249,6 +251,22 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
get => primitiveHeight;
set => OnPropertyChanged(value, ref primitiveHeight);
}
public double StressValue
{
get { return stressValue; }
set
{
OnPropertyChanged(value, ref stressValue);
}
}
public double StrainValue
{
get { return strainValue; }
set
{
OnPropertyChanged(value, ref strainValue);
}
}
public double ShowedX
{
get => showedX;

View File

@@ -1,10 +1,10 @@
using StructureHelper.Infrastructure.Enums;
using StructureHelper.UnitSystem.Systems;
using StructureHelper.Windows.MainWindow;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Materials;
using StructureHelperLogics.Models.Materials;
using StructureHelperCommon.Models.Shapes;
using System;
using StructureHelperLogics.Models.Primitives;
namespace StructureHelper.Infrastructure.UI.DataContexts
{

Binary file not shown.

View File

@@ -4,7 +4,6 @@ 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;

View File

@@ -1,10 +0,0 @@
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Shapes;
namespace StructureHelperCommon.Models.NdmPrimitives
{
public interface IPrimitive : ICenterShape
{
INdmPrimitive GetNdmPrimitive();
}
}

View File

@@ -1,31 +0,0 @@
using StructureHelperCommon.Infrastructures.Enums;
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;
}
}
}

View File

@@ -1,22 +0,0 @@
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();
}
}

View File

@@ -1,32 +0,0 @@
using StructureHelperCommon.Infrastructures.Enums;
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;
}
}
}

View File

@@ -50,15 +50,7 @@
<Compile Include="Infrastructures\Exceptions\StructureHelperException.cs" />
<Compile Include="Infrastructures\Interfaces\IHasParent.cs" />
<Compile Include="Infrastructures\Strings\ErrorString.cs" />
<Compile Include="Models\Entities\INdmPrimitive.cs" />
<Compile Include="Models\Entities\NdmPrimitive.cs" />
<Compile Include="Models\Materials\IPrimitiveMaterial.cs" />
<Compile Include="Infrastructures\Enums\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" />

View File

@@ -1,4 +1,4 @@
using StructureHelperCommon.Models.Materials;
using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@@ -1,5 +1,5 @@
using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Models.Materials;
using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
using System.Text;

View File

@@ -1,5 +1,5 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Materials;
using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.Infrastructures.CommonEnums;
using System;
using System.Collections.Generic;

View File

@@ -1,6 +1,6 @@
using StructureHelperCommon.Infrastructures.Enums;
namespace StructureHelperCommon.Models.Materials
namespace StructureHelperLogics.Models.Materials
{
public interface IPrimitiveMaterial
{

View File

@@ -2,7 +2,7 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Materials;
using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
using System.Text;

View File

@@ -1,13 +1,15 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelper.Models.Materials;
using StructureHelperCommon.Infrastructures.Enums;
using System;
namespace StructureHelperCommon.Models.Materials
namespace StructureHelperLogics.Models.Materials
{
public class PrimitiveMaterial : IPrimitiveMaterial
{
public string Id { get; }
public MaterialTypes MaterialType { get; set; }
public CodeTypes CodeType { get; set; }
IHeadMaterial HeadMaterial { get; set; }
public string ClassName { get; set; }
public double Strength { get; set; }

View File

@@ -1,7 +1,7 @@
using StructureHelperCommon.Models.Materials;
using StructureHelperLogics.Models.Materials;
using StructureHelperCommon.Models.Shapes;
namespace StructureHelperCommon.Models.Entities
namespace StructureHelperLogics.Models.Primitives
{
public interface INdmPrimitive
{

View File

@@ -1,7 +1,7 @@
using StructureHelperCommon.Models.Materials;
using StructureHelperLogics.Models.Materials;
using StructureHelperCommon.Models.Shapes;
namespace StructureHelperCommon.Models.Entities
namespace StructureHelperLogics.Models.Primitives
{
public class NdmPrimitive : INdmPrimitive
{

View File

@@ -1,8 +1,7 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.NdmPrimitives;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.Primitives;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{

View File

@@ -1,8 +1,8 @@
using System;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.Primitives;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{

View File

@@ -6,9 +6,9 @@ using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Materials;
using StructureHelperLogics.Models.Materials;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.Primitives;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
@@ -29,7 +29,11 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
}
return ndms;
}
/// <summary>
/// Returns dictionary of unique materials by collection of primitives
/// </summary>
/// <param name="ndmPrimitives"></param>
/// <returns></returns>
private static Dictionary<string, IPrimitiveMaterial> GetPrimitiveMaterials(IEnumerable<INdmPrimitive> ndmPrimitives)
{
Dictionary<string, IPrimitiveMaterial> primitiveMaterials = new Dictionary<string, IPrimitiveMaterial>();
@@ -40,7 +44,13 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
}
return primitiveMaterials;
}
/// <summary>
/// Return dictionary of ndm-materials by dictionary of primirive materials
/// </summary>
/// <param name="PrimitiveMaterials"></param>
/// <param name="options"></param>
/// <returns></returns>
/// <exception cref="StructureHelperException"></exception>
private static Dictionary<string, IMaterial> GetMaterials(Dictionary<string, IPrimitiveMaterial> PrimitiveMaterials, ITriangulationOptions options)
{
Dictionary<string, IMaterial> materials = new Dictionary<string, IMaterial>();
@@ -49,7 +59,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
foreach (string id in keyCollection)
{
IPrimitiveMaterial primitiveMaterial;
if (PrimitiveMaterials.TryGetValue(id, out primitiveMaterial) == false) { throw new Exception("Material dictionary is not valid"); }
if (PrimitiveMaterials.TryGetValue(id, out primitiveMaterial) == false) { throw new StructureHelperException("Material dictionary is not valid"); }
material = GetMaterial(primitiveMaterial, options);
materials.Add(id, material);
}

View File

@@ -4,12 +4,12 @@ using LoaderCalculator;
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.SourceData;
using StructureHelperCommon.Models.Entities;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Infrastructures.CommonEnums;
using StructureHelperLogics.Models.Calculations.CalculationsResults;
using StructureHelperLogics.Models.Calculations.CalculationProperties;
using System;
using StructureHelperLogics.Models.Primitives;
namespace StructureHelperLogics.Services
{

View File

@@ -7,9 +7,10 @@ using NUnit.Framework;
using StructureHelperLogics.NdmCalculations.Triangulations;
using System.Collections.Generic;
using System.Threading;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.NdmPrimitives;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.Primitives;
using StructureHelper.Infrastructure.UI.DataContexts;
using dContext = StructureHelper.Infrastructure.UI.DataContexts;
namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
{
@@ -40,19 +41,19 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
ITriangulationOptions options = new TriangulationOptions { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
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 dContext.Rectangle(new Center { X = 0, Y = 0 }, new Rectangle { Width = width, Height = height, Angle = 0 });
ndmPrimitives.Add(concreteRectangle.GetNdmPrimitive());
//Добавляем 4 точки для арматуры
// 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 dContext.Point(new Center { X = -width / 2 + 0.05d, Y = -height / 2 + 0.05 }, new Point { Area = bottomArea });
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 Point(new Center { X = width / 2 - 0.05d, Y = -height / 2 + 0.05 }, new Point { Area = bottomArea });
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 dContext.Point(new Center { X = -width / 2 + 0.05d, Y = height / 2 - 0.05 }, new Point { Area = topArea });
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 dContext.Point(new Center { X = width / 2 - 0.05d, Y = height / 2 - 0.05 }, new Point { Area = topArea });
ndmPrimitives.Add(rightTopReinforcementPoint.GetNdmPrimitive());
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
ndmCollection.AddRange(Triangulation.GetNdms(ndmPrimitives, options));

View File

@@ -7,10 +7,10 @@ using NUnit.Framework;
using StructureHelperLogics.NdmCalculations.Triangulations;
using System.Collections.Generic;
using System.Threading;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperLogics.Models.Calculations;
using StructureHelperLogics.Models.Primitives;
namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
{

View File

@@ -6,10 +6,9 @@ using NUnit.Framework;
using StructureHelperLogics.NdmCalculations.Triangulations;
using System.Collections.Generic;
using System.Threading;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperLogics.Models.Materials;
namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
{

View File

@@ -264,7 +264,7 @@ namespace StructureHelper.Windows.MainWindow
}
else if (primitiveType == PrimitiveType.Point)
{
primitive = new Point(0.50, 0, 0, this);
primitive = new Point(0.0005d, 0d, 0d, this);
}
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(primitiveType)); }
Primitives.Add(primitive);

View File

@@ -48,7 +48,7 @@
</Expander>
</DataTemplate>
<DataTemplate x:Key="TriangulationProperties">
<Expander Header="Triangulation" IsExpanded="True">
<Expander Header="Triangulation" IsExpanded="False">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="22"/>
@@ -76,6 +76,7 @@
<RowDefinition Height="22"/>
<RowDefinition Height="22"/>
<RowDefinition Height="22"/>
<RowDefinition Height="22"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
@@ -86,6 +87,7 @@
<TextBlock Grid.Row="2" Text="Center X"/>
<TextBlock Grid.Row="3" Text="Center Y"/>
<TextBlock Grid.Row="4" Text="Material color"/>
<TextBlock Grid.Row="5" Text="Z-index (integer)"/>
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Name}"/>
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left">
<ComboBox Width="120" ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding PrimitiveMaterial}">
@@ -111,6 +113,7 @@
</StackPanel>
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="3" Grid.Column="1" Margin="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="5" Grid.Column="1" Margin="1" Text="{Binding ZIndex}"/>
<StackPanel Grid.Row="4" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<CheckBox IsChecked="{Binding SetMaterialColor}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,20,0"/>
<Rectangle Width="50" Margin="5,0,10,0">
@@ -122,7 +125,7 @@
</StackPanel>
</Grid>
</Expander>
<Expander Header="Prestrain" IsExpanded="True">
<Expander Header="Prestrain" IsExpanded="False">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="22"/>

View File

@@ -3,7 +3,6 @@ using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelper.Models.Materials;
using StructureHelper.Windows.ColorPickerWindow;
using StructureHelper.Windows.MainWindow.Materials;
using StructureHelperCommon.Models.NdmPrimitives;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.ColorServices;
using StructureHelperLogics.Models.Materials;
@@ -181,6 +180,8 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
{
var shape = primitive as Point;
shape.Area = value;
OnPropertyChanged(nameof(Area));
OnPropertyChanged(nameof(shape.Diameter));
}
}
}
@@ -206,6 +207,14 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
}
}
public int ZIndex
{ get => primitive.ZIndex;
set
{
primitive.ZIndex = value;
}
}
public string this[string columnName]
{
get