Add value diagram windows and view models
This commit is contained in:
@@ -5,6 +5,7 @@ using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
@@ -33,6 +34,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Logics
|
||||
{
|
||||
new CrackCalculatorUpdateStrategy().Update(crackCalculator, (CrackCalculator)sourceObject);
|
||||
}
|
||||
else if (targetObject is IValueDiagramCalculator diagramCalculator)
|
||||
{
|
||||
new ValueDiagramCalculatorUpdateStrategy().Update(diagramCalculator, (IValueDiagramCalculator)sourceObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorCommonProcessor.ObjectTypeIsUnknown(typeof(INdmPrimitive), sourceObject.GetType());
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public interface IValueDigram : ISaveable
|
||||
public interface IValueDiagram : ISaveable, ICloneable
|
||||
{
|
||||
IPoint2DRange Point2DRange { get; }
|
||||
public int StepNumber { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public interface IValueDiagramCalculator : ICalculator
|
||||
{
|
||||
|
||||
IValueDiagramCalculatorInputData InputData { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.States;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
@@ -8,13 +8,13 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
/// <summary>
|
||||
/// Implements input data for Value diagram calculator
|
||||
/// </summary>
|
||||
public interface IValueDiagramCalculatorInputData : ISaveable, IHasForceActions, IHasPrimitives
|
||||
public interface IValueDiagramCalculatorInputData : ISaveable, IInputData, IHasForceActions, IHasPrimitives
|
||||
{
|
||||
IStateCalcTermPair StateTermPair { get; set; }
|
||||
/// <summary>
|
||||
/// Collection of diagram for calculation
|
||||
/// </summary>
|
||||
List<IValueDigram> Digrams { get; }
|
||||
List<IValueDiagramEntity> Digrams { get; }
|
||||
bool CheckStrainLimit { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
IValueDiagramCalculatorInputData? InputData { get; set; }
|
||||
List<IPoint2D> Points { get; set; }
|
||||
List<IForceTupleCalculatorResult> ForceTupleResults { get; set; }
|
||||
List<IExtendedForceTupleCalculatorResult> ForceTupleResults { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public interface IValueDiagramEntity : ISaveable, ICloneable
|
||||
{
|
||||
string Name { get; set; }
|
||||
bool IsTaken { get; set; }
|
||||
IValueDiagram ValueDigram { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public class ValueDiagramCalculatorInputDataUpdateStrategy : IParentUpdateStrategy<IValueDiagramCalculatorInputData>
|
||||
{
|
||||
private IUpdateStrategy<IValueDiagramEntity> entityUpdateStrategy;
|
||||
|
||||
public ValueDiagramCalculatorInputDataUpdateStrategy(IUpdateStrategy<IValueDiagramEntity> entityUpdateStrategy)
|
||||
{
|
||||
this.entityUpdateStrategy = entityUpdateStrategy;
|
||||
}
|
||||
|
||||
public ValueDiagramCalculatorInputDataUpdateStrategy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool UpdateChildren { get; set; } = true;
|
||||
|
||||
public void Update(IValueDiagramCalculatorInputData targetObject, IValueDiagramCalculatorInputData sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.CheckStrainLimit = sourceObject.CheckStrainLimit;
|
||||
targetObject.StateTermPair.LimitState = sourceObject.StateTermPair.LimitState;
|
||||
targetObject.StateTermPair.CalcTerm = sourceObject.StateTermPair.CalcTerm;
|
||||
if (UpdateChildren == true)
|
||||
{
|
||||
targetObject.Primitives.Clear();
|
||||
targetObject.Primitives.AddRange(sourceObject.Primitives);
|
||||
targetObject.ForceActions.Clear();
|
||||
targetObject.ForceActions.AddRange(sourceObject.ForceActions);
|
||||
targetObject.Digrams.Clear();
|
||||
entityUpdateStrategy ??= new ValueDiagramEntityUpdateStrategy();
|
||||
foreach (var entity in sourceObject.Digrams)
|
||||
{
|
||||
var newItem = entity.Clone() as IValueDiagramEntity;
|
||||
targetObject.Digrams.Add(newItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public class ValueDiagramCalculatorUpdateStrategy : IParentUpdateStrategy<IValueDiagramCalculator>
|
||||
{
|
||||
private IUpdateStrategy<IValueDiagramCalculatorInputData> inputDataUpdateStrategy;
|
||||
public bool UpdateChildren { get; set; } = true;
|
||||
|
||||
public void Update(IValueDiagramCalculator targetObject, IValueDiagramCalculator sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.Name = sourceObject.Name;
|
||||
targetObject.ShowTraceData = sourceObject.ShowTraceData;
|
||||
if (UpdateChildren == true)
|
||||
{
|
||||
CheckObject.IsNull(targetObject.InputData, ": target value diagram calculator input data");
|
||||
CheckObject.IsNull(sourceObject.InputData, ": source value diagram calculator input data");
|
||||
inputDataUpdateStrategy ??= new ValueDiagramCalculatorInputDataUpdateStrategy();
|
||||
inputDataUpdateStrategy.Update(targetObject.InputData, sourceObject.InputData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public class ValueDiagramEntityUpdateStrategy : IParentUpdateStrategy<IValueDiagramEntity>
|
||||
{
|
||||
private IUpdateStrategy<IValueDiagram> valueDiagramUpdateStrategy;
|
||||
|
||||
public ValueDiagramEntityUpdateStrategy(IUpdateStrategy<IValueDiagram> valueDiagramUpdateStrategy)
|
||||
{
|
||||
this.valueDiagramUpdateStrategy = valueDiagramUpdateStrategy;
|
||||
}
|
||||
|
||||
public ValueDiagramEntityUpdateStrategy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool UpdateChildren { get; set; } = true;
|
||||
|
||||
public void Update(IValueDiagramEntity targetObject, IValueDiagramEntity sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.IsTaken = sourceObject.IsTaken;
|
||||
targetObject.Name = sourceObject.Name;
|
||||
if (UpdateChildren == true)
|
||||
{
|
||||
valueDiagramUpdateStrategy ??= new ValueDiagramUpdateStrategy();
|
||||
valueDiagramUpdateStrategy.Update(targetObject.ValueDigram, sourceObject.ValueDigram);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
internal class ValueDiagramUpdateStrategy : IParentUpdateStrategy<IValueDiagram>
|
||||
{
|
||||
private IUpdateStrategy<IPoint2DRange> rangeUpdateStrategy;
|
||||
public bool UpdateChildren { get; set; } = true;
|
||||
|
||||
public void Update(IValueDiagram targetObject, IValueDiagram sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.StepNumber = sourceObject.StepNumber;
|
||||
if (UpdateChildren == true)
|
||||
{
|
||||
rangeUpdateStrategy ??= new Point2DRangeUpdateStrategy();
|
||||
rangeUpdateStrategy.Update(targetObject.Point2DRange, sourceObject.Point2DRange);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public class ValueDiagram : IValueDiagram
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public int StepNumber { get; set; } = 50;
|
||||
public IPoint2DRange Point2DRange { get; } = new Point2DRange(Guid.NewGuid());
|
||||
|
||||
|
||||
public ValueDiagram(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
ValueDiagram newItem = new(Guid.NewGuid());
|
||||
var updateStrategy = new ValueDiagramUpdateStrategy();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,14 +11,17 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public class ValueDiagramCalculator : IValueDiagramCalculator
|
||||
{
|
||||
private IValueDiagramCalculatorResult result;
|
||||
|
||||
public Guid Id { get; }
|
||||
public string Name { get; set; }
|
||||
public bool ShowTraceData { get; set; }
|
||||
|
||||
public IResult Result => throw new NotImplementedException();
|
||||
public IResult Result => result;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public Guid Id { get; }
|
||||
public IValueDiagramCalculatorInputData InputData { get; set; } = new ValueDiagramCalculatorInputData(Guid.NewGuid());
|
||||
|
||||
public ValueDiagramCalculator(Guid id)
|
||||
{
|
||||
@@ -27,7 +30,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
ValueDiagramCalculator newItem = new ValueDiagramCalculator(Guid.NewGuid());
|
||||
var updateLogic = new ValueDiagramCalculatorUpdateStrategy();
|
||||
updateLogic.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
public Guid Id { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public List<IValueDigram> Digrams { get; } = [];
|
||||
public List<IValueDiagramEntity> Digrams { get; } = [];
|
||||
/// <inheritdoc/>
|
||||
public List<IForceAction> ForceActions { get; } = [];
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
|
||||
public List<IPoint2D> Points { get; set; } = [];
|
||||
|
||||
public List<IForceTupleCalculatorResult> ForceTupleResults { get; set; } = [];
|
||||
public List<IExtendedForceTupleCalculatorResult> ForceTupleResults { get; set; } = [];
|
||||
|
||||
public bool IsValid { get; set; } = true;
|
||||
public string? Description { get; set; } = string.Empty;
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
{
|
||||
public class ValueDiagramEntity : IValueDiagramEntity
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public bool IsTaken { get; set; } = true;
|
||||
|
||||
public IValueDiagram ValueDigram { get; set; } = new ValueDiagram(Guid.NewGuid());
|
||||
|
||||
public ValueDiagramEntity(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
ValueDiagramEntity newItem = new ValueDiagramEntity(Guid.NewGuid());
|
||||
var updateStrategy = new ValueDiagramEntityUpdateStrategy();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user