LimitCarveCalculator Edit Window was changed
This commit is contained in:
@@ -13,5 +13,12 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public PredicateTypes PredicateType { get; set; }
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is null) { return false; }
|
||||
var item = obj as PredicateEntry;
|
||||
if (item.PredicateType == PredicateType & item.Name == Name) { return true; }
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
@@ -13,14 +14,14 @@ using System.Threading.Tasks;
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurveInputData : IInputData
|
||||
public class LimitCurveInputData : IInputData, ICloneable
|
||||
{
|
||||
public List<LimitStates> LimitStates { get; }
|
||||
public List<CalcTerms> CalcTerms { get; }
|
||||
public List<NamedCollection<INdmPrimitive>> PrimitiveSeries {get;}
|
||||
public List<PredicateEntry> PredicateEntries { get; }
|
||||
public List<LimitStates> LimitStates { get; private set; }
|
||||
public List<CalcTerms> CalcTerms { get; private set; }
|
||||
public List<NamedCollection<INdmPrimitive>> PrimitiveSeries {get; private set; }
|
||||
public List<PredicateEntry> PredicateEntries { get; private set; }
|
||||
public SurroundData SurroundData { get; set; }
|
||||
public int PointCount { get; set; }
|
||||
public LimitCurveInputData()
|
||||
@@ -42,5 +43,31 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new LimitCurveInputData()
|
||||
{
|
||||
LimitStates = LimitStates.ToList(),
|
||||
CalcTerms = CalcTerms.ToList(),
|
||||
PredicateEntries = PredicateEntries.ToList(),
|
||||
SurroundData = SurroundData.Clone() as SurroundData,
|
||||
PointCount = PointCount
|
||||
};
|
||||
foreach (var item in PrimitiveSeries)
|
||||
{
|
||||
var collection = item.Collection.ToList();
|
||||
newItem.PrimitiveSeries.Add
|
||||
(
|
||||
new NamedCollection<INdmPrimitive>()
|
||||
{
|
||||
Name = item.Name,
|
||||
Collection = collection
|
||||
}
|
||||
);
|
||||
}
|
||||
return newItem;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationsResults;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve.Factories;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -14,12 +15,13 @@ using System.Threading.Tasks;
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurvesCalculator : ISaveable, ICalculator, IHasActionByResult
|
||||
{
|
||||
private LimitCurvesResult result;
|
||||
private int curvesIterationCount;
|
||||
private LimitCurvesCalculatorUpdateStrategy updateStrategy => new();
|
||||
|
||||
public Guid Id { get; }
|
||||
public string Name { get; set; }
|
||||
@@ -27,7 +29,11 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve
|
||||
public IResult Result => result;
|
||||
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
|
||||
public LimitCurvesCalculator()
|
||||
{
|
||||
Name = "New calculator";
|
||||
InputData = new();
|
||||
}
|
||||
public void Run()
|
||||
{
|
||||
GetNewResult();
|
||||
@@ -110,12 +116,14 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var newItem = new LimitCurvesCalculator();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private void SetCurveCount(IResult locResult)
|
||||
{
|
||||
var curveResult = locResult as IiterationResult;;
|
||||
var curveResult = locResult as IiterationResult;
|
||||
result.IterationNumber = curvesIterationCount * InputData.PointCount + curveResult.IterationNumber;
|
||||
ActionToOutputResults?.Invoke(result);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurvesResult : IResult, IiterationResult
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
/// <summary>
|
||||
/// Limits of coordinates for workplane
|
||||
/// </summary>
|
||||
public class SurroundData
|
||||
public class SurroundData : ICloneable
|
||||
{
|
||||
public double XMax { get; set; }
|
||||
public double XMin { get; set; }
|
||||
@@ -39,5 +39,18 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
YMin = -1e7d;
|
||||
ConvertLogicEntity = ConvertLogics.ConverterLogics[0];
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new SurroundData()
|
||||
{
|
||||
XMax = XMax,
|
||||
XMin = XMin,
|
||||
YMax = YMax,
|
||||
YMin = YMin,
|
||||
ConvertLogicEntity = ConvertLogics.ConverterLogics[0],
|
||||
};
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
|
||||
{
|
||||
internal class LimitCurveInputDataUpdateStrategy : IUpdateStrategy<LimitCurveInputData>
|
||||
{
|
||||
SurroundDataUpdateStrategy surroundDataUpdateStrategy => new();
|
||||
public void Update(LimitCurveInputData targetObject, LimitCurveInputData sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.LimitStates.Clear();
|
||||
targetObject.LimitStates.AddRange(sourceObject.LimitStates);
|
||||
targetObject.CalcTerms.Clear();
|
||||
targetObject.CalcTerms.AddRange(sourceObject.CalcTerms);
|
||||
targetObject.PredicateEntries.Clear();
|
||||
targetObject.PredicateEntries.AddRange(sourceObject.PredicateEntries);
|
||||
targetObject.PointCount = sourceObject.PointCount;
|
||||
surroundDataUpdateStrategy.Update(targetObject.SurroundData, sourceObject.SurroundData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
|
||||
{
|
||||
internal class LimitCurvesCalculatorUpdateStrategy : IUpdateStrategy<LimitCurvesCalculator>
|
||||
{
|
||||
LimitCurveInputDataUpdateStrategy inputDataUpdateStrategy => new();
|
||||
public void Update(LimitCurvesCalculator targetObject, LimitCurvesCalculator sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.Name = sourceObject.Name;
|
||||
targetObject.ActionToOutputResults = sourceObject.ActionToOutputResults;
|
||||
inputDataUpdateStrategy.Update(targetObject.InputData, sourceObject.InputData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
|
||||
{
|
||||
internal class SurroundDataUpdateStrategy : IUpdateStrategy<SurroundData>
|
||||
{
|
||||
public void Update(SurroundData targetObject, SurroundData sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.XMax = sourceObject.XMax;
|
||||
targetObject.XMin = sourceObject.XMin;
|
||||
targetObject.YMax = sourceObject.YMax;
|
||||
targetObject.YMin = sourceObject.YMin;
|
||||
targetObject.ConvertLogicEntity = sourceObject.ConvertLogicEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user