Logic for interaction diagram was added
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public class ConstOneDirectionConverter : IConvertPointLogicEntity
|
||||
{
|
||||
private ConstOneDirectionLogic convertLogic;
|
||||
|
||||
public Guid Id { get; }
|
||||
public string Name { get; set; }
|
||||
public Directions Direction { get; private set; }
|
||||
public double ConstDirectionValue {get;set;}
|
||||
public string XAxisName { get; set; }
|
||||
public string YAxisName { get; set; }
|
||||
public string ConstAxisName { get; set; }
|
||||
public ForceTypes XForceType { get; set; }
|
||||
public ForceTypes YForceType { get; set; }
|
||||
public ForceTypes ZForceType { get; set; }
|
||||
|
||||
public IConvert2DPointTo3DPointLogic ConvertLogic
|
||||
{
|
||||
get
|
||||
{
|
||||
convertLogic.ConstDirectionValue = ConstDirectionValue;
|
||||
return convertLogic;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ConstOneDirectionConverter(Directions direction, Guid guid)
|
||||
{
|
||||
Id = guid;
|
||||
convertLogic = new ConstOneDirectionLogic(direction, 0d);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using System.Collections.Generic;
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class ConstOneDirectionLogic : IConvert2DPointTo3DPointLogic
|
||||
{
|
||||
private Directions constDirections;
|
||||
/// <summary>
|
||||
/// Direction, for which canstant value is assigned
|
||||
/// </summary>
|
||||
public Directions ConstDirections
|
||||
{
|
||||
get => constDirections;
|
||||
set
|
||||
{
|
||||
var availableDirections = new List<Directions>() { Directions.X, Directions.Y, Directions.Z };
|
||||
if (availableDirections.Contains(value) == false)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(value));
|
||||
}
|
||||
constDirections = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Constant value for assigned direction
|
||||
/// </summary>
|
||||
public double ConstDirectionValue { get; set; }
|
||||
public ConstOneDirectionLogic(Directions constDirection, double constValue)
|
||||
{
|
||||
ConstDirections = constDirection;
|
||||
ConstDirectionValue = constValue;
|
||||
}
|
||||
/// <inheritdoc/>
|
||||
public IPoint3D GetPoint3D(IPoint2D point2D)
|
||||
{
|
||||
IPoint3D point;
|
||||
if (ConstDirections == Directions.X)
|
||||
{
|
||||
point = new Point3D() { X = ConstDirectionValue, Y = - point2D.X, Z = point2D.Y };
|
||||
}
|
||||
else if (ConstDirections == Directions.Y)
|
||||
{
|
||||
point = new Point3D() { X = point2D.X, Y = ConstDirectionValue, Z = point2D.Y };
|
||||
}
|
||||
else if (ConstDirections == Directions.Z)
|
||||
{
|
||||
point = new Point3D() { X = point2D.Y, Y = point2D.X, Z = ConstDirectionValue };
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(ConstDirections));
|
||||
}
|
||||
return point;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <summary>
|
||||
/// Logic for convert 2DPoint of some plane to point of 3DSpace
|
||||
/// </summary>
|
||||
public interface IConvert2DPointTo3DPointLogic
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns point in 3D-space by 2D point in some workplane
|
||||
/// </summary>
|
||||
/// <param name="point2D"></param>
|
||||
/// <returns></returns>
|
||||
IPoint3D GetPoint3D(IPoint2D point2D);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public interface IConvertPointLogicEntity : ISaveable
|
||||
{
|
||||
string Name { get; set; }
|
||||
IConvert2DPointTo3DPointLogic ConvertLogic { get;}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public class LineShapeUpdateStrategy : IUpdateStrategy<ILineShape>
|
||||
{
|
||||
readonly PointShapeUpdateStrategy pointUpdateStrategy = new();
|
||||
readonly Point2DUpdateStrategy pointUpdateStrategy = new();
|
||||
public void Update(ILineShape targetObject, ILineShape sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class Point2DUpdateStrategy : IUpdateStrategy<IPoint2D>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void Update(IPoint2D targetObject, IPoint2D sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.X = sourceObject.X;
|
||||
targetObject.Y = sourceObject.Y;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,15 @@ using System.Threading.Tasks;
|
||||
namespace StructureHelperCommon.Models.Shapes.Logics
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class PointShapeUpdateStrategy : IUpdateStrategy<IPoint2D>
|
||||
public class Point3DUpdateStrategy : IUpdateStrategy<IPoint3D>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void Update(IPoint2D targetObject, IPoint2D sourceObject)
|
||||
public void Update(IPoint3D targetObject, IPoint3D sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.X = sourceObject.X;
|
||||
targetObject.Y = sourceObject.Y;
|
||||
targetObject.Z = sourceObject.Z;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user