Add inclined rebar
This commit is contained in:
@@ -1,16 +1,10 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Forces.Logics;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives.Logics;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
@@ -19,6 +13,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
private ICheckEntityLogic<IAccuracy> checkAccuracyLogic;
|
||||
private ICheckEntityLogic<IHasPrimitives> checkPrimitiveCollectionLogic;
|
||||
|
||||
public IForceCalculatorInputData InputData { get; set; }
|
||||
|
||||
@@ -66,11 +61,32 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
TraceMessage("Calculator does not contain any calc term");
|
||||
result = false;
|
||||
}
|
||||
CheckPrimitives();
|
||||
CheckAccuracy();
|
||||
CheckActions();
|
||||
return result;
|
||||
}
|
||||
|
||||
private void CheckPrimitives()
|
||||
{
|
||||
checkPrimitiveCollectionLogic ??= new CheckPrimitiveCollectionLogic(
|
||||
TraceLogger,
|
||||
new CheckRebarPrimitiveLogic()
|
||||
{
|
||||
CheckRebarHostMaterial = false,
|
||||
CheckRebarPlacement = false
|
||||
})
|
||||
{
|
||||
Entity = InputData,
|
||||
};
|
||||
if (checkPrimitiveCollectionLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
TraceMessage(checkPrimitiveCollectionLogic.CheckResult);
|
||||
|
||||
}
|
||||
|
||||
private void CheckActions()
|
||||
{
|
||||
var checkLogic = new CheckForceActionsLogic()
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces.Logics;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives.Logics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
@@ -22,7 +14,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
public class CheckCrackCalculatorInputDataLogic : ICheckInputDataLogic<ICrackCalculatorInputData>
|
||||
{
|
||||
private bool result;
|
||||
private ICheckPrimitiveCollectionLogic checkPrimitiveCollectionLogic;
|
||||
private ICheckEntityLogic<IHasPrimitives> checkPrimitiveCollectionLogic;
|
||||
|
||||
public ICrackCalculatorInputData InputData { get; set; }
|
||||
|
||||
@@ -31,7 +23,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public CheckCrackCalculatorInputDataLogic(ICheckPrimitiveCollectionLogic checkPrimitiveCollectionLogic)
|
||||
public CheckCrackCalculatorInputDataLogic(ICheckEntityLogic<IHasPrimitives> checkPrimitiveCollectionLogic)
|
||||
{
|
||||
this.checkPrimitiveCollectionLogic = checkPrimitiveCollectionLogic;
|
||||
}
|
||||
@@ -57,7 +49,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ParameterIsNull + ": check primitive logic");
|
||||
}
|
||||
checkPrimitiveCollectionLogic.HasPrimitives = InputData;
|
||||
checkPrimitiveCollectionLogic.Entity = InputData;
|
||||
checkPrimitiveCollectionLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger();
|
||||
if (checkPrimitiveCollectionLogic.Check() == false)
|
||||
{
|
||||
|
||||
@@ -11,22 +11,24 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
{
|
||||
public class CheckPrimitiveCollectionLogic : ICheckPrimitiveCollectionLogic
|
||||
public class CheckPrimitiveCollectionLogic : ICheckEntityLogic<IHasPrimitives>
|
||||
{
|
||||
private const string collectionDoesntHaveAnyPrimitives = "Calculator does not contain any primitives\n";
|
||||
private const string checkRebarLogic = ": check rebar logic";
|
||||
|
||||
private string checkResult;
|
||||
private bool result;
|
||||
private ICheckRebarPrimitiveLogic checkRebarPrimitiveLogic;
|
||||
private ICheckEntityLogic<IRebarNdmPrimitive> checkRebarPrimitiveLogic;
|
||||
|
||||
public IHasPrimitives HasPrimitives { get; set; }
|
||||
public IHasPrimitives Entity { get; set; }
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public CheckPrimitiveCollectionLogic(IShiftTraceLogger shiftTraceLogger, ICheckRebarPrimitiveLogic checkRebarPrimitiveLogic)
|
||||
public CheckPrimitiveCollectionLogic(
|
||||
IShiftTraceLogger shiftTraceLogger,
|
||||
ICheckEntityLogic<IRebarNdmPrimitive> checkRebarPrimitiveLogic)
|
||||
{
|
||||
TraceLogger = shiftTraceLogger;
|
||||
this.checkRebarPrimitiveLogic = checkRebarPrimitiveLogic;
|
||||
@@ -47,7 +49,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
|
||||
private void CheckPrimitives()
|
||||
{
|
||||
if (HasPrimitives.Primitives is null || (!HasPrimitives.Primitives.Any()))
|
||||
if (Entity.Primitives is null || (!Entity.Primitives.Any()))
|
||||
{
|
||||
result = false;
|
||||
checkResult += collectionDoesntHaveAnyPrimitives;
|
||||
@@ -55,7 +57,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var primitive in HasPrimitives.Primitives)
|
||||
foreach (var primitive in Entity.Primitives)
|
||||
{
|
||||
if (primitive is IRebarNdmPrimitive rebar)
|
||||
{
|
||||
@@ -71,7 +73,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ParameterIsNull + checkRebarLogic);
|
||||
}
|
||||
checkRebarPrimitiveLogic.RebarPrimitive = rebar;
|
||||
checkRebarPrimitiveLogic.Entity = rebar;
|
||||
checkRebarPrimitiveLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger();
|
||||
if (checkRebarPrimitiveLogic.Check() == false)
|
||||
{
|
||||
@@ -79,7 +81,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
checkResult += checkRebarPrimitiveLogic.CheckResult;
|
||||
return;
|
||||
}
|
||||
bool isPrimitivesContainRebarHost = HasPrimitives.Primitives.Contains(rebar.HostPrimitive);
|
||||
bool isPrimitivesContainRebarHost = Entity.Primitives.Contains(rebar.HostPrimitive);
|
||||
if (isPrimitivesContainRebarHost == false)
|
||||
{
|
||||
result = false;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using System;
|
||||
@@ -9,12 +10,14 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
{
|
||||
public class CheckRebarPrimitiveLogic : ICheckRebarPrimitiveLogic
|
||||
public class CheckRebarPrimitiveLogic : ICheckEntityLogic<IRebarNdmPrimitive>
|
||||
{
|
||||
private string checkResult;
|
||||
private bool result;
|
||||
|
||||
public IRebarNdmPrimitive RebarPrimitive { get; set; }
|
||||
public bool CheckRebarPlacement { get; set; } = true;
|
||||
public bool CheckRebarHostMaterial { get; set; } = true;
|
||||
public IRebarNdmPrimitive Entity { get; set; }
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
|
||||
@@ -40,33 +43,47 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
|
||||
private void CheckRebar()
|
||||
{
|
||||
if (RebarPrimitive.HostPrimitive is null)
|
||||
if (Entity.HostPrimitive is null)
|
||||
{
|
||||
result = false;
|
||||
string message = $"Primitive {RebarPrimitive.Name} does not have a host\n";
|
||||
string message = $"Primitive {Entity.Name} does not have a host\n";
|
||||
checkResult += message;
|
||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (RebarPrimitive.HostPrimitive is IHasDivisionSize division)
|
||||
if (CheckRebarPlacement == true)
|
||||
{
|
||||
if (!division.IsPointInside(RebarPrimitive.Center))
|
||||
{
|
||||
result = false;
|
||||
string message = $"Primitive of rebar {RebarPrimitive.Name} is out of its host {RebarPrimitive.HostPrimitive.Name}";
|
||||
checkResult += message;
|
||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||
}
|
||||
CheckIfRebarInsideHostPrimitive();
|
||||
}
|
||||
if (CheckRebarHostMaterial == true)
|
||||
{
|
||||
CheckIfRemarMaterialIsCrackedMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
if (RebarPrimitive.HostPrimitive.NdmElement.HeadMaterial.HelperMaterial is not ICrackedMaterial)
|
||||
private void CheckIfRemarMaterialIsCrackedMaterial()
|
||||
{
|
||||
if (Entity.HostPrimitive.NdmElement.HeadMaterial.HelperMaterial is not ICrackedMaterial)
|
||||
{
|
||||
result = false;
|
||||
string message = $"Material of host of {RebarPrimitive.Name} ({RebarPrimitive.HostPrimitive.NdmElement.HeadMaterial.Name}) does not support cracking\n";
|
||||
string message = $"Material of host of {Entity.Name} ({Entity.HostPrimitive.NdmElement.HeadMaterial.Name}) does not support cracking\n";
|
||||
checkResult += message;
|
||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckIfRebarInsideHostPrimitive()
|
||||
{
|
||||
if (Entity.HostPrimitive is IHasDivisionSize division)
|
||||
{
|
||||
if (!division.IsPointInside(Entity.Center))
|
||||
{
|
||||
result = false;
|
||||
string message = $"Primitive of rebar {Entity.Name} is out of its host {Entity.HostPrimitive.Name}";
|
||||
checkResult += message;
|
||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
{
|
||||
public interface ICheckPrimitiveCollectionLogic : ICheckLogic
|
||||
{
|
||||
IHasPrimitives HasPrimitives { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
{
|
||||
public interface ICheckRebarPrimitiveLogic : ICheckLogic
|
||||
{
|
||||
IRebarNdmPrimitive RebarPrimitive { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
|
||||
public Ndm GetConcreteNdm()
|
||||
{
|
||||
//#error //fix check rebar for host null
|
||||
var hostPrimitive = options.HostPrimitive;
|
||||
var material = hostPrimitive
|
||||
.NdmElement
|
||||
|
||||
Reference in New Issue
Block a user