Change field viewer
This commit is contained in:
@@ -7,12 +7,16 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
public class CrossSectionRepository : ICrossSectionRepository
|
||||
{
|
||||
private RepositoryOperationsLogic operations;
|
||||
|
||||
public Guid Id { get; }
|
||||
public List<IForceAction> ForceActions { get; private set; } = new();
|
||||
public List<IHeadMaterial> HeadMaterials { get; private set; } = new();
|
||||
public List<INdmPrimitive> Primitives { get; } = new();
|
||||
public List<ICalculator> Calculators { get; private set; } = new();
|
||||
|
||||
public IRepositoryOperationsLogic Operations => operations ??= new RepositoryOperationsLogic(this);
|
||||
|
||||
public CrossSectionRepository(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
/// <summary>
|
||||
/// Repository of members of cross-section
|
||||
/// </summary>
|
||||
public interface ICrossSectionRepository : ISaveable, IHasHeadMaterials, IHasForcesAndPrimitives, IHasCalculators
|
||||
{
|
||||
|
||||
IRepositoryOperationsLogic Operations { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
public interface IRepositoryOperationsLogic
|
||||
{
|
||||
IRepositoryOperation<ICrossSectionRepository, INdmPrimitive> Primitives { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
public class RepositoryOperationsLogic : IRepositoryOperationsLogic
|
||||
{
|
||||
private ICrossSectionRepository repository;
|
||||
private RepositoryPrimitiveOperation primitiveLogic;
|
||||
|
||||
public RepositoryOperationsLogic(ICrossSectionRepository repository)
|
||||
{
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
public IRepositoryOperation<ICrossSectionRepository, INdmPrimitive> Primitives => primitiveLogic ??= new RepositoryPrimitiveOperation(repository);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,13 @@
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator;
|
||||
using LoaderCalculator;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Data.ResultData;
|
||||
using LoaderCalculator.Data.SourceData;
|
||||
using LoaderCalculator.Logics;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperLogics.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using LoaderCalculator.Logics;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class RepositoryPrimitiveOperation : IRepositoryOperation<ICrossSectionRepository, INdmPrimitive>
|
||||
{
|
||||
private ICrossSectionRepository repository;
|
||||
|
||||
public RepositoryPrimitiveOperation(ICrossSectionRepository repository)
|
||||
{
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
public void RemoveAll()
|
||||
{
|
||||
foreach (var calculator in repository.Calculators)
|
||||
{
|
||||
if (calculator is IForceCalculator forceCalculator)
|
||||
{
|
||||
forceCalculator.InputData.Primitives.Clear();
|
||||
}
|
||||
else if (calculator is ICrackCalculator crackCalculator)
|
||||
{
|
||||
crackCalculator.InputData.Primitives.Clear();
|
||||
}
|
||||
else if (calculator is IValueDiagramCalculator valueDiagramCalculator)
|
||||
{
|
||||
valueDiagramCalculator.InputData.Primitives.Clear();
|
||||
}
|
||||
else if (calculator is ICurvatureCalculator curvatureCalculator)
|
||||
{
|
||||
curvatureCalculator.InputData.Primitives.Clear();
|
||||
}
|
||||
else if (calculator is ILimitCurvesCalculator limitCurve)
|
||||
{
|
||||
// skip
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(calculator) + $": Unsupported calculator type: { calculator.GetType().FullName }");
|
||||
}
|
||||
}
|
||||
repository.Primitives.Clear();
|
||||
}
|
||||
|
||||
public void Remove(IEnumerable<INdmPrimitive> entities)
|
||||
{
|
||||
foreach (var item in entities)
|
||||
{
|
||||
Remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove(INdmPrimitive entity)
|
||||
{
|
||||
foreach (var calculator in repository.Calculators)
|
||||
{
|
||||
if (calculator is IForceCalculator forceCalculator)
|
||||
{
|
||||
forceCalculator.InputData.Primitives.Remove(entity);
|
||||
}
|
||||
else if (calculator is ICrackCalculator crackCalculator)
|
||||
{
|
||||
crackCalculator.InputData.Primitives.Remove(entity);
|
||||
}
|
||||
else if (calculator is IValueDiagramCalculator valueDiagramCalculator)
|
||||
{
|
||||
valueDiagramCalculator.InputData.Primitives.Remove(entity);
|
||||
}
|
||||
else if (calculator is ICurvatureCalculator curvatureCalculator)
|
||||
{
|
||||
curvatureCalculator.InputData.Primitives.Remove(entity);
|
||||
}
|
||||
else if (calculator is ILimitCurvesCalculator limitCurve)
|
||||
{
|
||||
// skip, nothing to do
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(calculator) + $": Unsupported calculator type: {calculator.GetType().FullName}");
|
||||
}
|
||||
}
|
||||
repository.Primitives.Remove(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user