Add VisualAnalysisDTO
This commit is contained in:
@@ -25,7 +25,9 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorMessage);
|
||||
}
|
||||
if (!Primitives.Any(x => x.Triangulate == true))
|
||||
if (!Primitives.Any(x => x
|
||||
.NdmElement
|
||||
.Triangulate == true))
|
||||
{
|
||||
string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": There are not primitives to triangulate");
|
||||
TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
|
||||
@@ -33,8 +35,8 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
}
|
||||
foreach (var item in Primitives)
|
||||
{
|
||||
if (item.Triangulate == true &
|
||||
item.HeadMaterial is null)
|
||||
if (item.NdmElement.Triangulate == true &
|
||||
item.NdmElement.HeadMaterial is null)
|
||||
{
|
||||
string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": Primitive: {item.Name} can't be triangulated since material is null");
|
||||
TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
|
||||
|
||||
@@ -9,10 +9,22 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
/// <summary>
|
||||
/// Implement logic of triangulation of primitives which have parameters of division
|
||||
/// </summary>
|
||||
public interface IMeshHasDivisionLogic : ILogic
|
||||
{
|
||||
List<INdm> NdmCollection { get; set; }
|
||||
IHasDivisionSize Primitive { get; set; }
|
||||
/// <summary>
|
||||
/// Input collection of existing ndm parts
|
||||
/// </summary>
|
||||
List<INdm>? NdmCollection { get; set; }
|
||||
/// <summary>
|
||||
/// Input triangulated primitive
|
||||
/// </summary>
|
||||
IHasDivisionSize? Primitive { get; set; }
|
||||
/// <summary>
|
||||
/// Run process of triangulation
|
||||
/// </summary>
|
||||
void MeshHasDivision();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
CheckPrimitive();
|
||||
List<INdm> ndmCollection = new();
|
||||
if (Primitive.HeadMaterial.HelperMaterial is ICrackedMaterial)
|
||||
if (Primitive.NdmElement.HeadMaterial.HelperMaterial is ICrackedMaterial)
|
||||
{
|
||||
ProcessICracked(ndmCollection);
|
||||
}
|
||||
@@ -74,13 +74,13 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
|
||||
private void SetNewMaterial(INdmPrimitive? newPrimititve)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Process material {newPrimititve.HeadMaterial.Name} has started");
|
||||
var newHeadMaterial = newPrimititve.HeadMaterial.Clone() as IHeadMaterial;
|
||||
TraceLogger?.AddMessage($"Process material {newPrimititve.NdmElement.HeadMaterial.Name} has started");
|
||||
var newHeadMaterial = newPrimititve.NdmElement.HeadMaterial.Clone() as IHeadMaterial;
|
||||
var newMaterial = newHeadMaterial.HelperMaterial.Clone() as ICrackedMaterial;
|
||||
TraceLogger?.AddMessage($"Set work in tension zone for material {newPrimititve.HeadMaterial.Name}");
|
||||
TraceLogger?.AddMessage($"Set work in tension zone for material {newPrimititve.NdmElement.HeadMaterial.Name}");
|
||||
newMaterial.TensionForSLS = false;
|
||||
newHeadMaterial.HelperMaterial = newMaterial as IHelperMaterial;
|
||||
newPrimititve.HeadMaterial = newHeadMaterial;
|
||||
newPrimititve.NdmElement.HeadMaterial = newHeadMaterial;
|
||||
}
|
||||
|
||||
private List<INdm> GetNdms(INdmPrimitive primitive)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
@@ -12,30 +14,55 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class MeshHasDivisionLogic : IMeshHasDivisionLogic
|
||||
{
|
||||
public List<INdm> NdmCollection { get; set; }
|
||||
public IHasDivisionSize Primitive { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public List<INdm>? NdmCollection { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IHasDivisionSize? Primitive { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public void MeshHasDivision()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
CheckInputData();
|
||||
if (Primitive is IHasDivisionSize hasDivision)
|
||||
{
|
||||
if (hasDivision.ClearUnderlying == true)
|
||||
if (hasDivision.DivisionSize.ClearUnderlying == true)
|
||||
{
|
||||
TraceLogger?.AddMessage("Removing of background part has started", TraceLogStatuses.Service);
|
||||
NdmCollection
|
||||
.RemoveAll(x =>
|
||||
hasDivision
|
||||
.IsPointInside(new Point2D()
|
||||
{
|
||||
X = x.CenterX,
|
||||
Y = x.CenterY
|
||||
}) == true);
|
||||
NdmCollection.RemoveAll(x => IsCenterInside(x, hasDivision) == true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsCenterInside(INdm x, IHasDivisionSize hasDivision)
|
||||
{
|
||||
Point2D point = new Point2D()
|
||||
{
|
||||
X = x.CenterX,
|
||||
Y = x.CenterY
|
||||
};
|
||||
return hasDivision.IsPointInside(point);
|
||||
}
|
||||
|
||||
private void CheckInputData()
|
||||
{
|
||||
if (NdmCollection is null)
|
||||
{
|
||||
var message = ErrorStrings.ParameterIsNull + ": input NdmCollection";
|
||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(message);
|
||||
}
|
||||
if (Primitive is null)
|
||||
{
|
||||
var message = ErrorStrings.ParameterIsNull + ": input Primitive";
|
||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
divisionLogic.Primitive = hasDivision;
|
||||
divisionLogic.MeshHasDivision();
|
||||
}
|
||||
if (primitive.Triangulate == true)
|
||||
if (primitive.NdmElement.Triangulate == true)
|
||||
{
|
||||
meshLogic.Primitive = primitive;
|
||||
var ndms = meshLogic.MeshPrimitive();
|
||||
|
||||
Reference in New Issue
Block a user