CrossSection view model was improved

This commit is contained in:
Evgeny Redikultsev
2024-02-02 22:27:18 +05:00
parent b1fc0c763f
commit 165a2846bb
22 changed files with 307 additions and 170 deletions

View File

@@ -12,7 +12,7 @@ namespace StructureHelperCommon.Models.Shapes
{
private Directions constDirections;
/// <summary>
/// Direction, for which canstant value is assigned
/// Direction, for which constant value is assigned
/// </summary>
public Directions ConstDirections
{
@@ -31,6 +31,8 @@ namespace StructureHelperCommon.Models.Shapes
/// Constant value for assigned direction
/// </summary>
public double ConstDirectionValue { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public ConstOneDirectionLogic(Directions constDirection, double constValue)
{
ConstDirections = constDirection;
@@ -39,18 +41,46 @@ namespace StructureHelperCommon.Models.Shapes
/// <inheritdoc/>
public IPoint3D GetPoint3D(IPoint2D point2D)
{
TraceLogger?.AddMessage($"Logic convert point from 2D-space to 3D-space");
IPoint3D point;
if (ConstDirections == Directions.X)
{
point = new Point3D() { X = ConstDirectionValue, Y = - point2D.X, Z = point2D.Y };
point = new Point3D()
{
X = ConstDirectionValue,
Y = - point2D.X,
Z = point2D.Y
};
TraceLogger?.AddMessage($"Constant direction is x-direction, so X = {point.X}");
TraceLogger?.AddMessage($"X = ConstantValue = {point.X}");
TraceLogger?.AddMessage($"Y = - point2D.X = {point.Y}");
TraceLogger?.AddMessage($"Z = point2D.Y = {point.Z}");
}
else if (ConstDirections == Directions.Y)
{
point = new Point3D() { X = point2D.X, Y = ConstDirectionValue, Z = point2D.Y };
point = new Point3D()
{
X = point2D.X,
Y = ConstDirectionValue,
Z = point2D.Y
};
TraceLogger?.AddMessage($"Constant direction is Y-direction");
TraceLogger?.AddMessage($"X = point2D.X = {point.X}");
TraceLogger?.AddMessage($"Y = ConstantValue = {point.Y}");
TraceLogger?.AddMessage($"Z = point2D.Y = {point.Z}");
}
else if (ConstDirections == Directions.Z)
{
point = new Point3D() { X = point2D.Y, Y = point2D.X, Z = ConstDirectionValue };
point = new Point3D()
{
X = point2D.Y,
Y = point2D.X,
Z = ConstDirectionValue
};
TraceLogger?.AddMessage($"Constant direction is Z-direction");
TraceLogger?.AddMessage($"X = point2D.Y = {point.X}");
TraceLogger?.AddMessage($"Y = point2D.X = {point.Y}");
TraceLogger?.AddMessage($"Z = ConstantValue = {point.Z}");
}
else
{

View File

@@ -1,4 +1,5 @@
using System;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -13,7 +14,7 @@ namespace StructureHelperCommon.Models.Shapes
/// <summary>
/// Logic for convert 2DPoint of some plane to point of 3DSpace
/// </summary>
public interface IConvert2DPointTo3DPointLogic
public interface IConvert2DPointTo3DPointLogic : ILogic
{
/// <summary>
/// Returns point in 3D-space by 2D point in some workplane